importing csv file

I am a beginner and am working R datasets. When I upload my dataset, all the columns are filled with NA.

The original data looks like as following in csv file:

Title,Pages,date_started,date_read,Book.ID,Author,AdditionalAuthors,AverageRating,OriginalPublicationYear,read_time,MyRating,Gender,Fiction,Childrens,Fantasy,SciFi,Mystery,SelfHelp
1Q84,925,9/3/2019,9/10/2019,10357575,"Murakami, Haruki","Jay Rubin, Philip Gabriel",3.92,2009,7,5,0,1,0,1,1,0,0
A Disorder Peculiar to the Country,256,8/21/2019,8/22/2019,54572,"Kalfus, Ken",NA,3.01,2006,1,4,0,1,0,0,0,0,0
Alas, Babylon,323,12/21/2019,12/23/2019,38169,"Frank, Pat",NA,4.07,1959,2,5,0,1,0,0,1,0,0
Artemis,305,4/8/2019,4/11/2019,34928122,"Weir, Andy",NA,3.67,2017,3,4,0,1,0,0,1,0,0

I used the following function to upload into R :

 adres <- read_csv("readr.csv", "," )

I'm getting back dataframe that looks like this:
A tibble: 87 x 18
Title Pages date_started date_read Book.ID Author AdditionalAutho~

1 "1Q84,92~ NA NA NA NA NA NA
2 "A Disor~ NA NA NA NA NA NA

Every help is welcome and appreciated.

The data you posted work for me except that the third row has the Title value Alas, Babylon and that comma throws off the number of columns. Possibly there are other text values with commas in your full data set that cause more serious problems. I suggest you make a copy of your csv file and delete everything after the second data row. Does that version import correctly.?If it does, you might have to change the delimiter to something that never appears in the data or quote all of the text fields.

Prepare your datat in excel and save in csv format. After You import the database with the script read.csv.

setwd('D:\......')
###You write where is save your file###.
read.table<-read.csv('name of the file.csv',sep=';',dec=',',head=TRUE)
A<-read.table
###A is for the name of your file####
fix(A)

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.