Hello, I hope if someone can help mr with that, I’m in the cape-stone project of data analytics course, when i would like to import the csv files I can’t do that, however using setwd() , readxl, read.csv , and a lot, but no benefit.
What kind of file are you trying to read? The function readxl() is for reading spreadsheet files in the .xls or .xlsx formats. The read.csv() format is for reading plain text file that use a delimiter like a comma to separate the columns.
What directory is the file in relative to your working directory? You can find out your working directory by running getwd().
What code have you tried?
If you are running RStudio on your local computer and you are loading a csv file, use read.csv(), designate the path name with front slashes (even on Windows) and include the file extension in the file name. For example,
DATA <- read.csv("C:/Users/pc/Downloads/MyCSVData.csv")
Following along on @FJCC, most non-Windows systems use a forward slash for file paths. Windows uses a backslash, which unfortunately R interprets differently (as an escape character). While there are ways around this, the easy thing is to do as @FJCC suggests and replace backslashes with forward slashes.
To use Posit Cloud instead of RStudio on your pc, you need to upload any data files. In Posit Cloud, click on the Files tab in the lower right pane, then click on the the Upload tab. Click on the Choose File button and navigate to the csv or xls file on your computer. Select the file and click on Open and then OK. Go back to the Files tab and verify that the file has been uploaded.
Given that the free version of Posit Cloud only has 1 GB of memory, and the data sets for the capstone project can be quite large, you may be better off using RStudio on your own pc.
Thanks for your reply, I also tried with the front slash, but it gives me Permission Denied as shown in the screenshot, I don't know what to do about that, maybe I have to buy the charging version of RStudio?
yes, you are right about the memory, I felt the same, maybe because it is large so it is hard to import it, I'm still figuring it out. Thanks @EconProf
In this case define both, the path and the filename (including ending),
e.g.
data_in = read.csv("C:/Users/pc/Downloads/The Gym Data/dailyActivity_merged.csv")
It gives as shown below, I really would like to buy the charging version to avoid all of these errors, but I'm afraid even after that, it gives me the same
File not found. A typo somewhere?
Correct path? Are you user pc?
Find the correct path that leads you to the donwload folder.
Click on This PC, then "Users" (may be translated to your local language) , then your name, then downloads...
You can click on top into the path field and it gives you the path to this folder...
Adding to @Matthias' advice, you almost certainly have the file location wrong. I wonder if it was supposed to say "This PC" rather than "PC". You might go to where the file is located and then copy the path from Explorer. Paste it in to your command, changing to forward slashes, and add the file name and extension.