Kaggle and R Programming - cannot read csv file, path related issue

47 Views Asked by At

I am new to data analysis, R, and Kaggle. I am in the process of uploading my first dataset, "Bellabeat case study" to Kaggle and having issues reading in the csv files within the directory in Kaggle.

What I've done:

  1. I completed my analysis in Kaggle and saved the completed file.
  2. Created a new notebook and uploaded that file successfully.
  3. installed tidyverse package and loaded library. This was successful.
  4. Read in csv file - I cannot read my csv files into Kaggle anymore, even though I ran all the code in Kaggle prior to creating this new notebook.
  5. I tried a multitude of different paths to get my files with no success. (noted below)

Can someone please advise me on what I'm doing wrong?

Here is some code I used to try and figure out the issue:

# List all files in the directory
#files <- list.files("/kaggle/input/fitabase-data-4-12-16-5-12-16")

# Print the list of files
#print(files)

output: character(0)

# Get working directory
#getwd()

output: '/kaggle/working'

# Full path to the file
#file_path <- "/kaggle/input/fitabase-data-4-12-16-5-12-16/dailyActivity_merged.csv"

# Print the full file path
#print(file_path)

output: [1] "/kaggle/input/fitabase-data-4-12-16-5-12-16/dailyActivity_merged.csv"

# Set working directory does not work
# setwd("/kaggle/input/fitabase-data-4-12-16-5-12-16")  

Path's I've tried:

# activity_day <- read.csv(file = "/kaggle/input/fitabase-data-4-12-16-5-12-16/dailyActivity_merged.csv")

# activity_day <- read.csv(file = "dailyActivity_merged.csv")

# activity_day <- read.csv("/kaggle/input/fitabase-data-4-12-16-5-12-16/dailyActivity_merged.csv")

Error I keep getting:

#error: Warning message in file(file, "rt"):
#“cannot open file '/kaggle/input/fitabase-data-4-12-16-5-12-16/dailyActivity_merged.csv': No such file or directory”
#Error in file(file, "rt"): cannot open the connection
#Traceback:
0

There are 0 best solutions below