Most Common and Uncommon Errors in R:
1. Could not find function “xyz” when xyz isn’t a function.
Check for typos, in particular () instead of , eg, you put xyz(1,2) instead of xyz[1,2]
2. Could not find function “xyz” when xyz is a function.
I. Check for typos.
ii. Is it a function you wrote yourself or is included in a script? If so, run that bit of the script again and
make sure it runs without an error.
Iii. Have you loaded the package containing the function? Use ??xyz to see which package it’s in;
use search() to see if the package is loaded.
3. No such file or directory when you try to read in a file with read.table ,read.csv or similar functions.
i. Check that you have got the file name right, including the extension (the last few letters after the
dot), and it’s in “quotes”.
ii. Do one of the following:
Use the full path to the file, eg, “C:/users/me/workshop/ant.csv” Note that R uses forward slashes (/) in file names, not backslashes (\).
Change the working directory to the one with the file you are looking for: go to File > Change dir… or do setwd(choose.dir()) and select the right folder.
Put file.choose() in place of the file name, then browse to find the right file.
4.There is no package called ‘XYZ’ when you do library(XYZ).
i. Check the spelling for typos and lower/upper case!
ii. Look for the package in the list of packages installed: use Packages > Load package… from
the main menu or do
iii. If it’s not there, you need to install it. Most packages are on the CRAN repository; for those use
install.packages(“XYZ”) # with “quotes”
5. Error in file(con, “r”) : cannot open the connection
In addition: Warning message:
In file(con, “r”) :
InternetOpenUrl failed: ‘The server name or address could not be resolved’
Check the internet connection and run the code again.
6. Error in as.data.frame.default(x[[i]], optional = TRUE) :
cannot coerce class “c(“Simple_Sent_Token_Annotator”, “Annotator”)” to a data.frame
For this error just detach caret package & then detach ggplot2
THis is because ggplot2 is also there in NLP package
Loading required package: rJava
Error : .onLoad failed in loadNamespace() for ‘rJava’, details:
call: fun(libname, pkgname)
error: JAVA_HOME cannot be determined from the Registry
Error: package ‘rJava’ could not be loaded
fixing the Error?
Need to Install 64 bit Java
go to https://java.com/en/download/manual.jsp
choose ‘Windows Offline 64 bit’
Once this version of java installed the packages will be successfully installed and loaded into R.
Error: could not find function “view”
Need to Type Capital V in View
Error: could not find function “Skewness”
Need to install “Moments”
Error: could not find function “kurtosis”
Need to install “Moments”
Error in summary(Groceries) : object ‘Groceries’ not found
Need to write in “ “