Statinfer

103.1.9 Most Common Errors in R

Errors happens to appear however fluent one is.

In previous section, we studied about R History and Scripts, now we will be studying about Most Common Errors in R.

While executing the code in R, it is very likely that we get some error. There are some common errors like syntax & missing packages. By following the below checklist you can quickly fix the code errors.

Couldn’t find the object: Like for example, we named an object as “myvar” and we’ll be searching uppercase “myvar”, i.e., we are trying to refer something which does not exist.

myvar <- c(15, 17, 16, 15, 16)
Myvar
Error: object 'Myvar' not found

Most of the times we make mistakes in upper case and lower case. We couldn’t find a specific function, we are writing a function, but the function is not there or we might be referring the function in a wrong way. Maybe the relevant R packages are not installed, and then install the package which can be seen in the console.

qplot(mpg, wt, data=mtcars)
Error: could not find function 'qplot'
library(ggplot2)
qplot(mpg, wt, data=mtcars)

Non-numeric arguments are like if we’re trying to do arithmetic or math on strings, then obviously error will occur.

Name<- c("John", "Bob", "Kevin", "Smith", "Rick")
Name+1

Basically, if we’re doing incompatible operations, then we might get this type of error.

  • No such file or directory.
  • This package is incompatible with R and there are some packages which get updated, say package version 1 might be compatible with R version 3 but later on that package, it might have been upgraded or renamed. As we work on, we’ll get to know more about this.

R-Help

help.start()

We can just put a question mark (?) and type the function name for help (?str() ) or R help documentation is also good, rather than searching in the help library, we can directly search it in Google.

?substr() help(substr)

With this, the basic introduction to R has come to an end. We will be using these topics very often while working on R. In later sessions we will discuss Data handling techniques.

In the next post get ready to write your first R Program.

In next section, we will be studying about My First R Program.

10th January 2017

0 responses on "103.1.9 Most Common Errors in R"

Leave a Message

Blog Posts

Hurry up!!!

"use coupon code for FLAT 30% discount"  datascientistoffer        ___________________________________      Subscribe to our youtube channel. Get access to video tutorials.                

Contact Us

Statinfer Software Solutions#647 2nd floor 1st Main, Indira Nagar 1st Stage, 100 feet road,Indranagar Bangalore,Karnataka, Pin code:-560038 Landmarks: Opp. Namma Metro Pillar 48.

Connect with us

linkin fn twitter g

How to become a Data Scientist.?

top