Re: [R] Importing fixed-width data

2011-05-25 Thread Dennis Murphy
I get a data frame on my end: lines <- "2011-05-13 00:00:00 EONAAL330 dfa13002516PSCNONA 2011-05-13 00:00:01 EONAAL223 laa13044510AS.NONM 2011-05-13 00:00:05 EONBHS229 mia13001621NON" df = read.fwf(textConnection(lines), widths=c(19,-4,7,3,8,2,1,3,1), col.names=c("DateTime","Flight","Dest","ArrTi

Re: [R] Importing fixed-width data

2011-05-25 Thread Ian Gow
Everything looks OK. Does this help? > test <- >data.frame(alpha=as.factor(c("A","A","B","B","C")),number=c(1,2,3,4,5)) > mode(test) [1] "list" > class(test) [1] "data.frame" > sapply(test, mode) alphanumber "numeric" "numeric" > sapply(test, class) alphanumber "factor" "numeric

[R] Importing fixed-width data

2011-05-25 Thread James Rome
I have a data set where the lines look like: 2011-05-13 00:00:00 EONAAL330 dfa13002516PSCNONA 2011-05-13 00:00:01 EONAAL223 laa13044510AS.NONM Some lines are missing the field before and after the NON: 2011-05-13 00:00:05 EONBHS229 mia13001621NON I read them into R using df = read.fwf(file, wi