r - aggregate function fails in knitr but succeeds in console -


i have following r code:

cleandata <- aggregate(x = stormdata[c("fatalities", "injuries")],                        = list(tolower(stormdata$evtype)), sum) 

it runs fine in r studio console, when copy/paste in chunk in knitr generates error:

error in `$<-.data.frame`(`*tmp*`, "harm", value = c(15, 0, 2, 2, 2, 6,  :    replacement has 902297 rows, data has 898 calls: <anonymous> ... withvisible -> eval -> eval -> $<- -> $<-.data.frame 

i'm not sure why happening.


Comments

Popular posts from this blog

java - UnknownEntityTypeException: Unable to locate persister (Hibernate 5.0) -

python - ValueError: empty vocabulary; perhaps the documents only contain stop words -

ubuntu - collect2: fatal error: ld terminated with signal 9 [Killed] -