Re: [R] a very simple question

2012-03-19 Thread Petr Savicky
On Mon, Mar 19, 2012 at 12:47:12PM +, Dajiang Liu wrote: > > Thanks a lot for the clarification. I just find it very bizarre that if you > run a=0.1*(1:9);which(a==0.4) > it returns the right answer. Anyway, I will pay attention next time. Thanks a > lot. Hi. Yes, these things are bizarr

Re: [R] a very simple question

2012-03-19 Thread Ted Harding
On 19-Mar-2012 Dajiang Liu wrote: > Thanks a lot for the clarification. I just find it very bizarre > that if you run > a=0.1*(1:9);which(a==0.4) > it returns the right answer. Anyway, I will pay attention next time. > Thanks a > lot. The basic explanation is that, for an integer r (0 Date: 19-Ma

Re: [R] a very simple question

2012-03-19 Thread Berend Hasselman
1*(1:4) > a - 0.4 [1] -0.3 -0.2 -0.1 0.0 > Berend >> Date: Mon, 19 Mar 2012 08:59:59 +0100 >> From: rainer.schuerm...@gmx.net >> Subject: Re: [R] a very simple question >> To: ldjst...@hotmail.com; r-help@r-project.org >> >> As to the reasons, David as g

Re: [R] a very simple question

2012-03-19 Thread Dajiang Liu
0.6 0.7 0.8 0.9 > > which( a == 0.3 ) > [1] 3 > > Rgds, > Rainer > > > Original-Nachricht > > Datum: Sun, 18 Mar 2012 21:43:54 +0000 > > Von: Dajiang Liu > > An: r-help@r-project.org > > Betreff: [R] a very simple question >

Re: [R] a very simple question

2012-03-19 Thread Petr Savicky
On Sun, Mar 18, 2012 at 09:43:54PM +, Dajiang Liu wrote: > > Dear All, > I have a seemingly very simple question, but I just cannot figure out the > answer. I attempted to run the following:a=0.1*(1:9);which(a==0.3);it returns > integer(0). But obviously, the third element of a is equal to 0

Re: [R] a very simple question

2012-03-19 Thread Rainer Schuermann
18 Mar 2012 21:43:54 + > Von: Dajiang Liu > An: r-help@r-project.org > Betreff: [R] a very simple question > > Dear All, > I have a seemingly very simple question, but I just cannot figure out the > answer. I attempted to run the following:a=0.1*(1:9);which(a==0.3);it

Re: [R] a very simple question

2012-03-18 Thread David Winsemius
On Mar 18, 2012, at 4:43 PM, Dajiang Liu wrote: Dear All, I have a seemingly very simple question, but I just cannot figure out the answer. I attempted to run the following:a=0.1*(1:9);which(a==0.3);it returns integer(0). But obviously, the third element of a is equal to 0.3. I must have

[R] a very simple question

2012-03-18 Thread Dajiang Liu
Dear All, I have a seemingly very simple question, but I just cannot figure out the answer. I attempted to run the following:a=0.1*(1:9);which(a==0.3);it returns integer(0). But obviously, the third element of a is equal to 0.3. I must have missed something. Can someone kindly explain why? Than

Re: [R] A very simple question

2008-05-15 Thread Patrick Burns
There have been several solutions like: k[k != 3] The more general form of this idea is: k[!(k %in% 3)] Sticking closer to the original form would be: out <- which(k == 3) if(length(out)) k[-out] else k Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S

Re: [R] A very simple question

2008-05-15 Thread Erin Hodgess
Or > k <- c(1,1,1,2,2,1,1) > k[!(k==3)] [1] 1 1 1 2 2 1 1 > On Wed, May 14, 2008 at 1:59 PM, Julian Burgos <[EMAIL PROTECTED]> wrote: > Try this: > > k=c(1,1,1,2,2,1,1,1) > >> k[(k!=1)] > [1] 2 2 > >> k[(k!=2)] > [1] 1 1 1 1 1 1 > >> k[(k!=3)] > [1] 1 1 1 2 2 1 1 1 > > Julian > > > Shubha Vishwa

Re: [R] A very simple question

2008-05-14 Thread Julian Burgos
Try this: k=c(1,1,1,2,2,1,1,1) > k[(k!=1)] [1] 2 2 > k[(k!=2)] [1] 1 1 1 1 1 1 > k[(k!=3)] [1] 1 1 1 2 2 1 1 1 Julian Shubha Vishwanath Karanth wrote: Hi R, Suppose l=c(1,1,1,2,2,1,1,1) k[-which(k==1)] [1] 2 2 k[-which(k==2)] [1] 1 1 1 1 1 1 But, k[-which(k==3)]

Re: [R] A very simple question

2008-05-14 Thread Greg Snow
(801) 408-8111 > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Shubha > Vishwanath Karanth > Sent: Wednesday, May 14, 2008 9:16 AM > To: [EMAIL PROTECTED] > Subject: [R] A very simple question > > Hi R, > > > > Suppose &

Re: [R] A very simple question

2008-05-14 Thread Ingmar Visser
l[!l==3] On 14 May 2008, at 17:16, Shubha Vishwanath Karanth wrote: > Hi R, > > > > Suppose > > l=c(1,1,1,2,2,1,1,1) > > > > k[-which(k==1)] > > [1] 2 2 > > > > k[-which(k==2)] > > [1] 1 1 1 1 1 1 > > > > But, > > > > k[-which(k==3)] > > numeric(0) > > > > I do not want this numeric(0), instead t

Re: [R] A very simple question

2008-05-14 Thread Chuck Cleland
On 5/14/2008 11:16 AM, Shubha Vishwanath Karanth wrote: Hi R, Suppose l=c(1,1,1,2,2,1,1,1) k[-which(k==1)] [1] 2 2 k[-which(k==2)] [1] 1 1 1 1 1 1 But, k[-which(k==3)] numeric(0) I do not want this numeric(0), instead the whole k itself should be my result... How

Re: [R] A very simple question

2008-05-14 Thread Christos Hatzis
esday, May 14, 2008 11:16 AM > To: [EMAIL PROTECTED] > Subject: [R] A very simple question > > Hi R, > > > > Suppose > > l=c(1,1,1,2,2,1,1,1) > > > > k[-which(k==1)] > > [1] 2 2 > > > > k[-which(k==2)] > > [1] 1 1 1 1 1 1

[R] A very simple question

2008-05-14 Thread Shubha Vishwanath Karanth
Hi R, Suppose l=c(1,1,1,2,2,1,1,1) k[-which(k==1)] [1] 2 2 k[-which(k==2)] [1] 1 1 1 1 1 1 But, k[-which(k==3)] numeric(0) I do not want this numeric(0), instead the whole k itself should be my result... How do I do this? Thanks, Shubha This e-mail may contai

Re: [R] A Very Simple Question

2008-05-13 Thread Giovanni Petris
See ?scale HTH, Giovanni > Date: Tue, 13 May 2008 23:27:59 +0900 > From: Yukihiro Ishii <[EMAIL PROTECTED]> > Sender: [EMAIL PROTECTED] > Precedence: list > DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=ybb20050223; d=ybb.ne.jp; > > Hi Rusers! > > I am ashed of asking such a simple quest

Re: [R] A Very Simple Question

2008-05-13 Thread Greg Snow
?sweep -Original Message- From: "Yukihiro Ishii" <[EMAIL PROTECTED]> To: "r-help@r-project.org" Sent: 5/13/08 8:30 AM Subject: [R] A Very Simple Question Hi Rusers! I am ashed of asking such a simple question. X<-matrix(rnorm(24), 4) X0<-apply(X,2,mean

Re: [R] A Very Simple Question

2008-05-13 Thread Chuck Cleland
On 5/13/2008 10:27 AM, Yukihiro Ishii wrote: Hi Rusers! I am ashed of asking such a simple question. X<-matrix(rnorm(24), 4) X0<-apply(X,2,mean) What I want is a matrix which consists of colums such as X[,1]--X0[1]. X-X0 doesn't work. Perhaps apply function? scale(X, scale=FALSE) ?scale

[R] A Very Simple Question

2008-05-13 Thread Yukihiro Ishii
Hi Rusers! I am ashed of asking such a simple question. X<-matrix(rnorm(24), 4) X0<-apply(X,2,mean) What I want is a matrix which consists of colums such as X[,1]--X0[1]. X-X0 doesn't work. Perhaps apply function? Thanks in advance. Yukihiro Ishii 2-3-28 Tsurumakiminami, Hadano, 250-0002 Jap

Re: [R] A very simple question

2007-10-23 Thread John Kane
It sound like you have been loading an existing workspace in 2.5.0 when you started up R each time. I don't know much about this but you might want to see if you have some kind of .Rdata file in the 2.5.0 installation that is doing this. Otherwise did you make any changes to your Rprofile in 2

Re: [R] A very simple question

2007-10-22 Thread Tim Calkins
?save.image ?load HTH. tc On 10/23/07, David Kaplan <[EMAIL PROTECTED]> wrote: > Hi all, > > My apologies for a very simple question. I just downloaded > R 2.6.0. I want to bring in all of the objects from 2.5.0 > that I see when I type ls(). I have no idea how to do that. > > Thanks in advan

[R] A very simple question

2007-10-22 Thread David Kaplan
Hi all, My apologies for a very simple question. I just downloaded R 2.6.0. I want to bring in all of the objects from 2.5.0 that I see when I type ls(). I have no idea how to do that. Thanks in advance. David -- === Dav