Re: [R] Joining two datasets - recursive procedure?

2015-03-23 Thread Luca Meyer
wrote: Sorry forgot to keep the rest of the group in the loop - Luca -- Forwarded message -- From: Luca Meyer lucam1...@gmail.com Date: 2015-03-22 16:27 GMT+01:00 Subject: Re: [R] Joining two datasets - recursive procedure? To: Bert Gunter gunter.ber...@gene.com Hi

Re: [R] Joining two datasets - recursive procedure?

2015-03-23 Thread Luca Meyer
] Joining two datasets - recursive procedure? To: Bert Gunter gunter.ber...@gene.com Hi Bert, That is exactly what I am trying to achieve. Please notice that negative v4 values are allowed. I have done a similar task in the past manually by recursively alterating v4 distribution

Re: [R] Joining two datasets - recursive procedure?

2015-03-22 Thread Luca Meyer
Hi Bert, hello R-experts, I am close to a solution but I still need one hint w.r.t. the following procedure (available also from https://www.dropbox.com/s/qhmpkkrejjkpbkx/sample_code.txt?dl=0) rm(list=ls()) # this is (an extract of) the INPUT file I have: f1 - structure(list(v1 = c(A, A, A, A,

Re: [R] Joining two datasets - recursive procedure?

2015-03-22 Thread Bert Gunter
I would have thought that this is straightforward given my previous email... Just set z to what you want -- e,g, all B values to 29/number of B's, and all C values to 2.567/number of C's (etc. for more categories). A slick but sort of cheat way to do this programmatically -- in the sense that it

Re: [R] Joining two datasets - recursive procedure?

2015-03-22 Thread Bert Gunter
Oh, wait a minute ... You still want the marginals for the other columns to be as originally? If so, then this is impossible in general as the sum of all the values must be what they were originally and you cannot therefore choose your values for V3 arbitrarily. Or at least, that seems to be

Re: [R] Joining two datasets - recursive procedure?

2015-03-22 Thread Luca Meyer
Hi Bert, Thanks again for your assistance. Unfortunately when I apply the additional code you suggest I get B=40.23326 C=-8.66603 and not B=29 C=2.56723. Any idea why that might be happening? Please see below or on https://www.dropbox.com/s/qhmpkkrejjkpbkx/sample_code.txt?dl=0 the code I am

Re: [R] Joining two datasets - recursive procedure?

2015-03-22 Thread David Winsemius
...@gmail.com wrote: Sorry forgot to keep the rest of the group in the loop - Luca -- Forwarded message -- From: Luca Meyer lucam1...@gmail.com Date: 2015-03-22 16:27 GMT+01:00 Subject: Re: [R] Joining two datasets - recursive procedure? To: Bert Gunter gunter.ber...@gene.com

Re: [R] Joining two datasets - recursive procedure?

2015-03-21 Thread Bert Gunter
... or cleaner: z1 - with(f1,v4 + z -ave(z,v1,v2,FUN=mean)) Just for curiosity, was this homework? (in which case I should probably have not provided you an answer -- that is, assuming that I HAVE provided an answer). Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374

Re: [R] Joining two datasets - recursive procedure?

2015-03-21 Thread Luca Meyer
Hi Bert, Thank you for your message. I am looking into ave() and tapply() as you suggested but at the same time I have prepared a example of input and output files, just in case you or someone else would like to make an attempt to generate a code that goes from input to output. Please see below

Re: [R] Joining two datasets - recursive procedure?

2015-03-21 Thread Bert Gunter
z - rnorm(nrow(f1)) ## or anything you want z1 - f1$v4 + z - with(f1,ave(z,v1,v2,FUN=mean)) aggregate(v4~v1,f1,sum) aggregate(z1~v1,f1,sum) aggregate(v4~v2,f1,sum) aggregate(z1~v2,f1,sum) aggregate(v4~v3,f1,sum) aggregate(z1~v3,f1,sum) Cheers, Bert Bert Gunter Genentech Nonclinical

Re: [R] Joining two datasets - recursive procedure?

2015-03-21 Thread Luca Meyer
Hi Jeff other R-experts, Thank you for your note. I have tried myself to solve the issue without success. Following your suggestion, I am providing a sample of the dataset I am using below (also downloadble in plain text from https://www.dropbox.com/s/qhmpkkrejjkpbkx/sample_code.txt?dl=0):

Re: [R] Joining two datasets - recursive procedure?

2015-03-21 Thread Bert Gunter
1. Still not sure what you mean, but maybe look at ?ave and ?tapply, for which ave() is a wrapper. 2. You still need to heed the rest of Jeff's advice. Cheers, Bert Bert Gunter Genentech Nonclinical Biostatistics (650) 467-7374 Data is not information. Information is not knowledge. And

Re: [R] Joining two datasets - recursive procedure?

2015-03-18 Thread Michael Friendly
I'm not sure I understand completely what you want to do, but if the data were frequencies, it sounds like task for fitting a loglinear model with the model formula ~ V1*V2 + V3 On 3/18/2015 2:17 AM, Luca Meyer wrote: Hello, I am facing a quite challenging task (at least to me) and I was

[R] Joining two datasets - recursive procedure?

2015-03-18 Thread Luca Meyer
Thanks for you input Michael, The continuous variable I have measures quantities (down to the 3rd decimal level) so unfortunately are not frequencies. Any more specific suggestions on how that could be tackled? Thanks kind regards, Luca === Michael Friendly wrote: I'm not sure I understand

Re: [R] Joining two datasets - recursive procedure?

2015-03-18 Thread Jeff Newmiller
I don't understand your description. The standard practice on this list is to provide a reproducible R example [1] of the kind of data you are working with (and any code you have tried) to go along with your description. In this case, that would be two dputs of your input data frames and a dput

[R] Joining two datasets - recursive procedure?

2015-03-18 Thread Luca Meyer
Hello, I am facing a quite challenging task (at least to me) and I was wondering if someone could advise how R could assist me to speed the task up. I am dealing with a dataset with 3 discrete variables and one continuous variable. The discrete variables are: V1: 8 modalities V2: 13 modalities