import csv file from my computer

Hello , I need help with learning how to import a csv file into r. Here is my code but its not working. Its giving me an error message in the console.

read_csv(readr_example("weightLogInfo_merged.csv"))

So you have a file named 'weightLogInfo_merged.csv' that you want to load? In that case you wouldn't use readr_example inside of read_csv. readr_example is for reading in example files that come with the readr package.

read_csv("weightLogInfo_merged.csv")

If the file isn't in your working directory, you would need to either put the full path to the file or the path relative to your working directory. If you're not sure what the path of your working directory is you can find it using getwd().

What if you try read_csv(("weightLogInfo_merged.csv") ?

readr_example() is just for reading in sample files part of the readr package. Get path to readr example — readr_example • readr (tidyverse.org)

It always helps to show us any error messages.

Here is the error message

Error in read_csv(readr_example("weightLogInfo_merged.csv")) :
could not find function "read_csv"

Hello , I just tried that and its giving me an error message.

Error in read_csv(readr_example("weightLogInfo_merged.csv")) :
could not find function "read_csv"

You need to load the library first.

Try library(readr) or library(tidyverse) first

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.