Re: [R] indexing question

2009-01-13 Thread Thomas Lumley
ta Zahn wrote: From: baptiste auguie To: Dimitris Rizopoulos Date: Tue, 13 Jan 2009 09:38:09 + Subject: Re: [R] indexing question you can also look at subset, my.data.frame <- data.frame(a=rnorm(10), b=factor(sample(letters[1:4], 10, replace=T))) str(my.data.frame)

Re: [R] indexing question

2009-01-13 Thread Ista Zahn
rying to determine if I need to break my habit of naming data.frames "data". Thanks, Ista > > > On Tue, Jan 13, 2009 at 9:53 AM, Ista Zahn wrote: > > From: baptiste auguie > > To: Dimitris Rizopoulos > > Date: Tue, 13 Jan 2009 09:38:09 + > > Subjec

Re: [R] indexing question

2009-01-13 Thread jim holtman
on? Or are there cases where naming data.frames, vectors, matrices, > etc. can also cause problems? > > I hope I'm not being annoying -- I'm just trying to determine if I need to > break my habit of naming data.frames "data". > > Thanks, > Ista > >>

Re: [R] indexing question

2009-01-13 Thread jim holtman
t; Date: Tue, 13 Jan 2009 09:38:09 + > Subject: Re: [R] indexing question > >> you can also look at subset, >> >> >>my.data.frame <- data.frame(a=rnorm(10), >>> b=factor(sample(letters[1:4], 10, replace=T))) >>>str(my.da

Re: [R] indexing question

2009-01-13 Thread Ista Zahn
From: baptiste auguie To: Dimitris Rizopoulos Date: Tue, 13 Jan 2009 09:38:09 + Subject: Re: [R] indexing question > you can also look at subset, > > >my.data.frame <- data.frame(a=rnorm(10), >> b=factor(sample(letters[1:4], 10, replace=T))) >&g

Re: [R] indexing question

2009-01-13 Thread Bunny, lautloscrew.com
an be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] Namens Bunny, lautloscrew.com Verzonden: dinsdag 13 januari 2009 10:26 Aan: r-help@r-project.org Onderwerp: [R] indexing question Hi a

Re: [R] indexing question

2009-01-13 Thread ONKELINX, Thierry
reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens Bunny, lautloscrew.com Verzonden: dinsdag 13 januari 2009 10:26 Aan: r-help@r-project.org Onderwerp: [R] indexing

Re: [R] indexing question

2009-01-13 Thread baptiste auguie
you can also look at subset, my.data.frame <- data.frame(a=rnorm(10), b=factor(sample(letters[1:4], 10, replace=T))) str(my.data.frame) my.data.frame[my.data.frame$b == "a", ] subset(my.data.frame, b == "a") by the way, it is probably safer not to use "data" as a va

Re: [R] indexing question

2009-01-13 Thread Dimitris Rizopoulos
have a look at ?"[.data.frame"; what you need is the following: dat <- data.frame(a = rbinom(20, 1, 0.5), x = rnorm(20), y = rnorm(20)) dat dat[dat$a == 1, ] I hope it helps. Best, Dimitris Bunny, lautloscrew.com wrote: Hi all, i have a pretty easy indexing question, at least i believe so

[R] indexing question

2009-01-13 Thread Bunny, lautloscrew.com
Hi all, i have a pretty easy indexing question, at least i believe so. The main reason i post it here, is that brackets and $ are hard to google. How do I index correctly, if i just want to display the whole dataset conditioned on the fact that some particular column equals one. I know i