[R] csv mask order

Peter Langfelder peter.langfelder at gmail.com
Wed Jan 23 04:36:32 CET 2013


Do your lines start with the hash mark #? If so, they are considered
comment. Set comment.char="" in your call to read.csv. Another
frequent culprit (personal experience) are apostrophes ('). If you
have any in your file, use the argument quote = "\"" or, if you are
sure the data are not quoted, use quote="". This is all described in
detail in help(read.csv), you may want to study it carefully to see
whether your file is misinterpreted in some subtle way.

HTH

Peter

On Tue, Jan 22, 2013 at 4:49 PM, Todd Sformo
<Todd.Sformo at north-slope.org> wrote:
> I have imported a CSV file:
>
> rfishR <- read.csv(file="rfishR.csv",stringsAsFactors = FALSE,
>
>                   strip.white = TRUE, na.strings = c("NA","") )
>
> attach(rfishR)
>
> When I call it up in R, it starts with line 2066 rather than 1 and some of the headers (used Headers = TRUE, too) are "masked"?
> Sample data
> loc
>
> lat
>
> lon
>
> datum
>
> water
>
> date
>
> obs
>
> net
>
> species
>
> length
>
> mass
>
> other
>
> Dispos
>
> NS10
>
> 69.5
>
> -156.8
>
> NAD83
>
> Chuc
>
> ########
>
> pt
>
> f
>
> fourhorn sculpin
>
> 225
>
> na
>
> na
>
> id
>
> NS10
>
> 69.5
>
> -156.4
>
> NAD83
>
> Chuc
>
> ########
>
> pt
>
> f
>
> fourhorn sculpin
>
> 293
>
> na
>
> na
>
> id
>
> NS10
>
> 69.5
>
> -156.2
>
> NAD83
>
> Chuc
>
> ########
>
> pt
>
> f
>
> fourhorn sculpin
>
> 243
>
> na
>
> na
>
> id
>
> Please help.
> -TS
>
>
>         [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



More information about the R-help mailing list