Skip to content
Prev 350785 / 398502 Next

Error importing data - wrapping?

txt <- c("A B C D E", "A 1232 0.565", "B 2323 0.5656 0.5656 0.5656",
 "C 2323 0.5656", "D 2323 0.5656", "E 2323 0.5656", "F 2323 0.5656",
 "G 2323 0.5656", "G 2323 0.5656 0.5656 0.5656")
z <- read.table(text=txt, fill=TRUE, header=TRUE)
str(z)
#'data.frame':   8 obs. of  5 variables:
# $ A: Factor w/ 7 levels "A","B","C","D",..: 1 2 3 4 5 6 7 7
# $ B: int  1232 2323 2323 2323 2323 2323 2323 2323
# $ C: num  0.565 0.566 0.566 0.566 0.566 ...
# $ D: num  NA 0.566 NA NA NA ...
# $ E: num  NA 0.566 NA NA NA ...

If your file contains extra spaces or tabs at the ends of the lines it
is possible that using sep="\t" may mess things up: using an explicit
'sep' argument means that you have to use it consistently as a separator.


Bill Dunlap
TIBCO Software
wdunlap tibco.com

On Sat, May 9, 2015 at 8:22 AM, Kate Ignatius <kate.ignatius at gmail.com>
wrote: