0

I'm having a problem with the following code in an Rmd file, the problem is that if I run the commands in the console, the code runs perfectly fine, and also there is no mistakes in the syntax, I have change several styles but I'm still receiving the same error when I knit the file.

Raw_Data96_11$EVTYPE <- as.character(Raw_Data96_11$EVTYPE)

List_Events <- count(Raw_Data96_11, vars = "EVTYPE") 

List_Events <- arrange(List_Events,desc(n)) 

List_Events <- mutate(List_Events, percentage = trunc((100*(n/653530))))

Top_10_Events <- List_Events[1:10,2:3]

I had to change the syntax for count, when I run the command in the console, I did not had to use vars, but now I cannot run the command arrange, this is the error :

Quitting from lines 98-117 (PA_2_Reproducible_Research.Rmd) Error in order(List_Events$n) : argument 1 is not a vector Calls: ... withVisible -> eval -> eval -> arrange -> eval -> eval -> order Execution halted

I have included the libraries in that chunk but I'm still receiving an error, does anyone know what is going, is it the syntax or what else do I need to do?

CL.
  • 14,577
  • 5
  • 46
  • 73
Francisco Colina
  • 339
  • 2
  • 4
  • 13
  • You'll need to provide more code. It is impossible to tell from what you have posted. https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example – william3031 Jun 24 '20 at 22:12
  • Does this answer your question? [Code works interactively but not while knitting](https://stackoverflow.com/questions/62563941/code-works-interactively-but-not-while-knitting) – CL. Jun 25 '20 at 18:09

0 Answers0