Docsity
Docsity

Prepare for your exams
Prepare for your exams

Study with the several resources on Docsity


Earn points to download
Earn points to download

Earn points by helping other students or get them with a premium plan


Guidelines and tips
Guidelines and tips

FAQ and Troubleshooting Guide: Common Issues, Study notes of Advanced Computer Programming

I'm getting an error in file(file, “rt”) : cannot open the connection. In addition: Warning message: cannot open file 'what.csv': No such file or directory.

Typology: Study notes

2021/2022

Uploaded on 09/12/2022

lalitlallit
lalitlallit 🇺🇸

4.1

(10)

226 documents

1 / 3

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
FAQ and Troubleshooting Guide: Common Issues
The downside to R is that it doesn’t communicate well when expressing why you got an error--
only that you got an Error.
There can be multiple options for solving one error and the single solution that eventually
applies to that one problem can also apply to several other problems.
When you get an error, follow this checklist before escalating the issue to the forums or via
Google.
Help! My command isn’t working!
Did you spell the command wrong?
Did you use the wrong case?
help(), Help(), and HELP() are three different functions (and only the first one will work)
Did you forget to use quotation marks when they are needed?
install.packages(“gclus”) will work, while install.packages(gclus) will generate an error.
Did you forget to include the parentheses in a function call?
help() rather than help. Even if there are no options, you still need the().
Did you use the \ in a path name on Windows?
R sees the backlash character as an escape character.
setwd("c:\mydata") will generate an error. Use setwd("c:/mydata") or
setwd("c:\\mydata")instead
Did you call a function from a package that is not yet loaded?
The function str_trim() is contained in the stringr package.
If you try to use it before loading the package, you will get an error
I think my package isn’t loading correctly. I’m getting warnings or errors.
Sometimes, packages depend on other packages to work correctly
pf3

Partial preview of the text

Download FAQ and Troubleshooting Guide: Common Issues and more Study notes Advanced Computer Programming in PDF only on Docsity!

FAQ and Troubleshooting Guide: Common Issues The downside to R is that it doesn’t communicate well when expressing why you got an error-- only that you got an Error. There can be multiple options for solving one error and the single solution that eventually applies to that one problem can also apply to several other problems. When you get an error, follow this checklist before escalating the issue to the forums or via Google. Help! My command isn’t working! Did you spell the command wrong? Did you use the wrong case? help(), Help(), and HELP() are three different functions (and only the first one will work) Did you forget to use quotation marks when they are needed? install.packages(“gclus”) will work, while install.packages(gclus) will generate an error. Did you forget to include the parentheses in a function call? help() rather than help. Even if there are no options, you still need the(). Did you use the \ in a path name on Windows? R sees the backlash character as an escape character. setwd("c:\mydata") will generate an error. Use setwd("c:/mydata") or setwd("c:\mydata")instead Did you call a function from a package that is not yet loaded? The function str_trim() is contained in the stringr package. If you try to use it before loading the package, you will get an error I think my package isn’t loading correctly. I’m getting warnings or errors. Sometimes, packages depend on other packages to work correctly

If it says a package is missing, install it and then install the one that caused the error Sometimes there’s a conflict because two packages you’ve loaded have the same function. Whichever package is loaded last is the function that will take priority over the other one. To specify a specific package for a function, precede the code with nameofpackage:: For example, if filter() isn’t working, then try dplyr::filter() in your code I’m getting an error in file(file, “rt”) : cannot open the connection. In addition: Warning message: cannot open file ‘what.csv’: No such file or directory Your file isn’t where R thinks it is Check getwd() to see if the file you’re trying to access in that directory that R thinks it should look? If not, use setwd() to point to the correct directory or go through the menu Session > Set Working Directory > Choose Directory Is the file name spelled correctly? Run ls() to get a list of the files in the working directory and see if that file matches what’s listed. Sometimes it’s as simple as a capital letter when it shouldn’t. R working directory doesn’t work ideally with unzipped folders Make sure if you extract a zip, you move the folder to your computer and not just a temporary folder Objects, including column names, need to be one word Space won’t be interpreted correctly unless in the context of strings, so it must be surrounded by quotation marks To deal with columns that have spaces, you use the backtick next to the 1 button on your keyboard. so referencing column name on a dataframe called temp will be temp$column name`