[R] nested, unbalanced anova

2013-01-05 Thread Pfeiffer, Steven
Hello, For an experiment, I selected plots of land within a forest either with honeysuckle or without honeysuckle. Thus, my main factor is fixed, with 2 levels: "honeysuckle present"(n=11) and "honeysuckle absent"(n=8). Within each plot of land, I have a "trenched" subplot and an "untrenched" sub

[R] meboot

2013-01-05 Thread londonphd
Hi, I hope there is someone to help me with using 'meboot' package. I tried to create an ensemble of 999 replicates of a vector. however, I am getting the following error > oil.ens <- meboot(x = panel, reps = jboot, colsubj = 1, coldata = 3) Error in `[.data.frame`(x, order(x, na.last = na.last,

Re: [R] package metafor: error when setting 'col' and 'at' for a forest plot

2013-01-05 Thread Brian Z Ring
Good suggestion, and yes, the given examples work. Using a modification of one of the supplied examples, where in the final line I only added the parameter col=c(1,2,3): data(dat.bcg) dat <- escalc(measure="RR", ai=tpos, bi=tneg, ci=cpos, di=cneg, data=dat.bcg, append=TRUE) forest(dat$yi, dat$vi,

[R] How to use predict function from R2OpenBUGS results

2013-01-05 Thread Andras Farkas
Dear All,   I made some headways on my ODE problem in R2OpenBUGS, but got stuck again. Wonder if someone could help on the following:   I am running the following code:   library(R2OpenBUGS) dosetotal <-c(500,250) z <-c(4,2) grid <-c(4,15) n.grid <-2 tol <-0.001 dim <-2 T <-2 origin <-0 dosetime <

Re: [R] Install package from local zip file

2013-01-05 Thread Jeff Newmiller
You really need to ask the developer for support. You haven't indicated where you downloaded it or what instructions you followed, but I got a similar error trying to install http://pbil.univ-lyon1.fr/software/mareymap/MareyMap_1.0.zip, so it seems a case of stale software. The DESCRIPTION fil

Re: [R] building a regression model

2013-01-05 Thread Mario Bourgoin
You have to understand the ``scope'' argument to add1. As Rui Barradas points out, that argument expects a formula, but you pass it a data frame, YET you only get two warnings. You should practice having that feel strange to you, and having it make you investigate: 1- Why did you not have to giv

[R] Install package from local zip file

2013-01-05 Thread Zhangxinzhao
Hello, I just downloaded the MareyMap: an R-based tool and followed the instructions: Option1: Click "Packages-Install package(s) from local zip files", it showed the followed error messages: > utils:::menuInstallLocal() Error in read.dcf(file.path(pkgname, "DESCRIPTION"), c("Package", "Type")) :

Re: [R] Iterative loop using "repeat"

2013-01-05 Thread Jim Lemon
On 01/05/2013 10:32 PM, mary wrote: Thanks for the help:your reply has focused my problem in particular I'm trying to do a converge process; the robustm() function is: function (x,z) 1# {eigen<-eigen(x) 2# d<-madmatrix(z) ##I have created this function to calculate "mad" of a whole matrix 3# e

Re: [R] help "reshaping" dataframe

2013-01-05 Thread Andrea Goijman
Thanks all! These 2 options worked great. ### OPTION 1 u<-with(occ.data,ftable(Rep~Año+Site+Especie+Pres)) u[1:5,] library(reshape2) flat.occ<-dcast(as.data.frame(u), Año + Site + Especie + Pres ~ Rep, fill = 0) flat.occ[1:10,] ### OPTION 2 occ.data1<-occ.data[,-c(2:3)] library(reshape2) flat

Re: [R] lapply (and friends) with data.frames are slow

2013-01-05 Thread Kevin Ushey
Hi David, Yes, it is - although the SO question was more directed at figuring out why sapply seemed slower, the question to R-help is more nuanced in "is this coercion really necessary for data.frames?", and I figured it might take some more knowledge of R internals / the difference between lists

Re: [R] Need help on dataframe

2013-01-05 Thread Mario Bourgoin
Given the data: dat1<-read.table(header=TRUE,text=" ID V1 V2 V3 V4 16532 23221 36532 412 15 32 56832 63241 76533 812 15 31 96533 103275 116

Re: [R] lapply (and friends) with data.frames are slow

2013-01-05 Thread David Winsemius
On Jan 5, 2013, at 11:38 AM, Kevin Ushey wrote: Hey guys, I noticed something curious in the lapply call. I'll copy+paste the function call here because it's short enough: lapply <- function (X, FUN, ...) { FUN <- match.fun(FUN) if (!is.vector(X) || is.object(X)) X <- as.list(X)

Re: [R] lapply (and friends) with data.frames are slow

2013-01-05 Thread R. Michael Weylandt
On Sat, Jan 5, 2013 at 7:38 PM, Kevin Ushey wrote: > Hey guys, > > I noticed something curious in the lapply call. I'll copy+paste the > function call here because it's short enough: > > lapply <- function (X, FUN, ...) > { > FUN <- match.fun(FUN) > if (!is.vector(X) || is.object(X)) >

Re: [R] Need help on dataframe

2013-01-05 Thread arun
HI, Sorry, there was a mistake, which I noticed after seeing David's post. dat1<-read.table(text=" ID  V1  V2  V3  V4 1    6    5    3    2 2    3    2    2    1 3    6    5    3    2 4    12  15  3    2 5    6    8    3    2 6    3    2    4    1 7    6    5    3    3 8    12  15  3    1 9    6   

[R] lapply (and friends) with data.frames are slow

2013-01-05 Thread Kevin Ushey
Hey guys, I noticed something curious in the lapply call. I'll copy+paste the function call here because it's short enough: lapply <- function (X, FUN, ...) { FUN <- match.fun(FUN) if (!is.vector(X) || is.object(X)) X <- as.list(X) .Internal(lapply(X, FUN)) } Notice that lapp

Re: [R] Need help with time series data

2013-01-05 Thread arun
Hi, Just to add: As you have more columns of data, it would be better to do in this way:  Time1<-as.POSIXct("2013-01-01 00:00:00")  tseq<-seq(Time1,length.out=50,by="secs") dat2<-data.frame(TIME=tseq,matrix(NA,nrow=50,ncol=3)) #change nrow and ncol names(dat2)[-1]<-paste("Data",1:3,sep="") dat

Re: [R] Holiday in Canada

2013-01-05 Thread arun
HI Fares, date1<- seq.Date(as.Date("1jan2003",format="%d%b%Y"),as.Date("1jan2013",format="%d%b%Y"),by="day")    length(date1) #[1] 3654F  set.seed(51)  donation<-sample(1000:300,3654,replace=FALSE)  dat1<-data.frame(date1,donation)  library(chron) nrow(dat1[is.weekend(dat1[,1]),]) #[1] 1044

Re: [R] Need help with time series data

2013-01-05 Thread arun
HI, You could try this: Time1<-as.POSIXct("2013-01-01 00:00:00")  tseq<-seq(Time1,length.out=50,by="secs")  dat2<-data.frame(TIME=tseq,Data1=NA,Data2=NA,Data3=NA) dat3<-read.table(text=" ID    Date TIME    Data1    Data2    Data3 1    2013-01-01 00:00:00  34

Re: [R] Need help on dataframe

2013-01-05 Thread arun
HI, May be this helps: dat1<-read.table(text=" ID  V1  V2  V3  V4 1    6    5    3    2 2    3    2    2    1  3    6    5    3    2 4    12  15  3    2  5    6    8    3    2 6    3    2    4    1  7    6    5    3    3 8    12  15  3    1  9    6    5    3    3 10    3    2    7    5 

Re: [R] Need help on dataframe

2013-01-05 Thread arun
Hi, One more way: dat1<-read.table(text=" ID  V1  V2  V3  V4 1    6    5    3    2 2    3    2    2    1 3    6    5    3    2 4    12  15  3    2 5    6    8    3    2 6    3    2    4    1 7    6    5    3    3 8    12  15  3    1 9    6    5    3    3 10    3    2    7    5 11    6    5   

Re: [R] Rounding

2013-01-05 Thread peter dalgaard
On Jan 5, 2013, at 20:30 , Rolf Turner wrote: > On 01/06/2013 07:42 AM, David Arnold wrote: >> Hi, >> >> Can someone explain this: >> >>> options(digits=20) >>> 1/3 >> [1] 0.1483 >> >> Why the 1483 at the end? > > There are 10 sorts of people; those who understand binary > ari

Re: [R] Rounding

2013-01-05 Thread Rolf Turner
On 01/06/2013 07:42 AM, David Arnold wrote: > Hi, > > Can someone explain this: > >> options(digits=20) >> 1/3 > [1] 0.1483 > > Why the 1483 at the end? There are 10 sorts of people; those who understand binary arithmetic and those who don't. See also FAQ 7.31. cheers, Rolf

Re: [R] Need help on dataframe

2013-01-05 Thread David L Carlson
This is a slight modification of John's approach using 6 variables and 28 observations: set.seed(42) xx <- data.frame(aa = 1:28, matrix(sample(1:6, 6*28, replace = TRUE), nrow= 28)) dd <- ((1:nrow(xx)-1) %/% 7) +1 result <- aggregate(xx[,-1], by=list(dd), FUN=mean)[dd,-1] result <- data.f

Re: [R] Rounding

2013-01-05 Thread R. Michael Weylandt
On Sat, Jan 5, 2013 at 6:48 PM, R. Michael Weylandt wrote: > To be curt, "it's complicated," but it basically comes down to the > fact that 1/3 is not expressible by a finite sequence of powers of 2 > so it can't be perfectly represented in binary. But of course, that in turn leads to gems like t

Re: [R] Rounding

2013-01-05 Thread Achim Zeileis
On Sat, 5 Jan 2013, David Arnold wrote: Hi, Can someone explain this: options(digits=20) 1/3 [1] 0.1483 Why the 1483 at the end? Due to floating-point arithmetic, see FAQ 7.31. Thanks, David. david-arnolds-macbook-pro-2:~ darnold$ R --version R version 2.15.2 (2012-10-

Re: [R] Rounding

2013-01-05 Thread R. Michael Weylandt
On Sat, Jan 5, 2013 at 6:42 PM, David Arnold wrote: > Hi, > > Can someone explain this: > >> options(digits=20) >> 1/3 > [1] 0.1483 > > Why the 1483 at the end? To be curt, "it's complicated," but it basically comes down to the fact that 1/3 is not expressible by a finite sequence

[R] Rounding

2013-01-05 Thread David Arnold
Hi, Can someone explain this: > options(digits=20) > 1/3 [1] 0.1483 Why the 1483 at the end? Thanks, David. david-arnolds-macbook-pro-2:~ darnold$ R --version R version 2.15.2 (2012-10-26) -- "Trick or Treat" Copyright (C) 2012 The R Foundation for Statistical Computing ISBN 3

Re: [R] package metafor: error when setting 'col' and 'at' for a forest plot

2013-01-05 Thread David Winsemius
On Jan 4, 2013, at 9:13 PM, Brian Z Ring wrote: I am using metafor to create forest plots. This code gives me the expected plot (setting x axis tick marks): forest(forest$OR, ci.lb=forest$Low, ci.ub=forest$High, at=log(c(. 05, .25, 1, 10)), slab=forest$SNP, atransf=exp) As does this (set

Re: [R] Need help on dataframe

2013-01-05 Thread John Kane
Well, a rather simple-minded, brute force approach would be to add a factor variable to the data frame and use aggregate on it. I am sure there are better ways but this will work. EXAMPLE ### xx <- data.frame(aa =1:24, b = matrix(sample(c(1,2,3,4,5,6), 72, replace = TRUE

Re: [R] Need help with time series data

2013-01-05 Thread Achim Zeileis
On Sat, 5 Jan 2013, Simonas Kecorius wrote: Dear R users, Could you share your knowledge on following problem: Suppose we have dataframe: ID TIME Data1 Data2Data3 ... Data700 1.2013-01-01 00:00:00 3453 6

[R] Need help on dataframe

2013-01-05 Thread Simonas Kecorius
Dear R users, I came up to a problem by taking means (or other summary statistics) of a big dataframe. Suppose we do have a dataframe: ID V1 V2 V3 V4 V71 16 53 2 3 23 22 1 1 3

[R] Need help with time series data

2013-01-05 Thread Simonas Kecorius
Dear R users, Could you share your knowledge on following problem: Suppose we have dataframe: ID TIME Data1 Data2Data3 ... Data700 1.2013-01-01 00:00:00 3453 66 55 2.2013-01-01 00:00:01

Re: [R] building a regression model

2013-01-05 Thread Bert Gunter
Homework? There is a no homework policy on this list. -- Bert On Sat, Jan 5, 2013 at 3:06 AM, Katarzyna Nurzynska wrote: > Hi > > I am trying to build a regression model. My data looks like this: > > A B C DE > 1 1 12.575 > 2 0 0 1.64

Re: [R] SpatialPolygon with the max value gets no color assigned in spplot function when using

2013-01-05 Thread Roger Bivand
Jan Hornych gmail.com> writes: > > Hi, > > I would like to do coloring of map regions based on the region values > "weight". The approach I am taking is first to break regions into > equal intervals, > > classIntervals(spdf$weight,4)$brks #4 intervals in this case > > and coloring all regions

Re: [R] building a regression model

2013-01-05 Thread Rui Barradas
Hello, The "error" is just a warning, these are not the same thing. And the warning says that you're giving a wrong scope argument, one that includes the response. See ?add1. Argument 'scope' is "a formula giving the terms to be considered for adding or dropping." And you're passing the entir

[R] building a regression model

2013-01-05 Thread Katarzyna Nurzynska
Hi I am trying to build a regression model. My data looks like this: A B C         D                    E 1 1 1        2.57            5 2 0 0       1.64            3 0 5 1      4.8                    1 1 3 0      3.56                   168 1 1 1      2.13                   1 0 3 1      5

Re: [R] Iterative loop using "repeat"

2013-01-05 Thread mary
Thanks for the help:your reply has focused my problem in particular I'm trying to do a converge process; the robustm() function is: function (x,z) 1# {eigen<-eigen(x) 2# d<-madmatrix(z) ##I have created this function

Re: [R] Iterative loop using "repeat"

2013-01-05 Thread mary
Thanks for the help, For Mario: you're absolutely right in fact the process never stopped!!! in particular I'm trying to do a converge process; the robustm() function is: function (x,z) 1# {eigen<-eigen(x) 2# d<-madmatrix(z)

Re: [R] Iterative loop using "repeat"

2013-01-05 Thread mary
I'm sorry I read it again the answers and I realized that the condition "if(abs(b2[i,i]-b[i,i])<=0.001)" must be tested for the entire matrix and not only for the diagonal, I misspelled. thanks -- View this message in context: http://r.789695.n4.nabble.com/Iterative-loop-using-repeat-tp46546

Re: [R] Log analysis with R

2013-01-05 Thread Ramprakash Ramamoorthy
Exactly Jim! I am getting some inspiration from papers like these. http://www.cs.dal.ca/sites/default/files/technical_reports/CS-2011-04.pdf In short, I am trying to do a correlation across logs, rather than just visualizing them. On Sat, Jan 5, 2013 at 4:55 PM, Jim Holtman wrote: > I have do

Re: [R] Log analysis with R

2013-01-05 Thread Jim Holtman
I have done a lot of processing of performance logs from UNIX/ Linux systems using vmstat,iostat, process accounting, etc. R is very useful in this area. Is this what you are trying to process? Sent from my iPad On Jan 5, 2013, at 1:43, Ramprakash Ramamoorthy wrote: > I thought mailing lis

Re: [R] MT940 and MT942

2013-01-05 Thread Suzen, Mehmet
On 5 January 2013 10:04, peter dalgaard wrote: >> So it looks like some assembly is required, but puzzle pieces are available. Concerning MT940 spec, I don't know who is regulating this. There is no RFC or similar. The closest thing I found was from DB: https://deutschebank.nl/nl/docs/MT94042_EN.

[R] R: plm random effect: the estimated variance of the individual effect is negative

2013-01-05 Thread Millo Giovanni
Dear Matteo, as I stated in my previous email, if the random effects variance is set to zero then they are identically zero (as mean=0, sd=0) hence you just need to use 'plm(<...> , model="pooling")'. Best, Giovanni -Messaggio originale- Da: matteo ognibene [mailto:ognibenemat...@hotmail

Re: [R] MT940 and MT942

2013-01-05 Thread peter dalgaard
On Jan 5, 2013, at 03:23 , Ben Bolker wrote: > Suzen, Mehmet gmail.com> writes: > >> >> Hello List, >> >> Are there any R package that can process MT940/942? >> >> Thanks >> >> mem > > I find it hard to say because I have no idea what those formats are > (although googling suggests they'r

Re: [R] help "reshaping" dataframe

2013-01-05 Thread arun
HI, May be this helps:  occ.data1<-occ.data[,-c(2:3)] res<-reshape(occ.data1,direction="wide",idvar=c("specie","Site","Pres","year"),timevar="Rep",v.names="Rep") res<-res[,c(1:4,7:8,5:6,9)] res[grep("Rep",names(res))]<-apply(res[grep("Rep",names(res))],2, function(x) ifelse(is.na(x),0,1))  nam

Re: [R] help "reshaping" dataframe

2013-01-05 Thread arun
Hi, You could also use ?dcast() occ.data1<-occ.data[,-c(2:3)] library(reshape2) res1<-dcast(occ.data1,year+Site+specie+Pres~Rep,value.var="Rep") names(res1)[grep("[0-9]",names(res1))]<-paste("Rep",1:5,sep="") res1[,-c(1:4)]<-sapply(res1[,-c(1:4)],function(x) as.integer(is.na(x))) res1 #  year Sit

Re: [R] How to plot multiple time series with different time base in same plot?

2013-01-05 Thread arun
Hi, For the second part of your question, use ?merge() or ?join() from library(plyr) dat1<-read.table(text=" 2011-02-01 15.29130 2011-02-08 17.60278 2011-02-15 17.99737 2011-02-22 25.43690 ",sep="",header=FALSE,stringsAsFactors=FALSE) dat2<-read.table(text=" 2011-02-01 342.34 2011-02-02 68.45 20

[R] package metafor: error when setting 'col' and 'at' for a forest plot

2013-01-05 Thread Brian Z Ring
I am using metafor to create forest plots. This code gives me the expected plot (setting x axis tick marks): forest(forest$OR, ci.lb=forest$Low, ci.ub=forest$High, at=log(c(.05, .25, 1, 10)), slab=forest$SNP, atransf=exp) As does this (setting colors): forest(forest$OR, ci.lb=forest$Low, ci.ub=

[R] building a regression model

2013-01-05 Thread dada
Hi I am trying to build a regression model. My data looks like this: A B C D E 1 1 1 2.575 2 0 0 1.643 0 5 1 4.8 1 1 3 0 3.56168 1 1 1 2.131 0