[R] Skipping lines and incomplete rows

vioravis vioravis at gmail.com
Tue Jul 10 07:41:49 CEST 2012


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.


**********************************************************************************************
Remove this line
Remove this line
Remove this line
Time;Actual Speed;Actual Direction;Temp;Press;Value1;Value2
;[m/s];[°];°C;[hPa];[MWh];[MWh]
1/1/2012;0.0;0;#N/A;#N/A;0.0000;0.0000
1/2/2012;0.0;0;#N/A;#N/A;0.0000;0.0000
1/3/2012;0.0;0;#N/A;#N/A;1.5651;2.2112
1/4/2012;0.0;0;#N/A;#N/A;1.0000;2.0000
1/5/2012;0.0;0;#N/A;#N/A;3.2578;7.5455
***********************************************************************************************

I used the following code:
dat1<-read.table("testInput.txt",sep=";",skip=3,fill=TRUE,header=TRUE) 
dat1<-dat1[-1,] 
row.names(dat1)<-1:nrow(dat1)

Could you please let me know what is wrong with this approach? 

Thank you.

Ravi

--
View this message in context: http://r.789695.n4.nabble.com/Skipping-lines-and-incomplete-rows-tp4635830p4635952.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list