rstudio.cloud - Assignment Tag - R Markdown not being recognized

https://rstudio.cloud/spaces/26689/project/85741

I've got a workspace setup for my class, and distribute workshops to the students using the 'Assignment' tag, so it forces a copy for each student. However, it appears that something is glitching between me and them, because every student is being forced to install rmarkdown and all dependencies to be able to knit the rmd file which is included.

Steps I've tried:

  1. Make sure the file knits for me (it does)
  2. Disable and re-enable the Base package for the workspace (check)
  3. Ensure the Base package has rmarkdown and dependencies loaded (it does)

Despite this, when my TA tries it (and the students as well), knitting the file requires reinstalling all of the rmarkdown dependency chain, every time. Which is a bit annoying.

Any thoughts? Is it something about how the project is being copied for each student, which is somehow not copying the environment and installed package list?

Packages for different versions of R end up being saved on different file system paths and only the packages for the selected version of R end up showing up. So this is commonly seen if there's a mismatch between the R version used in the original - and one of the copies.

So the R version selected in the copies the same as the R version selected in the original? If you flip the copy to a different R version do the packages appear?

Sean

So it doesn't look like it's auto-switching to another version of R. However, when I tried to do this myself, it caused all kinds of interesting bugs.

  • start in R 3.6.0, knitting works
  • switch to R 3.5.3, not only does knitting not work, but R crashes constantly, I'm getting error messages that don't match the code (rbind failing when there's no binding of rows even happening!), etc.
  • switch back to R 3.6.0, knitting now fails, rmarkdown is not installed, run the reinstall

I'm currently testing, but is this intended behaviour? That is, if you switch from a version of R to another, that it completely wipes the libraries of the previously set version? (when I went from 3.6.0 to 3.5.3 and back, why did the previously installed 3.6.0 libraries go poof?)

So I was walking through this on a project on my end and if I install a package under R version 3.6.0 then it shows up in my "User Library" in the package pane.

When I flip to 3.5.3 then those packages disappear from the package pane. They disappear because packages are compiled under a specific R version so packages installed under 3.6.0 won't necessarily work in an earlier version of R. If I flip the R version back to 3.6.0 I see them again (which is what I would expect).

When I try this with a simple rmarkdown document it behaves as I would expected. If I knit under 3.6.0 it prompts me to install the packages which I do successfully. When I switch to 3.5.3 it prompts me again (because the packages at this point have only been installed under 3.6.0) but that works successfully. If I then switch back to 3.6.0 knitting works because the packages are already installed in that version.

Is it possible to add me to the space so I can interact with the project?

Sean

Done (assuming your email is your current username @ rstudio.com). Project in question is https://rstudio.cloud/spaces/26689/project/85741.

It might be somewhat corrected: I went through the following process -

  1. Unhooked my base project
  2. Flipped the base to R 3.5.3
  3. Installed rmarkdown + deps
  4. Flipped back to R 3.6.0
  5. Reinstalled rmarkdown + deps
  6. Re-enabled the base project

Once I did this, the 3.6.0 may have started working ok - behaviour changed somewhat.

However, in that particular project, if I flip to 3.5.3, it starts acting very strange. You can try the same things I did:

  1. Try knitting (comes back with a rbind error, but no indication as to why, and there's nothing in the document that should use rbind?!)
  2. Try running the first chunk - it crashes R ("abnormally terminated").
  3. Etc.

Let me know if you have any insight!

Ok... so you are officially taxing my knowledge of R internals - but that error seems to be generated from rmarkdown (and a couple other packages) when I load them.

Looking around for that error I did find this stack overflow article,

From the details it sounds like this could be caused by the source projects packages being corrupted or mis-installed in some way. The 2nd step mentioned in the post (reinstalling all of the packages) did seem to resolve the issue in my copy and knitting after I reinstalled all of the packages seemed to generate the html as expected.

On my end at least the IDE does prompt you about restarting the session in prior to re-installing all the packages - and I had to say "no" in order to proceed with the full reinstallation.

Sean

That did fix it. Very curious!

I wonder if the R Markdown failure to compile was related, and in one of the attempts to fix it, something was further corrupted. I did get an error message the other day that indicated that the library directory was not writeable - from install.packages()! So it's likely all related.

Thanks for helping troubleshoot. Shame we didn't track down a cause, but fixing the symptoms is good enough for now.

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