[R] Data.frames : difference between x$a and x[, a] ? - How set new values on x$a with a as variable ?

2010-09-10 Thread omerle
Hi, I got two questions : 1st Question             a=S             b=data.frame(S=3)             do.call(`-`,list(do.call(`$`,list(b,S)),5)) = How can I put new values on S column having the column name as a variable ? 2 nd Question        a=S       

Re: [R] Data.frames : difference between x$a and x[, a] ? - How set new values on x$a with a as variable ?

2010-09-10 Thread Ista Zahn
Hi, On Fri, Sep 10, 2010 at 4:05 AM, omerle ome...@laposte.net wrote: Hi, I got two questions : 1st Question             a=S             b=data.frame(S=3)             do.call(`-`,list(do.call(`$`,list(b,S)),5)) I think there is some confusion here. Why are you setting a equal to S but

Re: [R] Data.frames : difference between x$a and x[, a] ? - How set new values on x$a with a as variable ?

2010-09-10 Thread omerle
Message du 10/09/10 14:53 De : Ista Zahn A : omerle Copie à : r-help@r-project.org Objet : Re: [R] Data.frames : difference between x$a and x[, a] ? - How set new values on x$a with a as variable ? Hi, On Fri, Sep 10, 2010 at 4:05 AM, omerle wrote: Hi, I got two questions :

Re: [R] Data.frames : difference between x$a and x[, a] ? - How set new values on x$a with a as variable ?

2010-09-10 Thread Ista Zahn
On Fri, Sep 10, 2010 at 9:22 AM, omerle ome...@laposte.net wrote: Message du 10/09/10 14:53 De : Ista Zahn A : omerle Copie à : r-help@r-project.org Objet : Re: [R] Data.frames : difference between x$a and x[, a] ? - How set new values on x$a with a as variable ? Hi, On Fri, Sep 10,

Re: [R] Data.frames : difference between x$a and x[, a] ? - How set new values on x$a with a as variable ?

2010-09-10 Thread Hadley Wickham
I'm having trouble parsing this. What exactly do you want to do? 1 - Put a list as an element of a data.frame. That's quite convenient for my pricing function. I think this is a really bad idea. data.frames are not meant to be used in this way. Why not use a list of lists? It can be very

Re: [R] Data.frames : difference between x$a and x[, a] ? - How set new values on x$a with a as variable ?

2010-09-10 Thread Ivan Calandra
Le 9/10/2010 15:37, Ista Zahn a écrit : On Fri, Sep 10, 2010 at 9:22 AM, omerleome...@laposte.net wrote: Message du 10/09/10 14:53 De : Ista Zahn A : omerle Copie à : r-help@r-project.org Objet : Re: [R] Data.frames : difference between x$a and x[, a] ? - How set new values on x$a with

Re: [R] Data.frames : difference between x$a and x[, a] ? - How set new values on x$a with a as variable ?

2010-09-10 Thread David Winsemius
On Sep 10, 2010, at 9:42 AM, Hadley Wickham wrote: I'm having trouble parsing this. What exactly do you want to do? 1 - Put a list as an element of a data.frame. That's quite convenient for my pricing function. I think this is a really bad idea. data.frames are not meant to be used in this

Re: [R] Data.frames : difference between x$a and x[, a] ? - How set new values on x$a with a as variable ?

2010-09-10 Thread Hadley Wickham
I think this is a really bad idea. data.frames are not meant to be used in this way. Why not use a list of lists? It can be very convenient, but I suspect the original poster is confused about the different between vectors and lists. I wouldn't be surprised if someone were confused, since

Re: [R] Data.frames : difference between x$a and x[, a] ? - How set new values on x$a with a as variable ?

2010-09-10 Thread Bert Gunter
Well, let's see if the following helps or just adds to the confusion. First lists are vectors of mode list . But they are general recursive structures (in fact, completely general). Second, data frames are lists: each column of a data frame is a component (member) of the list with the additional