Skip to content
Prev 335609 / 398498 Next

subset every 5th row

Hi Veepsirtt,
May be this helps:

dat1 <- structure(list(V2 = c(11109.75, 11135.15, 11105.85, 11099.75, 
11055.55, 11063.45, 11045.65, 11065, 11061.2, 11070.25, 11069.3, 
11076, 11081.85, 11086.4, 11086.7, 11065.6, 11071.25, 11073.15, 
11077.8, 11067.7, 11061.1, 11065.9, 11069.1, 11063.3, 11070.45, 
11074.4, 11069.4, 11063.65, 11067.05, 11070.1, 11074, 11069.6, 
11072.65, 11073.7, 11061.35, 11064.2, 11066.85, 11078.15, 11079.65, 
11079.5, 11075.9, 11066.95, 11072.55, 11068.85, 11073.5, 11067.6, 
11055.3, 11053.3, 11052.65, 11047.6, 11045.25, 11028.9, 11036.15, 
11034.3, 11044.05, 11030.65, 11036.6, 11039.75, 11035.35, 11019.05
)), .Names = "V2", class = "data.frame", row.names = c(NA, 60L
))
dat1[seq(5,nrow(dat1),by=5),,drop=FALSE]
#or
dat1[((seq(nrow(dat1))-1)%%5+1)==5,,drop=FALSE]

A.K.
On Sunday, January 19, 2014 9:40 AM, "veepsirtt at gmail.com" <veepsirtt at gmail.com> wrote:
Hi A.K sir

1,11109.75
2,11135.15
3,11105.85
4,11099.75
5,11055.55
6,11063.45
7,11045.65
8,11065
9,11061.2
10,11070.25
11,11069.3
12,11076
13,11081.85
14,11086.4
15,11086.7
16,11065.6
17,11071.25
18,11073.15
19,11077.8
20,11067.7
21,11061.1
22,11065.9
23,11069.1
24,11063.3
25,11070.45
26,11074.4
27,11069.4
28,11063.65
29,11067.05
30,11070.1
31,11074
32,11069.6
33,11072.65
34,11073.7
35,11061.35
36,11064.2
37,11066.85
38,11078.15
39,11079.65
40,11079.5
41,11075.9
42,11066.95
43,11072.55
44,11068.85
45,11073.5
46,11067.6
47,11055.3
48,11053.3
49,11052.65
50,11047.6
51,11045.25
52,11028.9
53,11036.15
54,11034.3
55,11044.05
56,11030.65
57,11036.6
58,11039.75
59,11035.35
60,11019.05
thanks
veepsirtt


_____________________________________
Sent from http://r.789695.n4.nabble.com
Message-ID: <1390144897.82424.YahooMailNeo@web142605.mail.bf1.yahoo.com>
In-Reply-To: <28855582.194335.1390142371889.JavaMail.nabble@joe.nabble.com>