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
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
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
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
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
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,
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
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.
**
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
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
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
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
12 matches
Mail list logo