Re: [R] Accessing named members of a list in an array

2012-06-30 Thread Patrick Burns
Your problem is that you are trying to use `$` on an atomic vector rather than a list: > a<- array(list(NULL),dim=c(2,2)) > a[[1,1]] <- c(a=2,b=3) > a[[1,1]]$a Error in a[[1, 1]]$a : $ operator is invalid for atomic vectors > a[[1,1]] a b 2 3 > a[[1,1]] <- list(a=2,b=3) > a[[1,1]]$a [1] 2 > a[[1,

[R] Default for boot in mantel{ecodist} was Re: Size of subsample in ecodist mantel()

2012-06-30 Thread Nevil Amos
How do I use pboot to set the level of resampling (size of each resample) in mantel()? if I enter a value for pboot then the ulim==llim > X<-dist(1:100) > Y<-dist(1:100+50*rnorm(100)) > length(X) [1] 4950 > print(mantel(X~Y,nperm=1000,nboot=1000,pboot=10)) mantelr pval1 pval2 p

Re: [R] How to adjust the start of a series to zero? (i.e. subtract the first value from the sequence)

2012-06-30 Thread Bert Gunter
Simpler: dat1$adj_mean <- within(dat1, ave(mean, point, FUN = function(x)x-x[1])) ave() is a very handy function for this sort of thing. within() saves typing. -- Bert On Sat, Jun 30, 2012 at 4:16 PM, arun wrote: > HI, > > Try this: > #dat1: data > > dat2<-split(dat1,dat1$point) > adjmeanli

Re: [R] dcc in 'bootRes' package

2012-06-30 Thread andresholz
Hi Xanthe, I'm running in the exact same issue. Were you able to solve it? Could you please give me a hand? Thanks! Andres -- View this message in context: http://r.789695.n4.nabble.com/dcc-in-bootRes-package-tp380p4635017.html Sent from the R help mailing list archive at Nabble.com.

[R] significant difference between Gompertz hazard parameters?

2012-06-30 Thread piltdownpunk
Hello, all. I have co-opted a number of functions that can be used to plot the hazard/survival functions and associated density distribution for a Gompertz mortality model, given known parameters. The Gompertz hazard model has been shown to fit relatively well to the human adult lifespan. For ex

[R] Batch file rename basing on a look up table need help_New to R_A little bit complicated

2012-06-30 Thread wxx3dodu
Hello, all I'm pretty new to R and I wish to accomplish the following task I have many files need to do this task. I simplify the situation to five files. Their names are 001 232 242 123 132 I'd like to change the name of each file (column 1) to the name in column 2 in the following table column1

Re: [R] Adjusting length of series

2012-06-30 Thread arun
Hello, Try this: Dcr<-lapply(1:5,function(x) rnorm(10,15)) names(Dcr)<- c("Dcre1","Dcre2","Dcre3","Dcre4","Dcre5") #Works regCred<-lm(Dcr[[1]]~Dcr[[2]]+Dcr[[3]])  summary(regCred) #Works  regCred2<-lm(Dcre1~Dcre2+Dcre3,data=Dcr)  summary(regCred) # Do not work regCred3<-lm(Dcr[[1]][1:5]~Dcr[[4]]

Re: [R] Help

2012-06-30 Thread li li
Hi John, It worked. Thanks a lot! Hannah 2012/6/30 John Kane > It looks like we have different versions of software loaded. > I have R version 2.15.0 (2012-03-30) > > My packages. > reshape2_1.2.1 ggplot2_0.9.0 > > Hannah's packages. > R version 2.12.2 (2011-02-25) > quantreg_4.71 SparseM

Re: [R] Adjusting length of series

2012-06-30 Thread David Winsemius
On Jun 30, 2012, at 8:47 PM, David Winsemius wrote: On Jun 30, 2012, at 6:04 PM, Lekgatlhamang, lexi Setlhare wrote: Hi I have a follow up question, relating to subsetting to list items. After using the list and min(sapply()) method to adjust the length of the variables, I specify a dyna

Re: [R] approximation of test

2012-06-30 Thread David Winsemius
On Jun 30, 2012, at 3:38 PM, solafah bh wrote: Hello I want to use this function in R (wilcox.test) , is this function can approximate the statistic automatically if the sample size is large or not?? Why don't you test it? Regards Sulafah [[alternative HTML version deleted]]

Re: [R] Adjusting length of series

2012-06-30 Thread David Winsemius
On Jun 30, 2012, at 6:04 PM, Lekgatlhamang, lexi Setlhare wrote: Hi I have a follow up question, relating to subsetting to list items. After using the list and min(sapply()) method to adjust the length of the variables, I specify a dynamic regression equation using the variables in the li

Re: [R] loop in list

2012-06-30 Thread R. Michael Weylandt
I might think replicate() is slightly more idiomatic, but I'm not in a position to check if simplify=FALSE will keep a list. Best, Michael On Jun 30, 2012, at 7:13 PM, Rui Barradas wrote: > Hello, > > You can avoid the loop using lapply. > > f <- function(x) sample(100, 10) > samp.list <- l

Re: [R] loop in list

2012-06-30 Thread Rui Barradas
Hello, You can avoid the loop using lapply. f <- function(x) sample(100, 10) samp.list <- lapply(1:20, f) will choose 20 samples of 10 integers up to 100 and put them in a list. All you need is to write a function f(). f() must have an argument, even if it doesn't use it. If you need other ar

Re: [R] How to adjust the start of a series to zero? (i.e. subtract the first value from the sequence)

2012-06-30 Thread arun
HI, Try this: #dat1: data dat2<-split(dat1,dat1$point) adjmeanlist<-lapply(dat2,function(x)x[,3]-x[,3][1]) dat3<-data.frame(dat1,adjmean=unlist(adjmeanlist))  head(dat3)   point time mean    sd  adjmean 1 1    1 52.50100 1.5073927 0.00 3 1    2 54.50182 0.8510329 2.000818 4   

Re: [R] loop in list

2012-06-30 Thread arun
Hi, Try this, list1<-list() vec<-rnorm(15,25) for(i in 1:20) { list1[[i]]<-sample(vec,replace=FALSE) } list1 [[1]]  [1] 24.28594 25.05309 25.48962 24.71479 22.48122 25.41300 25.26129 25.15602  [9] 24.91442 23.65078 26.84776 24.85934 25.00111 24.16320 27.05351 [[2]]  [1] 24.91442 24.28594 25.05

[R] Adjusting length of series

2012-06-30 Thread Lekgatlhamang, lexi Setlhare
Hi I have a follow up question, relating to subsetting to list items. After using the list and min(sapply()) method to adjust the length of the variables, I specify a dynamic regression equation using the variables in the list. My list looks like this: Dcr<- list(Dcre1=DCred1,Dcre2=DCred2,Dcre3

Re: [R] Covariance structure for lme

2012-06-30 Thread apcoble
This bit helped me to match lme results in R with SAS, try options(contrasts=c("contr.sum","contr.poly")) before lme model. -- View this message in context: http://r.789695.n4.nabble.com/Covariance-structure-for-lme-tp4630413p4635005.html Sent from the R help mailing list archive at Nab

Re: [R] How to adjust the start of a series to zero? (i.e. subtract the first value from the sequence)

2012-06-30 Thread Rui Barradas
Hello, Try, where 'dat' is your dataset, dd <- lapply(split(dat, dat$point), function(x) x$mean - x$mean[1]) dat$adj_mean <- NA for(i in names(dd)) dat$adj_mean[dat$point == i] <- dd[[i]] rm(dd) # clean-up Now 'dat' has one extra column, with the adjusted mean values. Hope this helps,

Re: [R] How to adjust the start of a series to zero? (i.e. subtract the first value from the sequence)

2012-06-30 Thread Phil Spector
Kristiina - If the data will always be sorted so that the first time for a point appears first in the data frame, you can use: sort2v4$adj_mean = sort2v4$mean - ave(sort2v4$mean,sort2v4$point,FUN=function(x)x[1]) Otherwise, something like this should work: firstmeans = subset(sort2v4,time

Re: [R] loop in list

2012-06-30 Thread Greg Snow
Instead of a loop you can use the replicate or lapply functions which will create lists for you. otherwise you can start with an empty list (mylist <- list() ) then add to the list in each iteration of the loop: for(i in 1:10) { mylist[[i]] <- myfunction(i) } On Sat, Jun 30, 2012 at 1:34

[R] How to adjust the start of a series to zero? (i.e. subtract the first value from the sequence)

2012-06-30 Thread Kristiina Hurme
Hello, I'd have a time series, where I am plotting the means and sd of a distance for a variety of positions along a bird's bill. I'd like to set each line (represented by "point") to start at zero, so that I can look at the absolute change along the series. At the moment I only know how to do tha

[R] Using Pers. Dictionary with Aspell in R

2012-06-30 Thread Ribbis
My goal is to use Aspell 0.60 with a personal dictionary within R. Running WinXP, R 2.15.1, and Cygwin's install of Aspell 0.60. Using a test file with 2/5 words misspelled: SpellTest.txt test text txxt endeavour mytzlplk and dictionary files (aspell.en.pws, and spell.en.prepl respectively) of:

[R] approximation of test

2012-06-30 Thread solafah bh
Hello I want to use this function in R (wilcox.test) , is this function can approximate the statistic automatically  if the sample size is large or not??   Regards Sulafah [[alternative HTML version deleted]] __ R-help@r-project.org mailing list

[R] loop in list

2012-06-30 Thread solafah bh
Hello I have a loop to sample 20 samples and I want to put them in one list, how I can make this??   Regards Sulafah [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE d

Re: [R] Help

2012-06-30 Thread John Kane
It looks like we have different versions of software loaded. I have R version 2.15.0 (2012-03-30) My packages. reshape2_1.2.1 ggplot2_0.9.0 Hannah's packages. R version 2.12.2 (2011-02-25) quantreg_4.71 SparseM_0.89 reshape2_1.1 ggplot2_0.8.9 proto_0.3-9.2 [6] reshape_0.8.4 plyr_1.6 It look

Re: [R] Help

2012-06-30 Thread li li
The following is what I get when I run the code. > library(ggplot2) Loading required package: reshape Loading required package: plyr Attaching package: 'reshape' The following object(s) are masked from 'package:plyr': rename, round_any Loading required package: grid Loading required packa

Re: [R] turning R expressions into functions?

2012-06-30 Thread Dirk Eddelbuettel
On 30 June 2012 at 11:39, Greg Snow wrote: | Look at the replicate function, it takes an expression (does not need | a function) and runs that expression the specified number of times. | Will that accomplish what you want without needing to worry about | substitute, quote, eval, etc.? And also lo

Re: [R] graph from txt file

2012-06-30 Thread Rui Barradas
Hello, The answer to the question is yes. But first a note. Your vertex ids start at 51 and the greater is 173. igraph vertices (and edges) are automatically numbered starting at 1, in this latest package version. Previous versions vertex numbers were zero based. If you look online you will al

Re: [R] plot background - excel gradient style background ?

2012-06-30 Thread Greg Snow
Here are examples of a histogram and a boxplot using rasterImage to make the background: bg <- matrix( c('#ff','#ff','#ff'), ncol=1 ) tmp <- hist(iris$Sepal.Width) xylim <- par('usr') rasterImage(bg, xylim[1], xylim[3], xylim[2], xylim[4]) plot(tmp, add=TRUE, lwd=3) plot( Petal.Le

Re: [R] Significance of interaction depends on factor reference level - lmer/AIC model averaging

2012-06-30 Thread Bert Gunter
1. This has nothing to do with R. It's your lack of understanding of linear models issues. See ?contrasts and ?contrast for the specific, but I doubt that you will understand how these fit in with the underlying statistical issues (and I would be delighted to be wrong). So, in order of (my )prefere

Re: [R] Accessing named members of a list in an array

2012-06-30 Thread Peter Ehlers
On 2012-06-30 09:04, David Winsemius wrote: On Jun 30, 2012, at 9:35 AM, mlell08 wrote: Dear List, I've created a two-dimensional array which shall contain a value and its error, respectively. These two values are concatenated in al list and bear the names "sl" and "sl_err" But I can't adres

Re: [R] turning R expressions into functions?

2012-06-30 Thread Greg Snow
Look at the replicate function, it takes an expression (does not need a function) and runs that expression the specified number of times. Will that accomplish what you want without needing to worry about substitute, quote, eval, etc.? On Fri, Jun 29, 2012 at 11:36 AM, Jochen Voß wrote: > [ please

Re: [R] Help

2012-06-30 Thread Peter Ehlers
On 2012-06-30 07:04, John Kane wrote: Hi Hannah, I have run both the original code and the code copied from the email and both seem to work just fine. I don't know why you are getting that error message. Do you have both ggplot2 and reshape2 loaded? Still that should not g

Re: [R] Accessing named members of a list in an array

2012-06-30 Thread arun
Hi, You can use these as well to access named members. > a[1] [[1]] a b 2 3  >a[1][[1]][1] a 2 > a[[1,1]][1] a 2 >a[[1,1]][2] b 3   >identical(a[[1,1]]["a"],a[[1,1]][1],a[1][[1]][1]) [1] TRUE > a[[1,1]][["a"]] [1] 2 > a[[1,1]][["b"]] [1] 3 or, > a[[c(1,2)]] [1] 3  >a[[c(1,1)]] [1]

Re: [R] graph from txt file

2012-06-30 Thread HIMANSHU MITTAL
Thanks a lot. Just one more question. me given the two node ids and the graph, can i find the corresponding edge attributes( date and label)? On Sat, Jun 30, 2012 at 2:10 PM, Rui Barradas wrote: > Hello, > > Just set the attribute, > > V(g)$date <- as.POSIXct(as.POSIXlt(rep(**315522000, 6), > or

[R] Significance of interaction depends on factor reference level - lmer/AIC model averaging

2012-06-30 Thread Andy Robertson
Dear R users, I am using lmer combined with AIC model selection and averaging (in the MuMIn package) to try and assess how isotope values (which indicate diet) vary within a population of animals. I have multiple measures from individuals (variable 'Tattoo') and multiple individuals within

Re: [R] Binary Quadratic Opt?

2012-06-30 Thread menkes
Hi Khris, If all your variables are binary then you may want to check CPLEX and/or Gurobi (both provide a free academic license). http://www-01.ibm.com/software/integration/optimization/cplex-optimizer/ http://www.gurobi.com/products/additional-products-using-gurobi/r The algorithms that CPLEX a

Re: [R] How do I extract coefficient standard errors /CI for a "coxme" model

2012-06-30 Thread David Winsemius
On Jun 30, 2012, at 8:33 AM, dunner wrote: Hello, and thanks for your time I'm trying to extract standard errors to produce confidence intervals from a multivariable coxme model object so I can write a function that will print a summary for some reproducible research. As far as I can gle

Re: [R] Accessing named members of a list in an array

2012-06-30 Thread David Winsemius
On Jun 30, 2012, at 9:35 AM, mlell08 wrote: Dear List, I've created a two-dimensional array which shall contain a value and its error, respectively. These two values are concatenated in al list and bear the names "sl" and "sl_err" But I can't adress them using the $-notation. a<- array

Re: [R] Help

2012-06-30 Thread John Kane
Hi Hannah, I have run both the original code and the code copied from the email and both seem to work just fine. I don't know why you are getting that error message. Do you have both ggplot2 and reshape2 loaded? Still that should not give you the error message you are getting.

[R] Accessing named members of a list in an array

2012-06-30 Thread mlell08
Dear List, I've created a two-dimensional array which shall contain a value and its error, respectively. These two values are concatenated in al list and bear the names "sl" and "sl_err" But I can't adress them using the $-notation. a<- array(list(NULL),dim=c(2,2)) a[[1,1]]<- c(a=2,b=3) a[[1,1]]

Re: [R] package ‘rggobi’ is not available (for R version 2.15.0)

2012-06-30 Thread Uwe Ligges
On 29.06.2012 21:03, YTP wrote: My criticism is aimed at the previous reply, which gave an arcane and not helpful suggestion (granted, it may only seem that way to me because of my own incompetence, but I don't know that the knowledge needed to understand "binary package" and "install from th

[R] How do I extract coefficient standard errors /CI for a "coxme" model

2012-06-30 Thread dunner
Hello, and thanks for your time I'm trying to extract standard errors to produce confidence intervals from a multivariable coxme model object so I can write a function that will print a summary for some reproducible research. As far as I can glean, the SE is produced on-the-fly by the print meth

[R] Calling a .net DLL from R?

2012-06-30 Thread Cheng Li
Hi Everyone, I am a newbie to R. I have a .net DLL developed by myself. Now I wan to call this DLL from my R environment. After searching on the Internet, I didn't get any clue. Dose anyone have any experience on this subject. Is there any available package to do such work? Regards, Cheng

Re: [R] Problem installing RBloomberg

2012-06-30 Thread yoda55
Thx for the info. I didn't know the package name changed. -- View this message in context: http://r.789695.n4.nabble.com/Problem-installing-RBloomberg-tp4634624p4634959.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.

Re: [R] About Error message

2012-06-30 Thread Bert Gunter
Ummm Read the error message and do what it says? " F is missing from cr smooth - refit model with current mgcv. " The older models appear to be incompatible with the newer version of mgcv/R summary() methods. Read the new ?summary help. There may be a parameter you can give it to make it wor

Re: [R] Indifference curve

2012-06-30 Thread Rui Barradas
Hello, Is this it? u <- function(x, y) 3*x^2 + 2*y x <- seq(-10, 10, by=1) y <- seq(0, 150, by=1) a <- c(100, 200, 300) persp(x, y, outer(x, y, u), ticktype="detailed") contour(x, y, outer(x, y, u), levels=a) Hope this helps, Rui Barradas Em 28-06-2012 10:13, Akhil dua escreveu: Hello eve

Re: [R] plot background - excel gradient style background ?

2012-06-30 Thread Jim Lemon
On 06/30/2012 07:07 AM, jcrosbie wrote: I have a number of different figures I wish to create with a gradient background. In addition to the two examples I've uploaded I need a boxplot, histogram, etc. http://r.789695.n4.nabble.com/file/n4634932/fig1.png fig1.png http://r.789695.n4.nabble.com/f

Re: [R] graph from txt file

2012-06-30 Thread Rui Barradas
Hello, Just set the attribute, V(g)$date <- as.POSIXct(as.POSIXlt(rep(315522000, 6), origin="1970-01-01")) V(g)$date Rui Barradas Em 30-06-2012 04:26, HIMANSHU MITTAL escreveu: Thanks a lot. But i have one more doubt one of the attribute i have is time of edge formation id1,id2,label,time 5

Re: [R] the meaning of subscripts

2012-06-30 Thread Deepayan Sarkar
On Thu, Jun 28, 2012 at 9:27 PM, startend wrote: > Hi, > > Now i am dealing with longitudinal data set and I want to see the rough > marginal plot for 2 variables separately. > I found the code from one example here, > > reading <- > read.table("http://www.ats.ucla.edu/stat/R/examples/alda/data/re

Re: [R] predicting expected number of events using a coxph model

2012-06-30 Thread peter dalgaard
On Jun 29, 2012, at 23:56 , agittens wrote: > I fit a coxph model: > > coxphfit <- coxph(Surv(sampledLifetime, !sampledCensoredQ) ~ curpbc6 + > prevpbc6, sampledTimeSeries) > > Now I'm trying to predict the expected number of events using a new dataset. > The documentation suggests that > >

Re: [R] lattice histogram log and non log values

2012-06-30 Thread Deepayan Sarkar
On Thu, Jun 28, 2012 at 2:41 AM, LCOG1 wrote: > Hello all, >  Please consider the following > > library(lattice) > Colors. <-rep(brewer.pal(7, "Dark2"),2) > color <- 1 > > Data.X.. <- data.frame(UnitArea = c(rnorm(1000), rnorm(1000)), Type = > c(rep("Base",1000),rep("Log",1000))) > >              

Re: [R] incorrect number of subscripts on matrix

2012-06-30 Thread Berend Hasselman
andre bedon wrote > > Hi, > Wondering if anyone could help me out with this error.Im trying to fill a > matrix with random numbers taken from an exponential distribution using a > loop: > x.3<-matrix(rep(0,3000),nrow=1000,byrow=T)for(i in > 1:1000){x[i,]<-rexp(3,rate=2/3)} > I get the error messa

Re: [R] incorrect number of subscripts on matrix

2012-06-30 Thread Patrick Burns
Andre, 1) The matrix you created was called 'x.3', not 'x'. I guess this could be an item in 'The R Inferno', perhaps it falls into Circle 8.3.32. 2) You don't need a loop at all: x.3 <- matrix(rexp(3000, rate=2/3), nrow=1000) This is Circle 3. http://www.burns-stat.com/pages/Tutor/R_inferno.