[R] ggplot2: how to jitter spaghetti plot so slopes are preserved

2014-08-20 Thread David Romano
Hi, Suppose I have a the data frame given by: > dput(toy.df) structure(list(id = c(1, 2, 1, 2), time = c(1L, 1L, 2L, 2L), value = c(1, 2, 2, 3)), .Names = c("id", "time", "value"), row.names = c(NA, 4L), class = "data.frame") that is: > toy.df id time value 1 11 1 2 21 2 3

Re: [R] trouble using sapply to perform multiple t-test

2014-02-16 Thread David Romano
t; #0.1091573 1.000 > > A.K. > > > On Saturday, February 15, 2014 3:19 PM, David Romano > wrote: > Hi folks, > > I'm having trouble with code that used to work, and I can't figure out > what's going wrong. I'd be grateful for any help in sortin

[R] trouble using sapply to perform multiple t-test

2014-02-15 Thread David Romano
Hi folks, I'm having trouble with code that used to work, and I can't figure out what's going wrong. I'd be grateful for any help in sorting this out. Suppose I define a matrix > mm <- matrix(1:15, 25,2) and compare the first 15 values of column 1 of mm to the values remaining in the same colum

[R] memory leak using 'apply'? [was: how to parallelize 'apply' across multiple cores on a Mac]

2013-05-04 Thread David Romano
in advance for you help, David On Fri, May 3, 2013 at 4:56 PM, David Romano wrote: > Hi everyone, > > I'm trying to use apply (with a call to zoo's rollapply within) on the > columns of a 1.5Kx165K matrix, and I'd like to make use of the other cores > on my machine

Re: [R] how to parallelize 'apply' across multiple cores on a Mac

2013-05-04 Thread David Romano
(I neglected to use reply-all.) -- Forwarded message -- From: David Romano Date: Sat, May 4, 2013 at 11:25 AM Subject: Re: [R] how to parallelize 'apply' across multiple cores on a Mac To: Charles Berry On Sat, May 4, 2013 at 9:32 AM, Charles Berry wrote: > Davi

Re: [R] how to best add columns to a matrix with many columns

2013-05-03 Thread David Romano
t; Research Engineer (Solar/BatteriesO.O#. #.O#. with > /Software/Embedded Controllers) .OO#. .OO#. rocks...1k > --- > Sent from my phone. Please excuse my brevity. > > Da

[R] how to best add columns to a matrix with many columns

2013-05-03 Thread David Romano
Hi everyone, I have large data frame, say df1, with 165K columns, and all but the first four columns of df1 are numeric. I transformed the numeric data and obtained a matrix, call it data.m, with 165K - 4 columns, and then tried to create a second data frame by replacing the numeric columns of

[R] how to parallelize 'apply' across multiple cores on a Mac

2013-05-03 Thread David Romano
Hi everyone, I'm trying to use apply (with a call to zoo's rollapply within) on the columns of a 1.5Kx165K matrix, and I'd like to make use of the other cores on my machine to speed it up. (And hopefully also leave more memory free: I find that after I create a big object like this, I have to save

Re: [R] different behavior of $ with string literal vs string variable as argument

2013-02-10 Thread David Romano
Sorry, this was meant to go to the full list. -David On Sun, Feb 10, 2013 at 2:15 PM, David Romano wrote: > > > On Sun, Feb 10, 2013 at 1:59 PM, Bert Gunter wrote: > >> Please read the Help before posting. >> >> ?"$" says: >> > > It helps to

Re: [R] different behavior of $ with string literal vs string variable as argument

2013-02-10 Thread David Romano
On Sun, Feb 10, 2013 at 1:40 PM, Duncan Murdoch wrote: > On 13-02-10 4:06 PM, David Romano wrote: > >> Hi everyone, >> >> I ran into the issue below while trying to execute a command of the form >> >> apply(list.names,1, function(x) F(favorite.list$x) ) &

[R] different behavior of $ with string literal vs string variable as argument

2013-02-10 Thread David Romano
Hi everyone, I ran into the issue below while trying to execute a command of the form apply(list.names,1, function(x) F(favorite.list$x) ) where list.names is a character vector containing the names of the elements of favorite.list and F is some function defined on a list element. Namely, the

Re: [R] question about reproducibility/consistency of principal component and lda directions in R

2013-02-10 Thread David Romano
On Sat, Feb 9, 2013 at 11:43 AM, Uwe Ligges wrote: > > > On 08.02.2013 20:14, David Romano wrote: > >> Hi everyone, >> >> I'm not exactly sure how to ask this question most clearly, but I hope >> that >> giving the context in which it occurs for me

[R] question about reproducibility/consistency of principal component and lda directions in R

2013-02-08 Thread David Romano
e same, but with the first lda scores, so I have the same questions about lda directions, too. Any light you could shed on these questions would be very welcome! Thanks in advance, David Romano [[alternative HTML version deleted]] __ R-help@r-

Re: [R] how to extract test for collinearity and constantcy used in lda

2013-02-08 Thread David Romano
ze for having missed it.As to the "variables collinear" warning, it's still not clear to me what level of correlation will trigger it. My apologies, David On Wed, Feb 6, 2013 at 12:21 PM, David Romano wrote: > Hi everyone, > > I'm trying to vectorize an applicat

[R] how to extract test for collinearity and constantcy used in lda

2013-02-06 Thread David Romano
Hi everyone, I'm trying to vectorize an application of lda to each 2D slice of a 3D array, but am running into trouble: It seems there are quite a few 2D slices that trigger either the "variables are collinear" warning, or worse, trigger a "variable appears to be constant within groups" error and

Re: [R] how to "multiply" list of matrices by list of vectors

2013-02-06 Thread David Romano
2,list) > > mapply("%*%",mlist,vlist[1:2],SIMPLIFY=FALSE) > #[[1]] > #[,1] > #[1,] 19 > #[2,] 22 > #[3,] 25 > #[4,] 28 > # > #[[2]] > #[,1] > #[1,] 67 > #[2,] 74 > #[3,] 81 > #[4,] 88 > > A.K. > - Original Mes

[R] how to "multiply" list of matrices by list of vectors

2013-02-05 Thread David Romano
Hi everyone, I'd like to be able to apply lda to each 2D matrix slice of a 3D array, and then use the scalings to obtain the corresponding lda scores. I can use 'apply' to get a list of the lda output for each 2D slice, and can create a list of the resulting scalings, but I'm not sure how to mult

Re: [R] using 'apply' to apply princomp to an array of datasets

2012-12-12 Thread David Romano
t; > > For the column numbers you can do > > colnums <- which(colidx) > > Hope this helps, > > Rui Barradas > > Em 12-12-2012 17:14, David Romano escreveu: >> >> Hi everyone, >> >> Suppose I have a 3D array of datasets, where say dimension 1 corr

Re: [R] using 'apply' to apply princomp to an array of datasets

2012-12-12 Thread David Romano
Sorry, I just realized I didn't send the message below in plain text. -David Romano On Wed, Dec 12, 2012 at 9:14 AM, David Romano wrote: > > Hi everyone, > > Suppose I have a 3D array of datasets, where say dimension 1 corresponds > to cases, dimension 2 to datasets

[R] using 'apply' to apply princomp to an array of datasets

2012-12-12 Thread David Romano
27;m not sure how to produce. My second question is: 2) Having answered question 1), now suppose there may be datasets containing NA value -- how could I select the subset of values from dimension 2 corresponding to the datasets for which this is true (again using *apply?)? Thanks in advance for any lig

Re: [R] odd behavior of browser()

2012-12-12 Thread David Romano
On Tue, Dec 4, 2012 at 2:12 PM, David Romano wrote: > > > On Tue, Dec 4, 2012 at 10:22 AM, Duncan Murdoch > wrote: > >> On 04/12/2012 12:54 PM, David Romano wrote: >> >>> Hi everyone, >>> >>> I normally include a call to browser() as I'

[R] odd behavior of browser()

2012-12-04 Thread David Romano
avior is the following: file bugcheck.r: browser() a <- 1 b <- 2 > source("bugcheck.r") Called from: eval(expr, envir, enclos) Browse[1]> > > ls() [1] "a" "b" > a [1] 1 > b [1] 2 I'd be gratefu

Re: [R] using ifelse to remove NA's from specific columns of a data frame containing strings and numbers

2012-11-15 Thread David Romano
at 6:46 AM, Bert Gunter wrote: > David: > > You seem to be getting lost in basic R tasks. Have you read the Intro > to R tutorial? If not, do so, as this should tell you how to do what > you need. If so, re-read the sections on indexing ("["), replacement, > and NA's.

[R] using ifelse to remove NA's from specific columns of a data frame containing strings and numbers

2012-11-15 Thread David Romano
data frame into a vector-like list of elements (which I would hope would work). I'd be grateful for any suggestions! Thanks, David Romano [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman

Re: [R] splitting character vectors into multiple vectors using strsplit

2012-11-02 Thread David Romano
by replacing the anonymous function by c, we obtain a more elegant but more wasteful solution. Thanks again for everyone's help, David Romano On Fri, Sep 7, 2012 at 11:12 AM, David Romano wrote: > Hi folks, > > Suppose I create the character vector charvec by > > > cha

[R] splitting character vectors into multiple vectors using strsplit

2012-09-07 Thread David Romano
splitlist [[1]] [1] "a1" "b1" [[2]] [1] "a2" "b2" I was wondering whether there is already a function which can extract the "a" and "b" parts of the list splitlist; that is, that can return the same vectors as those created by c("a1&q

[R] ways of getting around allocMatrix limit?

2012-07-31 Thread David Romano
I need to multiply to very large, nonsparse matrices, and so get the error "allocMatrix: too many elements specified". Is there a way to set the limit for allocMatrix? In my case, the two matrices, A and B, are nxm and mxp where m is small, so I could subdivide each into blocks of submatrices A=r

Re: [R] using save() to work with objects that exceed memory capacity

2012-07-30 Thread David Romano
On Sun, Jul 29, 2012 at 7:08 AM, R. Michael Weylandt < michael.weyla...@gmail.com> wrote: > On Sat, Jul 28, 2012 at 10:48 AM, David Romano > wrote: > > Context: I'm relatively new to R and am working with very large > datasets. > > > > General problem: I

[R] using save() to work with objects that exceed memory capacity

2012-07-28 Thread David Romano
uot;mat")' retrieves no objects. Why is this? I'd be grateful for any help on either my specific questions, or suggestions of a better ways to address the issue of limited memory. Thanks, David Romano [[alternative HTML version deleted]] __