Re: [R] ANCOVA, Ops.factor, singular fit???
[EMAIL PROTECTED] writes: I'm trying to perform ANCOVAs in R 1.14, on a Mac OS X, but I can't figure out ?! There's no version 1.14 of R. what I am doing wrong. Essentially, I'm testing whether a number of quantitative dental measurements (the response variables in each ANCOVA) show sexual dimorphism (the sexes are the groups) independently of the animal's size (the concomitant variable). I have attached a 13-column matrix as a data frame (so far, so good). But then I tried to do this: model-lm(ln2~sex*ln1) or this: model-lm(ln2~sex+ln1) and got this: Warning message: - not meaningful for factors in: Ops.factor(y, z$residuals) which I don't understand. (In my matrix, ln2 is the name of the second column, a response variable, and ln1 is the name of the first column, a concomitant variable. Sex is the rightmost column, indicating sex. The first 14 rows are measurements for male individuals, and the next 13 rows are measurements for female individuals.) The data output is bizarre, too--it's just so long, and everything begins with ln 11 or ln 12. How can I fix this? My best guess is that you have a data error so that ln1 and ln2 are not read as numeric variables. Nonstandard codes for missing will do that to you, for instance. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Function as.Date leading to error implying that strptime requires 3 arguments
Your system (unstated) is corrupted. R runs its examples as part of it test suite, so this is not an error in R 2.2.1 (which is not current: see the posting guide which asked you to update *before* posting). One possibility is that you have strptime from a much earlier version of R in use somehow. I suggest you remove all versions of R from your system and reinstall one latest version (2.3.1 beta). On Fri, 19 May 2006, Rob Balshaw wrote: I'm using R V 2.2.1. When I try an example from the as.Date help page, I get an error. x - c(1jan1960, 2jan1960, 31mar1960, 30jul1960) z - as.Date(x, %d%b%Y) Error in strptime(x, format) : 2 arguments passed to 'strptime' which requires 3 Any suggestions would be appreciated. Thanks, Rob __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] intervals from cut() as numerics?
Hi, Given some example data: dat - seq(4, 7, by = 0.05) x - sample(dat, 30) y - sample(dat, 30) error - x - y I have broken the rage of x into 10 groups and I can calculate the bias (mean(error)) for each of these 10 groups: groups - cut(x, breaks = 10) max.bias - aggregate(error, list(group = groups), mean) max.bias group x 1(4,4.3] -0.775 2 (4.3,4.6] -0.975 3 (4.6,4.9] -0.675 4 (4.9,5.2] -0.9125000 5 (5.2,5.5] 1.050 6 (5.5,5.8] 0.317 7 (5.8,6.1] 0.1375000 8 (6.1,6.4] 1.183 9 (6.4,6.7] 0.250 10 (6.7,7] 1.700 Which is fine. Now I am producing a plot of the residuals vs observed and I want to draw line segments from e.g. (4,4.3] at height = -0.775, but for all 10 groups, like so: plot(x, error, type = n) abline(h = 0, col = grey) panel.smooth(x, error) arrows(4, -0.775, 4.3, -0.775, length = 0.05, angle = 90, code = 3) The problem is getting the range/interval for each group from (4,4.3], so I can automate this. Anyone think of a way to do this - happy to change the way the groups are generated if cut() is not the right tool for the job here. Many thanks, Gav -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% *Note new Address and Fax and Telephone numbers from 10th April 2006* %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC [f] +44 (0)20 7679 0565 UCL Department of Geography Pearson Building [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street London, UK[w] http://www.ucl.ac.uk/~ucfagls/cv/ WC1E 6BT [w] http://www.ucl.ac.uk/~ucfagls/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] intervals from cut() as numerics?
G'day Gavin, GS == Gavin Simpson [EMAIL PROTECTED] writes: GS The problem is getting the range/interval for each group from GS (4,4.3], so I can automate this. Most likely there is an easier way, but this seems to work: ## get the levels of groups: tmp - levels(groups) ## remove the opening ( and closing ] from the string: tmp1 - sapply(tmp, function(x) substr(x, 2, nchar(x)-1)) ## split into two character strings: tmp2 - strsplit(tmp1, ,) ## turn into results into two numbers: tmp3 - lapply(tmp2, as.numeric) ## Of course, we can do everything in one go: lapply(strsplit(sapply(levels(groups), function(x) substr(x, 2, nchar(x)-1)), ,), as.numeric) $(4.05,4.32] [1] 4.05 4.32 $(4.32,4.6] [1] 4.32 4.60 $(4.6,4.87] [1] 4.60 4.87 $(4.87,5.15] [1] 4.87 5.15 $(5.15,5.43] [1] 5.15 5.43 $(5.43,5.7] [1] 5.43 5.70 $(5.7,5.98] [1] 5.70 5.98 $(5.98,6.25] [1] 5.98 6.25 $(6.25,6.53] [1] 6.25 6.53 $(6.53,6.8] [1] 6.53 6.80 Cheers, Berwin == Full address Berwin A Turlach Tel.: +61 (8) 6488 3338 (secr) School of Mathematics and Statistics+61 (8) 6488 3383 (self) The University of Western Australia FAX : +61 (8) 6488 1028 35 Stirling Highway Crawley WA 6009e-mail: [EMAIL PROTECTED] Australiahttp://www.maths.uwa.edu.au/~berwin __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Can lmer() fit a multilevel model embedded in a regression?
I would like to fit a hierarchical regression model from Witte et al. (1994; see reference below). It's a logistic regression of a health outcome on quntities of food intake; the linear predictor has the form, X*beta + W*gamma, where X is a matrix of consumption of 82 foods (i.e., the rows of X represent people in the study, the columns represent different foods, and X_ij is the amount of food j eaten by person i); and W is a matrix of some other predictors (sex, age, ...). The second stage of the model is a regression of X on some food-level predictors. Is it possible to fit this model in (the current version of) lmer()? The challenge is that the persons are _not_ nested within food items, so it is not a simple multilevel structure. We're planning to write a Gibbs sampler and fit the model directly, but it would be convenient to be able to flt in lmer() as well to check. Andrew --- Reference: Witte, J. S., Greenland, S., Hale, R. W., and Bird, C. L. (1994). Hierarchical regression analysis applied to a study of multiple dietary exposures and breast cancer. Epidemiology 5, 612-621. -- Andrew Gelman Professor, Department of Statistics Professor, Department of Political Science [EMAIL PROTECTED] www.stat.columbia.edu/~gelman Statistics department office: Social Work Bldg (Amsterdam Ave at 122 St), Room 1016 212-851-2142 Political Science department office: International Affairs Bldg (Amsterdam Ave at 118 St), Room 731 212-854-7075 Mailing address: 1255 Amsterdam Ave, Room 1016 Columbia University New York, NY 10027-5904 212-851-2142 (fax) 212-851-2164 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Can lmer() fit a multilevel model embedded in a regression?
I don't answser your question directly.I juset point out that Rnews 2005-1 has an article about lmer :Fitting linear mixed models in R Using the lme4 package by the author of the package Matrix.The article says lmer handles nested and non-nested grouping factors equally easily. Hope This helps. 2006/5/20, Andrew Gelman [EMAIL PROTECTED]: I would like to fit a hierarchical regression model from Witte et al. (1994; see reference below). It's a logistic regression of a health outcome on quntities of food intake; the linear predictor has the form, X*beta + W*gamma, where X is a matrix of consumption of 82 foods (i.e., the rows of X represent people in the study, the columns represent different foods, and X_ij is the amount of food j eaten by person i); and W is a matrix of some other predictors (sex, age, ...). The second stage of the model is a regression of X on some food-level predictors. Is it possible to fit this model in (the current version of) lmer()? The challenge is that the persons are _not_ nested within food items, so it is not a simple multilevel structure. We're planning to write a Gibbs sampler and fit the model directly, but it would be convenient to be able to flt in lmer() as well to check. Andrew --- Reference: Witte, J. S., Greenland, S., Hale, R. W., and Bird, C. L. (1994). Hierarchical regression analysis applied to a study of multiple dietary exposures and breast cancer. Epidemiology 5, 612-621. -- Andrew Gelman Professor, Department of Statistics Professor, Department of Political Science [EMAIL PROTECTED] www.stat.columbia.edu/~gelman Statistics department office: Social Work Bldg (Amsterdam Ave at 122 St), Room 1016 212-851-2142 Political Science department office: International Affairs Bldg (Amsterdam Ave at 118 St), Room 731 212-854-7075 Mailing address: 1255 Amsterdam Ave, Room 1016 Columbia University New York, NY 10027-5904 212-851-2142 (fax) 212-851-2164 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- 黄荣贵 Deparment of Sociology Fudan University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] my first R program
Is this what you're after? pos [1] 120 134 156 169 203 dat2 Col1 Col2 p.val 112 0.45 212 0.56 323 0.56 423 0.68 523 0.88 634 0.76 735 0.79 835 0.92 plot(pos, rep(0, 5), type = n, ylim = c(0, 1)) with(dat2, segments(pos[Col1], p.val, pos[Col2], p.val)) abline(h = 0.5, lty = dotted) ?segments Peter Ehlers [EMAIL PROTECTED] wrote: Hello, This is my first attempt at using R. Still trying to figure out and understand how to work with data frames. I am trying to plot the following data(example). Some experimental data i am trying to plot here. 1) i have 2 files 2) First File: Number Position 1 120 2 134 3 156 4 169 5 203 3) Second File: Col1Col2p-val 1 2 0.45 1 2 0.56 2 3 0.56 2 3 0.68 2 3 0.88 3 4 0.76 3 5 0.79 3 5 0.92 I am trying to plot this with position as x-axis and p-val as the y-axis. The col1 and col2 in the second file correspond to the number column in first file. I am having trouble to figure out how to associate the col1 and col2 with their corresponding position values The x-axis should start with 120 as that is the min value and next values should be spaced proportionally away from the first. I tried using the percentage method to place them...but couldnt completely get it correct. so it would look like : | ||| | 120 134 156 169203 Hopefully i explained it correctly. i would like to plot the p-value as horizontal lines drawn between the col1 and col2 values (ie: positions) So, the plot will have as many horizontal lines as the rows in the second file. And ONE reference horizontal line passing thru the plot at p-val=0.5, to see what values lie below that and what above it. I have made some progress in plotting the horizontal axis, but having trouble bringing all the data together.Not sure yet how to manipulate them using the data frames:( Any suggestions and tips will be greatly appreciated. Thank you -Kiran __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How can you buy R?
I'd like to know what people think is the meaning of section 2.b of the GPL (http://www.gnu.org/copyleft/gpl.html#SEC1): You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. After section 2.c, the GPL continues, If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. I'm not an attorney, but it would seem to me any code written in R is arguably derived from R. Even if R code were not derived from R, I don't see how it could reasonably be considered independent of R. If my interpretation is correct, then any claim by an R package developer to a license more restrictive than GPL would not be enforceable; such claim would seem to violate the spirit, intent, and letter of the GPL. A boundary case is provided by the glmmADMB package. As I read the GPL, this package must operate under GPL. This means that if anyone wants their source code, the authors of that package are required to give it to them. I just noticed that the version of glmmADMB that I downloaded 3/14/2006 does NOT contain a src subdirectory. This surprises me, given the comment on http://cran.fhcrc.org/banner.shtml; that we generally do not accept submissions of precompiled binaries. That is, however, not required by the GPL, as I understand it. Rather, it seems to say that Otter Research (http://www.otter-rsch.com/), who distribute more general AD Model Builder software, could be required to make freely available source code for all the binaries they use. This should be fairly easy for them, because their AD Model Builder produces C++ code, which they could easily include in a src subdirectory of their package. The GPL would NOT require them to distribute source code for the AD Model Builder itself, since that has an independent existence. If anyone has any evidence contradicting the above, I'd like to know. Best Wishes, Spencer Graves Marc Schwartz (via MN) wrote: On Fri, 2006-05-19 at 17:59 -0300, Rogerio Porto wrote: While reading the various answers, I've remembered that the juridic part can't be that so simple. If I'm not fogeting something, there are some packages in R that has a more restrictive licence than GPL. HTH, Rogerio. Any CRAN packages (or other R packages not on CRAN) that have non-commercial use restrictions, likely would not be able to be used by the OP anyway, even prior to this new policy. So I suspect that this would be a non-issue. If Damien's employer is willing to accept the GPL license (probably the most significant issue) and feels the need to pay for something, they could make an appropriate donation to the R Foundation. Perhaps even secure a little PR benefit for having done so. Is Damien's employer allowing the use of Firefox instead of IE? If so, the precedent within the confines of the policy has been set already. Firefox is GPL, free and no CD. There is an awful lot of commercial software out there than can be purchased online, properly licensed and downloaded, without the need for a physical CD. Anti-virus software perhaps being the most notable example. So: License: GPL CD: Don't need one Purchase:Donation to the R Foundation Being able to use R: Priceless :-) HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Can lmer() fit a multilevel model embedded in a regression?
Ronggui, Thanks for the pointer. I am aware of this Rnews article and in fact have used lmer() to fit non-nested grouping factors. The difficulty here is that the second level--foods--is not a grouping factor at all. Andrew ronggui wrote: I don't answser your question directly.I juset point out that Rnews 2005-1 has an article about lmer :Fitting linear mixed models in R Using the lme4 package by the author of the package Matrix.The article says lmer handles nested and non-nested grouping factors equally easily. Hope This helps. 2006/5/20, Andrew Gelman [EMAIL PROTECTED]: I would like to fit a hierarchical regression model from Witte et al. (1994; see reference below). It's a logistic regression of a health outcome on quntities of food intake; the linear predictor has the form, X*beta + W*gamma, where X is a matrix of consumption of 82 foods (i.e., the rows of X represent people in the study, the columns represent different foods, and X_ij is the amount of food j eaten by person i); and W is a matrix of some other predictors (sex, age, ...). The second stage of the model is a regression of X on some food-level predictors. Is it possible to fit this model in (the current version of) lmer()? The challenge is that the persons are _not_ nested within food items, so it is not a simple multilevel structure. We're planning to write a Gibbs sampler and fit the model directly, but it would be convenient to be able to flt in lmer() as well to check. Andrew -- Andrew Gelman Professor, Department of Statistics Professor, Department of Political Science [EMAIL PROTECTED] www.stat.columbia.edu/~gelman Statistics department office: Social Work Bldg (Amsterdam Ave at 122 St), Room 1016 212-851-2142 Political Science department office: International Affairs Bldg (Amsterdam Ave at 118 St), Room 731 212-854-7075 Mailing address: 1255 Amsterdam Ave, Room 1016 Columbia University New York, NY 10027-5904 212-851-2142 (fax) 212-851-2164 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How can you buy R?
On Fri, 2006-05-19 at 15:43 -0700, Spencer Graves wrote: I'd like to know what people think is the meaning of section 2.b of the GPL (http://www.gnu.org/copyleft/gpl.html#SEC1): You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. After section 2.c, the GPL continues, If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. I'm not an attorney, but it would seem to me any code written in R is arguably derived from R. Even if R code were not derived from R, I don't see how it could reasonably be considered independent of R. If my interpretation is correct, then any claim by an R package developer to a license more restrictive than GPL would not be enforceable; such claim would seem to violate the spirit, intent, and letter of the GPL. {I cleared the recipients list out as this would have required moderator intervention before getting through} IANAL [1] but AFAICS this is referring to the source for R itself, not code written in the R language. Therefore, glmmADMB would not be violating the GPL as it is not releasing the source for R (or parts thereof) under a different or more restrictive licence. The authors of glmmADMB are free to choose their own licensing terms for their software, and they appear to have licenced the linking R code under the GPL. However, they are not required to release their ADMB software under the GPL or provide the source code, because it doesn't include GPL software as an integral part. Again, IANAL and may have got this all wrong - happy to be corrected - but that is my understanding... G [1] I Am Not A Lawyer A boundary case is provided by the glmmADMB package. As I read the GPL, this package must operate under GPL. This means that if anyone wants their source code, the authors of that package are required to give it to them. I just noticed that the version of glmmADMB that I downloaded 3/14/2006 does NOT contain a src subdirectory. This surprises me, given the comment on http://cran.fhcrc.org/banner.shtml; that we generally do not accept submissions of precompiled binaries. That is, however, not required by the GPL, as I understand it. Rather, it seems to say that Otter Research (http://www.otter-rsch.com/), who distribute more general AD Model Builder software, could be required to make freely available source code for all the binaries they use. This should be fairly easy for them, because their AD Model Builder produces C++ code, which they could easily include in a src subdirectory of their package. The GPL would NOT require them to distribute source code for the AD Model Builder itself, since that has an independent existence. If anyone has any evidence contradicting the above, I'd like to know. Best Wishes, Spencer Graves Marc Schwartz (via MN) wrote: On Fri, 2006-05-19 at 17:59 -0300, Rogerio Porto wrote: While reading the various answers, I've remembered that the juridic part can't be that so simple. If I'm not fogeting something, there are some packages in R that has a more restrictive licence than GPL. HTH, Rogerio. Any CRAN packages (or other R packages not on CRAN) that have non-commercial use restrictions, likely would not be able to be used by the OP anyway, even prior to this new policy. So I suspect that this would be a non-issue. If Damien's employer is willing to accept the GPL license (probably the most significant issue) and feels the need to pay for something, they could make an appropriate donation to the R Foundation. Perhaps even secure a little PR benefit for having done so. Is Damien's employer allowing the use of Firefox instead of IE? If so, the precedent within the confines of the policy has been set already. Firefox is GPL, free and no CD. There is an awful lot of commercial software out there than can be purchased online, properly licensed and downloaded, without the need for a physical CD. Anti-virus software perhaps being the most notable example. So: License: GPL CD: Don't need one Purchase:Donation to the R Foundation Being able to use R: Priceless :-) HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch
Re: [R] How can you buy R?
It is my understanding that interpreted code is considered to be data and hence not able to be legally restricted in the same way that compiled code can be. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Gavin Simpson wrote: On Fri, 2006-05-19 at 15:43 -0700, Spencer Graves wrote: I'd like to know what people think is the meaning of section 2.b of the GPL (http://www.gnu.org/copyleft/gpl.html#SEC1): You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. After section 2.c, the GPL continues, If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. I'm not an attorney, but it would seem to me any code written in R is arguably derived from R. Even if R code were not derived from R, I don't see how it could reasonably be considered independent of R. If my interpretation is correct, then any claim by an R package developer to a license more restrictive than GPL would not be enforceable; such claim would seem to violate the spirit, intent, and letter of the GPL. {I cleared the recipients list out as this would have required moderator intervention before getting through} IANAL [1] but AFAICS this is referring to the source for R itself, not code written in the R language. Therefore, glmmADMB would not be violating the GPL as it is not releasing the source for R (or parts thereof) under a different or more restrictive licence. The authors of glmmADMB are free to choose their own licensing terms for their software, and they appear to have licenced the linking R code under the GPL. However, they are not required to release their ADMB software under the GPL or provide the source code, because it doesn't include GPL software as an integral part. Again, IANAL and may have got this all wrong - happy to be corrected - but that is my understanding... G [1] I Am Not A Lawyer A boundary case is provided by the glmmADMB package. As I read the GPL, this package must operate under GPL. This means that if anyone wants their source code, the authors of that package are required to give it to them. I just noticed that the version of glmmADMB that I downloaded 3/14/2006 does NOT contain a src subdirectory. This surprises me, given the comment on http://cran.fhcrc.org/banner.shtml; that we generally do not accept submissions of precompiled binaries. That is, however, not required by the GPL, as I understand it. Rather, it seems to say that Otter Research (http://www.otter-rsch.com/), who distribute more general AD Model Builder software, could be required to make freely available source code for all the binaries they use. This should be fairly easy for them, because their AD Model Builder produces C++ code, which they could easily include in a src subdirectory of their package. The GPL would NOT require them to distribute source code for the AD Model Builder itself, since that has an independent existence. If anyone has any evidence contradicting the above, I'd like to know. Best Wishes, Spencer Graves Marc Schwartz (via MN) wrote: On Fri, 2006-05-19 at 17:59 -0300, Rogerio Porto wrote: While reading the various answers, I've remembered that the juridic part can't be that so simple. If I'm not fogeting something, there are some packages in R that has a more restrictive licence than GPL. HTH, Rogerio. Any CRAN packages (or other R packages not on CRAN) that have non-commercial use restrictions, likely would not be able to be used by the OP anyway, even prior to this new policy. So I suspect that this would be a non-issue. If Damien's employer is willing to accept the GPL license (probably the most significant issue) and feels the need to pay for something, they could make an appropriate donation to the R Foundation. Perhaps even secure a little PR benefit for having done so. Is Damien's employer allowing the use of Firefox instead of IE? If so, the precedent within the confines of the policy has been set already. Firefox is GPL, free and no CD. There is an awful lot of commercial software out there than can be purchased online, properly licensed and downloaded, without the need for a physical CD. Anti-virus software perhaps being the most notable example. So: License: GPL CD: Don't need one Purchase:Donation to the R Foundation Being able to use R: Priceless :-) HTH, Marc Schwartz __ R-help@stat.math.ethz.ch
Re: [R] determination of number of entries in list elements
The answer is: sapply(mlist, length) to the question : Benjamin == Benjamin Otto [EMAIL PROTECTED] on Fri, 19 May 2006 12:09:43 +0200 writes: Benjamin Hi, is there some elegant way to determine the Benjamin number of components stored in each list element? Benjamin Example: Benjamin The list: - list Benjamin $Elem1 [1] A B C Benjamin $Elem1 [1] D Benjamin $Elem1 [1] E F Benjamin Then normal command length(list) would return Benjamin 3. But I would like some command return the array Benjamin of the single element lengths like Benjamin [1] 3 1 2 Benjamin so I can afterwards get my list subset with only Benjamin entries which have a certain amount of components Benjamin bigger or lower than a certain threshold. Benjamin regards Benjamin Benjamin Benjamin __ Benjamin R-help@stat.math.ethz.ch mailing list Benjamin https://stat.ethz.ch/mailman/listinfo/r-help Benjamin PLEASE do read the posting guide! Benjamin http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R-OT list needed?
AndyL == Liaw, Andy [EMAIL PROTECTED] on Fri, 19 May 2006 10:32:56 -0400 writes: From: Dirk Eddelbuettel On 19 May 2006 at 14:20, (Ted Harding) wrote: | than you, what that seems to spell out -- maybe R-Social | might be better). AndyL A ROT-SIG list? :-) Instead of 'R-Social', 'R-community' might be slightly more self explaining (People using R in sociology might think 'R-Social' to be for them). Another vessel I sometimes would have had liked, was a meta list, discussing about R-help policy {as the S-news-advisory list for those (oldtimers like me) who remember}. If we think about yet another list, I'd like to use that list also for such advisory topics. The problem with such extra lists is that many of them never gain enough momentum to become relevant - even for their target audience. We could make it an experiment: Create and announce the list to R-help; only keep the list if it has more than 200 (say) subscribers within a month. BTW: R-help now has regular 2006-05-20.13: 2069 digest 2006-05-20.13: 2386 --- total 2006-05-20.13: 4455 subscribers (as registered by mailman, i.e., in theory; some invalid e-mail addresses are not automatically unsubscribed by the software, unfortunately; OTOH, there are probably are Gmane-only or Archives-only occasional readers, and some subscribed addresses probably are aliases that which distribute to more than one person) Martin Maechler, ETH Zurich (maintainer of most(?) R mailing lists) Perfect! Those with bruises from asking silly or uninformed questions on r-help can refer to that list as ... R-AntiSocial. Just kidding. I'd be up for an off-topic list with a more discerning look at publically fudged and quoted numbers. Carl Bialik does something related in his Numbers Guy column at the on-line Wall Street Journal, but that requires a subscription. AndyL For more such statistics (and if you've got 24 AndyL minutes to spare), see AndyL http://video.google.com/videoplay?docid=-869183917758574879. AndyL Andy Dirk -- Hell, there are no rules here - we're trying to accomplish something. -- Thomas A. Edison __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html AndyL __ AndyL R-help@stat.math.ethz.ch mailing list AndyL https://stat.ethz.ch/mailman/listinfo/r-help PLEASE AndyL do read the posting guide! AndyL http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Converting character strings to numeric
The data was extracted from a PDF file. I am told by the organization responsible for the data that it is a matter of style. Well now that I know, I can get around it. Thank you. Tom Prof Brian Ripley wrote: Your minus eight is a hyphen eight, and those will print the same in a monospaced font. As to how you get a hyphen into a string, it depends how you do it but I presume this was not entered at an R console. On Fri, 19 May 2006, Mulholland, Tom wrote: I think you are correct (as expected) I don't know where in the original data the string is, but there is other data doing the same thing. + strsplit(test, )[[1]] [1] 5159 3336 3657 559 3042 55307 -816104 as.numeric(strsplit(test, )[[1]]) [1] 5159 3336 3657 559 304255 307NA 16104 Warning message: NAs introduced by coercion charToRaw(test) [1] 35 31 35 39 20 33 33 33 36 20 33 36 35 37 20 35 35 39 20 33 30 34 32 20 35 35 20 33 30 37 20 96 38 20 31 36 31 30 34 test [1] 5159 3336 3657 559 3042 55 307 -8 16104 x1 - 5159 3336 3657 559 3042 55 307 -8 16104 charToRaw(x1) [1] 35 31 35 39 20 33 33 33 36 20 33 36 35 37 20 35 35 39 20 33 30 34 32 20 35 35 20 33 30 37 20 2d 38 20 31 36 31 30 34 as.numeric(strsplit(x1, )[[1]]) [1] 5159 3336 3657 559 304255 307-8 16104 So it looks as if the 96 is throwing it out. I'll dig deeper. I guess there's a bit more pre-Processing to do. The only thing that seems slightly strange is that the small example I made up did not use the original data source, but was typed in the same way I did x1 above. However I can't reproduce the error so it may still be a case of finger trouble on my part. Tom -Original Message- From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Sent: Friday, 19 May 2006 3:03 PM To: Mulholland, Tom Cc: R-Help (E-mail) Subject: Re: [R] Converting character strings to numeric On Fri, 19 May 2006, Mulholland, Tom wrote: After replies off the list which indicate the code should work. I tried a variety of approaches. Rebooting, Using the --vanilla option and then removing the whole lot and resinstalling. It now works. I guess it's another of those windows things? No, it works under Windows. What you have not shown us is x3: x3 [1] 1159 1129 1124 -5-0.44 -1.52 My guess is that you have something invisible in x1, e.g. a nbspace not a space (although that does not fully explain the results). What does charToRaw(x1) [1] 31 31 35 39 20 31 31 32 39 20 31 31 32 34 20 2d 35 20 2d 30 2e 34 34 20 2d [26] 31 2e 35 32 give for you? Thanks to those that helped. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Mulholland, Tom Sent: Friday, 19 May 2006 11:48 AM To: R-Help (E-mail) Subject: [R] Converting character strings to numeric I assume that I have missed something fundamental and that it is there in front of me in An Introduction to R, but I need someone to point me in the right direction. x1 - 1159 1129 1124 -5 -0.44 -1.52 x2 - c(1159,1129,1124,-5,-0.44,-1.52) x3 - unlist(strsplit(x1, )) str(x2) chr [1:6] 1159 1129 1124 -5 -0.44 -1.52 str(x3) chr [1:6] 1159 1129 1124 -5 -0.44 -1.52 as.numeric(x2) [1] 1159.00 1129.00 1124.00 -5.00 -0.44 -1.52 as.numeric(x3) [1] 1159 1129 1124 NA NA NA Warning message: NAs introduced by coercion What do I have to do to get x3 to be the same as x2. Tom -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] merge problem... extra lines appear in the presence of NAs
Good morning! I've searched the docs etc... Am I doing something wrong or is this a bug? I'm doing a merge of two dataframes and getting extra rows in the resulting dataframe - the dataframes being merged might have NAs... count - 10 nacount - 3 a1 - as.data.frame(as.Date(2005-06-01)+0:(count-1)) names(a1) - mdate a1$value - runif(count) a1[floor(runif(nacount)*count),]$value - NA a2 - as.data.frame(as.Date(2005-06-01)+0:(count-1)) names(a2) - mdate a2$value2 - runif(count) #a2[floor(runif(nacount)*count),]$value2 - NA a1 mdate value 1 2005-06-09NA 2 2005-06-02 0.5287683 3 2005-06-03 0.7563833 4 2005-06-09NA 5 2005-06-05 0.1027646 6 2005-06-06 0.7775884 7 2005-06-07 0.2993592 8 2005-06-09NA 9 2005-06-09 0.7434682 10 2005-06-10 0.2096477 a2 mdatevalue2 1 2005-06-01 0.5347852 2 2005-06-02 0.9322765 3 2005-06-03 0.9106499 4 2005-06-04 0.6810564 5 2005-06-05 0.5871867 6 2005-06-06 0.8123808 7 2005-06-07 0.9675379 8 2005-06-08 0.9470369 9 2005-06-09 0.7493767 10 2005-06-10 0.8864103 atot - merge(a1,a2,all=T) However, I find the following results to be quite un-intuitive - are they correct? May I draw your attention to lines 9:12... Should lines 9:11 be there? atot mdate valuevalue2 1 2005-06-01NA 0.5347852 2 2005-06-02 0.5287683 0.9322765 3 2005-06-03 0.7563833 0.9106499 4 2005-06-04NA 0.6810564 5 2005-06-05 0.1027646 0.5871867 6 2005-06-06 0.7775884 0.8123808 7 2005-06-07 0.2993592 0.9675379 8 2005-06-08NA 0.9470369 9 2005-06-09NA 0.7493767 10 2005-06-09NA 0.7493767 11 2005-06-09NA 0.7493767 12 2005-06-09 0.7434682 0.7493767 13 2005-06-10 0.2096477 0.8864103 Note with no NAs, it works perfectly and as expected... a1 - as.data.frame(as.Date(2005-06-01)+0:(count-1)) names(a1) - mdate a1$value - runif(count) #a1[floor(runif(nacount)*count),]$value - NA atot - merge(a1,a2,all=T) atot mdate valuevalue2 1 2005-06-01 0.35002519 0.5347852 2 2005-06-02 0.76318940 0.9322765 3 2005-06-03 0.32759570 0.9106499 4 2005-06-04 0.47218729 0.6810564 5 2005-06-05 0.74435374 0.5871867 6 2005-06-06 0.81415290 0.8123808 7 2005-06-07 0.04774783 0.9675379 8 2005-06-08 0.21799101 0.9470369 9 2005-06-09 0.99472758 0.7493767 10 2005-06-10 0.41974293 0.8864103 R started in each case with --vanilla _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status Patched major 2 minor 3.0 year 2006 month 05 day11 svn rev38037 language R version.string Version 2.3.0 Patched (2006-05-11 r38037) win-xp-pro sp2 - binary installs from CRAN it works in a similar way if I say atot - merge(a1,a2,by.x=mdate,by.y=mdate,all=T) or even atot - merge(a1,a2,by=mdate,all=T) also tested on versions 2.2.1, 2.3.0 cheers, Sean O'Riordain (ps. ctrl-v paste wouldn't work on 2.4.0-dev downloaded this morning - didn't try very hard though) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] intervals from cut() as numerics?
On Sat, 2006-05-20 at 17:39 +0800, Berwin A Turlach wrote: G'day Gavin, GS == Gavin Simpson [EMAIL PROTECTED] writes: GS The problem is getting the range/interval for each group from GS (4,4.3], so I can automate this. Most likely there is an easier way, but this seems to work: ## get the levels of groups: tmp - levels(groups) ## remove the opening ( and closing ] from the string: tmp1 - sapply(tmp, function(x) substr(x, 2, nchar(x)-1)) ## split into two character strings: tmp2 - strsplit(tmp1, ,) ## turn into results into two numbers: tmp3 - lapply(tmp2, as.numeric) ## Of course, we can do everything in one go: lapply(strsplit(sapply(levels(groups), function(x) substr(x, 2, nchar(x)-1)), ,), as.numeric) Many thanks Berwin. My brain wasn't in character string processing mode, but your solution works just fine. For the archives then, here is the full script: ## example data dat - seq(4, 7, by = 0.05) x - sample(dat, 30) y - sample(dat, 30) ## residuals error - x - y ## break range of x into 10 groups groups - cut(x, breaks = 10) ##calculate bias (mean) per group max.bias - aggregate(error, list(group = groups), mean)$x ## turn cut intervals into numeric interv - lapply(strsplit(sapply(levels(groups), function(x) substr(x, 2, nchar(x)-1)), ,), as.numeric) ## reformat cut intervals as 2 col matrix for easy plotting interv - matrix(unlist(interv), ncol = 2, byrow = TRUE) ## plot the residuals vs observed plot(x, error, type = n) abline(h = 0, col = grey) panel.smooth(x, error) ## add bias indicators per group arrows(interv[,1], max.bias, interv[,2], max.bias, length = 0.05, angle = 90, code = 3) All the best, G snip / Cheers, Berwin == Full address Berwin A Turlach Tel.: +61 (8) 6488 3338 (secr) School of Mathematics and Statistics+61 (8) 6488 3383 (self) The University of Western Australia FAX : +61 (8) 6488 1028 35 Stirling Highway Crawley WA 6009e-mail: [EMAIL PROTECTED] Australiahttp://www.maths.uwa.edu.au/~berwin -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% *Note new Address and Fax and Telephone numbers from 10th April 2006* %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC [f] +44 (0)20 7679 0565 UCL Department of Geography Pearson Building [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street London, UK[w] http://www.ucl.ac.uk/~ucfagls/cv/ WC1E 6BT [w] http://www.ucl.ac.uk/~ucfagls/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] lmer, p-values and all that
here here. I had the wonderful benefit of sitting in a coffee shop in San Francisco with Doug listening to an excellent explanation. I only wish we could replicate that as an FAQ! Thanks for this, Doug. -Original Message- From: [EMAIL PROTECTED] on behalf of Marc Schwartz Sent: Fri 5/19/2006 7:54 PM To: Frank E Harrell Jr Cc: Douglas Bates; r-help Subject:Re: [R] lmer, p-values and all that On Fri, 2006-05-19 at 17:44 -0500, Frank E Harrell Jr wrote: Douglas Bates wrote: Users are often surprised and alarmed that the summary of a linear . . . . Doug, I have been needing this kind of explanation. That is very helpful. Thank you. I do a lot with penalized MLEs for ordinary regression and logistic models and know that getting sensible P-values is not straightforward even in that far simpler situation. Frank I would like to echo Frank's comments and say Thanks to Doug for taking the time to provide this post. I would also like to suggest that this issue has indeed become a FAQ and would like to recommend that an addition to the main R FAQ be made (wording TBD) but along the lines of: Why are p values not displayed when using lmer()? The response could be: Doug Bates has kindly provided an extensive response in a post to the r-help list, which can be reviewed at: https://stat.ethz.ch/pipermail/r-help/2006-May/094765.html This might save Doug, Harold and Spencer (I am probably missing some others here) keystrokes in the future... :-) Best regards, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] (Nothing to do with) merge problem... extra lines appear in the presence of NAs
I think you forgot to read over your own message before sending it: take a look at a1 which has FOUR rows with mdate == 2005-06-09. Those correspond to rows to 9:12 in the result, as you are merging on 'mdate'. You example is not reproducible, of course, since you used random values. Perhaps you intended a1[floor(runif(nacount)*count), value] - NA On Sat, 20 May 2006, Sean O'Riordain wrote: Good morning! [Or afternoon in Europe, ] I've searched the docs etc... Am I doing something wrong or is this a bug? I'm doing a merge of two dataframes and getting extra rows in the resulting dataframe - the dataframes being merged might have NAs... count - 10 nacount - 3 a1 - as.data.frame(as.Date(2005-06-01)+0:(count-1)) names(a1) - mdate a1$value - runif(count) a1[floor(runif(nacount)*count),]$value - NA a2 - as.data.frame(as.Date(2005-06-01)+0:(count-1)) names(a2) - mdate a2$value2 - runif(count) #a2[floor(runif(nacount)*count),]$value2 - NA a1 mdate value 1 2005-06-09NA 2 2005-06-02 0.5287683 3 2005-06-03 0.7563833 4 2005-06-09NA 5 2005-06-05 0.1027646 6 2005-06-06 0.7775884 7 2005-06-07 0.2993592 8 2005-06-09NA 9 2005-06-09 0.7434682 10 2005-06-10 0.2096477 a2 mdatevalue2 1 2005-06-01 0.5347852 2 2005-06-02 0.9322765 3 2005-06-03 0.9106499 4 2005-06-04 0.6810564 5 2005-06-05 0.5871867 6 2005-06-06 0.8123808 7 2005-06-07 0.9675379 8 2005-06-08 0.9470369 9 2005-06-09 0.7493767 10 2005-06-10 0.8864103 atot - merge(a1,a2,all=T) However, I find the following results to be quite un-intuitive - are they correct? May I draw your attention to lines 9:12... Should lines 9:11 be there? atot mdate valuevalue2 1 2005-06-01NA 0.5347852 2 2005-06-02 0.5287683 0.9322765 3 2005-06-03 0.7563833 0.9106499 4 2005-06-04NA 0.6810564 5 2005-06-05 0.1027646 0.5871867 6 2005-06-06 0.7775884 0.8123808 7 2005-06-07 0.2993592 0.9675379 8 2005-06-08NA 0.9470369 9 2005-06-09NA 0.7493767 10 2005-06-09NA 0.7493767 11 2005-06-09NA 0.7493767 12 2005-06-09 0.7434682 0.7493767 13 2005-06-10 0.2096477 0.8864103 Note with no NAs, it works perfectly and as expected... a1 - as.data.frame(as.Date(2005-06-01)+0:(count-1)) names(a1) - mdate a1$value - runif(count) #a1[floor(runif(nacount)*count),]$value - NA atot - merge(a1,a2,all=T) atot mdate valuevalue2 1 2005-06-01 0.35002519 0.5347852 2 2005-06-02 0.76318940 0.9322765 3 2005-06-03 0.32759570 0.9106499 4 2005-06-04 0.47218729 0.6810564 5 2005-06-05 0.74435374 0.5871867 6 2005-06-06 0.81415290 0.8123808 7 2005-06-07 0.04774783 0.9675379 8 2005-06-08 0.21799101 0.9470369 9 2005-06-09 0.99472758 0.7493767 10 2005-06-10 0.41974293 0.8864103 R started in each case with --vanilla _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status Patched major 2 minor 3.0 year 2006 month 05 day11 svn rev38037 language R version.string Version 2.3.0 Patched (2006-05-11 r38037) win-xp-pro sp2 - binary installs from CRAN it works in a similar way if I say atot - merge(a1,a2,by.x=mdate,by.y=mdate,all=T) or even atot - merge(a1,a2,by=mdate,all=T) also tested on versions 2.2.1, 2.3.0 cheers, Sean O'Riordain (ps. ctrl-v paste wouldn't work on 2.4.0-dev downloaded this morning - didn't try very hard though) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] (Nothing to do with) merge problem... extra lines appear in the presence of NAs
Apologies all! Thank you Brian Sean On 20/05/06, Prof Brian Ripley [EMAIL PROTECTED] wrote: I think you forgot to read over your own message before sending it: take a look at a1 which has FOUR rows with mdate == 2005-06-09. Those correspond to rows to 9:12 in the result, as you are merging on 'mdate'. You example is not reproducible, of course, since you used random values. Perhaps you intended a1[floor(runif(nacount)*count), value] - NA On Sat, 20 May 2006, Sean O'Riordain wrote: Good morning! [Or afternoon in Europe, ] I've searched the docs etc... Am I doing something wrong or is this a bug? I'm doing a merge of two dataframes and getting extra rows in the resulting dataframe - the dataframes being merged might have NAs... count - 10 nacount - 3 a1 - as.data.frame(as.Date(2005-06-01)+0:(count-1)) names(a1) - mdate a1$value - runif(count) a1[floor(runif(nacount)*count),]$value - NA a2 - as.data.frame(as.Date(2005-06-01)+0:(count-1)) names(a2) - mdate a2$value2 - runif(count) #a2[floor(runif(nacount)*count),]$value2 - NA a1 mdate value 1 2005-06-09NA 2 2005-06-02 0.5287683 3 2005-06-03 0.7563833 4 2005-06-09NA 5 2005-06-05 0.1027646 6 2005-06-06 0.7775884 7 2005-06-07 0.2993592 8 2005-06-09NA 9 2005-06-09 0.7434682 10 2005-06-10 0.2096477 a2 mdatevalue2 1 2005-06-01 0.5347852 2 2005-06-02 0.9322765 3 2005-06-03 0.9106499 4 2005-06-04 0.6810564 5 2005-06-05 0.5871867 6 2005-06-06 0.8123808 7 2005-06-07 0.9675379 8 2005-06-08 0.9470369 9 2005-06-09 0.7493767 10 2005-06-10 0.8864103 atot - merge(a1,a2,all=T) However, I find the following results to be quite un-intuitive - are they correct? May I draw your attention to lines 9:12... Should lines 9:11 be there? atot mdate valuevalue2 1 2005-06-01NA 0.5347852 2 2005-06-02 0.5287683 0.9322765 3 2005-06-03 0.7563833 0.9106499 4 2005-06-04NA 0.6810564 5 2005-06-05 0.1027646 0.5871867 6 2005-06-06 0.7775884 0.8123808 7 2005-06-07 0.2993592 0.9675379 8 2005-06-08NA 0.9470369 9 2005-06-09NA 0.7493767 10 2005-06-09NA 0.7493767 11 2005-06-09NA 0.7493767 12 2005-06-09 0.7434682 0.7493767 13 2005-06-10 0.2096477 0.8864103 Note with no NAs, it works perfectly and as expected... a1 - as.data.frame(as.Date(2005-06-01)+0:(count-1)) names(a1) - mdate a1$value - runif(count) #a1[floor(runif(nacount)*count),]$value - NA atot - merge(a1,a2,all=T) atot mdate valuevalue2 1 2005-06-01 0.35002519 0.5347852 2 2005-06-02 0.76318940 0.9322765 3 2005-06-03 0.32759570 0.9106499 4 2005-06-04 0.47218729 0.6810564 5 2005-06-05 0.74435374 0.5871867 6 2005-06-06 0.81415290 0.8123808 7 2005-06-07 0.04774783 0.9675379 8 2005-06-08 0.21799101 0.9470369 9 2005-06-09 0.99472758 0.7493767 10 2005-06-10 0.41974293 0.8864103 R started in each case with --vanilla _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status Patched major 2 minor 3.0 year 2006 month 05 day11 svn rev38037 language R version.string Version 2.3.0 Patched (2006-05-11 r38037) win-xp-pro sp2 - binary installs from CRAN it works in a similar way if I say atot - merge(a1,a2,by.x=mdate,by.y=mdate,all=T) or even atot - merge(a1,a2,by=mdate,all=T) also tested on versions 2.2.1, 2.3.0 cheers, Sean O'Riordain (ps. ctrl-v paste wouldn't work on 2.4.0-dev downloaded this morning - didn't try very hard though) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] problem with pdf() R 2.2.1, os 10.4.6
Marc Schwartz wrote: On Fri, 2006-05-19 at 16:36 -0700, Betty Gilbert wrote: Hi, I'm trying to write a histogram to a pdf pdf() plot-hist(c, xlim=c( 0.69, 0.84), ylim=c(0,100)) when I try to open the pdf I can't open it, there is always some error . Is there something I should add to make it run under this operation system? I had problems upgrading to 2.3 (problem downloading packages) so I'm not sure an upgrade will work out with me. I just want a publication quality histogram... thank you, betty Betty, You need to explicitly close the pdf device with: dev.off() once the plotting related code has completed. See the example in ?pdf for more information. Otherwise, the result of hist() is not flushed to the disk file and the file then properly closed. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html and maybe you are better off with plot_something dev.print(pdf) with the standard settings of pdf() you get more or less a pdf file maintaining the current aspect ratio of the plot on the screen prior to the dev.print call __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] ANCOVA, Ops.factor, singular fit???
On Sat, 2006-05-20 at 08:36 +0200, Peter Dalgaard wrote: [EMAIL PROTECTED] writes: I'm trying to perform ANCOVAs in R 1.14, on a Mac OS X, but I can't figure out ?! There's no version 1.14 of R. Looking at the Mac page on CRAN, I suspect that this is the GUI version number, rather than the R version number. This has confused me as well in prior posts. I don't use a Mac, so am unclear as to how this particular version number is obtained. Is there a Help - About type of menu on the Mac GUI where this value is displayed? Not sure if this would be considered user error, or if the GUI is unclear as to differing version numbering between R and the other components on Macs. what I am doing wrong. Essentially, I'm testing whether a number of quantitative dental measurements (the response variables in each ANCOVA) show sexual dimorphism (the sexes are the groups) independently of the animal's size (the concomitant variable). I have attached a 13-column matrix as a data frame This may be the problem. If the data source is a matrix, which can of course only contain a single data type, the inclusion of a gender column, which is presumably textual, will force all columns to text in the matrix and then to factors in the data frame: ln1 - 1:5 ln2 - 1:5 sex - c(Male, Female, Female, Male, Male) mat - cbind(ln1, sex, ln2) mat ln1 sex ln2 [1,] 1 Male 1 [2,] 2 Female 2 [3,] 3 Female 3 [4,] 4 Male 4 [5,] 5 Male 5 str(mat) chr [1:5, 1:3] 1 2 3 4 5 Male Female Female Male ... - attr(*, dimnames)=List of 2 ..$ : NULL ..$ : chr [1:3] ln1 sex ln2 Note that all columns in 'mat' are now character vectors. DF - as.data.frame(mat) DF ln1sex ln2 1 1 Male 1 2 2 Female 2 3 3 Female 3 4 4 Male 4 5 5 Male 5 str(DF) `data.frame': 5 obs. of 3 variables: $ ln1: Factor w/ 5 levels 1,2,3,4,..: 1 2 3 4 5 $ sex: Factor w/ 2 levels Female,Male: 2 1 1 2 2 $ ln2: Factor w/ 5 levels 1,2,3,4,..: 1 2 3 4 5 Note that all columns are factors, the default behavior of converting character vectors into a data frame. Now the model with interactions: model - lm(ln2 ~ sex * ln1, data = DF) Warning message: - not meaningful for factors in: Ops.factor(y, z$residuals) summary(model) Call: lm(formula = ln2 ~ sex * ln1, data = DF) Residuals: ALL 5 residuals are 0: no residual degrees of freedom! Coefficients: (5 not defined because of singularities) Estimate Std. Error t value Pr(|t|) (Intercept) 3 NA NA NA sexMale-2 NA NA NA ln12 -1 NA NA NA ln13 NA NA NA NA ln143 NA NA NA ln154 NA NA NA sexMale:ln12 NA NA NA NA sexMale:ln13 NA NA NA NA sexMale:ln14 NA NA NA NA sexMale:ln15 NA NA NA NA Residual standard error: NA on 0 degrees of freedom Multiple R-Squared:NA, Adjusted R-squared:NA F-statistic:NA on 4 and 0 DF, p-value: NA Warning message: ^ not meaningful for factors in: Ops.factor(r, 2) The long output that you refer to is presumably the multitude of terms and interactions at the various levels of the three factors. How did you read in the data initially? You need to be careful to maintain the data types, as Peter notes below. Reviewing the R Import/Export Manual may be helpful. HTH, Marc Schwartz (so far, so good). But then I tried to do this: model-lm(ln2~sex*ln1) or this: model-lm(ln2~sex+ln1) and got this: Warning message: - not meaningful for factors in: Ops.factor(y, z$residuals) which I don't understand. (In my matrix, ln2 is the name of the second column, a response variable, and ln1 is the name of the first column, a concomitant variable. Sex is the rightmost column, indicating sex. The first 14 rows are measurements for male individuals, and the next 13 rows are measurements for female individuals.) The data output is bizarre, too--it's just so long, and everything begins with ln 11 or ln 12. How can I fix this? My best guess is that you have a data error so that ln1 and ln2 are not read as numeric variables. Nonstandard codes for missing will do that to you, for instance. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How can you buy R?
On 5/19/06, Spencer Graves [EMAIL PROTECTED] wrote: I'd like to know what people think is the meaning of section 2.b of the GPL (http://www.gnu.org/copyleft/gpl.html#SEC1): You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. After section 2.c, the GPL continues, If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. I'm not an attorney, but it would seem to me any code written in R is arguably derived from R. Even if R code were not derived from R, I don't see how it could reasonably be considered independent of R. If my interpretation is correct, then any claim by an R package developer to a license more restrictive than GPL would not be enforceable; such claim would seem to violate the spirit, intent, and letter of the GPL. A boundary case is provided by the glmmADMB package. As I read the GPL, this package must operate under GPL. This means that if anyone wants their source code, the authors of that package are required to give it to them. I just noticed that the version of glmmADMB that I downloaded 3/14/2006 does NOT contain a src subdirectory. This surprises me, given the comment on http://cran.fhcrc.org/banner.shtml; that we generally do not accept submissions of precompiled binaries. That is, however, not required by the GPL, as I understand it. Rather, it seems to say that Otter Research (http://www.otter-rsch.com/), who distribute more general AD Model Builder software, could be required to make freely available source code for all the binaries they use. This should be fairly easy for them, because their AD Model Builder produces C++ code, which they could easily include in a src subdirectory of their package. The GPL would NOT require them to distribute source code for the AD Model Builder itself, since that has an independent existence. If anyone has any evidence contradicting the above, I'd like to know. This sort of question is inevitably answered in the GPL FAQ (which is intended for the non-lawyers among us, unlike the GPL): http://www.gnu.org/licenses/gpl-faq.html My personal feeling has been that very few people on the R lists understand the GPL, so I would not recommend posts here as a source of knowledge on the matter :-) Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] intervals from cut() as numerics?
as an alternative, you can have a look inside cut.default and use the part that produces the breaks, i.e., breaks - 10 groups - cut(x, breaks = breaks) max.bias - as.vector(tapply(error, groups, mean)) # from cut.default() nb - as.integer(breaks + 1) dx - diff(rx - range(x, na.rm = TRUE)) breaks - round(seq(rx[1] - dx/1000, rx[2] + dx/1000, len = nb), 2) mat - cbind(breaks[1:(nb - 1)], breaks[2:nb]) plot(x, error, type = n) abline(h = 0, col = grey) panel.smooth(x, error) arrows(mat[, 1], max.bias, mat[, 2], max.bias, length = 0.05, angle = 90, code = 3) Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm Quoting Gavin Simpson [EMAIL PROTECTED]: On Sat, 2006-05-20 at 17:39 +0800, Berwin A Turlach wrote: G'day Gavin, GS == Gavin Simpson [EMAIL PROTECTED] writes: GS The problem is getting the range/interval for each group from GS (4,4.3], so I can automate this. Most likely there is an easier way, but this seems to work: ## get the levels of groups: tmp - levels(groups) ## remove the opening ( and closing ] from the string: tmp1 - sapply(tmp, function(x) substr(x, 2, nchar(x)-1)) ## split into two character strings: tmp2 - strsplit(tmp1, ,) ## turn into results into two numbers: tmp3 - lapply(tmp2, as.numeric) ## Of course, we can do everything in one go: lapply(strsplit(sapply(levels(groups), function(x) substr(x, 2, nchar(x)-1)), ,), as.numeric) Many thanks Berwin. My brain wasn't in character string processing mode, but your solution works just fine. For the archives then, here is the full script: ## example data dat - seq(4, 7, by = 0.05) x - sample(dat, 30) y - sample(dat, 30) ## residuals error - x - y ## break range of x into 10 groups groups - cut(x, breaks = 10) ##calculate bias (mean) per group max.bias - aggregate(error, list(group = groups), mean)$x ## turn cut intervals into numeric interv - lapply(strsplit(sapply(levels(groups), function(x) substr(x, 2, nchar(x)-1)), ,), as.numeric) ## reformat cut intervals as 2 col matrix for easy plotting interv - matrix(unlist(interv), ncol = 2, byrow = TRUE) ## plot the residuals vs observed plot(x, error, type = n) abline(h = 0, col = grey) panel.smooth(x, error) ## add bias indicators per group arrows(interv[,1], max.bias, interv[,2], max.bias, length = 0.05, angle = 90, code = 3) All the best, G snip / Cheers, Berwin == Full address Berwin A Turlach Tel.: +61 (8) 6488 3338 (secr) School of Mathematics and Statistics+61 (8) 6488 3383 (self) The University of Western Australia FAX : +61 (8) 6488 1028 35 Stirling Highway Crawley WA 6009e-mail: [EMAIL PROTECTED] Australia http://www.maths.uwa.edu.au/~berwin -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% ~% *Note new Address and Fax and Telephone numbers from 10th April 2006* %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% ~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC [f] +44 (0)20 7679 0565 UCL Department of Geography Pearson Building [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street London, UK[w] http://www.ucl.ac.uk/~ucfagls/cv/ WC1E 6BT [w] http://www.ucl.ac.uk/~ucfagls/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% ~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Non-GPLed packages (was How can you buy R?)
On Sat, 20 May 2006, Patrick Burns wrote: It is my understanding that interpreted code is considered to be data and hence not able to be legally restricted in the same way that compiled code can be. Yes: see http://www.gnu.org/licenses/gpl-faq.html#IfInterpreterIsGPL for a clearcut opinion from FSF. However, most R packages contain compiled code that is linked against R's headers and is dynamically linked into R, and that is a more contentious issue. See http://www.gnu.org/licenses/gpl-faq.html and especially http://www.gnu.org/licenses/gpl-faq.html#MereAggregation http://www.gnu.org/licenses/gpl-faq.html#GPLAndPlugins See also Q2.11 in the R FAQ, which says `The R Core Team does not provide legal advice under any circumstances' (including here). The onus is on those distributing packages to ensure that they meet the requirements of R's GPL. Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Gavin Simpson wrote: On Fri, 2006-05-19 at 15:43 -0700, Spencer Graves wrote: I'd like to know what people think is the meaning of section 2.b of the GPL (http://www.gnu.org/copyleft/gpl.html#SEC1): You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. After section 2.c, the GPL continues, If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. I'm not an attorney, but it would seem to me any code written in R is arguably derived from R. Even if R code were not derived from R, I don't see how it could reasonably be considered independent of R. If my interpretation is correct, then any claim by an R package developer to a license more restrictive than GPL would not be enforceable; such claim would seem to violate the spirit, intent, and letter of the GPL. {I cleared the recipients list out as this would have required moderator intervention before getting through} IANAL [1] but AFAICS this is referring to the source for R itself, not code written in the R language. Therefore, glmmADMB would not be violating the GPL as it is not releasing the source for R (or parts thereof) under a different or more restrictive licence. The authors of glmmADMB are free to choose their own licensing terms for their software, and they appear to have licenced the linking R code under the GPL. However, they are not required to release their ADMB software under the GPL or provide the source code, because it doesn't include GPL software as an integral part. Again, IANAL and may have got this all wrong - happy to be corrected - but that is my understanding... G [1] I Am Not A Lawyer A boundary case is provided by the glmmADMB package. As I read the GPL, this package must operate under GPL. This means that if anyone wants their source code, the authors of that package are required to give it to them. I just noticed that the version of glmmADMB that I downloaded 3/14/2006 does NOT contain a src subdirectory. This surprises me, given the comment on http://cran.fhcrc.org/banner.shtml; that we generally do not accept submissions of precompiled binaries. That is, however, not required by the GPL, as I understand it. Rather, it seems to say that Otter Research (http://www.otter-rsch.com/), who distribute more general AD Model Builder software, could be required to make freely available source code for all the binaries they use. This should be fairly easy for them, because their AD Model Builder produces C++ code, which they could easily include in a src subdirectory of their package. The GPL would NOT require them to distribute source code for the AD Model Builder itself, since that has an independent existence. If anyone has any evidence contradicting the above, I'd like to know. Best Wishes, Spencer Graves Marc Schwartz (via MN) wrote: On Fri, 2006-05-19 at 17:59 -0300, Rogerio Porto wrote: While reading the various answers, I've remembered that the juridic part can't be that so simple. If I'm not fogeting something, there are some packages in R that has a more restrictive licence than GPL. HTH, Rogerio. Any CRAN packages (or other R packages not on CRAN) that have non-commercial use restrictions, likely would not be able to be used by the OP anyway, even prior to this new policy. So I suspect that this would be a non-issue. If Damien's employer is willing to accept the GPL license (probably the most significant issue) and feels the need to pay for something, they could make an appropriate donation to the R
Re: [R] intervals from cut() as numerics?
One can simplify this slightly using strapply from the gsubfn package. Given groups, this will create interv. strapply applies the indicated function, as.numeric, to each matched pattern, i.e. to each string that represents a number, producing a list of vectors. Then we rbind those vectors together: library(gsubfn) interv - do.call(rbind, strapply(levels(groups), [[:digit:].]+, as.numeric)) On 5/20/06, Gavin Simpson [EMAIL PROTECTED] wrote: On Sat, 2006-05-20 at 17:39 +0800, Berwin A Turlach wrote: G'day Gavin, GS == Gavin Simpson [EMAIL PROTECTED] writes: GS The problem is getting the range/interval for each group from GS (4,4.3], so I can automate this. Most likely there is an easier way, but this seems to work: ## get the levels of groups: tmp - levels(groups) ## remove the opening ( and closing ] from the string: tmp1 - sapply(tmp, function(x) substr(x, 2, nchar(x)-1)) ## split into two character strings: tmp2 - strsplit(tmp1, ,) ## turn into results into two numbers: tmp3 - lapply(tmp2, as.numeric) ## Of course, we can do everything in one go: lapply(strsplit(sapply(levels(groups), function(x) substr(x, 2, nchar(x)-1)), ,), as.numeric) Many thanks Berwin. My brain wasn't in character string processing mode, but your solution works just fine. For the archives then, here is the full script: ## example data dat - seq(4, 7, by = 0.05) x - sample(dat, 30) y - sample(dat, 30) ## residuals error - x - y ## break range of x into 10 groups groups - cut(x, breaks = 10) ##calculate bias (mean) per group max.bias - aggregate(error, list(group = groups), mean)$x ## turn cut intervals into numeric interv - lapply(strsplit(sapply(levels(groups), function(x) substr(x, 2, nchar(x)-1)), ,), as.numeric) ## reformat cut intervals as 2 col matrix for easy plotting interv - matrix(unlist(interv), ncol = 2, byrow = TRUE) ## plot the residuals vs observed plot(x, error, type = n) abline(h = 0, col = grey) panel.smooth(x, error) ## add bias indicators per group arrows(interv[,1], max.bias, interv[,2], max.bias, length = 0.05, angle = 90, code = 3) All the best, G snip / Cheers, Berwin == Full address Berwin A Turlach Tel.: +61 (8) 6488 3338 (secr) School of Mathematics and Statistics+61 (8) 6488 3383 (self) The University of Western Australia FAX : +61 (8) 6488 1028 35 Stirling Highway Crawley WA 6009e-mail: [EMAIL PROTECTED] Australiahttp://www.maths.uwa.edu.au/~berwin -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% *Note new Address and Fax and Telephone numbers from 10th April 2006* %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC [f] +44 (0)20 7679 0565 UCL Department of Geography Pearson Building [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street London, UK[w] http://www.ucl.ac.uk/~ucfagls/cv/ WC1E 6BT [w] http://www.ucl.ac.uk/~ucfagls/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] intervals from cut() as numerics?
Actually here is one further simplification. Here we add the simplify = TRUE to strapply producing an interv which is the transpose of the prior interv and so we modify arrows accordingly. Also suggest you use set.seed when using the random generator so that the example is exactly reproducible. # plot cut intervals as arrows over data ## example data set.seed(1) dat - seq(4, 7, by = 0.05) x - sample(dat, 30) y - sample(dat, 30) ## residuals error - x - y ## break range of x into 10 groups groups - cut(x, breaks = 10) ## calculate bias (mean) per group max.bias - tapply(error, groups, mean) ## turn cut intervals into numeric matrix library(gsubfn) interv - strapply(levels(groups), [[:digit:].]+, as.numeric, simplify = TRUE) ## plot the residuals vs observed plot(x, error, type = n) abline(h = 0, col = grey) panel.smooth(x, error) ## add bias indicators per group arrows(interv[1,], max.bias, interv[2,], max.bias, length = 0.05, angle = 90, code = 3) On 5/20/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: One can simplify this slightly using strapply from the gsubfn package. Given groups, this will create interv. strapply applies the indicated function, as.numeric, to each matched pattern, i.e. to each string that represents a number, producing a list of vectors. Then we rbind those vectors together: library(gsubfn) interv - do.call(rbind, strapply(levels(groups), [[:digit:].]+, as.numeric)) On 5/20/06, Gavin Simpson [EMAIL PROTECTED] wrote: On Sat, 2006-05-20 at 17:39 +0800, Berwin A Turlach wrote: G'day Gavin, GS == Gavin Simpson [EMAIL PROTECTED] writes: GS The problem is getting the range/interval for each group from GS (4,4.3], so I can automate this. Most likely there is an easier way, but this seems to work: ## get the levels of groups: tmp - levels(groups) ## remove the opening ( and closing ] from the string: tmp1 - sapply(tmp, function(x) substr(x, 2, nchar(x)-1)) ## split into two character strings: tmp2 - strsplit(tmp1, ,) ## turn into results into two numbers: tmp3 - lapply(tmp2, as.numeric) ## Of course, we can do everything in one go: lapply(strsplit(sapply(levels(groups), function(x) substr(x, 2, nchar(x)-1)), ,), as.numeric) Many thanks Berwin. My brain wasn't in character string processing mode, but your solution works just fine. For the archives then, here is the full script: ## example data dat - seq(4, 7, by = 0.05) x - sample(dat, 30) y - sample(dat, 30) ## residuals error - x - y ## break range of x into 10 groups groups - cut(x, breaks = 10) ##calculate bias (mean) per group max.bias - aggregate(error, list(group = groups), mean)$x ## turn cut intervals into numeric interv - lapply(strsplit(sapply(levels(groups), function(x) substr(x, 2, nchar(x)-1)), ,), as.numeric) ## reformat cut intervals as 2 col matrix for easy plotting interv - matrix(unlist(interv), ncol = 2, byrow = TRUE) ## plot the residuals vs observed plot(x, error, type = n) abline(h = 0, col = grey) panel.smooth(x, error) ## add bias indicators per group arrows(interv[,1], max.bias, interv[,2], max.bias, length = 0.05, angle = 90, code = 3) All the best, G snip / Cheers, Berwin == Full address Berwin A Turlach Tel.: +61 (8) 6488 3338 (secr) School of Mathematics and Statistics+61 (8) 6488 3383 (self) The University of Western Australia FAX : +61 (8) 6488 1028 35 Stirling Highway Crawley WA 6009e-mail: [EMAIL PROTECTED] Australiahttp://www.maths.uwa.edu.au/~berwin -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% *Note new Address and Fax and Telephone numbers from 10th April 2006* %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC [f] +44 (0)20 7679 0565 UCL Department of Geography Pearson Building [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street London, UK[w] http://www.ucl.ac.uk/~ucfagls/cv/ WC1E 6BT [w] http://www.ucl.ac.uk/~ucfagls/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How can you buy R?
G'day Spencer, SG == Spencer Graves [EMAIL PROTECTED] writes: SG I'm not an attorney, but it would seem to me any code written SG in R is arguably derived from R. IANAL either, and I long since stopped reading gnu.misc.discuss in which the interpretation of the various licences are regularly discussed. SG Even if R code were not derived from R, I don't see how it SG could reasonably be considered independent of R. R is one implementation of the S language. If the R code works without modification under S-PLUS (another implementation), then I believe you can argue that it is independent of R. On the user level, it might well be the case that most commands work in R and S-PLUS, but on the package developer lever there are enough differences that typically the same code does not work on both, R and S-PLUS, and that you have to make small adjustments depending on the package. If all R specific code is within if(is.R()) constructs (and likewise for all S-PLUS specific code), then you can probably still argue independence. It might become trickier if you handle the R/S-PLUS specific code externally via Perl/Python/??? scripts and provide files with (slightly) different code for the R package and the S-PLUS package. In this case the R code for the R package is presumably derived from R and has to be put under the GPL. A question that always interested me was whether you can used GPL'd code in S-PLUS. At some point, I got the impression that according to the GPL the user would violate the GPL if a package contained GPL code (in particular C and/or FORTRAN code) that was dynamically linked into S-PLUS by the R code. My understanding was that in that moment a product was created that would have to be wholly under the GPL, so the user was violating the GPL and lost the write to use your package. For this reason I started to use the LGPL for S-PLUS packages that I put on statlib. I noticed that when these packages were ported to R, the licence was changed to GPL, but that is o.k. and allowed by the LGPL. I guess this question will soon become more interesting again since there have been e-mails to this mailing list that S-PLUS wants to become more compatible to R so that packages developed for R can be easily used (ported?) to S-PLUS. I guess the guys in Insightful have to be very careful on how they do that... :) SG A boundary case is provided by the glmmADMB package. As I SG read the GPL, this package must operate under GPL. According to the DESCRIPTION file (at least the 0.3 version for linux) it does. SG This means that if anyone wants their source code, the authors SG of that package are required to give it to them. I agree, but isn't it all there? Or are you talking about the files in the (inst/)admb directory? The authors of that package should probably write somewhere tht the files in that directory are not under the GPL and everything would be fine. SG I just noticed that the version of glmmADMB that I SG downloaded 3/14/2006 does NOT contain a src subdirectory. SG This surprises me, given the comment on SG http://cran.fhcrc.org/banner.shtml; that we generally do not SG accept submissions of precompiled binaries. But from where die you download it? I cannot see it on CRAN. I found it on the web-site of Otter Research and, presumably, they are free to distribute packages that contain precompiled binaries. SG That is, however, not required by the GPL, as I understand it. SG Rather, it seems to say that Otter Research SG (http://www.otter-rsch.com/), who distribute more general AD SG Model Builder software, could be required to make freely SG available source code for all the binaries they use. This SG should be fairly easy for them, because their AD Model SG Builder produces C++ code, which they could easily include in SG a src subdirectory of their package. The GPL would NOT SG require them to distribute source code for the AD Model SG Builder itself, since that has an independent existence. I definitely agree to the latter. But from a quick look at the R code it seems to me that this packge does not dynamically link any code into R. Rather, it seems that the communication with the precompiled binaries are via calls to system() and communications via files written into a temporary directory. So while the C++ code could be made available in the src subdirectory, I don't see why the GPL would require them to do so. Those binaries seem to be also stand-alone and independent. You can probably reverse-engineer the R code to see how you could use them without R. SG If anyone has any evidence contradicting the above, I'd like SG to know. I guess the above indicates that I have partly a different interpretation than you have. But, as I said, I am not a lawyer. And as the German proverb goes Wo kein Klaeger ist, ist auch kein Richter---which means that you will probably only get
Re: [R] Fast update of a lot of records in a database?
Though I'd question the prudence of doing mass database changes through R: Other things equal, single updates in a loop should be slower than a correlated update due to the performance costs of bind and execute (and perhaps even parse). Also, updates are generally slower than inserts because of rollback and logging, and the potential of introducing chained blocks to hold the updates. The correlated temporary table update should be faster than the original, provided indexing is appropriate (i.e an index on bigtable.id). Any chance you could create a new bigtable as a join select of old bigtable and updates? This would be faster still. Steve Miller -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of hadley wickham Sent: Friday, May 19, 2006 2:20 PM To: Duncan Murdoch Cc: [EMAIL PROTECTED]; r-help@stat.math.ethz.ch; [EMAIL PROTECTED] Subject: Re: [R] Fast update of a lot of records in a database? put the updates into a temporary table called updates UPDATE bigtable AS a FROM updates AS b WHERE a.id = b.id SET a.col1 = b.col1 I don't think this will be any faster - why would creating a new table be faster than updating existing rows? I've never had a problem with using large numbers of SQL update statements (in the order of hundreds of thousands) to update a table and having them complete in a reasonable time (a few minutes). How heavily indexed is the field you are updating? You may be able to get some speed improvements by turning off indices before the update and back on again afterwards (highly dependent on your database system though). I would strongly suspect your bottleneck lies elsewhere (eg. when generating the statements in R, or using ODBC to send them) Hadley __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How can you buy R? [Broadcast]
My understanding is that if a licensee wants to redistribute GPL code (or work derived from GPL code), then it has to be done under GPL as well, meaning the person must make it known to users that they can have access to the source code if so desired, and they can do anything they want with that code (including selling), but GPL must remain in force for further redistribution. FSF used to sell Emacs source code on tape for around $200, and I believe Richard Stallman was able to get quite a bit of support through that channel. The idea of having R Foundation selling CDs had come up before. Unfortunately I believe the R Foundation does not have the manpower or resource to do that. I do not believe code written in a GPL language is automatically GPL'ed. To me a language (or, more specifically, a system if you will) is not unlike an OS. There are plenty of commercial software for Linux. I believe those people must feel quite confident that they are not covered (or infected?) by GPL. Just my $0.02... Andy _ From: [EMAIL PROTECTED] on behalf of Spencer Graves Sent: Fri 5/19/2006 6:43 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; r-help@stat.math.ethz.ch; Damien Joly Subject: Re: [R] How can you buy R? [Broadcast] I'd like to know what people think is the meaning of section 2.b of the GPL (http://www.gnu.org/copyleft/gpl.html#SEC1): You must cause any work that you distribute or publish, that in whole or in part contains or is derived from the Program or any part thereof, to be licensed as a whole at no charge to all third parties under the terms of this License. After section 2.c, the GPL continues, If identifiable sections of that work are not derived from the Program, and can be reasonably considered independent and separate works in themselves, then this License, and its terms, do not apply to those sections when you distribute them as separate works. I'm not an attorney, but it would seem to me any code written in R is arguably derived from R. Even if R code were not derived from R, I don't see how it could reasonably be considered independent of R. If my interpretation is correct, then any claim by an R package developer to a license more restrictive than GPL would not be enforceable; such claim would seem to violate the spirit, intent, and letter of the GPL. A boundary case is provided by the glmmADMB package. As I read the GPL, this package must operate under GPL. This means that if anyone wants their source code, the authors of that package are required to give it to them. I just noticed that the version of glmmADMB that I downloaded 3/14/2006 does NOT contain a src subdirectory. This surprises me, given the comment on http://cran.fhcrc.org/banner.shtml http://cran.fhcrc.org/banner.shtml that we generally do not accept submissions of precompiled binaries. That is, however, not required by the GPL, as I understand it. Rather, it seems to say that Otter Research (http://www.otter-rsch.com/ http://www.otter-rsch.com/ ), who distribute more general AD Model Builder software, could be required to make freely available source code for all the binaries they use. This should be fairly easy for them, because their AD Model Builder produces C++ code, which they could easily include in a src subdirectory of their package. The GPL would NOT require them to distribute source code for the AD Model Builder itself, since that has an independent existence. If anyone has any evidence contradicting the above, I'd like to know. Best Wishes, Spencer Graves Marc Schwartz (via MN) wrote: On Fri, 2006-05-19 at 17:59 -0300, Rogerio Porto wrote: While reading the various answers, I've remembered that the juridic part can't be that so simple. If I'm not fogeting something, there are some packages in R that has a more restrictive licence than GPL. HTH, Rogerio. Any CRAN packages (or other R packages not on CRAN) that have non-commercial use restrictions, likely would not be able to be used by the OP anyway, even prior to this new policy. So I suspect that this would be a non-issue. If Damien's employer is willing to accept the GPL license (probably the most significant issue) and feels the need to pay for something, they could make an appropriate donation to the R Foundation. Perhaps even secure a little PR benefit for having done so. Is Damien's employer allowing the use of Firefox instead of IE? If so, the precedent within the confines of the policy has been set already. Firefox is GPL, free and no CD. There is an awful lot of commercial software out there than can be purchased online, properly licensed and downloaded, without the need for a physical CD. Anti-virus software perhaps being the most notable example. So: License: GPL CD: Don't need one Purchase:
[R] sapply and Date objects
This is probably a dumb question, but I cannot figure it out. Why does this happen? dt - as.Date(1954-02-01) as.character(dt) [1] 1954-02-01 sapply(c(dt), as.character) [1] -5813 Thanks. FS __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] sapply and Date objects
From ?sapply we see that sapply requires a list or atomic vector. If its not a list then looking at the first few two lines of sapply we see it tries to convert the first arg to a list using as.list. Note that using your dt: as.list(dt) [[1]] [1] -5813 so try this instead: sapply(list(dt), as.character) On 5/20/06, Fernando Saldanha [EMAIL PROTECTED] wrote: This is probably a dumb question, but I cannot figure it out. Why does this happen? dt - as.Date(1954-02-01) as.character(dt) [1] 1954-02-01 sapply(c(dt), as.character) [1] -5813 Thanks. FS __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] sapply and Date objects
On Sat, 2006-05-20 at 11:01 -0400, Fernando Saldanha wrote: This is probably a dumb question, but I cannot figure it out. Why does this happen? dt - as.Date(1954-02-01) as.character(dt) [1] 1954-02-01 sapply(c(dt), as.character) [1] -5813 Thanks. FS Does this help? dt - as.Date(1954-02-01) dt [1] 1954-02-01 # Note the numeric value of dt is an offset from the default # base date in R of 1970-01-01 str(dt) Class 'Date' num -5813 dt + 5813 [1] 1970-01-01 When using sapply(), the 'X' argument is first coerced to a list which is then passed to lapply(). So: as.list(dt) [[1]] [1] -5813 str(as.list(dt)) List of 1 $ : num -5813 Note that the result of the coercion to a list loses the Date class attribute. Thus, you end up with just a numeric value, which you are then coercing to a character vector. So, in effect you are doing: unlist(lapply(as.list(dt), as.character)) [1] -5813 HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] multiple plots in a function()
Sorry for again asking the same question, but I am still not successfull, also after using grid-package, as recommended previously: I want to write a function() which generates a graphical output and can be used in a loop to produce several results with a layout like in par(mfrow=c(5,5)) for ( i in 1:10){ plot(1:10) } Here is the (experimental) code: myfunction - function(){ vp1 - viewport(x=0.1, y=.7, w=.8, h=.2, just=left, name=vp1) vp2 - viewport(x=.1, y=.5, w=.8, h=.2, just=left, name=vp2) pushViewport(vp1) grid.rect(gp=gpar(col=grey)) grid.text(vp1) grid.xaxis(main=FALSE) upViewport() pushViewport(vp2) grid.rect(gp=gpar(col=grey)) grid.text(vp2) grid.xaxis() } And the following loop: par(mfrow=c(5,5)) for (i in 1:10) { grid.newpage() # when ommitting this line, the following plots will be plotted as childrens of the afore generated parent myfunction() } In conclusion, every myfunction() result overwrites the output of the previous output and is not plotted side by side as intended. What to change? Thanks a lot, Dirk Dr.med. D. Weismann Schwerpunkt Endokrinologie/Diabetologie Medizinische Klinik und Poliklinik I Universität Würzburg Josef-Schneider-Str. 2 97080 Würzburg email: [EMAIL PROTECTED] Telefon: 0931/201-1 -Ursprüngliche Nachricht- Von: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Gesendet: Mi 17.05.2006 03:19 An: Weismann, Dirk Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Betreff: Re: [R] multiple plots in a function() Use grid graphics http://www.stat.auckland.ac.nz/~paul/grid/grid.html and the gridbase package to incorporate classic graphics in that. On 5/16/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thanks a lot, but my problem is not to get a temporary change with par()in myfunction and return to 'oldpar'after finishing. What I want is, that the output of myfunction is handled like one graphic (ie one plot) and therefore I can get the output of myfunction 10times side by side in one window (e.g. mfrow=c(5,5)). But the 'par(mfrow=c(1,2))' inside 'myfunction' makes this impossible. I used plot(..,type=n)two times to initialize the graphics in 'myfunction' and filled both with a lot of low-level graphic code. Since I always need both graphical outputs to interpret the results, I prefer to write one function instead of two for each plot. This might not be the best way to create a graphical output in a function, but how to do it better? Thanks, Dirk -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Gabor Grothendieck Gesendet: Dienstag, 16. Mai 2006 05:01 An: Weismann, Dirk Cc: r-help@stat.math.ethz.ch Betreff: Re: [R] multiple plots in a function() You could override par by optionally passing it as an argument: f - function(x = 1:10, y = 1:10, par = list(mfrow = c(2,2))) { if (!is.null(par)) { on.exit(par(opar)) opar - par(par) } plot(x) plot(y) } opar - par(mfrow=c(4,4)) for(i in 1:8) f(par = NULL) par(opar) On 5/15/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Dear all, I have the following problem: I have written a function genereating to plots, eg myfunction - (data, some.parameters) { #some calculations etc . par (mfrow=c(1,2)) plot1(..) plot2(.) } which works fine. But for analysing several variants, I tried a slope, eg: par (mfrow=c(5,5)) for ( i in 1:10) { myfunction(data, i) } Off course, the par() in myfunction overwrites the par() before the slope. So, how to write myfunction, that it plots two plots and can be used in the slope like in the example? Thanks a lot, Dirk Dr.med Dirk Weismann Schwerpunkt für Endokrinologie und Diabetologie Medizinische Universitätsklinik I 97080 Würzburg email: [EMAIL PROTECTED] Telefon: 0049-931-201-36744 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] nlme model specification
Thanks for providing such a simple, replicatable example. When I tried that and similar examples, the response matched what you report. I also tried the following slight modification of the 'nlme' call that worked for you: mod4 - +nlme(circumference ~ SSlogis(age, Asym, xmid, scal), +data = Orange, +fixed = list(Asym+xmid+scal ~ 1), +start = fixef(fm1Oran.lis)) Error in parse(file, n, text, prompt) : syntax error in ~ This error message matches what you got. I tentatively conclude that 'fixed' does NOT like an argument of class 'list'. To diagnose this further, I tried 'traceback': traceback() 6: parse(text = paste(~, paste(nVal, collapse = /))) 5: eval(parse(text = paste(~, paste(nVal, collapse = / 4: getGroupsFormula.reStruct(reSt) 3: getGroupsFormula(reSt) 2: nlme.formula(circumference ~ SSlogis(age, Asym, xmid, scal), data = Orange, fixed = list(Asym + xmid + scal ~ 1), start = fixef(fm1Oran.lis)) 1: nlme(circumference ~ SSlogis(age, Asym, xmid, scal), data = Orange, fixed = list(Asym + xmid + scal ~ 1), start = fixef(fm1Oran.lis)) I then tried to further isolate the problem using 'debug': debug(getGroupsFormula.reStruct) Error: object getGroupsFormula.reStruct not found Unfortunately, it's hidden is a namespace: methods(getGroupsFormula) [1] getGroupsFormula.default* getGroupsFormula.gls* [3] getGroupsFormula.lme* getGroupsFormula.lmList* [5] getGroupsFormula.reStruct* Non-visible functions are asterisked I could trace this further by making local copies of all the functions in the call stack, but I don't have time for that right now. 'help(package=nlme)' says the 'author' is Pinheiro, Bates, DebRoy, and Sarkar, and the 'Maintainer' is 'R-core'. I've cc-ed Bates on this reply. If you don't hear from someone else in a few days, you might consider making local copies of the functions in this call stack, then trying 'debug(getGroupsFormula.reStruct)', and generating another post based on what you learn doing that. You might see, for example, if the example that works also calls 'getGroupFormula.reStruct'. I'm sorry I couldn't provide an answer, but with luck, my reply will inspire someone else to do something that can enlighten us both. Best Wishes, Spencer Graves p.s. Before you submit another post on this, I suggest you 'update.packages'. A new version of 'nlme' is now available. It won't solve your problem, but it at least will assure someone else that you are up to date. sessionInfo() Version 2.3.0 (2006-04-24) i386-pc-mingw32 attached base packages: [1] methods stats graphics grDevices utils datasets [7] base other attached packages: nlme 3.1-72 Martin Henry H. Stevens wrote: Hi folks, I am tearing my hair out on this one. I am using an example from Pinheiro and Bates. ### this works data(Orange) mod.lis - nlsList(circumference ~ SSlogis(age, Asymp, xmid, scal), data=Orange ) ### This works mod - nlme(circumference ~ SSlogis(age, Asymp, xmid, scal), data=Orange, fixed = Asymp + xmid + scal ~ 1, start = fixef(mod.lis) ) ### I try a slightly different model specification for the fixed effects, and it does not work. ### fixed = list(Asymp ~ 1, xmid ~ 1, scal ~ 1) ### I tried following the example on page 355. mod - nlme(circumference ~ SSlogis(age, Asymp, xmid, scal), data=Orange, fixed = list(Asymp ~ 1, xmid ~ 1, scal ~ 1), start = fixef(mod.lis) ) ### I get Error in parse(file, n, text, prompt) : syntax error in ~ nlme version 3.1-71 version _ platform powerpc-apple-darwin8.6.0 arch powerpc os darwin8.6.0 system powerpc, darwin8.6.0 status major 2 minor 3.0 year 2006 month 04 day24 svn rev37909 language R version.string Version 2.3.0 (2006-04-24) Dr. M. Hank H. Stevens, Assistant Professor 338 Pearson Hall Botany Department Miami University Oxford, OH 45056 Office: (513) 529-4206 Lab: (513) 529-4262 FAX: (513) 529-4243 http://www.cas.muohio.edu/~stevenmh/ http://www.muohio.edu/ecology/ http://www.muohio.edu/botany/ E Pluribus Unum __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] sapply and Date objects
?sapply says X: list or (atomic) vector to be used. now dt is neither, and it has been coerced to a list, losing its class. Reading the help page for the function often resolves such questions. On Sat, 20 May 2006, Fernando Saldanha wrote: This is probably a dumb question, but I cannot figure it out. Why does this happen? dt - as.Date(1954-02-01) as.character(dt) [1] 1954-02-01 sapply(c(dt), as.character) [1] -5813 -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] multiple plots in a function()
Read through this thread for some sample code: https://www.stat.math.ethz.ch/pipermail/r-help/2005-May/072462.html On 5/20/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Sorry for again asking the same question, but I am still not successfull, also after using grid-package, as recommended previously: I want to write a function() which generates a graphical output and can be used in a loop to produce several results with a layout like in par(mfrow=c(5,5)) for ( i in 1:10){ plot(1:10) } Here is the (experimental) code: myfunction - function(){ vp1 - viewport(x=0.1, y=.7, w=.8, h=.2, just=left, name=vp1) vp2 - viewport(x=.1, y=.5, w=.8, h=.2, just=left, name=vp2) pushViewport(vp1) grid.rect(gp=gpar(col=grey)) grid.text(vp1) grid.xaxis(main=FALSE) upViewport() pushViewport(vp2) grid.rect(gp=gpar(col=grey)) grid.text(vp2) grid.xaxis() } And the following loop: par(mfrow=c(5,5)) for (i in 1:10) { grid.newpage() # when ommitting this line, the following plots will be plotted as childrens of the afore generated parent myfunction() } In conclusion, every myfunction() result overwrites the output of the previous output and is not plotted side by side as intended. What to change? Thanks a lot, Dirk Dr.med. D. Weismann Schwerpunkt Endokrinologie/Diabetologie Medizinische Klinik und Poliklinik I Universität Würzburg Josef-Schneider-Str. 2 97080 Würzburg email: [EMAIL PROTECTED] Telefon: 0931/201-1 -Ursprüngliche Nachricht- Von: Gabor Grothendieck [mailto:[EMAIL PROTECTED] Gesendet: Mi 17.05.2006 03:19 An: Weismann, Dirk Cc: [EMAIL PROTECTED]; [EMAIL PROTECTED] Betreff: Re: [R] multiple plots in a function() Use grid graphics http://www.stat.auckland.ac.nz/~paul/grid/grid.html and the gridbase package to incorporate classic graphics in that. On 5/16/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Thanks a lot, but my problem is not to get a temporary change with par()in myfunction and return to 'oldpar'after finishing. What I want is, that the output of myfunction is handled like one graphic (ie one plot) and therefore I can get the output of myfunction 10times side by side in one window (e.g. mfrow=c(5,5)). But the 'par(mfrow=c(1,2))' inside 'myfunction' makes this impossible. I used plot(..,type=n)two times to initialize the graphics in 'myfunction' and filled both with a lot of low-level graphic code. Since I always need both graphical outputs to interpret the results, I prefer to write one function instead of two for each plot. This might not be the best way to create a graphical output in a function, but how to do it better? Thanks, Dirk -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Gabor Grothendieck Gesendet: Dienstag, 16. Mai 2006 05:01 An: Weismann, Dirk Cc: r-help@stat.math.ethz.ch Betreff: Re: [R] multiple plots in a function() You could override par by optionally passing it as an argument: f - function(x = 1:10, y = 1:10, par = list(mfrow = c(2,2))) { if (!is.null(par)) { on.exit(par(opar)) opar - par(par) } plot(x) plot(y) } opar - par(mfrow=c(4,4)) for(i in 1:8) f(par = NULL) par(opar) On 5/15/06, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Dear all, I have the following problem: I have written a function genereating to plots, eg myfunction - (data, some.parameters) { #some calculations etc . par (mfrow=c(1,2)) plot1(..) plot2(.) } which works fine. But for analysing several variants, I tried a slope, eg: par (mfrow=c(5,5)) for ( i in 1:10) { myfunction(data, i) } Off course, the par() in myfunction overwrites the par() before the slope. So, how to write myfunction, that it plots two plots and can be used in the slope like in the example? Thanks a lot, Dirk Dr.med Dirk Weismann Schwerpunkt für Endokrinologie und Diabetologie Medizinische Universitätsklinik I 97080 Würzburg email: [EMAIL PROTECTED] Telefon: 0049-931-201-36744 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list
[R] GLM with nested design
Dear list members, I'd like to perform a glm analysis with a hierarchically nested design. In particular, I have one fixed factor (Land Use Classes) with three levels and a random factor (quadrat) nested within Land Use Classes with different levels per classes (class artificial = 1 quadrat; class crops = 67 quadrats; and class seminatural = 30 quadrats). I have four replicates per each quadrats (response variable = species richness per plot) Here some question about: 1) could I analize these data using the class artificial (i.e. I have only 1 level)? 2) using R I'd like perfor a glm analysis considering my response variable (count of species) with a Poisson distribution. How can I develop my model considering the nested nature of my design? I'm sorry but I don't know the right package to use. 3) for the Anova analysis I'd like use a post-hoc comparison between pairwise classes. What is the right procedure to do this? Is this analysis performed in R? Thanks Giovanni -- Dr. Giovanni Bacaro Università degli Studi di Siena Dipartimento di Scienze Ambientali G. Sarfatti Via P.A. Mattioli 4 53100 Siena tel. 0577 235408 email: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How can you buy R?
The issue in the glmmADMB example is not if they were required to release it under GPL (my reading from the GPL FAQ is that they probably were not, given that communication is between processes and the R code is interpreted). Rather, it is stated to be under GPL _but_ there is no source code offer for the executables (and the GPL FAQ says that for anonymous FTP it should be downloadable via the same site, and the principles apply equally to HTTP sites). As the executables are not for my normal OS and I would like to exercise my freedom to try the GPLed code, I have requested the sources from the package maintainer. Once again, the GPL FAQ and its references, http://www.gnu.org/licenses/gpl-faq.html, are a more informed source than mailing lists. If you think you understand it, try the exam at http://www.gnu.org/cgi-bin/license-quiz.cgi (cheaper than testing in court). On Sat, 20 May 2006, Berwin A Turlach wrote: G'day Spencer, SG == Spencer Graves [EMAIL PROTECTED] writes: SG I'm not an attorney, but it would seem to me any code written SG in R is arguably derived from R. IANAL either, and I long since stopped reading gnu.misc.discuss in which the interpretation of the various licences are regularly discussed. SG Even if R code were not derived from R, I don't see how it SG could reasonably be considered independent of R. R is one implementation of the S language. If the R code works without modification under S-PLUS (another implementation), then I believe you can argue that it is independent of R. On the user level, it might well be the case that most commands work in R and S-PLUS, but on the package developer lever there are enough differences that typically the same code does not work on both, R and S-PLUS, and that you have to make small adjustments depending on the package. If all R specific code is within if(is.R()) constructs (and likewise for all S-PLUS specific code), then you can probably still argue independence. It might become trickier if you handle the R/S-PLUS specific code externally via Perl/Python/??? scripts and provide files with (slightly) different code for the R package and the S-PLUS package. In this case the R code for the R package is presumably derived from R and has to be put under the GPL. A question that always interested me was whether you can used GPL'd code in S-PLUS. At some point, I got the impression that according to the GPL the user would violate the GPL if a package contained GPL code (in particular C and/or FORTRAN code) that was dynamically linked into S-PLUS by the R code. My understanding was that in that moment a product was created that would have to be wholly under the GPL, so the user was violating the GPL and lost the write to use your package. For this reason I started to use the LGPL for S-PLUS packages that I put on statlib. I noticed that when these packages were ported to R, the licence was changed to GPL, but that is o.k. and allowed by the LGPL. I guess this question will soon become more interesting again since there have been e-mails to this mailing list that S-PLUS wants to become more compatible to R so that packages developed for R can be easily used (ported?) to S-PLUS. I guess the guys in Insightful have to be very careful on how they do that... :) SG A boundary case is provided by the glmmADMB package. As I SG read the GPL, this package must operate under GPL. According to the DESCRIPTION file (at least the 0.3 version for linux) it does. SG This means that if anyone wants their source code, the authors SG of that package are required to give it to them. I agree, but isn't it all there? Or are you talking about the files in the (inst/)admb directory? The authors of that package should probably write somewhere tht the files in that directory are not under the GPL and everything would be fine. SG I just noticed that the version of glmmADMB that I SG downloaded 3/14/2006 does NOT contain a src subdirectory. SG This surprises me, given the comment on SG http://cran.fhcrc.org/banner.shtml; that we generally do not SG accept submissions of precompiled binaries. But from where die you download it? I cannot see it on CRAN. I found it on the web-site of Otter Research and, presumably, they are free to distribute packages that contain precompiled binaries. SG That is, however, not required by the GPL, as I understand it. SG Rather, it seems to say that Otter Research SG (http://www.otter-rsch.com/), who distribute more general AD SG Model Builder software, could be required to make freely SG available source code for all the binaries they use. This SG should be fairly easy for them, because their AD Model SG Builder produces C++ code, which they could easily include in SG a src subdirectory of their package. The GPL would NOT SG require them to distribute source code for the AD
Re: [R] checking package dependencies
Richard M. Heiberger wrote: I am having a similar problem with Windows. I first tried R-2.3.0, then following this post, tried R-2.2.1. In both versions, I can't get anything useful with the cygwin shell inside emacs. I get valid error messages from cygwin in a standalone cygwin window and from the msdos shell, either standalone or inside emacs. Here is the messages from the cygwin shell. The ls -alF for all the files mentioned look good. I don't know where the access is denied message is coming from. Perhaps someone can help interpret them. 1. cygwin is not supported. 2. Access is denied suggests this is not an R but a problem of your (OS/cygwin ? ) setup. Uwe Ligges [EMAIL PROTECTED] ~/HH-R.package $ PATH=.:/cygdrive/c/progra~1/R/tools/bin:/cygdrive/c/MinGW/bin:/cygdrive/c/Perl /bin:/cygdrive/c/texmf/miktex/bin:/cygdrive/c/progra~1/R/R-2.3.0/bin:/usr/local/ bin:/usr/bin:/cygdrive/c/gs/gs8.00/bin:/cygdrive/c/gs/gs8.00/lib:/cygdrive/c/win dows:/cygdrive/c/windows/system32 [EMAIL PROTECTED] ~/HH-R.package $ [EMAIL PROTECTED] ~/HH-R.package $ R_HOME=c:/progra~1/R/R-2.3.0 [EMAIL PROTECTED] ~/HH-R.package $ [EMAIL PROTECTED] ~/HH-R.package $ export PATH R_HOME [EMAIL PROTECTED] ~/HH-R.package $ Rcmd check HH * checking for working latex ...Access is denied. NO * using log directory 'c:/HOME/rmh/HH-R.package/HH.Rcheck' Access is denied. * using * checking for file 'HH/DESCRIPTION' ... OK * checking extension type ... Package * this is package 'HH' version '1.0' * checking package dependencies ...Access is denied. OK * checking if this is a source package ... OK * checking whether package 'HH' can be installed ...Access is denied. Error: cannot open file 'c:/HOME/rmh/HH-R.package/HH.Rcheck/00install.out' for re ading [EMAIL PROTECTED] ~/HH-R.package $ Rcmd build HH * checking for file 'HH/DESCRIPTION' ... OK * preparing 'HH': * checking DESCRIPTION meta-information ...Access is denied. OK * cleaning src * removing junk files Access is denied. Access is denied. Access is denied. Error: cannot open file 'HH/DESCRIPTION' for reading [EMAIL PROTECTED] ~/HH-R.package $ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How can you buy R?
On 5/20/06, Berwin A Turlach [EMAIL PROTECTED] wrote: G'day Spencer, SG == Spencer Graves [EMAIL PROTECTED] writes: SG I'm not an attorney, but it would seem to me any code written SG in R is arguably derived from R. IANAL either, and I long since stopped reading gnu.misc.discuss in which the interpretation of the various licences are regularly discussed. SG Even if R code were not derived from R, I don't see how it SG could reasonably be considered independent of R. R is one implementation of the S language. If the R code works without modification under S-PLUS (another implementation), then I believe you can argue that it is independent of R. On the user level, it might well be the case that most commands work in R and S-PLUS, but on the package developer lever there are enough differences that typically the same code does not work on both, R and S-PLUS, and that you have to make small adjustments depending on the package. If all R specific code is within if(is.R()) constructs (and likewise for all S-PLUS specific code), then you can probably still argue independence. It might become trickier if you handle the R/S-PLUS specific code externally via Perl/Python/??? scripts and provide files with (slightly) different code for the R package and the S-PLUS package. In this case the R code for the R package is presumably derived from R and has to be put under the GPL. A question that always interested me was whether you can used GPL'd code in S-PLUS. At some point, I got the impression that according to the GPL the user would violate the GPL if a package contained GPL code (in particular C and/or FORTRAN code) that was dynamically linked into S-PLUS by the R code. My understanding was that in that moment a product was created that would have to be wholly under the GPL, so the user was violating the GPL and lost the write to use your package. A user can never violate the GPL. The GPL does not govern use, it governs distribution. Specifically, quoteActivities other than copying, distribution and modification are not covered by this License; they are outside its scope. The act of running the Program is not restricted.../quote Distribution of source is fairly straightforward (and it's perfectly fine for you to distribute source on statlib under the GPL). Things become more interesting when any one (e.g. Insightful) distributes binaries (of a package/chapter in R/S, say) under the GPL, because they are required by the GPL to supply (upon request) not only the 'source' (of the package or chapter), but also all the tools required to reproduce the binary version from the source. I'm not sure how this works in S-PLUS, but in R it would mean everything needed to do an R CMD INSTALL. There's a standard exception for this in the GPL, namely, you don't need to supply quoteanything that is normally distributed (in either source or binary form) with the major components (compiler, kernel, and so on) of the operating system on which the executable runs/quote. S-PLUS would certainly not qualify among these. However, the original author can add an exception to the license specifically for S-PLUS, as noted in http://www.gnu.org/licenses/gpl-faq.html#GPLIncompatibleLibs For this reason I started to use the LGPL for S-PLUS packages that I put on statlib. I noticed that when these packages were ported to R, the licence was changed to GPL, but that is o.k. and allowed by the LGPL. I guess this question will soon become more interesting again since there have been e-mails to this mailing list that S-PLUS wants to become more compatible to R so that packages developed for R can be easily used (ported?) to S-PLUS. I guess the guys in Insightful have to be very careful on how they do that... :) Deepayan -- http://www.stat.wisc.edu/~deepayan/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to use lm.predict to obtain fitted values?
On Friday 19 May 2006 17:35, Peter Ehlers wrote: Larry Howe wrote: I have had a similar issue recently, and looking at the archives of this list, I see other cases of it as well. It took me a while to figure out that the variable name in the data frame must be identical to the variable name in the model. I don't see this mentioned in the documentation of predict.lm, and R issues no warning in this case. How would I go about officially requesting that this is mentioned, either in the documentation, or as a warning? Sincerely, Larry Howe Here's what I would do before officially requesting anything: read 'An Introduction to R', especially section 11.3: predict(object, newdata=data.frame) The data frame supplied must have variables specified with the same labels as the original. Seems pretty explicit. As well, the predict.lm help page has, under Arguments: newdata An optional data frame in which to look for variables with which to predict. That, too, seems unambiguous; i.e. you can't predict with values of z when z is not in your formula. Peter Ehlers My fault, I should have read ALL the manuals before posing my question. I only read the 2445 page Reference Manual. I also read Intro to R, but that was some time ago. An optional data frame in which to look for variables with which to predict. means almost nothing to me. Specifically it doesn't translate to me, as an engineer and software developer, but not a statistician, that the names have to match, and furthermore if they don't match, R fails silently. Larry Howe __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to use lm.predict to obtain fitted values?
On 5/20/06, Larry Howe [EMAIL PROTECTED] wrote: On Friday 19 May 2006 17:35, Peter Ehlers wrote: Larry Howe wrote: I have had a similar issue recently, and looking at the archives of this list, I see other cases of it as well. It took me a while to figure out that the variable name in the data frame must be identical to the variable name in the model. I don't see this mentioned in the documentation of predict.lm, and R issues no warning in this case. How would I go about officially requesting that this is mentioned, either in the documentation, or as a warning? Sincerely, Larry Howe Here's what I would do before officially requesting anything: read 'An Introduction to R', especially section 11.3: predict(object, newdata=data.frame) The data frame supplied must have variables specified with the same labels as the original. Seems pretty explicit. As well, the predict.lm help page has, under Arguments: newdata An optional data frame in which to look for variables with which to predict. That, too, seems unambiguous; i.e. you can't predict with values of z when z is not in your formula. Peter Ehlers My fault, I should have read ALL the manuals before posing my question. I only read the 2445 page Reference Manual. I also read Intro to R, but that was some time ago. An optional data frame in which to look for variables with which to predict. means almost nothing to me. Specifically it doesn't translate to me, as an engineer and software developer, but not a statistician, that the names have to match, and furthermore if they don't match, R fails silently. Larry Howe I have had offline conversations not related to this thread by others who were also confused by this so I agree it would be worthwhile to clarify it. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R SOAP Client Alternatives Recommendations
Hello: Has anyone written a Java plugin for R which can talk to a SOAP Server? I have tried SSOAP and it seems like it is not a complete implementation of the SOAP standard. Are there any other alternatives which I can use to communicate to a SOAP Server from R? Can anyone provide any examples? Many Thanks In Advance __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] How to use lm.predict to obtain fitted values?
An optional data frame in which to look for variables with which to predict. means almost nothing to me. Specifically it doesn't translate to me, as an engineer and software developer, but not a statistician, that the names have to match, and furthermore if they don't match, R fails silently. Larry Howe I have had offline conversations not related to this thread by others who were also confused by this so I agree it would be worthwhile to clarify it. Thank you! If there is anything I can do to help get this documented / clarified, please let me know. Larry __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Generating random numbers from skew power exponential distribution?
Dear R Help List, I'm trying to do some MCMC work, fitting a Bayesian version of the skew exponential power (sometimes called the skew power exponential) distribution, for which I need to draw random numbers. The implementation of rSEP in the gamlss library seems a little clunky (and uses integration); is there a simple/efficient way to generate random numbers from this distribution, say using a rejection scheme, as there is for the power exponential and the skew normal distribution? Thanks! Simon Simon D.W. Frost, M.A., D.Phil. Department of Pathology University of California, San Diego Antiviral Research Center 150 W. Washington St., Suite 100 San Diego, CA 92103 USA Tel: +1 619 543 8080 x275 Fax: +1 619 298 0177 Email: [EMAIL PROTECTED] The information transmitted in this e-mail is intended only ...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R SOAP Client Alternatives Recommendations
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Alex Restrepo wrote: Hello: Has anyone written a Java plugin for R which can talk to a SOAP Server? Use SJava or rJava or arji to dynamically load Java classes into R that perform the SOAP. I have tried SSOAP and it seems like it is not a complete implementation of the SOAP standard. Which part of the standard do you need that are not there? And which version of SSOAP? There are recent updates that are not yet released that deal with a different aspect of SOAP, but we need to know to which bits of the spec. you are referring. Are there any other alternatives which I can use to communicate to a SOAP Server from R? Can anyone provide any examples? Many Thanks In Advance __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html - -- Duncan Temple Lang[EMAIL PROTECTED] Department of Statistics work: (530) 752-4782 4210 Mathematical Sciences Building fax: (530) 752-7099 One Shields Ave. University of California at Davis Davis, CA 95616, USA -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.3 (Darwin) iD8DBQFEb23m9p/Jzwa2QP4RAhfPAJ492TyXcYScSzMYW3OlJoHZmsNW4wCeOW44 SRcq6P5Omce9pJIgtXfTYqc= =d2JD -END PGP SIGNATURE- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] About STL function
comments inline frossard victor wrote: Hi, I'm a student in hydrobiology and I actually work on river's discharge and try to extract from my data the seasonal and trend components. I use STL function but I have several problems in understanding what this function have done. I'd like to know what means the IQR results which gave me some % about the seasonal component, trend component and the remainder component. IQR = Interquartile range = (3rd Qu.)-(1st Qu.). It is a measure of spread, similar to standard deviation. The percentages are something like a non-parametric R^2. Moreover, the graphic representation of stl function change the scale between the different part of the plot, my data have the good scale but the seasonal, trend and remainder component have an other scale. My data scale vary from 0 to 150 (m3/day), the trend scale go from 0 to 25, the seasonal scale vary from -10 to 20. Is that normal? has a change of units occur? what does it means? That sounds pretty normal to me. Have you worked the examples in ?stl? The plots I reviewed from the first two examples have small gray bars near the right margin indicating the relative adjustment of the scale of each component. This is necessary, because you can have a very small seasonal superimposed on a dominant trend or a very large seasonal dominating a small but very important trend, etc. Hope this helps. Bon Chance, Spencer Graves Thanks for your answers. Victor. - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] regular expression change in R version 2.3.0?
Hi, This has been reverted in R-devel, so you should get the old behavior in it. Gabor Grothendieck posted a work around for R 2.3.x. best wishes Robert Thomas Girke wrote: The interpretation of regular expressions with repetition quantifiers in the 'gregexpr' function seems to have changed between R Version 2.2.0 and 2.3.0. The 'gsub' function, however, gives the same results in R Versions 2.2.0 and 2.3.0. Below is an example that demonstrates the version differences of the 'gregexpr' function. I am not sure whether this new behavior is an intended change or represents a bug. Personally, I liked the old behavior of this function more useful, since it is consistent with the Perl regular expressions. Here are my questions: (1) Is there a possibility to obtain from 'gregexpr' the old output of R version 2.2.0 when using regular expressions with repetition quantifiers. (2) How can one be informed about regular expression changes and the associated functions in new versions of R? Here is the example code to demonstrate the version difference of the 'gregexpr' function between versions 2.3.0 and 2.2.0: # Example string x - xxx # gregexpr in Version 2.2.0 (2005-10-06 r35749) gregexpr([a]{1,}, as.character(x), perl=T) [[1]] [1] 2 7 attr(,match.length) [1] 4 4 # gregexpr in Version 2.3.0 (2006-04-24) gregexpr([a]{1,}, as.character(x), perl=T) [[1]] [1] 2 3 4 5 7 8 9 10 attr(,match.length) [1] 4 3 2 1 4 3 2 1 # gsub gives expected output in Versions 2.2.0 2.3.0 gsub([a]{1,}, _, as.character(x), perl=T) [1] x_x_x Thanks in advance for your help. Thomas -- Robert Gentleman, PhD Program in Computational Biology Division of Public Health Sciences Fred Hutchinson Cancer Research Center 1100 Fairview Ave. N, M2-B876 PO Box 19024 Seattle, Washington 98109-1024 206-667-7700 [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] checking package dependencies
Thank you for your comments. After further investigation and off-line correspondence with Duncan Murdoch, I found that the principal problem was a bad unzip from cygwin. It was leaving the .exe files with permission 666 instead of the correct 777. I changed unzip programs and everything now works inside the cygwin *shell* buffer inside emacs. There was a secondary problem that the environment variables inside the emacs buffer running cygwin needed adjustment. These three changes are needed inside the bash running inside emacs to make the command Rcmd check packagename work: PATH=.:/cygdrive/c/progra~1/R/tools/bin:/cygdrive/c/MinGW/bin:/cygdrive/c/Perl/bin:/cygdrive/c/texm f/miktex/bin:/cygdrive/c/progra~1/R/R- 2.3.0/bin:/cygdrive/c/progra~1/htmlhe~1:/usr/local/bin:/usr/bin:/cygdrive/c/gs/gs8.00/bin:/cygdrive /c/gs/gs8.00/lib:/cygdrive/c/windows:/cygdrive/c/windows/system32 R_HOME=c:/progra~1/R/R-2.3.0 COMSPEC=c:\windows\system32\cmd.exe ##this is necessary and in DOS notation In order to make C-c C-p (equivalently, clicking preview) work on .Rd files, I needed the following emacs statements (setenv PATH .;c:\\progra~1 \\R\\tools\\bin;c:\\MinGW\\bin;c:\\Perl\\bin;c:\\texmf\\miktex\\bin;c:\\progra~1\\R\\R-2.3.0 \\bin;c:\\progra~1\\htmlhe~1;c:\\gs\\gs8.00\\bin;c:\\gs\\gs8.00 \\lib;c:\\windows;c:\\windows\\system32) (setenv R_HOME c:\progra~1\R\R-2.3.0) (setenv COMSPEC c:\windows\system32\cmd.exe) My mailer folds lines at about 100 characters. Receiving mail programs might fold them again. Each of those PATH statements is a single line. Please unfold them before using them. Rich __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html