qrc R from scratch