[R] Writing a .pdf file within a function - what do I need to return()?

2012-03-13 Thread Dgnn
I am trying to write a function that generates one PDf containing plots from several .csv files within a directory. When I manually execute the code it seems to work, but not when it is a function. I think I need to return() something, but haven't had much luck figuring out what/how. plot.isi<-fu

[R] partial duplicates of dataframe rows, indexing and removal

2011-12-07 Thread Dgnn
Hello. I am trying to remove from my dataframe, those rows in which the first 7 columns are duplicated even if subsequent columns make those rows unique. df<-data.frame(id=rep(c('amy','bob','joe') , each=5), pet1=sample(LETTERS[1:3],15, replace=T), pet2=sample(LETTERS[1:3],15, replace=T),

Re: [R] list index rules evaluation behavior

2010-03-30 Thread Dgnn
Sorry for not supplying some example code for the above example. Here's an example list 'a' with histogram elements A, B, and C which are also lists. >a $A $breaks [1] -80 -70 -60 -50 -40 -30 -20 -10 0 10 20 30 40 50 60 $counts [1] 1 0 0 2 29 120 301 433 421 265 93 43 9

Re: [R] Code is too slow: mean-centering variables in a data frame by subgroup

2010-03-30 Thread Dgnn
I posted a similar problem last week (but with an uninformative subject header) See if this http://n4.nabble.com/a-vectorized-solution-to-some-simple-dataframe-math-td1692810.html#a1710410 this helps. -- View this message in context: http://n4.nabble.com/Code-is-too-slow-mean-centering-variab

[R] list index rules evaluation behavior

2010-03-30 Thread Dgnn
I have what may be a simple/foolish question, but I've done the due diligence and looked through pages of posts here as well as several of the PDFs on the CRAN site, but haven't been able find what I'm after. I am working with a list of say 3 histogram objects A, B & C, and each histogram is a li

Re: [R] a vectorized solution to some simple dataframe math?

2010-03-29 Thread Dgnn
Thanks a lot for the help guys. That's exactly what I was looking for. I'm trying to avoid loops, but still don't know what tasks simply require them. Thanks again! Cheers, Jasn -- View this message in context: http://n4.nabble.com/a-vectorized-solution-to-some-simple-dataframe-math-tp1692810p1

[R] a vectorized solution to some simple dataframe math?

2010-03-27 Thread Dgnn
I have a data frame containing the results of time measurements taken from several cells. Each cell was measured in conditions A and B, and there are an arbitrary number of measurements in each condition. I am trying to calculate the difference of each measurement from the mean of a given cell in

[R] lapply and list indexing basics

2010-03-07 Thread Dgnn
I have split my original dataframe to generate a list of dataframes each of which has 3 columns of factors and a 4th column of numeric data. I would like to use lapply to apply the fitdistr() function to only the 4th column (x$isi) of the dataframes in the list. Is there a way to do this or am I

[R] lapply and list indexing basics (after realizing I wasn't previously subscribed...sorry)

2010-03-07 Thread Dgnn
I have split my original dataframe to generate a list of dataframes each of which has 3 columns of factors and a 4th column of numeric data. I would like to use lapply to apply the fitdistr() function to only the 4th column (x$isi) of the dataframes in the list. Is there a way to do this or am

Re: [R] Extract vector elements until cumsum <= x

2010-01-04 Thread Dgnn
again for your help Dgnn -- View this message in context: http://n4.nabble.com/Extract-vector-elements-until-cumsum-x-tp998023p998420.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://st

[R] Extract vector elements until cumsum <= x

2010-01-03 Thread Dgnn
filter{stat} and rollmean{zoo} were suggested, but, I haven't been able to figure a way to use them for this problem. Best wishes to all, and thanks for the help! Dgnn -- View this message in context: http://n4.nabble.com/Extract-vector-elements-until-cumsum-x-tp998023p998023.html Sent from