Help knitting R File to PDF

I just started R coding a while ago, and I was trying to knit the file to either a PDF or a HTML .
However, I got an error doing that which says

Any help is appreciated.

At line 25, data_ass1 is not found. Restart R in the current session or restart RStudio and make sure that line 17 puts an object named such into the global environment.

I dont know what it means by data_ass1 not found when the code can run.

It means that when the knit process begins, it has a global environment that does not include any user-created objects, such as data_ass1, which is not explicitly brought in.

Although data_ass1 may have been in the interactive environment when knit was invoked, data_ass1 is not available to use unless it is created in a chunk. None of the chunks in the screen shot show that happening. Perhaps df in line 17 should be named data_ass1. It cannot be determined without access to the local file being read in, which is not provided here.

omg thanks. You're a lifesaver. It finally was able to export to PDF. R coding is so complicated it scares me !

1 Like

Think of R as school algebra writ large: f(x) = y. Some object, f acts upon some object, x, to produce some other object, y. Objects have different properties. Some are functions like f, some are arguments, like x and the others have the properties produced by giving x as an argument to f. f is a first-class object, meaning that it can be given as an argument to some other function, g, as in the school case of g(f(x))

Keeping this in mind provides a mental checklist to start troubleshooting.

Is it possible to see all of f, x and y in the context of the current environment?

Because

Your hands can't hit what your eyes can't see.—Mohamed Ali

This topic was automatically closed 7 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.