So I have a few rmarkdown documents i'd like to compile as local jobs. To this end I wrote a simple script calling render(document). This works fine for most documents, but for one I encounter a super weird 'object not found' error. The function call looks like this:
where sam_dat is just defined above this line and adonis2 is the adonis function from vegan. Knitting the document from rstudio works, so does calling the render script from a terminal with Rscript...
if you replace this long function call, with something that simply prints the sam_dat$group2 that was imeddiately defined the moment before.
Would that work in this 3rd case?
but it doesnt look right to me as a formula because its got the $ to pick a variable from a different data set. and theres no explict data param.
can you maybe restruce the function call, to more explicitly set data, have all the variables in one data frame, and the formula cleanly naming them ?
probably will fix it up for you.
Hang on, I thought I'd tried printing it earlier, and I had, but slightly differently. So sam_dat is made by calling sample_data() on a variable called ps_relab. so ps_relab is assigned, then I call:
print(ps_relab)
sam_dat <- sample_data(ps_relab)
It now halts at sample_data(). But print() seems to be working? Include is false, could that be a cause?
ps_relab is a phyloseq-class object. I can't see the output because its a rmarkdown being knitted, but it fails before it can create any output. print(ps_relab) should output a description of the object...
It's quite a pickle. All my experience is in traditional scripts and shiny apps, I rarely touch knitr/markdown world. I'll back out and hopefully someone else here with experience debugging markdown renders can help
If you could attempt a reprex, just some minimal data and the fewest transformations to demonstrate an example of the fault. Sharing that here would help people help you.
Best of luck.