If spacing is critical, use 'sprintf' for creating the output.
> Lines1<- read.csv(textConnection("Year, Day, Hour, Value
+ 2010, 001,0,15.9
+ 2010, 001,1,7.3
+ 2010, 001,2,5.2
+ 2010, 001,3,8.0
+ 2010, 001,4,0.0
+ 2010, 001,5,12.1
+ 201
quot;,Lines2)," ")
# [1] 3 3 3 3 3 3 3 3 3 3 3 3
str_count(gsub("\\d+,\\s+\\d+,\\s+(\\d+,\\s+\\d+)","\\1",Lines2)," ")
# [1] 3 3 3 3 3 3 3 3 3 3 3 3
write(Lines2,"capture2.txt")
A.K.
- Original Message -
From: "Mostafavipak, N
Hi all;
I have a data set with the format below:
Year, Day, Hour, Value
2010, 001,0,15.9
2010, 001,1,7.3
2010, 001,2,5.2
2010, 001,3,8.0
2010, 001,4,0.0
2010, 001,5,12.1
2010, 001,6,11.6
2010, 001,7,13.9
2010, 001,8,
3 matches
Mail list logo