简体   繁体   中英

Reading csv file in R

I read my csv file in R using

data <- read.csv("data.csv",header = FALSE)

What I get is

name place    phone #
sam  london   5343234
     NA       NA
jim  USA      4325235
john USA      NA
     NA       NA

How to remove the row with NA.These NA appear because I had a excel file in which there were spaces and I saved that file as csv.I want to generalize this code so the spaces could appear anywhere.So how to clean this up?

由于NA似乎是空行,因此您可以尝试:

data <- read.csv("data.csv", header=FALSE, blank.lines.skip=TRUE)

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM