creating package (learnr tutorial)

Hi. I am trying to build a package (specifically a learnr tutorial). I am getting this error when I press "install and restart". Anyone know what I should do? This is on Windows.

==> Rcmd.exe INSTALL --no-multiarch --with-keep.source tutorialR4DS

  • installing to library 'C:/Users/willi/Documents/R/win-library/4.1'
  • installing source package 'tutorialR4DS' ...
    ** using staged installation
    ** R
    Error in parse(outFile) : attempt to use zero-length variable name
    ERROR: unable to collate and parse R files for package 'tutorialR4DS'
  • removing 'C:/Users/willi/Documents/R/win-library/4.1/tutorialR4DS'

Exited with status 1.

:wave: @onyourmark!

  • Is the source of your package public? In particular is there a collate field in the DESCRIPTION, while there is no R file at all? (if the package only contains a learnr tutorial I suppose there is no R file).

  • Are you able to build and install other packages (if you create a minimal R package via e.g. usethis::create_package()) or is the problem specifically hapening with your tutorial package?

  • How have you created the package?

Hello. Thank you for your willingness to help.
I realized what I was doing wrong.
Or at least I realized how to fix it.

I created a new project with a new github repository. I was not using this command before

usethis::use_tutorial("lesson1", "Your First Lesson", open = interactive())

because I had already built the tutorial and already had the inst folder. But perhaps I should have run it again.

Anyway with the new project, I ran the use_tutorial() function and it seems to be working because when I run
Install and restart, I get this:

==> Rcmd.exe INSTALL --no-multiarch --with-keep.source TidyverseTutorials

  • installing to library 'C:/Users/willi/Documents/R/win-library/4.1'
  • installing source package 'TidyverseTutorials' ...
    ** using staged installation
    No man pages found in package 'TidyverseTutorials'
    ** inst
    ** help
    *** installing help indices
    ** building package indices
    ** testing if installed package can be loaded from temporary location
    ** testing if installed package can be loaded from final location
    ** testing if installed package keeps a record of temporary installation path
  • DONE (TidyverseTutorials)

And it appears in my list of tutorials in the tutorial pane of RStudio.

Thanks again.
By the way, if you want to try it out, it is available from this:
learnr::run_tutorial("learnrexs", "TidyverseTutorials")

1 Like

Ah yes looking at the doc of use_tutorial() it does quite a few things that'd be easy to forget. Good luck with further development of the package!

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.