R package development


I'm attempting to write an R package based on some functions I wrote. I think I have everything down but I've ran into a road block I'm hoping you can help with.

I'm using R-Studio, R 3.4.4 and roxygen to do my bidding. I'm trying to run a check (--as-cran) and both of my functions (dsr.R, dsrr.R) return the same error:

==> devtools::check(args = c('--as-cran'))

Updating dsr documentation

Loading dsr

Warning: The existing 'NAMESPACE' file was not generated by roxygen2, and will not be overwritten.

Warning: dsr.R:23: Missing name

Warning: dsrr.R:21: Missing name

Deleting dsr.Rd

Deleting dsrr.Rd
I know why this is happening. In the dsr.R and dsrr.R programs, I have the following line of code:

This is the first line of code (after all of the roxygen naming and stuff) right before the dsr and dsrr functions are respectively defined. I had to include this argument because I was previously getting this:

dsrr: no visible binding for global variable 'ratio'

dsrr: no visible binding for global variable 'se'

dsrr: no visible binding for global variable 'reference'

dsrr: no visible binding for global variable 'lower'

dsrr: no visible binding for global variable 'upper'
and similarly for the dsr.R

I think my problem can be fixed by placing the globalVariables code somewhere else in my package but I'm not sure where.

Any advice would help. Any other information that you might need to help (package versions, system specs, etc) please request it and I can post.

Thanks so much.
Do you have your code on github?
Thanks for the reply Dason!

I have it working now but I'm still a bit unsure how (the answer is confounded)

I noticed I had an error in one of my
#' @param
statements in the program header, so I fixed this.

I also made a file called globals.R and stuck the
in there.

I ran check --as-cran and now it passed with no errors or warnings.

Is globals.R a `recognized` file in an R package? i.e. I simply created this program in the directory with the rest of the functions but didn't explicitly reference it anywhere, but it seems to work.

I'm slowly learning github - I hope to get the package on there very soon
Thanks Dason!

I think I have it up and running, perhaps you can try it out. I have a small R script (attached) that calls the package from github, loads it, and executes an example.

Development with github has been a bit difficult for me - I think I understand the concept of it but using it for my own work is a whole other beast. It's my long-term goal to get comfortable with it.