I have a problem importing my data file to R. My laptop has broken down so that I am currently using the PC at university. There is a problem reading a csv file into R suddenly, and the error I get is "unexpected error in..."
The code I was using was (after renaming the data a few times since it did not work):
setwd("C:/Users/s1101923/Desktop)
getwd()
library(readr)
data <- read_csv("C:/Users/s1101923/Desktop/logreg.csv")
data1 <- read_csv("C:/Users/s1101923/Desktop/data_for_today.csv")
did you try
library(readr)
data <- read_csv("C:/Users/s1101923/Desktop/data_for_today.csv")
You have a typo in your code when setting the working directory. You forgot the closing quotation marks. It should be like this:
setwd("C:/Users/s1101923/Desktop")
Also, you can just use the data name when reading your csv file. No need for the entire path.
Try df=read.csv('file_name.csv') and you dont need any library for this. and you dont need to specify the whole path. just save the csv file where your r programs are saved and type data=read.csv('data_for_today.csv') make sure you have save the csv file in the location where your r programs will be saved.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.