`path` must be a string / path does not exist

Hi everyone,
kindly asking for your help.

I cannot work with excel sheets, nor csv sheets
both reading function do not work, only errors received:

  • When i work with Excel i write in R:
    setwd("~/Documents/FINTECH/GAMES ANALYIS")
    library(readxl)
    file.choose("Games_kurz")
    mydata<-read_excel("Games_kurz")

and I get: > mydata<-read_excel("Games_kurz")
Fehler: path does not exist: ‘Games_kurz’

OR
path` must be a string

I also installed quartz in the background, as my teacher said this might be the problem in R-studio on Mac, does anyone can help me? R: OS X Quartz Device

Also, do i need to do anything in the background to make use of that? thank you!!

For an Excel file include the .xls or .xlsx extension in the name. For a csv file include the .csv extension.

Check in Finder to confirm that the Games_kurz file doesn't have an extension, or just try with Games_kurz.xlsx.

To cut down on file location problems, create a new Project in RStudio for related scripts and create a folder data and put all your data files for the scripts there. install.libraries("here") and use library(here) in your script. Then you will be able to use

my_data <- read_excel(here("data/the_file.xlsx"))

knowing that it should work everytime even if your working directory is another folder in the project.

1 Like

dear @technocrat ! thanks for your reply. i tried both, without success,...

for the file - new project- it does also not :frowning:

dear @EconProf , please see above! thank you very much for your help!

The file name must be a string. Try

mydata <- read_excel("Games kurz.xlsx")
1 Like

One way to think about this is that anything (object) that R already "knows about" (is in namespace in the environment) doesn't need "" quotation marks, but anything new coming into the environment, like a file, does.

This topic was automatically closed 42 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.