Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error creating notebook: non-numeric argument to binary operator; RStudio

Tags:

r

rstudio

There is an error located in the upper left hand corner of my RStudio setup which reads "Error creating notebook: non-numeric argument to binary operator". (According to Stack Overflow, you can access the image here.)

enter image description here

I've noticed that this error is likely the issue preventing me from modifying my html file on rpubs.com which is rather problematic.

Any advise as to the root or possible causes of this error and/or solutions would be greatly appreciated. I'm hoping to be able to upload a corrected version of my file to rpubs.

like image 778
pdel Avatar asked Jul 11 '17 02:07

pdel


People also ask

What does it mean non-numeric argument to binary operator in R?

item : non-numeric argument to binary operator”. The reason for this is that one of the columns in our data frame has the factor class instead of the numeric class.

What is non-numeric argument in binary operator?

The “non-numeric argument to binary operator” error occurs when we perform arithmetic operations on non-numeric elements.


2 Answers

The following method worked for me to fix this error:

I went into my user folder on my local disk drive > AppData (this is a hidden folder so you have to "Show hidden items") > Local > RStudio-Desktop > notebooks

And then I deleted the folder with the name that corresponds to the .rmd file that has this error. So for you, you would look for the folder that has "Assignment3Code" in its name, and delete it.

Then go back to RStudio and save the code again, the associated notebook should be generated.

If this does not help, the notebook cache may be also stored in the project directory under .Rproj.user -> [Some hex nums] -> unsaved-notebooks OR .Rproj.user -> shared -> notebooks where you may need to delete the corresponding directories as well.

like image 130
Laura Lels Avatar answered Oct 04 '22 00:10

Laura Lels


Session > Restart R and Clear Output worked for me. I saved and re-saved .Rmd file with no problems after using this.

like image 33
Dan Tarr Avatar answered Oct 04 '22 01:10

Dan Tarr