[R] How to select not continous rows?

2010-10-20 Thread skan

Hello

How can I select several not continuous rows ?

If I wanted to select rows 1 to 7 I'll write
mydata[,1:7]

But what if I need to select rows 1 to 5 and 10 to 15?


-- 
View this message in context: 
http://r.789695.n4.nabble.com/How-to-select-not-continous-rows-tp3003840p3003840.html
Sent from the R help mailing list archive at Nabble.com.

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to select not continous rows?

2010-10-20 Thread Ista Zahn
Hi,

On Wed, Oct 20, 2010 at 9:25 AM, skan juanp...@gmail.com wrote:

 Hello

 How can I select several not continuous rows ?

 If I wanted to select rows 1 to 7 I'll write
 mydata[,1:7]

 But what if I need to select rows 1 to 5 and 10 to 15?

mydata[, c(1:5, 10:15)]

-Ista


 --
 View this message in context: 
 http://r.789695.n4.nabble.com/How-to-select-not-continous-rows-tp3003840p3003840.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Ista Zahn
Graduate student
University of Rochester
Department of Clinical and Social Psychology
http://yourpsyche.org

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to select not continous rows?

2010-10-20 Thread Dennis Murphy
mydata[c(1:5, 10:15), ]

HTH,
Dennis

On Wed, Oct 20, 2010 at 6:25 AM, skan juanp...@gmail.com wrote:


 Hello

 How can I select several not continuous rows ?

 If I wanted to select rows 1 to 7 I'll write
 mydata[,1:7]

 But what if I need to select rows 1 to 5 and 10 to 15?


 --
 View this message in context:
 http://r.789695.n4.nabble.com/How-to-select-not-continous-rows-tp3003840p3003840.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to select not continous rows?

2010-10-20 Thread Henrique Dallazuanna
mydata[c(1:5, 10:15),]

On Wed, Oct 20, 2010 at 11:25 AM, skan juanp...@gmail.com wrote:


 Hello

 How can I select several not continuous rows ?

 If I wanted to select rows 1 to 7 I'll write
 mydata[,1:7]

 But what if I need to select rows 1 to 5 and 10 to 15?


 --
 View this message in context:
 http://r.789695.n4.nabble.com/How-to-select-not-continous-rows-tp3003840p3003840.html
 Sent from the R help mailing list archive at Nabble.com.

 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.




-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40 S 49° 16' 22 O

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to select not continous rows?

2010-10-20 Thread David Winsemius


On Oct 20, 2010, at 9:25 AM, skan wrote:



Hello

How can I select several not continuous rows ?

If I wanted to select rows 1 to 7 I'll write
mydata[,1:7]

But what if I need to select rows 1 to 5 and 10 to 15?


mydata[ , c(1:5, 10:15) ]

--
David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


Re: [R] How to select not continous rows?

2010-10-20 Thread David Winsemius


On Oct 20, 2010, at 10:01 AM, David Winsemius wrote:



On Oct 20, 2010, at 9:25 AM, skan wrote:



Hello

How can I select several not continuous rows ?

If I wanted to select rows 1 to 7 I'll write
mydata[,1:7]

But what if I need to select rows 1 to 5 and 10 to 15?


mydata[ , c(1:5, 10:15) ]


Fortunately you got 3 other correct answers, and my incorrect one  
should remain outvoted.


--
David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


David Winsemius, MD
West Hartford, CT

__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.