Stuck with beginner functions

Hello All, If anyone would be so kind to help a newbie out please, I am currently working on my first Case study for the data analytics certificate.

First, I was getting the following errors: "cannot open file '202406-divvy-tripdata.csv': No such file or directory"
I found the answer on this forum and figured I had to use the path. Then I get the following error: Error:

Summary

"'\U

' used without hex digits in character string (:1:24)"

Please show us the code that is trying to open the file. Feel free to obfuscate any server or user names for security reasons.

Thanks for replying. First time posting in this forum, How do i obfuscate? sorry. Let me edit my post as well to show the code. Thanks again

To obfuscate, just type any junk ("xxx", "mycathatesme", ...) in place of anything you wouldn't want the internet to see.

These are the codes that I was trying to attempt:
Jul2024<- read.csv("L:\dgfng\xxxxx\akfjnjfn\lalalafdsknakdgfjn\asfjkajfb\202406-divvy-tripdata\202406-divvy-tripdata.csv")
Error: '\U' used without hex digits in character string (:1:24)

and

Jul2024<- read.csv("202406-divvy-tripdata.csv")
Error in file(file, "rt") : cannot open the connection
In addition: Warning message:
In file(file, "rt") :
cannot open file '202406-divvy-tripdata.csv': No such file or directory

Try replacing the backslashes \ with forward slashes / in your file path.

Jul2024<- read.csv("L:/dgfng/xxxxx/akfjnjfn/lalalafdsknakdgfjn/asfjkajfb/202406-divvy-tripdata/202406-divvy-tripdata.csv")
2 Likes

THANK YOU SO MUCH! It worked! Thus, I do not have to fix the backlashes at the source just at the console in R?

backslashes and forward slashes are both examples of file separators, these are Operating System dependendent ( think, Windows/Mac/Linux etc.) ;
R has handy function file.path() that knows what is appropriate for your system, and can put in the correct slash (or other seperator)
one would use it like so :

Jul2024 <- read.csv(file.path("L:", "dgfng", "xxxxx", "akfjnjfn", "lalalafdsknakdgfjn", "asfjkajfb", "202406-divvy-tripdata", "202406-divvy-tripdata.csv"))
1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.