If for each combination of X and Y there is at most one Z and Z is numeric
(it could be made so in your example) then you could use xtabs which is
faster:
> m <- n <- 10
> DF <- data.frame(X = gl(m*n, 1), Y = gl(m, n), Z = 10*(1:(n*m)))
> system.time(w1 <- reshape(DF, timevar = "X", idvar = "Y", d
I wrote:
> It still needs some debugging, to put it mildly
> (doesn't work properly on reals), but the basic idea appears to work.
It works for reals on a 64-bit machine, but not on a 32-bit machine. I
figure the culprit is this bit of c code:
SET_VECTOR_ELT(wideCol, wideRow, VECTOR_ELT(longCol,
> "Mitchell" == Mitchell Skinner <[EMAIL PROTECTED]>
> on Thu, 24 Aug 2006 00:26:52 -0700 writes:
Mitchell> I wrote:
>> It still needs some debugging, to put it mildly
>> (doesn't work properly on reals), but the basic idea appears to work.
Mitchell> It works for reals
On Thu, 24 Aug 2006, Martin Maechler wrote:
> > "Mitchell" == Mitchell Skinner <[EMAIL PROTECTED]>
> > on Thu, 24 Aug 2006 00:26:52 -0700 writes:
>
> Mitchell> I wrote:
> >> It still needs some debugging, to put it mildly
> >> (doesn't work properly on reals), but the basi
Your example does not correspond to your description. You have taken a
random number of loci for each subject and measured each a random number
of times:
> with(test, table(table(subject, locus)))
0 1 2 3 4 5 6 7 8
118021 114340 54963 17848 4288
I'd like to thank everyone that's replied so far--more inline:
On Thu, 2006-08-24 at 11:16 +0100, Prof Brian Ripley wrote:
> Your example does not correspond to your description. You have taken a
> random number of loci for each subject and measured each a random number
> of times:
You're righ
If your Z in reality is not naturally numeric try representing it as a
factor and using
the numeric levels as your numbers and then put the level labels back on:
m <- n <- 5
DF <- data.frame(X = gl(m*n, 1), Y = gl(m, n), Z = letters[1:25])
Zn <- as.numeric(DF$Z)
system.time(w1 <- reshape(DF, timev
On Thu, 2006-08-24 at 08:57 -0400, Gabor Grothendieck wrote:
> If your Z in reality is not naturally numeric try representing it as a
> factor and using
> the numeric levels as your numbers and then put the level labels back on:
>
> m <- n <- 5
> DF <- data.frame(X = gl(m*n, 1), Y = gl(m, n), Z =
Here's the essence of a solution (0.14 sec for this bit)
res <- with(betterTest, {
subjects <- levels(subject)
loci <- levels(locus)
## replace "" by as.character(NA) if you prefer
res <- matrix("", length(subjects), length(loci),
dimnames = list(subjects, loci))
ind <- cbind(as.inte
On 8/24/06, Mitch Skinner <[EMAIL PROTECTED]> wrote:
> On Thu, 2006-08-24 at 08:57 -0400, Gabor Grothendieck wrote:
> > If your Z in reality is not naturally numeric try representing it as a
> > factor and using
> > the numeric levels as your numbers and then put the level labels back on:
> >
> > m
I assume that the fact that SEXP's passed through .Call
are read-only is a convention, consistent with R semantics.
This can be awkward when huge matrices are passed
as in:
newP <- .Call("myfunc", P)
because this would cause the huge matrix to be copied.
Is there any danger if I violate the conve
Dominick Samperi wrote:
> I assume that the fact that SEXP's passed through .Call
> are read-only is a convention, consistent with R semantics.
>
> This can be awkward when huge matrices are passed
> as in:
> newP <- .Call("myfunc", P)
> because this would cause the huge matrix to be copied.
Yes,
On Thu, 24 Aug 2006, Hin-Tak Leung wrote:
> Dominick Samperi wrote:
>> I assume that the fact that SEXP's passed through .Call
>> are read-only is a convention, consistent with R semantics.
Yes
>> This can be awkward when huge matrices are passed
>> as in:
>> newP <- .Call("myfunc", P)
>> becaus
Rather off-topic, not really about R nor development at all,
but I think the issue is vaguely relevant for potential package writers.
Mitch Skinner wrote:
> When there's a chance (however slim, in this case) that something I
> write will end up getting used by someone else, I usually use my
> per
I've been trying to track down some of the issues with command line length
limits, and those writing GUIs/front-ends need to pay some attention to
the issue.
src/unix/system.txt says
*int R_ReadConsole(char *prompt, char *buf, int buflen, int hist)
*
* This function prints the given p
15 matches
Mail list logo