Re: [R] Skipping lines and incomplete rows

2012-07-11 Thread arun
dat4$variable1<-as.Date(dat4[,1],format="%m/%d/%Y %H:%M") A.K. - Original Message - From: vioravis To: r-help@r-project.org Cc: Sent: Wednesday, July 11, 2012 8:30 AM Subject: Re: [R] Skipping lines and incomplete rows Thanks a lot for the guidance. I

Re: [R] Skipping lines and incomplete rows

2012-07-11 Thread Rui Barradas
Hello, That seems easy. dat$variable1 <- with(dat, paste(variable1, variable2)) dat$variable2 <- dat$variable3 dat$variable3 <- "" Then convert variable1 to date/time using as.POSIXct or strptime See ?strptime. Hope this helps, Rui Barradas Em 11-07-2012 13:30, vioravis escreveu: Thanks a

Re: [R] Skipping lines and incomplete rows

2012-07-11 Thread vioravis
Thanks a lot for the guidance. I have another text file with a time stamp and an empty column as given below: First line: Skip this line Second line: skip this line Third line: skip this line variable1

Re: [R] Skipping lines and incomplete rows

2012-07-11 Thread Uwe Ligges
NA 1.5651 2.2112 5 1/4/2012 0.00 #NA #NA 1. 2. 6 1/5/2012 0.0 0 #NA #NA 3.2578 7.5455 A.K. - Original Message - From: vioravis To: r-help@r-project.org Cc: Sent: Tuesday, July 10, 2012 1:41 AM Subject: Re: [R] Sk

Re: [R] Skipping lines and incomplete rows

2012-07-10 Thread arun
0 4 1/3/2012  0.0    0  #NA   #NA 1.5651 2.2112 5 1/4/2012  0.0    0  #NA   #NA 1. 2. 6 1/5/2012      0.0        0  #NA   #NA 3.2578 7.5455 A.K. - Original Message - From: vioravis To: r-help@r-project.org Cc: Sent: Tues

Re: [R] Skipping lines and incomplete rows

2012-07-10 Thread Rui Barradas
Or maybe it's better to coerce Temp and Press to numeric, if they are variables temperature and presssure. dat$Time <- as.Date(dat$Time, format="%m/%d/%Y") dat$Temp <- as.numeric(dat$Temp) dat$Press <- as.numeric(dat$Press) This makes those '#N/A' values NA. Rui Barradas Em 10-07-2012 09:34,

Re: [R] Skipping lines and incomplete rows

2012-07-10 Thread Rui Barradas
Hello, My approach was slightly different, to use readLines to take care of the header and read.table for the data. This works with the new dataset you've posted, but we must use the option comment.char = "". Try the following. head <- readLines("test.txt", n=4)[4] dat <- read.table("test.t

Re: [R] Skipping lines and incomplete rows

2012-07-10 Thread vioravis
Thanks a lot Rui and Arun. The methods work fine with the data I gave but when I tried the two methods with the following semi-colon separated data using sep = ";". Only the first 3 columnns are read properly rest of the columns are either empty or NAs. **

Re: [R] Skipping lines and incomplete rows

2012-07-09 Thread arun
nt: Monday, July 9, 2012 6:23 AM Subject: [R] Skipping lines and incomplete rows I have a text file that has semi-colon separated values. The table is nearly 10,000 by 585. The files looks as follows: *** First line: Skip this line Second line: skip this li

Re: [R] Skipping lines and incomplete rows

2012-07-09 Thread arun
Cc: Sent: Monday, July 9, 2012 6:23 AM Subject: [R] Skipping lines and incomplete rows I have a text file that has semi-colon separated values. The table is nearly 10,000 by 585. The files looks as follows: *** First line: Skip this line Second line: skip this li

Re: [R] Skipping lines and incomplete rows

2012-07-09 Thread Rui Barradas
Hello, Try the following. head <- readLines("test.txt", n=4)[4] dat <- read.table("test.txt", skip=5) names(dat) <- unlist(strsplit(head, " ")) dat hope this helps, Rui Barradas Em 09-07-2012 11:23, vioravis escreveu: I have a text file that has semi-colon separated values. The table is nea

[R] Skipping lines and incomplete rows

2012-07-09 Thread vioravis
I have a text file that has semi-colon separated values. The table is nearly 10,000 by 585. The files looks as follows: *** First line: Skip this line Second line: skip this line Third line: skip this line variable1 Variable2 Variable3 Variable4