Re: [R] rename and color a list of list of list of values

2015-06-05 Thread Karim Mezhoud
Thanks Sven, I started with the first function. The values are not in a list but in df. it is more easy for me the output is a df: Genesbrca_tcga gbm_tcga color_brca color_gbm name1 v1v2col1 col2 name2 v3v4

[R] "Updating Loaded Package" behavior

2015-06-05 Thread Drew Marticorena
Hello, I am trying to handle more gracefully the issue that occurs when one attempts to install a new version of a package whose library is currently loaded. When one does this the functions in the package work but when one tries to view the documentation a warning pop is given and the followin

Re: [R] [FORGED] Re: Dunnett Test in 'multicomp' package

2015-06-05 Thread James Henson
Thanks. A useful tip for a long-time SAS user. James F. Henson On Fri, Jun 5, 2015 at 3:47 AM, Gerrit Eichner < gerrit.eich...@math.uni-giessen.de> wrote: > Hello, everyone, > > aside from Rolf's hint (and Richard's warning!) you could also consider > relevel(): > > viagraData$dose <- relevel( vi

[R] Error in eigen(nhatend)

2015-06-05 Thread Olu Ola via R-help
Hello, I am estimating a nonlinear GMM and I got the following error message. I have searched online in other to understand what is going on but could not find help > ngmm = optimx(par=b0, fn=object,gr=gred, method = c("BFGS","nlminb","nlm"), > itnmax=1, control=list(follow.on = TRUE,startte

[R] Confidence interval for the mean in the random intercept and random slople model

2015-06-05 Thread li li
Hi all, I am fitting a random slope and random intercept model usign lme fucntion as shown below. Type is factor with two levels. I would like to to find a confidence interval for mean of this model. Note that the variance we use in finding the confidence interval should include the variariance c

Re: [R] S4 / operator "[" : Compatibility issue between lme4 and kml

2015-06-05 Thread Martin Maechler
> Christophe Genolini > on Fri, 5 Jun 2015 00:36:42 -0700 writes: > Hi all, > There is a compatibility issue between the package 'lme4' and my package > 'kml'. I define the "[" operator. It works just fine in my package (1). If I > try to use the lme4 package, then it

Re: [R] rename and color a list of list of list of values

2015-06-05 Thread Sven E. Templer
Hi Karim, you should learn ?Map to iterate along the list and supply mutliple list arguments (there is also parallel:::mcMap for multicore). The magic of the color code generation you figure out yourself, I guess... Here 'i' intends to be the value, 'n' the name, e.g. # returns color by charact

[R] rename and color a list of list of list of values

2015-06-05 Thread Karim Mezhoud
Hi all, I have a list like this expBefore <- list(HM450=list(brac_tcga=list("ATM"=0.19,"ATR"=0.02,"BRCA1"=0.02,"BRCA2"=0.89,"CHEK1"=0.71,"CHEK2"=0.03), gbm_tcga=list("ATM"=0.19,"ATR"=0.02,"BRCA1"=0.02,"BRCA2"=0.89,"CHEK1"=0.71,"CHEK2"=0.03) ), HM27=list(brac_tcga=list("ATM"=0.19,

Re: [R] [FORGED] Re: Dunnett Test in 'multicomp' package

2015-06-05 Thread Richard M. Heiberger
One more note. There is actually a valid reason to use `levels<-`, and that is to change the spelling of the levels while maintaining the existing order. > tmp <- factor(c("mm", "cm", "dm", "m", "km")) > tmp [1] mm cm dm m km Levels: cm dm km m mm > levels(tmp) <- c("centimeter","decimeter","kil

Re: [R] building a list in a loop

2015-06-05 Thread William Dunlap
Does the following do what you want? > d <- list() # empty list > for(i in 1:8) if (i %% 2 == 0) { newElement <- structure(list(i), names=LETTERS[i]) d <- c(d, newElement) } > str(d) List of 4 $ B: int 2 $ D: int 4 $ F: int 6 $ H: int 8 Bill Dunlap TIBCO Software wdunlap tibco.c

Re: [R] building a list in a loop

2015-06-05 Thread Jeff Newmiller
Your explanation of the problem is unclear and your use of HTML formatting corrupts your code examples. One issue is your reference to a loop while showing no loop nor input nor output. There is more than one construct for iterating in R. One problem you may be encountering is that you cannot c

Re: [R] is.na for S4 object

2015-06-05 Thread Martin Maechler
> Martin Morgan > on Thu, 4 Jun 2015 10:33:37 -0700 writes: > On 06/04/2015 10:08 AM, cgenolin wrote: >> Hi the list, >> >> I have a variable y that is either NA or some S4 object. I would like to >> know in which case I am, but it seems taht is.na does not work w

Re: [R] Matrix of indexes to extract sparse data in dataframe

2015-06-05 Thread Sergio Fonda
Thank you very much! Il 05/giu/2015 15:58, "David L Carlson" ha scritto: > You can select elements of a matrix using a 2 dimensional matrix that > specifies the row/column number of the cells you want to extract: > > > c2 <- cbind(seq_len(nrow(c0)), c1) > > c2 >c1 > [1,] 1 2 > [2,] 2 2

Re: [R] Matrix of indexes to extract sparse data in dataframe

2015-06-05 Thread David L Carlson
You can select elements of a matrix using a 2 dimensional matrix that specifies the row/column number of the cells you want to extract: > c2 <- cbind(seq_len(nrow(c0)), c1) > c2 c1 [1,] 1 2 [2,] 2 2 [3,] 3 1 [4,] 4 2 [5,] 5 1 [6,] 6 1 > d1 <- c0[c2] > d1 [1] -1 -3 12 2 -23 17

Re: [R] Matrix of indexes to extract sparse data in dataframe

2015-06-05 Thread Sergio Fonda
Thank you, of course but I can't use that form as I told. My question is about the possibility to enter in a dataframe with a matrix of indices and get the corresponding values Thanks again Il 05/giu/2015 15:39, "John Kane" ha scritto: > d1 <- apply(c0, 1, min) I think does it. > > John Kane

Re: [R] if else statement for rain data to define zero for dry and one to wet

2015-06-05 Thread John Kane
Please do not post in HTML. It made your posting unreadable. R-help is a plain text list and when it removes all the HTML tags often the result is gibberish Have a look at http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example and http://adv-r.had.co.nz/Reproduci

Re: [R] Matrix of indexes to extract sparse data in dataframe

2015-06-05 Thread John Kane
d1 <- apply(c0, 1, min) I think does it. John Kane Kingston ON Canada > -Original Message- > From: sergio.fond...@gmail.com > Sent: Fri, 5 Jun 2015 15:06:34 +0200 > To: r-help@r-project.org > Subject: [R] Matrix of indexes to extract sparse data in dataframe > > I would like to avoid

[R] Matrix of indexes to extract sparse data in dataframe

2015-06-05 Thread Sergio Fonda
I would like to avoid a "for loop" to get a vector of data taken from rows of a data frame for specific columns. An example is the following (I can't apply min to every row of df, this is just an example): c0=data.frame(a=c(3,-2,12,7,-23,17) , b=c(-1,-3,14,2,6,19)) c1=apply(c0,1,which.min) > c1 [1

Re: [R] if else statement for rain data to define zero for dry and one to wet

2015-06-05 Thread PIKAL Petr
Hi I will not inspect your function as it is corrupted by HTML posting. If your data frame is named rain newrain <- (rain>.1)*1 gives you new data frame with reqired coding. However I am not sure, what do you want to do next. Do you want to merge those 2 data frames so as coded column is besi

[R] Changing colours for heatmap plot

2015-06-05 Thread John Wasige
​Dear community, Could somebody help on how I can change the colour for this plot in the heatmap plot script below to something like c("green", "green", "black", "green", "green", "black", "black", "green", "green", "black"): ## library(gplots) library(lattice) ### loading data data <- read.

[R] if else statement for rain data to define zero for dry and one to wet

2015-06-05 Thread roslinazairimah zakaria
Dear r-users, I have a set of rain data: X1950 X1951 X1952 X1953 X1954 X1955 X1956 X1957 X1958 X1959 X1960 X1961 X1962 1 0.0 0.0 14.3 0.0 13.5 13.2 4.0 0 3.3 0 0 0.0 2 0.0 0.0 21.9 0.0 10.9 6.6 2.1 0 0.0 0 0 0.0 3 25.3 6.7 18.6 0.8

[R] R to HTML problem

2015-06-05 Thread Pijush Das
Hi r-help, I am trying to develop a program in R where I want to display the out put result in a HTML page. But I unable to put two tables side by side which is required to me. Another problem is that I unable to put the title in the center of the page. The code is given below. Please help me.

Re: [R] building a list in a loop

2015-06-05 Thread PIKAL Petr
Hi I do not understand. „i“ is variable and list elements are called by this variable #constructing list > d<-as.list(sample(letters[1:5], 5, replace=F)) > names(d) <- letters[1:5] > d $a [1] "c" $b [1] "a" $c [1] "e" $d [1] "b" $e [1] "d" #variable el > el<-"a" #result > d[[el]]<-"whatever I

[R] Are melt and dcast with ffdf possible?

2015-06-05 Thread Ken Nussear
Having trouble getting melt and dcast to work with ffdf I'm trying to cast 3 columns to a square matrix With a regular data.frame. comb <- expand.grid((1:10),(1:10)) dim(comb) comb$Dist <- (1:100) c.melt <- melt(comb, id.vars=c("Var1","Var2")) dcast(c.melt,Var2~Var1) goes from > comb V

Re: [R] building a list in a loop

2015-06-05 Thread carol white via R-help
Here is the best solution that I found as the list is built in the embedded functions withtout using loop index, list elements' names etc d = list()d[[length(d)+1]] = 1:3d[[length(d)+1]] = 4:6 Many thanks for your help On Friday, June 5, 2015 12:04 PM, PIKAL Petr wrote: #yiv172814

Re: [R] building a list in a loop

2015-06-05 Thread carol white via R-help
in this example can elements of the list be accessed by their name if their name is the value of a variable?el = "a"can the first element d[[1]] be accessed by el instead of the list index like d$a but via el? Thanks On Friday, June 5, 2015 12:04 PM, PIKAL Petr wrote: #yiv1728143

Re: [R] S4 / operator "[" : Compatibility issue between lme4 and kml

2015-06-05 Thread Martin Maechler
> Martin Maechler > on Fri, 5 Jun 2015 11:33:46 +0200 writes: > Christophe Genolini > on Fri, 5 Jun 2015 00:36:42 -0700 writes: >> Hi all, >> There is a compatibility issue between the package 'lme4' and my package >> 'kml'. I define the "[" operator. It work

Re: [R] building a list in a loop

2015-06-05 Thread PIKAL Petr
Hi This I do not consider as a loop without index. AFAIK i is index and the loop is executed twice. First with i equal to „a“ and second time with i equal to „b“. In that case you need to have some objects which are named “a” or “b” and you can use it for selection or computing d<-list(a=NU

Re: [R] building a list in a loop

2015-06-05 Thread PIKAL Petr
Hi Can you please specify how loop without index shall be constructed? It is rather new topic for me. Petr From: carol white [mailto:wht_...@yahoo.com] Sent: Friday, June 05, 2015 11:21 AM To: PIKAL Petr Subject: Re: [R] building a list in a loop also consider a loop without index (not like fo

Re: [R] building a list in a loop

2015-06-05 Thread PIKAL Petr
Hi I do not understand. My mind reading ambilities are limited. Where do you get your vectors from? Instead of vec<-vec+3*(i-1) you can use any computation to create any object. d<-list() n=2 for (i in 1:n) { s<-sample(1:26, 10, replace=FALSE) rn<-rnorm(10) y<-rn*s*rnorm(1)+rnorm(1) fit<-lm(y~

Re: [R] S4 / operator "[" : Compatibility issue between lme4 and kml

2015-06-05 Thread Martin Maechler
> Christophe Genolini > on Fri, 5 Jun 2015 00:36:42 -0700 writes: > Hi all, > There is a compatibility issue between the package 'lme4' and my package > 'kml'. I define the "[" operator. It works just fine in my package (1). If I > try to use the lme4 package, then it

Re: [R] [FORGED] Re: Dunnett Test in 'multicomp' package

2015-06-05 Thread Gerrit Eichner
Hello, everyone, aside from Rolf's hint (and Richard's warning!) you could also consider relevel(): viagraData$dose <- relevel( viagraData$dose, ref = "placebo") Hth -- Gerrit On Fri, 5 Jun 2015, Rolf Turner wrote: On 05/06/15 11:08, Jim Lemon wrote: Hi James, You can change the order

[R] building a list in a loop

2015-06-05 Thread carol white via R-help
It might be an easy question but how to construct correctly a list in a loop? The following doesn't work before starting the loopd = NULL#in the loop, 1st iteration d = list(d,c(1,2,3)d[[1]] NULL [[2]] [1] 1 2 3#in the loop, 2nd iterationd=list(d,c(4,5,6)d [[1]] [[1]][[1]] NULL [[1]][[2]] [1] 1

[R] S4 / operator "[" : Compatibility issue between lme4 and kml

2015-06-05 Thread cgenolin
Hi all, There is a compatibility issue between the package 'lme4' and my package 'kml'. I define the "[" operator. It works just fine in my package (1). If I try to use the lme4 package, then it does no longer work (2). Moreover, it has some kind of strange behavior (3). Do you know what is wrong?

Re: [R] is.na for S4 object

2015-06-05 Thread cgenolin
So easy! Thanks a lot. -- View this message in context: http://r.789695.n4.nabble.com/is-na-for-S4-object-tp4708201p4708234.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more