-1

I'm compiling knitr document from a .R file:

knit2pdf(example.Rnw, output=paste0(name,".tex"))

But in the document example.Rnw, there's the function:

do.call(cbind,mget(as.character(rep_names)))

Where rep_names it's the name of some dataframes created by a loop, which i want to merge. The thing is i don't know the extact number of dataframes created.

If i compile the document directly from knitr works perfectly, but when i execute from .R file, he didn't find the objects of rep_names. Example on .pdf output.

## Error: value for ’Object_1’ not found

Where Object_1 is rep_names[1]. The problem is on which session are the object created?

1 Answers1

0

It's hard to provide any assistance here without a reproducible example. Looking at what you have, I imagine you should change the way you're creating the dataframes to put them in a list rather than as named objects in the global environment. This way you can change the problematic line to do.call(cbind, listofdfs). There are numerous questions and answers here that recommend this strategy.

Thomas
  • 43,637
  • 12
  • 109
  • 140