Can you read a string in a dataframe with the read.csv() function? - SOLVED

  • EDIT: SOLVED, I had the incorrect working directory set. I used setwd() in the chunk to select folder and now it works. I'll keep this post here temporarily in case someone else has a similar issue.

I'm attempting to import a .csv file into my RNotebook project. Instead of the typical read.csv("DATASET.csv", headers=TRUE) function, I'd like it to pull the file name from a string within dataframe instead, example below...

DATA <- "Dataset.csv"
TEST <- read.csv(DATA, headers=TRUE, stringsAsFactors=FALSE)

I've also set my working directory to the folder which would contain the .csv file of the same name (Dataset.csv).

Any ideas would be greatly appreciated, thank you! :slight_smile:


Welcome and thanks for noting your post as solved. Will be a boon to many to come.

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