Re: [R] Apply quantile function to each dataframe in a List R

2014-08-04 Thread rhelpmaillist
Try this: lapply(a,function(x) apply(x[,-c(1,2)],2,quantile,probs=0.95)) # a is your example list At 2014-08-05 09:17:23, "Zilefac Elvis" wrote: >Hello, >I would like to calculate for each numeric column in a dataframe, >quantile(x,probs=o.95). >My list object has 120 dataframes, each dataframe h

[R] Apply quantile function to each dataframe in a List R

2014-08-04 Thread Zilefac Elvis
Hello, I would like to calculate for each numeric column in a dataframe, quantile(x,probs=o.95). My list object has 120 dataframes, each dataframe has 102 columns. Here is an example as well as a reproducible example: [[120]]   Year Site Sim001 Sim002 Sim003 Sim004 Sim005 Sim006 Sim007 Sim008 Si

[R] simulation data with dichotomous varuables

2014-08-04 Thread thanoon younis
Dear R-users i need your help to solve my problem in the code below, i want to simulate two different samples R1 and R2 and each sample has 10 variables and 1000 observations so i want to simulate a data with high correlation between var. in R1 and also in R2 and no correlation between R1 and R2 a

Re: [R] Normal probability plot examples for Wikipedia (was "qqnorm with histogram?")

2014-08-04 Thread Charles Berry
Spencer Graves structuremonitoring.com> writes: > > Hi, Jim et al.: > >Thanks for the reply, Jim. > >What are your favorite examples using normal probability plots to > identify outliers, skewness, kurtosis, mixtures, and the need for > transformations in plots of raw data an

Re: [R] Compare data in two rows and replace objects in data frame

2014-08-04 Thread jim holtman
here is another way of doing it using 'tidyr' and 'dplyr' > x <- read.table(text = "CloneIDgenotype2001genotype2002 > genotype2003 + 2471250111 + 2471250000 + 2433062000 + 2433062111 + 100021605110 + 100021605101

Re: [R] Compare data in two rows and replace objects in data frame

2014-08-04 Thread John McKown
On Mon, Aug 4, 2014 at 4:53 AM, raz wrote: > Dear all, > > I have a data frame 144 x 2 values. > I need to take every value in the first row and compare to the second row, > and the same for rows 3-4 and 5-6 and so on. > the output should be one line for each of the two row comparison. > the c

Re: [R] keep information on the number of warnings

2014-08-04 Thread William Dunlap
Look at withCallngHandlers for another way to capture warnings. It will let you attach warnings from an iteration of your function to the output of the function so you can later track down the root cause of the warning. E.g., the attached captureWarningsAndMessagesWithContext attaches warnings, m

[R] Normal probability plot examples for Wikipedia (was "qqnorm with histogram?")

2014-08-04 Thread Spencer Graves
Hi, Jim et al.: Thanks for the reply, Jim. What are your favorite examples using normal probability plots to identify outliers, skewness, kurtosis, mixtures, and the need for transformations in plots of raw data and residuals from model fits -- or using half-normal plots with es

Re: [R] keep information on the number of warnings

2014-08-04 Thread David Winsemius
On Aug 4, 2014, at 9:24 AM, Luis Borda de Agua wrote: > Dear David > > Thank you very much for your reply. I‚ve only seen it now. > I tried length(warnings) and I got a strange result. > > When I used > > lw <- length(warnings) > print(lw) > > I obtained lw=36 > > however, the number of w

Re: [R] Convert some columns of List to dataframe R

2014-08-04 Thread Zilefac Elvis
Great! Thanks, John. For the eye sees not itself, but by reflection and someother things On Sunday, August 3, 2014 4:54 PM, John McKown wrote: On Sun, Aug 3, 2014 at 5:12 PM, Zilefac Elvis wrote: > Dear All, > I have a List in R and would like to convert it to data.frame. > Below is a reprod

[R] keep information on the number of warnings

2014-08-04 Thread Luis Borda de Agua
Dear David Thank you very much for your reply. I’ve only seen it now. I tried length(warnings) and I got a strange result. When I used lw <- length(warnings) print(lw) I obtained lw=36 however, the number of warnings was 38 according to message to screen: "There were 38 warnings (use warni

Re: [R] Count number of change in a specified time interval

2014-08-04 Thread jim holtman
Here is the solution using 'rle': > require(data.table) > x <- read.table(text = "CASE_ID YEAR_MTH ATT_1 + CB26A201302 1 + CB26A201302 0 + CB26A201302 0 + CB26A201303 1 + CB26A201303 1 + CB26A201304 0 + CB26A201305

Re: [R] Count number of change in a specified time interval

2014-08-04 Thread Bert Gunter
Or ?rle Bert Sent from my iPhone -- please excuse typos. > On Aug 4, 2014, at 8:28 AM, jim holtman wrote: > > Try this, but I only get 2 changes for CB27A instead of you indicated 3: > >> require(data.table) >> x <- read.table(text = "CASE_ID YEAR_MTH ATT_1 > + CB26A201302 1 > +

Re: [R] Count number of change in a specified time interval

2014-08-04 Thread jim holtman
Try this, but I only get 2 changes for CB27A instead of you indicated 3: > require(data.table) > x <- read.table(text = "CASE_ID YEAR_MTH ATT_1 + CB26A201302 1 + CB26A201302 0 + CB26A201302 0 + CB26A201303 1 + CB26A201303 1 + CB26A201

Re: [R] Filling in missing values in a column based on previousandfollowingvalues

2014-08-04 Thread John McKown
On Mon, Aug 4, 2014 at 9:01 AM, Florian Denzinger wrote: > Hi John, > > I only meant the subsetting of the dataframe by using the zoo function > suggested by Gerrit! Not a new solution/function, I am afraid. > Regards, > F I take it that means you _don't_ have a solution. If not, or even if you

[R] Calculation of network centrality measures weighted by network size

2014-08-04 Thread Jenny Jiang
Hello, My name is Jenny Jiang and I am a Finance Honours research student from the University of New South Wales Australia. Currently my research project involves the calculating of some network centrality measures in R, which are degree, closeness, betweenness and eigen vector. However I am ha

Re: [R] Filling in missing values in a column based on previousandfollowingvalues

2014-08-04 Thread Florian Denzinger
Hi John, I only meant the subsetting of the dataframe by using the zoo function suggested by Gerrit! Not a new solution/function, I am afraid. Regards, F Am 04.08.2014 um 14:13 schrieb John McKown : > On Mon, Aug 4, 2014 at 6:34 AM, Florian Denzinger > wrote: >> Shortly after answering to you

Re: [R] Filling in missing values in a column based on previousandfollowingvalues

2014-08-04 Thread John McKown
On Mon, Aug 4, 2014 at 6:34 AM, Florian Denzinger wrote: > Shortly after answering to your first email, I got to solution. Sorry for the > unnecessary noise. > > Regards, > F > Florian, I'd be interested in seeing your solution. I need as many techniques in my "bag of tricks" as I can find. --

Re: [R] memory corruption in R

2014-08-04 Thread cosmos science
Sorry for spamish message but here is the error log of CORElearn failure: *** glibc detected *** /usr/local/lib64/R/bin/exec/R: malloc(): memory corruption: 0x4b9b0788 *** === Backtrace: = /lib64/libc.so.6[0x394b67d012] /lib64/libc.so.6(__libc_malloc+0x63)[0x394b67f493] /lib64/

Re: [R] Compare data in two rows and replace objects in data frame

2014-08-04 Thread arun
You could try data.table #dat is the dataset library(data.table) v1 <- setNames(c("HT", "A", "B", "Aht", "Bht"), c("11", "10", "01", "1-", "-1")) dat2 <- setDT(dat1)[, lapply(.SD, function(x) v1[paste(x, collapse="")]), by=CloneID] A.K. On Monday, August 4, 2014 5:55 AM, raz wrote: Dear a

Re: [R] Filling in missing values in a column based on previousandfollowingvalues

2014-08-04 Thread Florian Denzinger
Shortly after answering to your first email, I got to solution. Sorry for the unnecessary noise. Regards, F Am 04.08.2014 um 12:00 schrieb Gerrit Eichner : > On Mon, 4 Aug 2014, Florian Denzinger wrote: > >> this is great, thanks! >> >> one problem I noticed though is that it fills all NA va

Re: [R] Compare data in two rows and replace objects in data frame

2014-08-04 Thread Gerrit Eichner
Hello, Raz, if X is the data frame that contains your data, then using sort of an "indexing trick" to circumvent your numerous if-statements as in aggregate( X[ c( "genotype 2001", "genotype 2002", "genotype 2003")], X[ "CloneID"], FUN = function( x) c(

Re: [R] Filling in missing values in a column based on previousandfollowingvalues

2014-08-04 Thread Gerrit Eichner
On Mon, 4 Aug 2014, Florian Denzinger wrote: this is great, thanks! one problem I noticed though is that it fills all NA values in every column, is it possible to specify only one column, e.g. only ID (I have NA values in another column I want to keep) Yes, of course. Just access only one c

[R] Compare data in two rows and replace objects in data frame

2014-08-04 Thread raz
Dear all, I have a data frame 144 x 2 values. I need to take every value in the first row and compare to the second row, and the same for rows 3-4 and 5-6 and so on. the output should be one line for each of the two row comparison. the comparison is: if row1==1 and row2==1 <-'HT' if row1==1 an

Re: [R] Filling in missing values in a column based on previousandfollowing values

2014-08-04 Thread Florian Denzinger
this is great, thanks! one problem I noticed though is that it fills all NA values in every column, is it possible to specify only one column, e.g. only ID (I have NA values in another column I want to keep) Kind regards, Florian Am 04.08.2014 um 11:31 schrieb Gerrit Eichner : > Hello, F

Re: [R] Filling in missing values in a column based on previousandfollowing values

2014-08-04 Thread Gerrit Eichner
Hello, Florian, function na.locf() from package zoo mightdo what you want. Hth -- Gerrit - Dr. Gerrit Eichner Mathematical Institute, Room 212 gerrit.eich...@math.uni-giessen.de Justus-Liebig-University Gie

[R] Filling in missing values in a column based on previous and following values

2014-08-04 Thread fd
I have the following .csv file containing about 4 values (here only an extract and simplified version): NAME ; YEAR; ID; VALUE; CUMMB Sample1;1998;354; 45;45 Sample1;1999;354; 23;68 Sample1;2000;NA;66;134 Sample1;

Re: [R] memory corruption in R

2014-08-04 Thread cosmos science
The CORElearn crashed when I used a test file of 100MB for the analysis. However, it was difficult to send this big file to the developer, so I sent a smaller test file ( ~40MB) to the developer. With this file, the CORElearn did not crash. So, now I am now running the code with the same (~40MB) t

Re: [R] memory corruption in R

2014-08-04 Thread Prof Brian Ripley
On 04/08/2014 08:48, cosmos science wrote: HI... I am using R-package CORElearn ( http://cran.r-project.org/web/packages/CORElearn/index.html). During its application on a dataset, It crashed. The crash message says *** glibc detected *** /usr/local/lib64/R/bin/exec/R: malloc(): memory corrupti

[R] memory corruption in R

2014-08-04 Thread cosmos science
HI... I am using R-package CORElearn ( http://cran.r-project.org/web/packages/CORElearn/index.html). During its application on a dataset, It crashed. The crash message says *** glibc detected *** /usr/local/lib64/R/bin/exec/R: malloc(): memory corruption: 0x4b9b0788 *** The error log "cd