Re: [R] Robust ANCOVA
> On Mar 27, 2016, at 9:52 AM, HAMID REZA ASHRAFI via R-help >wrote: > > HiI have a set of data with two independent variables, a pretest (covariate) > and posttest (dependent variable).Can anyone help me run robust ANCOVA?If you > wish I can send you the data file.yours > [[alternative HTML version deleted]] https://cran.r-project.org/web/views/Robust.html help(pac=MASS, rlm) # A starting point perhaps: MASS::rlm( Post ~ pre +IV1 + IV2, data=yourdataframe) -- David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] How to form groups for this specific problem?
Hello All: I would like to get some help with the following problem and understand how this can be done in R efficiently. The header is given in the data frame. *Component, TLA* C1, TLA1 C2, TLA1 C1, TLA2 C3, TLA2 C4, TLA3 C5, TLA3 Notice that C1 is a component of TLA1 and TLA2. I would like to form groups of mutually exclusive subsets and create a new column called group for this subset. For the above data, the subsets and the new group column value will be like so: *Component, TLA, Group* C1, TLA1, 1 C2, TLA1, 1 C1, TLA2, 1 C3, TLA2, 1 C4, TLA3, 2 C5, TLA3, 2 Appreciate any help on this. I could have looped through the observations and tried some logic but I did not try that yet. -- Satish Vadlamani [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help with function calls
... and here is a maybe slightly neater approach using ?mapply (again with the method column changed to character(): f <- function(meth,i,fr) do.call(meth,list((fr[i,]))) mapply(FUN=f,meth=input.df[,4],seq_len(nrow(input.df)), MoreArgs = list(fr = input.df[,1:3]) ) Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Sun, Mar 27, 2016 at 11:44 AM, Bert Gunterwrote: > OOPS! I forgot to tell you that I first changed the "method" column, > which is a factor, to character, with > > input.df$method <- as.character(input.df$method) > > Then things will work properly. > > -- Bert > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Sun, Mar 27, 2016 at 11:35 AM, Bert Gunter wrote: >> 1. return() is not needed in R functions (it's harmless, however). You >> might wish to go through an R function tutorial (many good ones are on >> the web) to learn about what slick things you can do with functions in >> R. >> >> 2. The following is just a brute force loop, so more elegant >> approaches are likely possible, but this seems to do what you want: >> >> sapply(seq_len(nrow(input.df)), >>function(i)do.call(input.df[i,4],list(x=unlist(input.df[i,1:3]))) >> ) >> >> ## see ?do.call >> >> 3. I suspect that a change in your data structure might facilitate >> your task, but of course, not knowing the task, I would not know what >> changes would be useful. See ?switch for something that might be >> related to what you are trying to do. >> >> Cheers, >> Bert >> >> >> >> >> >> Bert Gunter >> >> "The trouble with having an open mind is that people keep coming along >> and sticking things into it." >> -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) >> >> >> On Sun, Mar 27, 2016 at 8:46 AM, Naresh Gurbuxani >> wrote: >>> I have a data frame with with several columns of parameters and one column >>> of function name which should be used with these parameters. My goal is to >>> call the appropriate function for each row and summarize the results in a >>> list or data frame. I can partition the data frame according to function >>> name, then call each function at a time. Is there a more elegant way to >>> achieve this result with one call only? >>> >>> Below is an example. Here the functions are simple. It is possible to >>> write a function that incorporates both the functions. It is not so easy >>> in my actual task. My goal is to make one call and obtain res.df. >>> >>> Thanks, >>> Naresh >>> >>> >>> >>> sum.sq <- function(x) {return(sum(x^2))} >>> >>> sum.cube <- function(x) {return(sum(x^3))} >>> >>> input.df <- data.frame(x1 = c(1,2,3,4), x2 = c(2,3,4,5), x3 = c(3,4,5,6), >>> method = c(rep("sum.sq", 2), rep("sum.cube", 2)), case = c("a", "b", "c", >>> "d")) >>> >>> library(plyr) >>> >>> res.df1 <- ddply(subset(input.df, method == "sum.sq"), c("case"), >>> function(df) { >>> x.vec <- c(df$x1, df$x2, df$x3) >>> return(data.frame(sum.power = sum.sq(x.vec))) >>> }) >>> >>> res.df2 <- ddply(subset(input.df, method == "sum.cube"), c("case"), >>> function(df) { >>> x.vec <- c(df$x1, df$x2, df$x3) >>> return(data.frame(sum.power = sum.cube(x.vec))) >>> }) >>> >>> res.df <- rbind(res.df1, res.df2) >>> res.df <- merge(res.df, input.df[,c("method", "case")], by = "case") >>> >>> >>> >>> >>> __ >>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >>> https://stat.ethz.ch/mailman/listinfo/r-help >>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >>> and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Robust ANCOVA
Hi Hamid, This looks a bit like a repeated measures analysis, but for a simple introduction to ANCOVA using R see the latter part of the following: http://www.stat.columbia.edu/~martin/W2024/R8.pdf Jim On Mon, Mar 28, 2016 at 3:52 AM, HAMID REZA ASHRAFI via R-helpwrote: > HiI have a set of data with two independent variables, a pretest (covariate) > and posttest (dependent variable).Can anyone help me run robust ANCOVA?If you > wish I can send you the data file.yours > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] 'split-lapply' vs. 'aggregate'
Dear Massimo, The difference is in the handling of NAs. Try, e.g., airquality <- na.omit(airquality) and compare again. Best, John - John Fox, Professor McMaster University Hamilton, Ontario Canada L8S 4M4 web: socserv.mcmaster.ca/jfox From: R-help [r-help-boun...@r-project.org] on behalf of Massimo Bressan [massimo.bres...@arpa.veneto.it] Sent: March 27, 2016 5:45 PM To: r-help@r-project.org Subject: [R] 'split-lapply' vs. 'aggregate' this might be a trivial question (eventually sorry for that!) but I definitely can not catch the problem here... please consider the following reproducible example: why of different results through 'split-lapply' vs. 'aggregate'? I've been also through a check against different methods (e.g. data.table, dplyr) and the results were always consistent with 'split-lapply' but apparently not with 'aggregate' I must be certainly wrong! could someone point me in the right direction? thanks ## s <- split(airquality, airquality$Month) ls <- lapply(s, function(x) {colMeans(x[c("Ozone", "Solar.R", "Wind")], na.rm = TRUE)}) do.call(rbind, ls) # slightly different results with aggregate(.~ Month, airquality[-c(4,6)], mean, na.rm=TRUE) ## [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] 'split-lapply' vs. 'aggregate'
this might be a trivial question (eventually sorry for that!) but I definitely can not catch the problem here... please consider the following reproducible example: why of different results through 'split-lapply' vs. 'aggregate'? I've been also through a check against different methods (e.g. data.table, dplyr) and the results were always consistent with 'split-lapply' but apparently not with 'aggregate' I must be certainly wrong! could someone point me in the right direction? thanks ## s <- split(airquality, airquality$Month) ls <- lapply(s, function(x) {colMeans(x[c("Ozone", "Solar.R", "Wind")], na.rm = TRUE)}) do.call(rbind, ls) # slightly different results with aggregate(.~ Month, airquality[-c(4,6)], mean, na.rm=TRUE) ## [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help with function calls
OOPS! I forgot to tell you that I first changed the "method" column, which is a factor, to character, with input.df$method <- as.character(input.df$method) Then things will work properly. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Sun, Mar 27, 2016 at 11:35 AM, Bert Gunterwrote: > 1. return() is not needed in R functions (it's harmless, however). You > might wish to go through an R function tutorial (many good ones are on > the web) to learn about what slick things you can do with functions in > R. > > 2. The following is just a brute force loop, so more elegant > approaches are likely possible, but this seems to do what you want: > > sapply(seq_len(nrow(input.df)), >function(i)do.call(input.df[i,4],list(x=unlist(input.df[i,1:3]))) > ) > > ## see ?do.call > > 3. I suspect that a change in your data structure might facilitate > your task, but of course, not knowing the task, I would not know what > changes would be useful. See ?switch for something that might be > related to what you are trying to do. > > Cheers, > Bert > > > > > > Bert Gunter > > "The trouble with having an open mind is that people keep coming along > and sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Sun, Mar 27, 2016 at 8:46 AM, Naresh Gurbuxani > wrote: >> I have a data frame with with several columns of parameters and one column >> of function name which should be used with these parameters. My goal is to >> call the appropriate function for each row and summarize the results in a >> list or data frame. I can partition the data frame according to function >> name, then call each function at a time. Is there a more elegant way to >> achieve this result with one call only? >> >> Below is an example. Here the functions are simple. It is possible to >> write a function that incorporates both the functions. It is not so easy >> in my actual task. My goal is to make one call and obtain res.df. >> >> Thanks, >> Naresh >> >> >> >> sum.sq <- function(x) {return(sum(x^2))} >> >> sum.cube <- function(x) {return(sum(x^3))} >> >> input.df <- data.frame(x1 = c(1,2,3,4), x2 = c(2,3,4,5), x3 = c(3,4,5,6), >> method = c(rep("sum.sq", 2), rep("sum.cube", 2)), case = c("a", "b", "c", >> "d")) >> >> library(plyr) >> >> res.df1 <- ddply(subset(input.df, method == "sum.sq"), c("case"), >> function(df) { >> x.vec <- c(df$x1, df$x2, df$x3) >> return(data.frame(sum.power = sum.sq(x.vec))) >> }) >> >> res.df2 <- ddply(subset(input.df, method == "sum.cube"), c("case"), >> function(df) { >> x.vec <- c(df$x1, df$x2, df$x3) >> return(data.frame(sum.power = sum.cube(x.vec))) >> }) >> >> res.df <- rbind(res.df1, res.df2) >> res.df <- merge(res.df, input.df[,c("method", "case")], by = "case") >> >> >> >> >> __ >> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >> https://stat.ethz.ch/mailman/listinfo/r-help >> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html >> and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help with function calls
1. return() is not needed in R functions (it's harmless, however). You might wish to go through an R function tutorial (many good ones are on the web) to learn about what slick things you can do with functions in R. 2. The following is just a brute force loop, so more elegant approaches are likely possible, but this seems to do what you want: sapply(seq_len(nrow(input.df)), function(i)do.call(input.df[i,4],list(x=unlist(input.df[i,1:3]))) ) ## see ?do.call 3. I suspect that a change in your data structure might facilitate your task, but of course, not knowing the task, I would not know what changes would be useful. See ?switch for something that might be related to what you are trying to do. Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Sun, Mar 27, 2016 at 8:46 AM, Naresh Gurbuxaniwrote: > I have a data frame with with several columns of parameters and one column of > function name which should be used with these parameters. My goal is to call > the appropriate function for each row and summarize the results in a list or > data frame. I can partition the data frame according to function name, then > call each function at a time. Is there a more elegant way to achieve this > result with one call only? > > Below is an example. Here the functions are simple. It is possible to write > a function that incorporates both the functions. It is not so easy in my > actual task. My goal is to make one call and obtain res.df. > > Thanks, > Naresh > > > > sum.sq <- function(x) {return(sum(x^2))} > > sum.cube <- function(x) {return(sum(x^3))} > > input.df <- data.frame(x1 = c(1,2,3,4), x2 = c(2,3,4,5), x3 = c(3,4,5,6), > method = c(rep("sum.sq", 2), rep("sum.cube", 2)), case = c("a", "b", "c", > "d")) > > library(plyr) > > res.df1 <- ddply(subset(input.df, method == "sum.sq"), c("case"), > function(df) { > x.vec <- c(df$x1, df$x2, df$x3) > return(data.frame(sum.power = sum.sq(x.vec))) > }) > > res.df2 <- ddply(subset(input.df, method == "sum.cube"), c("case"), > function(df) { > x.vec <- c(df$x1, df$x2, df$x3) > return(data.frame(sum.power = sum.cube(x.vec))) > }) > > res.df <- rbind(res.df1, res.df2) > res.df <- merge(res.df, input.df[,c("method", "case")], by = "case") > > > > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] loading
Err, you already loaded it, there is not necessarily another message. Just try the functions you want to use. .. Best, Uwe Ligges On 27.03.2016 19:10, farzana akbari wrote: hi I install plm and pglm packages but I can not load no one of them. the massage of loading plm is library(plm) Loading required package: Formula and for pglm is library(pglm) Loading required package: maxLik Loading required package: miscTools Please cite the 'maxLik' package as: Henningsen, Arne and Toomet, Ott (2011). maxLik: A package for maximum likelihood estimation in R. Computational Statistics 26(3), 443-458. DOI 10.1007/s00180-010-0217-1. If you have questions, suggestions, or comments regarding the 'maxLik' package, please use a forum or 'tracker' at maxLik's R-Forge site: https://r-forge.r-project.org/projects/maxlik/ can you help me? and also when i wanna Formula package there is no massage . for installing Formula massage is --- Please select a CRAN mirror for use in this session --- Warning: package ‘Formula’ is in use and will not be installed i used 3.1.3 and 3.2.4 ver *64 and 32 and my computer is 64 bit please help me [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] loading
hi I install plm and pglm packages but I can not load no one of them. the massage of loading plm is > library(plm) Loading required package: Formula and for pglm is > library(pglm) Loading required package: maxLik Loading required package: miscTools Please cite the 'maxLik' package as: Henningsen, Arne and Toomet, Ott (2011). maxLik: A package for maximum likelihood estimation in R. Computational Statistics 26(3), 443-458. DOI 10.1007/s00180-010-0217-1. If you have questions, suggestions, or comments regarding the 'maxLik' package, please use a forum or 'tracker' at maxLik's R-Forge site: https://r-forge.r-project.org/projects/maxlik/ can you help me? and also when i wanna Formula package there is no massage . for installing Formula massage is --- Please select a CRAN mirror for use in this session --- Warning: package ‘Formula’ is in use and will not be installed i used 3.1.3 and 3.2.4 ver *64 and 32 and my computer is 64 bit please help me [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Robust ANCOVA
HiI have a set of data with two independent variables, a pretest (covariate) and posttest (dependent variable).Can anyone help me run robust ANCOVA?If you wish I can send you the data file.yours [[alternative HTML version deleted]] __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Open source project that needs performance optimizations
I am not up on the internals of R but there does seem some run for parallelism. Are we talking about special hardware? or running this on an Intel Box? If it is the second, then I am thinking threads would be the way to go. Please consider the following R statements: for( i in 1:30 )a[i] = f1(i) Would it make sense to setup a separate thread for each call to f1? I think it in most cases, the answer is no but on some machines and depending on the running time of f1, it could be a big win. Also, does the user have to change his code, or would R be smart enough to do the work behind the scenes. I consider the second to be significantly better than the first. You may also want to look at the following URL http://stackoverflow.com/questions/1395309/how-to-make-r-use-all-processors Bob On 3/27/2016 11:52 AM, PSATHAS NILOS-HRISTOS wrote: Hello, i am an undergraduate student on computer engineering and im considering to do my thesis to an open source project and make performance optimizations and/or add parallelism to it where possible (or even better make use of GPU). Do you think that R-project is a good candidate? Thanks, Psathas Neilos __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Issue with var command in stats package
> On Mar 27, 2016, at 9:14 AM, John, Larrywrote: > > Am using R version 3.2.4 in a fully updated version of Windows 7 and the most > current versions of coorplot, FactoMineR and factoextra to support multiple > correspondence analysis. However, today, a line of code that worked just fine > on one set of data produced an error message on a different set of data. > > Specifically, when I ran: > > corrplot(var$contrib, is.corr = FALSE) > > I received the following message: > >> corrplot(var$contrib, is.corr = FALSE) > Error in var$contrib : object of type 'closure' is not subsettable Since there is apparently not an object in your workspace named `var`, the interpreter is instead finding the function named `var` (which delivers the variance of a vector) and then is trying to apply the `$`-function to it but there is no `$`-method for functions. > > Can you please tell me what this error message means and roughly what I might > need to do to correct it? If necessary, I can provide the original data files. I doubt that the error is in your data. You need to find the section of code that was supposed to be creating an object named `var` and hopefully you now understand why that naming convention was a bad idea. Rewrite that section of code to use objects having more meaningful names, which will result in errors that are more helpful to you in the future. -- David Winsemius Alameda, CA, USA __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Issue with var command in stats package
Somewhere you'd named an R object var, which is also the name of the function. There's no way to access part of a function with $ so var$contrib is throwing the closure error, which is telling you that you can't index a function. Sarah On Sun, Mar 27, 2016 at 12:14 PM, John, Larrywrote: > Am using R version 3.2.4 in a fully updated version of Windows 7 and the most > current versions of coorplot, FactoMineR and factoextra to support multiple > correspondence analysis. However, today, a line of code that worked just fine > on one set of data produced an error message on a different set of data. > > Specifically, when I ran: > > corrplot(var$contrib, is.corr = FALSE) > > I received the following message: > >> corrplot(var$contrib, is.corr = FALSE) > Error in var$contrib : object of type 'closure' is not subsettable > > Can you please tell me what this error message means and roughly what I might > need to do to correct it? If necessary, I can provide the original data files. > > Many thanks for your kind help. > > Very Respectfully, > > Larry John > Principal Analyst > ANSER __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Issue with var command in stats package
Am using R version 3.2.4 in a fully updated version of Windows 7 and the most current versions of coorplot, FactoMineR and factoextra to support multiple correspondence analysis. However, today, a line of code that worked just fine on one set of data produced an error message on a different set of data. Specifically, when I ran: corrplot(var$contrib, is.corr = FALSE) I received the following message: > corrplot(var$contrib, is.corr = FALSE) Error in var$contrib : object of type 'closure' is not subsettable Can you please tell me what this error message means and roughly what I might need to do to correct it? If necessary, I can provide the original data files. Many thanks for your kind help. Very Respectfully, Larry John Principal Analyst ANSER __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Open source project that needs performance optimizations
Hello, i am an undergraduate student on computer engineering and im considering to do my thesis to an open source project and make performance optimizations and/or add parallelism to it where possible (or even better make use of GPU). Do you think that R-project is a good candidate? Thanks, Psathas Neilos __ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.