R package and initial code