Couldnt not find function "cc" Knit PDF in R - r

When trying to Knit PDF on R Studio i get this error. cc() is a function from package CCA(), which I've installed and loaded previously. It runs perfectly in the console as does this other function: plt.cc(), which needs the same package and library, too.
Quitting from lines 125-128 (Preview-ecc331f1f51.Rmd) Error in eval(expr, envir, enclos) : could not find function "cc" Calls: <Anonymous> ... handle -> withCallingHandlers -> withVisible -> eval -> eval Execution halted
Need some help guys, i'm 'bout to crack my display !

You should do this
require(CCA)
cc(SOMETHING) ...

Related

Error with setwd() when compile Rmarkdown

I am doing an R markdown file, I have the last versiĆ³n of R and RStudio, but I get an error when I trie to compile. My file is pretty simple, that's the reason why I don't know what it is happening.
I have already consulted this pages:
Shiny demo doesnt work: Error in setwd(old) : character argument expected #844
character argument expected #14
Error for Knit to HTML
But I can't found the problem.
This is the error:
setwd(wd): character argument expected
Error in setwd(wd) : character argument expected
Calls: <Anonymous> ... call_inline -> in_dir -> .handleSimpleError -> h -> setwd
Error in setwd(wd) : character argument expected
Calls: <Anonymous> ... in_dir -> setwd -> .handleSimpleError -> h -> setwd
Error in setwd(oldwd) : character argument expected
Calls: <Anonymous> -> setwd
Execution halted
Thank you very much.

How to resolve this Error when knit markdown

I'm trying to knit an RMarkdown to an HTML file.
But I got an error like this
Quitting from lines 28-34 (learning_map2.Rmd)
Error in slot(p, "Polygons") :
cannot get a slot ("Polygons") from an object of type "NULL"
Calls: ... createSPComment -> lapply -> FUN -> sapply -> lapply -> slot
Execution halted
screenshot_1598604180|690x133
But I can run it on my mac. It's just doesn't run in my Window PC.
Thanks all!

Getting error: "Error in table(x0) : object 'PONDICE' not found" while trying to knit

Apologies if this has been answered already. I tried to find a solution that would help, but I was not lucky. I have several data set which I took from the CD that came with my textbook. When I run my code in R, there are no problems. When I try to knit (word, pdf, and HTML), I get the error message: Quitting from lines 20-26 (hw1math424_3.Rmd)
Error in table(x0) : object 'PONDICE' not found
Calls: <Anonymous> ... withCallingHandlers -> withVisible -> eval -> eval -> tab1 -> table
Execution halted.
library(epiDisplay)
tab1(PONDICE$icetype, sort.group = "decreasing", cum.percent = TRUE)
This produces a nice bar graph in R, but wont knit. I have all the files saved to a desktop folder. Please Help! These files came from Regression Analysis (7th edition) Please ask if you need more info!

Trying to Knit but can't because read excel function is not being recognized in R

My whole program is working but when I try to knit to a document the same error is being thrown.
Quitting from lines 3-78 (Untitled.spin.Rmd)
Error in eval(expr, envir, enclos) : could not find function "read_excel"
Calls: <Anonymous> ... handle -> withCallingHandlers -> withVisible -> eval -> eval
Execution halted
I don't under stand why. Where are the first 5 lines of my code.
Dataset_Stats1Project <- read_excel(Users/jamiestokes16/Desktop/Dataset_WomeninGov5.xlsx)
#Descriptive stats for important variables
summary(Dataset_WomeninGov$Wcongress)
summary(Dataset_WomeninGov$Wgov)
summary(Dataset_WomeninGov$Wleg)
Any help would be appreciated.
When you knit a document, knitr essentially creates a new R session for the code to run in. So any packages loaded session will not be accessible unless you load them directly within the .Rmd file.
I always find it easiest to include a chunk at the start of the document loading any packages used:
```{r LoadPackages, include = FALSE}
library(readlx)
# add other packages here
```

Cryptic dplyr error when trying to knit html

I have a snippet that depends on a package that I wrote. I'm trying to knit a markdown document and am getting an error:
Error in eval(expr, envir, enclos) : not a vector
Calls: <Anonymous> ... freduce -> <Anonymous> -> bind_rows -> rbind_all -> .Call
The same snippet runs in the console, and the previous line is a lapply that returns a list of data frames. There's confidential data and it'd take a while to come up with a reproducible example so I thought I'd see if others have any tips.

Resources