RE: [R] Installing packages from source on WindowsXP
I recall having this problem. I think I had a version that didn't work. Did you download the htmlhelp.exe from http://www.murdoch-sutherland.com/Rtools/ . The path does not matter as I have it in a folder on it's own. I think that I also had a path to the version that didn't work and I had to get my IT people to let me put my location first. Tom -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Tyler Smith Sent: Friday, 22 April 2005 1:27 PM To: R-Help Subject: [R] Installing packages from source on WindowsXP Hi, I'm having some problems installing packages from the source files on Windows, using R CMD INSTALL pkg. I'm running WindowsXP, and I've followed the instructions as per the README.packages file from the R installation. I ran into a hitch, with the install failing following a hhc: not found warning. I figured out that this was related to the html help workshop. Adding the HHW folder to the Path variable didn't help. README.packages mentions that HHW should be in the same drive as the other tools, which it is, but in a different folder. So I put a copy of hhc.exe in the Rtools/bin folder and everything seems to have worked out. My question is, is this going to cause me problems later on? Should I transfer all the HHW files to the Rtools/bin? Is there a better way to arrange the HHW files? I'm installing from source files instead of using the automated GUI feature because I want to read the original code to see how experienced users write functions. I'm using version 2.0.1 Patched (2005-04-16). Thanks for your time, Tyler -- Tyler Smith PhD Candidate Department of Plant Science McGill University [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 __ 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 closes unexpectedly with write.dbf()
On Thu, 21 Apr 2005, Robin Schroeder wrote: Dear R-list, I am trying to do a relatively simple manipulation in R on a dbf file and then write the dbf file back out the file system. Here are the commands: (load the foreign library package) union - read.dbf(C:/ITRSampleData/fromGrass/union.dbf, as.is=FALSE) attach(union) union$wu_fract - area_union*a_SUM/a_area_tor detach(union) write.dbf(union, C://ITRSampleData/fromR/union_postR.dbf) after I run the last command, Windows tells me that R has encountered a problem and needs to shut down. It also asks if I want to report the problem to microsoft... R then shuts down completely. I have tried this with the factor2char=TRUE and FALSE, with the same result. I checked is.data.frame(union) and it is true. An empty dbf file is created in the correct place, so I know R has access/permissions and my file path is correct. I have used the write.dbf command in a number of other places and have never run into this problem. Please state the version of the foreign library you are using, update foreign to 0.8-7, and try again. There were two bugs in write.dbf() up to 0.8-5, one when a column of the data frame was all 0 and the other when a column was all NA. Also please do summary(union$wu_fract) - I suspect it is either all 0 or NA. 0.8-7 guards against both of these problems, which are in code trying to work out the appropriate width of the output DBF fields. I am running R 2.0.0 on windows xp. Any ideas? Thanks in advance, Robin Schroeder Robin Tori Schroeder (formerly Schoeninger) International Institute for Sustainability P.O. Box 873211 Arizona State University Tempe, Arizona 85287-3211 Phone: (480) 727-7290 __ 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 -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [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
[R] Error when downloading and installing ALL R packages
Hi, after updating to 2.1 (see below) I am no longer able to install all R packages as mentioned at http://support.stat.ucla.edu/view.php?supportid=30. After finishing the download, I received the following error: [...] trying URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.1/xgobi_1.2- 13.zip' Content type 'application/zip' length 102623 bytes opened URL downloaded 100Kb trying URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.1/yags_4.0- 1.zip' Content type 'application/zip' length 168770 bytes opened URL downloaded 164Kb package 'AMORE' successfully unpacked and MD5 sums checked package 'AlgDesign' successfully unpacked and MD5 sums checked Error in sprintf(gettext(unable to move temp installation '%d' to '%s'), : use format %s for character objects TIA, Bernd version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status Patched major2 minor1.0 year 2005 month04 day 18 language R __ 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] Beginner in R
hello ( and sorry for my poor english ... ) I'm a newbie on R software and I need to obtain this kind of system : a structure, like a liste : my_struct - list() my_struct$a - a_value my_struct$b - another_value my_struct$c - one_more_value and a function with two args : the first is a instance of the structure, and the second is any component of the structure (here $a, $b or $c) and the function will do some transformations on this component : my_func - function(a_struct, a_comp) { a_comp - transformationFunct(a_comp) a_result - someComputation(a_struct) return(a_result) } In reallity, the structure have lot of components (+/- 40) who are input parameters for a time discret model and this function is to do selective sensitivity analysis. Thanks in advance for this information and thanks for doing a open high quality software. Norbert __ 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] pointer to comments re Paul Murrell's new book, R, SAS on Andrew Gelman's blog
Brief comment on blog. S Plus is mentioned only in passing. I've always thought comparisons between SAS and R are invalid as they do different things. If I wasn't using R I'd be coding in either C or Fortran. SAS appears to be a database with statistical functionality attached. I've always thought that R being open source makes the results more reliable. There is nothing like having your name attached to something to ensure it is correct. Also if you have any doubts about the calculations it is possible to look at the source to see exactly what is going on. While I'm here I'd like to thank the R Core group and ETH for providing the harware for the mailing list. Phineas Campbell Tony Plate [EMAIL PROTECTED] 04/22/05 4:15 AM There are some interesting comments re Paul Murrell's new book, R, SAS on Andrew Gelman's blog: http://www.stat.columbia.edu/~cook/movabletype/archives/2005/04/a_new_book_on_r.html -- Tony Plate __ 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] lme4: apparently different results between 0.8-2 and 0.95-6
Steve Cumming wrote: I've been using lme4 to fit Poisson GLMMs with crossed random effects. The data are counts(y) sampled at 55 sites over 4 (n=12) or 5 (n=43) years. Most models use three fixed effects: x1 is a two level factor; x2 and x3 are continuous. We are including random intercepts for YEAR and SITE. On subject-matter considerations, we are also including a random coefficient for x3 within YEAR. Neglecting the log link, the model is y_{i,j} = x'_i \beta + \eta_i + z'_i \phi_j + \epsilon_{i,j} where i indexes SITE and j indexes YEAR, \beta is the vector of fixed effects \eta_i in the random intercept for SITE and \phi_j are the random intercept and coefficient for YEAR. I have written x'_i because the covariates are assumed (reasonably) to be constant over the 5 years. Thus, obviously, the z'_i = (1, x3_i) are constant over j as well. Using lme4 0.8-2 and R 1.9.0 (under Windows), the call GLMM(y~x1 + x2 + x3,random = list(YEAR=~1+x3, SITE=~1), data=foo, family=poisson, offset=log(reps)) seemed to work correctly, so far as I can tell. The fixed effects were more-or-less consistent with those estimated by an ordinary GLM, and the random YEAR effects had signs, magnitudes and correlation appeared to be sensible and consistent with my expectations. Earlier today, we updated to lme4 0.95-6 and R 2.1.0. When we try to use lmer to fit the same model, it complains bitterly: lmer(y ~ x1 + x2 + x3 + (1 + x3 | YEAR) + (1 | SITE), data=foo, family=poisson, offset=log(reps)) Error: Unable to invert singular factor of downdated X'X Simpler models still work (or at least return): lmer(y ~ x1 + x2 + x3 + (1 + x3 | YEAR), ...) lmer(y ~ x1 + x2 + x3 + (1 | YEAR) + (1 | SITE), ...) As I mentioned, the design is unbalanced. But, we get same invert singular factor Error using the balanced subset. Can anybody advise? Are we using lmer incorrectly? Or is the new error perhaps telling us that GLMM in 0.8-2 wasn't actually working in some sense? I think you are using lmer correctly and that deep in the code there is a glitch related to exactly the circumstances you outlined - a model matrix with more than one column for one grouping factor (i.e. (x3|YEAR)) and a model matrix with a different number of columns for another grouping factor (1|SITE)). Because, as you mentioned, YEAR and SITE are crossed, the internal representation gets more complicated than it would be if you had nested grouping factors. The fact that you can fit the simpler models (thanks for checking that) is a strong indication where the problem is. Is it possible for you to share the data with Deepayan Sarkar and me? If so it would help us track down the bug. Please contact us off list if you can do so. In the meantime I suggest using GLMM for this particular problem if you still have access to the old copy of the lme4 package. If not, contact us off list and we will provide you with a replacement package that can be used in conjunction with the current lme4. This is an exemplary bug report. You did a great job of isolating the problem. __ 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] pointer to comments re Paul Murrell's new book, R, SAS on Andrew Gelman's blog
Tony Plate wrote: There are some interesting comments re Paul Murrell's new book, R, SAS on Andrew Gelman's blog: http://www.stat.columbia.edu/~cook/movabletype/archives/2005/04/a_new_book_on_r.html I found the comments quite interesting. I also find it somewhat amusing when people speculate on what is necessary if R truly wanted to compete in that space. R doesn't compete with commercial software. As our co-founder and resident sage, Ross Ihaka, characterizes our approach, We have a simple 'marketing strategy' - we put the software out there for you to use. If you decide to use it, that's great. If not, that's ok too. __ 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 needed with lattice graph!
Dear R users, If I manage to sort out this graph, it is certainly a candidate for the new R graph gallery (http://addictedtor.free.fr/graphiques/displayGallery.php)! I created the following lattice graph: library(lattice) tmp - expand.grid(geology = c(Sand,Clay,Silt,Rock), species = c(ArisDiff,BracSera,CynDact,ElioMuti,EragCurS,EragPseu), dist = seq(1,9,1) ) tmp$height - rnorm(216) sps - trellis.par.get(superpose.symbol) sps$pch - 1:6 trellis.par.set(superpose.symbol, sps) xyplot( height ~ dist | geology, data = tmp, groups = species, type = b, cex = 1.2, layout = c(2,2), lines = list(col=grey), key = list(columns = 2, type = b, cex = 1.2, text = list(paste(unique(tmp$species))), points = Rows(sps, 1:6) ) ) However, for once, the R defaults are not to my liking. I plot the graph to postscript and the result is less then optimal. I would like to plot the point symbols in black and white, both in the graphs and the key. I would like the lines to be a single style (grey or a light dash) and preferably the lines do not go through the symbols (like figure 4.11 in the MASS book). I have tried many, many options, but results varied from wrong symbols to wrong things plotted. Splitting the lines and points over different panels seems the way, but I can not make it work. Your help is much appreciated! This graph and the resulting black and white graph will be posted on the R graph gallery. Thanks, Sander. -- Dr. Sander P. Oom Animal, Plant and Environmental Sciences, University of the Witwatersrand Private Bag 3, Wits 2050, South Africa Tel (work) +27 (0)11 717 64 04 Tel (home) +27 (0)18 297 44 51 Fax +27 (0)18 299 24 64 Email [EMAIL PROTECTED] Web www.oomvanlieshout.net/sander __ 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] Intership: R programmer, London
State Street Global Advisors (one of the world's leading assets management companies)'s alternative strategies group is looking for interns able to bring a significant contribution to our RD projects. Here are some of the directions we are currently investigating: - Digital Signal Processing (Kalman filter, wavelets, Hilbert transform, etc.) - New temporal database indexing methods - Use of non-linear and/or robust methods to replace linear regression - Generalization of algorithms or methods from daily data to intra-day (irregularly-spaced) data - Automating, in R, the analyses used to assess and monitor our investment strategies. The candidate: - should have good programming skills (R, matlab, C++, etc.) - should be proficient in a numeric subject (statistics, signal processing, numerical analysis, physics, bioinformatics, etc.) - need not have any prior financial knowledge. Length: At least three months, but we shall favour longer periods (six months, possibly more). The position is in London. The pay and the contract will depend on the training period length. Applications can be sent to me ([EMAIL PROTECTED]). -- Vincent __ 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] How to tell if R is running in batch mode
Hi Is there a way to programmatically tell whether R is running in batch or GUI mode? Thanks Dave ___ David Khabie-Zeitoune Quantitative Arbitrage Brevan Howard Asset Management direct: +44 (0)20 7022 6167 mobile:+44 (0)7799 411 797 email: [EMAIL PROTECTED] Almack House 28 King Street London SW1Y 6XA [[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] Beginner in R
Norbert Billet [EMAIL PROTECTED] writes: hello ( and sorry for my poor english ... ) I'm a newbie on R software and I need to obtain this kind of system : a structure, like a liste : my_struct - list() my_struct$a - a_value my_struct$b - another_value my_struct$c - one_more_value and a function with two args : the first is a instance of the structure, and the second is any component of the structure (here $a, $b or $c) and the function will do some transformations on this component : my_func - function(a_struct, a_comp) { a_comp - transformationFunct(a_comp) a_result - someComputation(a_struct) return(a_result) } If I catch your drift, you're looking for something like my_func - function(a_struct, a_name) { a_struct[[a_name]] - transformationFunct(a_struct[[a_name]]) someComputation(a_struct) } my_func(my_struct, b) or maybe even a loop over all components with lapply(names(my_struct), my_func, a_struct=my_struct) In reallity, the structure have lot of components (+/- 40) who are input parameters for a time discret model and this function is to do selective sensitivity analysis. Thanks in advance for this information and thanks for doing a open high quality software. Norbert -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- 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] How to tell if R is running in batch mode
Khabie-Zeitoune, David wrote: Hi Is there a way to programmatically tell whether R is running in batch or GUI mode? ?interactive __ 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 tell if R is running in batch mode
Khabie-Zeitoune, David [EMAIL PROTECTED] writes: Is there a way to programmatically tell whether R is running in batch or GUI mode? interactive() should do (it's not distinguishing between GUI and terminal mode though). -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- 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
[R] Anova - interpretation of the interaction term
Hi So carrying on my use of analysis of variance to check for the effects of two factors. It's made simpler by the fact that both my factors have only two levels each, creating four unique groups. I have a highly significant interaction term. In the context of the experiment, this makes sense. I can visualise the data graphically, and sure enough I can see that both factors have different effects on the data DEPENDING on what the value of the other factor is. I explain this all to my colleague - and she asks but which ones are different? This is best illustrated with an example. We have either infected | uninfected, and vaccinated | unvaccinated (the two factors). We're measuring expression of a gene. Graphically, in the infected group, vaccination makes expression go up. In the uninfected group, vaccination makes expression go down. In both the vaccinated and unvaccinated groups, infection makes expression go down, but it goes down further in unvaccinated than it does in vaccinated. So from a statistical point of view, I can see exactly why the interaction term is significant, but what my colleage wants to know is that WITHIN the vaccinated group, does infection decrease expression significantly? And within the unvaccinated group, does infection decrease expression significantly? Etc etc etc Can I get this information from the output of the ANOVA, or do I carry out a separate test on e.g. just the vaccinated group? (seems a cop out to me) Many thanks, and sorry, but it's Friday. Mick __ 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] Required Packages etiquette
[This is probably more appropriate for R-devel rather than R-help.] IMHO the criterion for requiring a package (say `X') is that, if some function(s) in your package can not perform its tasks correctly without something in `X', then you should list `X' as required. You can not assume the user will have `X' loaded (or even installed) if you do not list it as `required'. Andy From: GiusVa Dear friends, I am writing a package that I think may be of interest to many people so I am in the process to build-check-write-thedocumentation for it. I have some questions regarding the rules that a package should abide in order to be consistent with the other packages on CRAN. I have read and reread the Writing R extension manual and googled the mailing list and I have found answers to many questions, but some have been left unanswered. Sorry if they may seem trivial, but I have joined the R community only 4 months ago and I still I do not have a feeling of what is the right course of action. Questions: 1) the package I am writing ( MYPKG throughout the rest of the message) makes use of many packages. Some of them are fundamental to MYPKG and are pervasive, i.e. without them the package will not work and many functions are used. For these class of packages I (think) know what to do. The second class of package interests MYPKG only for specific task. For example, I need the coda package if one wants to use a specific function of MYPKG that produces a MCMC chain. What is the best way to require the package? Inside the function that request it? The relation between the third class of packages and MYPKG is very tricky. For example, from the MASS package MYPKG only uses ginv to get the generalized inverse. ginv is an important function, i.e. it is used in many functions. Do I have to require MASS? Or should I just include only ginv in the package? Thank you for patience. Giuseppe |Giuseppe Ragusa |University of California, San Diego |9500 Gilman Dr. 0508 |La Jolla, CA 92093 __ 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] pointer to comments re Paul Murrell's new book, R, SAS on Andrew Gelman's blog
Douglas Bates [EMAIL PROTECTED] writes: Tony Plate wrote: There are some interesting comments re Paul Murrell's new book, R, SAS on Andrew Gelman's blog: http://www.stat.columbia.edu/~cook/movabletype/archives/2005/04/a_new_book_on_r.html I found the comments quite interesting. I also find it somewhat amusing when people speculate on what is necessary if R truly wanted to compete in that space. R doesn't compete with commercial software. As our co-founder and resident sage, Ross Ihaka, characterizes our approach, We have a simple 'marketing strategy' - we put the software out there for you to use. If you decide to use it, that's great. If not, that's ok too. Just to prevent misattribution: Notice that this is from the comments *to* Andrew Gelman's note, not comments *by* A.G. (And at least some of us do think about the market requirements from time to time. I agree with Ross that we can afford to try to do it right rather than be driven by marketing, though.) -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- 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] Installing packages from source on WindowsXP
Tyler Smith wrote: Hi, I'm having some problems installing packages from the source files on Windows, using R CMD INSTALL pkg. I'm running WindowsXP, and I've followed the instructions as per the README.packages file from the R installation. I ran into a hitch, with the install failing following a hhc: not found warning. I figured out that this was related to the html help workshop. Adding the HHW folder to the Path variable didn't help. README.packages mentions that HHW should be in the same drive as the other tools, which it is, but in a different folder. So I put a copy of hhc.exe in the Rtools/bin folder and everything seems to have worked out. My question is, is this going to cause me problems later on? Should I No, only if you want to update and forget to update that file as well. Uwe Ligges transfer all the HHW files to the Rtools/bin? Is there a better way to arrange the HHW files? I'm installing from source files instead of using the automated GUI feature because I want to read the original code to see how experienced users write functions. I'm using version 2.0.1 Patched (2005-04-16). Thanks for your time, Tyler __ 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] Anova - interpretation of the interaction term
On 22-Apr-05 michael watson \(IAH-C\) wrote: [...] So from a statistical point of view, I can see exactly why the interaction term is significant, but what my colleage wants to know is that WITHIN the vaccinated group, does infection decrease expression significantly? And within the unvaccinated group, does infection decrease expression significantly? Etc etc etc Can I get this information from the output of the ANOVA, or do I carry out a separate test on e.g. just the vaccinated group? (seems a cop out to me) If I understand right, each of these questions can only be answered in terms of the changes in mean level *within* group. However, you are entitled to use the residual sum of squares (after estimating both effects and interaction) for the estimate of SE to which you compare these within-group changes. Provided, of course, that the variance is homogenous across groups (i.e. treatment and/or infection has no influence on variability). You can get the latter from the original ANOVA (interaction term included) but I think you should get the difference of means (infected vs non-infected) by a separate anlysis of each group. Many thanks, and sorry, but it's Friday. Don't apologise. Not your fault it's Friday. (Who *can* I blame?) Cheers, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 22-Apr-05 Time: 11:52:40 -- XFMail -- __ 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 know if a classification tree is predicitve or not?
Laure Maton wrote: Hello, I would like to know how to know if a classification tree is predictive or not ? Is it sufficient to analyse results of cross validation? Depends on your interpretation of predictive, maybe you want to look at stuff like sensitivity and specificity as well. Uwe Ligges Thanks for your help Laure Maton __ 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] Using R to illustrate the Central Limit Theorem
On 21-Apr-05 [EMAIL PROTECTED] wrote: Here's a bit of a refinement on Ted's first suggestion. [ corrected from runif(M*k), N, k) to runif(N*k), N, k) ] N - 1 graphics.off() par(mfrow = c(1,2), pty = s) for(k in 1:20) { m - (rowMeans(matrix(runif(N*k), N, k)) - 0.5)*sqrt(12*k) hist(m, breaks = FD, xlim = c(-4,4), main = k, prob = TRUE, ylim = c(0,0.5), col = lemonchiffon) pu - par(usr)[1:2] x - seq(pu[1], pu[2], len = 500) lines(x, dnorm(x), col = red) qqnorm(m, ylim = c(-4,4), xlim = c(-4,4), pch = ., col = blue) abline(0, 1, col = red) Sys.sleep(1) } Very nice! (I can better keep up with it mentally, though, with Sys.sleep(2) or Sys.sleep(3), which moght be better for classroom demo). One thing occurred to me, watching it: people might say Yes, we can see how the distribution - Normal, nice and smooth, especially in the tails and side-arms; but the peaks always look a bit rough. Which could be the cue for introducing SD(ni) = sqrt(E[ni]), and the following hack of the above code seems to show this OK in the rootograms: N - 1 graphics.off() par(mfrow = c(1,2), pty = s) for(k in 1:20) { m - (rowMeans(matrix(runif(N*k), N, k)) - 0.5)*sqrt(12*k) hm - hist(m, breaks = FD, xlim = c(-4,4), main = k, plot=FALSE, prob = TRUE, ylim = c(0,0.5), col = lemonchiffon) hm$counts-sqrt(hm$counts) ; plot(hm,xlim = c(-4,4),main = k,ylab=sqrt(Frequency)) pu - par(usr)[1:2] x - seq(pu[1], pu[2], len = 500) lines(x, sqrt(N*dnorm(x)*(hm$breaks[2]-hm$breaks[1])), col = red) qqnorm(m, ylim = c(-4,4), xlim = c(-4,4), pch = ., col = blue) abline(0, 1, col = red) Sys.sleep(2) } (and also shows clearly how the tails of the sample move outwards into the tails of the Normal, as in fact you expect from the finite range of mean(runif(k)), especially initially: very visible for k up to about 5, and not really settled down for k10). Next stop: Hanging rootograms! Best wishes, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 22-Apr-05 Time: 13:10:19 -- XFMail -- __ 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] Assign factor and levels inside function
Aha! You've just opened the door to another level for this blundering R user. I even went back to my well-used copy of An Introduction to R to see where I missed this standard approach for processing new data. Nothing clear but certainly alluded to in many of the function examples. I don't know why I was stuck in that rut. I'm sure 99.9% of you on this list know this, but... To be clear for anyone searching these archives later: Don't bother to ask your function to make assignments to pos=1 (the global environment), just do the assignment yourself when calling the function. For example, instead of coding a function call like this: processData(dat) to assign the processed data to pos=1, simply make the assignment when calling the function: dat - processData(dat) Thanks for being gentle on me, Andy. Tim Liaw, Andy [EMAIL PROTECTED] 4/21/2005 9:57:22 PM Tim, From: Tim Howard Andy, Thank you for the help. Yes, my question really did seem like I was going through a lot of unnecessary steps just to define levels of a variable. But that was just for the example. In my application, I bring new datasets into R on a daily basis. While the data differs, the variables are the same, and the categorical variables have the same levels. So I find myself daily applying the same factor and level definitions (by cutting and pasting the large chunk of commands from a text file). It really would be simpler to have it wrapped up in a function. That's why I asked the question about putting this into a function. Upon reading your answer, I thought maybe I could use your example and use the super-assignment '-' in the function. But, your method assigns levels, but does not define the var as a factor (interesting!). levels(y$one) - seq(1, 9, by=2) y$one [1] 1 1 3 3 5 7 attr(,levels) [1] 1 3 5 7 9 is.factor(y$one) [1] FALSE Ouch! levels- is generic, and the default method simply attach the levels attribute to the object. You need to coerce the object into a factor explicitly. Unfortunately, whenever I try to use - with the dataframe as the variable, I get an error message: fncFact - function(datfra){ + datfra$one - factor(datfra$one, levels=c(1,3,5,7,9)) + } fncFact(y) Error in fncFact(y) : Object datfra not found I believe the canonical ways of doing something like this in R is something along the line of: processData - function(dat) { dat$f1 - factor(dat$f1, levels=...) ... ## any other manipulations you want to do dat } Then when you get new data, you just do: newData - processData(newData) HTH, Andy Tim Liaw, Andy [EMAIL PROTECTED] 4/20/2005 4:03:24 PM Wouldn't it be easier to do this? levels(y$one) - seq(1, 9, by=2) y$one [1] 1 1 3 3 5 7 attr(,levels) [1] 1 3 5 7 9 Andy From: Tim Howard R-help, After cogitating for a while, I finally figured out how to define a data.frame column as factor and assign the levels within a function... BUT I still need to pass the data.frame and its name separately. I can't seem to find any other way to pass the name of the data.frame, rather than the data.frame itself. Any suggestions on how to go about it? Is there something like value(object) or name(object) that I can't find? #sample dataframe for this example y - data.frame( one=c(1,1,3,3,5,7), two=c(2,2,6,6,8,8)) levels(y$one) # check out levels NULL # the function I've come up with fncFact - function(datfra, datfraNm){ datfra$one - factor(datfra$one, levels=c(1,3,5,7,9)) assign(datfraNm, datfra, pos=1) } fncFact(y, y) levels(y$one) [1] 1 3 5 7 9 I suppose only for aesthetics and simplicity, I'd like to have only pass the data.frame and get the same result. Thanks in advance, Tim Howard version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor0.1 year 2004 month11 day 15 language R __ 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 -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have
[R] fBasics question: Get dates corresponding to maximum values
fBasics question: Get maximum dates Hello, This two series data set has been created with the timeSeries() function from fBasics str(total) Formal class 'timeSeries' [package fBasics] with 7 slots ..@ Data : num [1:262, 1:2] 8703 8603 8573 8680 8668 ... .. ..- attr(*, dimnames)=List of 2 .. .. ..$ : chr [1:262] 2004-04-19 01:00:00 2004-04-20 01:00:00 2004-04-21 01:00:00 2004-04-22 01:00:00 ... .. .. ..$ : chr [1:2] TS.1 TS.2 ..@ positions: chr [1:262] 2004-04-19 01:00:00 2004-04-20 01:00:00 2004-04-21 01:00:00 2004-04-22 01:00:00 ... ..@ format : chr %Y-%m-%d %H:%M:%S ..@ FinCenter: chr London ..@ units: chr [1:2] TS.1 TS.2 ..@ title: chr Time Series Object ..@ documentation: chr Created at London 2005-04-22 12:54:36 Here are the first three lines: total[1:3,] TS.1 TS.2 2004-04-19 01:00:00 8702.82 55.18 2004-04-20 01:00:00 8602.98 48.48 2004-04-21 01:00:00 8573.05 46.65 I managed to get the maximum for each series: maxima-c(max([EMAIL PROTECTED],1]), max([EMAIL PROTECTED],2])) maxima [1] 9927.20 83.11 But now, I'd like to get the CORRESPONDING DATES for these maxima. Another question, is there a way to refer to data as TS.1 or TS.2 in function instead of [EMAIL PROTECTED],1:2]? Thanks version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor1.0 year 2005 month04 day 18 language R __ 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] lsfit result - how to compute t-values for coefficients
Hi I used lsfit instead of lm since I have a huge Y data-set (X being constant for all Y). Since I require the t-values for all coefficients: which would be the fastest way to compute them, eg for the example: ## using lsfit with a matrix response: t.length - 5 d.dim - c(t.length,7,8,9) # dimesions: time, x, y, z Y - array( rep(1:t.length, prod(d.dim)) + rnorm(prod(d.dim), 0, 0.1), d.dim) X - cbind(c(1,3,2,4,5), c(1,1,1,5,5)) date() rsq -lsfit(X, array(c(Y), dim = c(t.length, prod(d.dim[2:4]$coef[2,] #coef for first non-const pred names(rsq) - prod(d.dim[2:4]) rsq - array(rsq, dim = d.dim[2:4]) date() what would be the best way to get the t-value for all coef, not only (as above illustrated for the beta value) for one predefined coef? ##- many thanks christoph __ 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] Error when downloading and installing ALL R packages
I have no idea how to solve that error, but I use the following bit of code (which I picked up from someone else on this list) to update ALL packages on CRAN and it works on 2.1.0: x - packageStatus(repositories=http://cran.r-project.org/src/contrib;) st - x$avai[Status] install.packages(rownames(st)[which(st$Status==not installed)]) May want to give it a try and see if it also produces that error. Thanks, Roger On 4/22/05, Bernd Weiss [EMAIL PROTECTED] wrote: Hi, after updating to 2.1 (see below) I am no longer able to install all R packages as mentioned at http://support.stat.ucla.edu/view.php?supportid=30. After finishing the download, I received the following error: [...] trying URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.1/xgobi_1.2- 13.zip' Content type 'application/zip' length 102623 bytes opened URL downloaded 100Kb trying URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.1/yags_4.0- 1.zip' Content type 'application/zip' length 168770 bytes opened URL downloaded 164Kb package 'AMORE' successfully unpacked and MD5 sums checked package 'AlgDesign' successfully unpacked and MD5 sums checked Error in sprintf(gettext(unable to move temp installation '%d' to '%s'), : use format %s for character objects TIA, Bernd version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status Patched major2 minor1.0 year 2005 month04 day 18 language R __ 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] ugly loop
The following code is slow and ugly: count-0 for(i in 1:nrow(ver)) for(j in 1:ncol(ver)) { count-count+1 x[count]-pt$x[ver[i,j]] y[count]-pt$y[ver[i,j]] z[count]-pt$z[ver[i,j]] } Please help me make it better. Thanks! Bill __ 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] ugly loop
maybe you want something like this: x - c(t(pt$x)) Best, --D Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Bill Simpson [EMAIL PROTECTED] To: r-help r-help@stat.math.ethz.ch Sent: Friday, April 22, 2005 2:58 PM Subject: [R] ugly loop The following code is slow and ugly: count-0 for(i in 1:nrow(ver)) for(j in 1:ncol(ver)) { count-count+1 x[count]-pt$x[ver[i,j]] y[count]-pt$y[ver[i,j]] z[count]-pt$z[ver[i,j]] } Please help me make it better. Thanks! Bill __ 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] ugly loop
On Fri, 2005-04-22 at 08:58 -0400, Bill Simpson wrote: The following code is slow and ugly: count-0 for(i in 1:nrow(ver)) for(j in 1:ncol(ver)) { count-count+1 x[count]-pt$x[ver[i,j]] y[count]-pt$y[ver[i,j]] z[count]-pt$z[ver[i,j]] } Please help me make it better. Thanks! The following should work: ver - matrix(sample(1:16, 16), ncol = 4) pt - data.frame(x = sample(1:16, 16), + y = sample(1:16, 16), + z = sample(1:16, 16)) ver [,1] [,2] [,3] [,4] [1,]895 13 [2,] 14 161 10 [3,] 122 117 [4,]634 15 pt x y z 1 6 15 15 2 9 2 3 3 11 1 5 4 14 4 10 5 13 7 14 6 1 14 7 7 15 10 4 8 10 5 12 9 4 12 2 10 8 8 13 11 16 11 1 12 7 13 9 13 2 16 11 14 3 9 16 15 5 6 8 16 12 3 6 x - pt$x[ver] y - pt$y[ver] z - pt$z[ver] x [1] 10 3 7 1 4 12 9 11 13 6 16 14 2 8 15 5 y [1] 5 9 13 14 12 3 2 1 7 15 11 4 16 8 10 6 z [1] 12 16 9 7 2 6 3 5 14 15 1 10 11 13 4 8 Keep in mind that a matrix is a vector with dims, so you can fill a vector from the matrix simply by doing the indexing with a single value, which will do the fill indexed column by column. 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] ugly loop
To clarify: I want to get rid of the loop over i,j Here is a simpler example. ver is a 2D matrix count-0 for(i in 1:nrow(ver)) for(j in 1:ncol(ver)) { count-count+1 x[count]-ver[i,j] } Bill __ 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] lsfit result - how to compute t-values for coefficients
You can try something like: fit - lsfit(X, array(Y, dim = c(t.length, prod(d.dim[2:4] rsq - sapply(ls.print(fit, print.it=FALSE)$coef.table, function(x) x[-1,c(1, 3)]) dim(rsq) - c(ncol(X), 2, dim(rsq)[2]) dimnames(rsq) - list(NULL, c(Estimate, t-value), prod(d.dim[2:4])) HTH, Andy From: Christoph Lehmann Hi I used lsfit instead of lm since I have a huge Y data-set (X being constant for all Y). Since I require the t-values for all coefficients: which would be the fastest way to compute them, eg for the example: ## using lsfit with a matrix response: t.length - 5 d.dim - c(t.length,7,8,9) # dimesions: time, x, y, z Y - array( rep(1:t.length, prod(d.dim)) + rnorm(prod(d.dim), 0, 0.1), d.dim) X - cbind(c(1,3,2,4,5), c(1,1,1,5,5)) date() rsq -lsfit(X, array(c(Y), dim = c(t.length, prod(d.dim[2:4]$coef[2,] #coef for first non-const pred names(rsq) - prod(d.dim[2:4]) rsq - array(rsq, dim = d.dim[2:4]) date() what would be the best way to get the t-value for all coef, not only (as above illustrated for the beta value) for one predefined coef? ##- many thanks christoph __ 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] ugly loop
then use x - c(t(ver)) Best, --D Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Bill Simpson [EMAIL PROTECTED] To: r-help r-help@stat.math.ethz.ch Sent: Friday, April 22, 2005 3:17 PM Subject: Re: [R] ugly loop To clarify: I want to get rid of the loop over i,j Here is a simpler example. ver is a 2D matrix count-0 for(i in 1:nrow(ver)) for(j in 1:ncol(ver)) { count-count+1 x[count]-ver[i,j] } Bill __ 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] ugly loop
Thanks Marc for your help. The following code is slow and ugly: count-0 for(i in 1:nrow(ver)) for(j in 1:ncol(ver)) { count-count+1 x[count]-pt$x[ver[i,j]] y[count]-pt$y[ver[i,j]] z[count]-pt$z[ver[i,j]] } Please help me make it better. Thanks! The following should work: ver - matrix(sample(1:16, 16), ncol = 4) pt - data.frame(x = sample(1:16, 16), + y = sample(1:16, 16), + z = sample(1:16, 16)) ver [,1] [,2] [,3] [,4] [1,]895 13 [2,] 14 161 10 [3,] 122 117 [4,]634 15 pt x y z 1 6 15 15 2 9 2 3 3 11 1 5 4 14 4 10 5 13 7 14 6 1 14 7 7 15 10 4 8 10 5 12 9 4 12 2 10 8 8 13 11 16 11 1 12 7 13 9 13 2 16 11 14 3 9 16 15 5 6 8 16 12 3 6 x - pt$x[ver] y - pt$y[ver] z - pt$z[ver] This doesn't give the same results as my original code -- it scrambles the order. OK I will explain my example. pts contains the x, y, z coordinates of some 3D points. These points are the vertices of 3D triangles. ver contains the indexes into pts. each line of ver contains 3 vertices -- they are the corners of a triangle. For example, if line 1 of ver is 10 9 7 That means I need to draw a triangle whose coordinates are pt$x[10],pt$y[10],pt$z[10] pt$x[9],pt$y[9],pt$z[9] pt$x[7],pt$y[7],pt$z[7] Now it should be clear why the ordering is critical. I am using rgl.triangles() to plot. It requires the x,y,z coordinates in the order I gave in my original code. Cheers Bill __ 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] ugly loop
Almost there; you need the transpose of v, since Bill originally had columns changing faster: e.g. x - pt$x[t(ver)] -Original Message- From: Marc Schwartz [EMAIL PROTECTED] Sent: Apr 22, 2005 9:17 AM To: Bill Simpson [EMAIL PROTECTED] Cc: R-Help r-help@stat.math.ethz.ch Subject: Re: [R] ugly loop On Fri, 2005-04-22 at 08:58 -0400, Bill Simpson wrote: The following code is slow and ugly: count-0 for(i in 1:nrow(ver)) for(j in 1:ncol(ver)) { count-count+1 x[count]-pt$x[ver[i,j]] y[count]-pt$y[ver[i,j]] z[count]-pt$z[ver[i,j]] } Please help me make it better. Thanks! The following should work: ver - matrix(sample(1:16, 16), ncol = 4) pt - data.frame(x = sample(1:16, 16), + y = sample(1:16, 16), + z = sample(1:16, 16)) ver [,1] [,2] [,3] [,4] [1,]895 13 [2,] 14 161 10 [3,] 122 117 [4,]634 15 pt x y z 1 6 15 15 2 9 2 3 3 11 1 5 4 14 4 10 5 13 7 14 6 1 14 7 7 15 10 4 8 10 5 12 9 4 12 2 10 8 8 13 11 16 11 1 12 7 13 9 13 2 16 11 14 3 9 16 15 5 6 8 16 12 3 6 x - pt$x[ver] y - pt$y[ver] z - pt$z[ver] x [1] 10 3 7 1 4 12 9 11 13 6 16 14 2 8 15 5 y [1] 5 9 13 14 12 3 2 1 7 15 11 4 16 8 10 6 z [1] 12 16 9 7 2 6 3 5 14 15 1 10 11 13 4 8 Keep in mind that a matrix is a vector with dims, so you can fill a vector from the matrix simply by doing the indexing with a single value, which will do the fill indexed column by column. 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] ugly loop
On Fri, 2005-04-22 at 09:31 -0400, Bill Simpson wrote: Thanks Marc for your help. The following code is slow and ugly: count-0 for(i in 1:nrow(ver)) for(j in 1:ncol(ver)) { count-count+1 x[count]-pt$x[ver[i,j]] y[count]-pt$y[ver[i,j]] z[count]-pt$z[ver[i,j]] } Please help me make it better. Thanks! The following should work: ver - matrix(sample(1:16, 16), ncol = 4) pt - data.frame(x = sample(1:16, 16), + y = sample(1:16, 16), + z = sample(1:16, 16)) ver [,1] [,2] [,3] [,4] [1,]895 13 [2,] 14 161 10 [3,] 122 117 [4,]634 15 pt x y z 1 6 15 15 2 9 2 3 3 11 1 5 4 14 4 10 5 13 7 14 6 1 14 7 7 15 10 4 8 10 5 12 9 4 12 2 10 8 8 13 11 16 11 1 12 7 13 9 13 2 16 11 14 3 9 16 15 5 6 8 16 12 3 6 x - pt$x[ver] y - pt$y[ver] z - pt$z[ver] This doesn't give the same results as my original code -- it scrambles the order. OK I will explain my example. pts contains the x, y, z coordinates of some 3D points. These points are the vertices of 3D triangles. ver contains the indexes into pts. each line of ver contains 3 vertices -- they are the corners of a triangle. For example, if line 1 of ver is 10 9 7 That means I need to draw a triangle whose coordinates are pt$x[10],pt$y[10],pt$z[10] pt$x[9],pt$y[9],pt$z[9] pt$x[7],pt$y[7],pt$z[7] Now it should be clear why the ordering is critical. I am using rgl.triangles() to plot. It requires the x,y,z coordinates in the order I gave in my original code. That's what I get for not comparing your results against my own. I just noted that you are going by row and not by column. So, using the same data above: count-0 for(i in 1:nrow(ver)) + for(j in 1:ncol(ver)) + { + count-count+1 + x[count]-pt$x[ver[i,j]] + y[count]-pt$y[ver[i,j]] + z[count]-pt$z[ver[i,j]] + } x [1] 10 4 13 2 3 12 6 8 7 9 16 15 1 11 14 5 y [1] 5 12 7 16 9 3 15 8 13 2 11 10 14 1 4 6 z [1] 12 2 14 11 16 6 15 13 9 3 1 4 7 5 10 8 Thus, I just need to use t(ver) instead of ver: x - pt$x[t(ver)] y - pt$y[t(ver)] z - pt$z[t(ver)] x [1] 10 4 13 2 3 12 6 8 7 9 16 15 1 11 14 5 y [1] 5 12 7 16 9 3 15 8 13 2 11 10 14 1 4 6 z [1] 12 2 14 11 16 6 15 13 9 3 1 4 7 5 10 8 That should do it? HTH, Marc Off to make another pot of coffee __ 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] Installing packages from source on WindowsXP
Ok, I uninstalled my copy of HHW (and deleted the extra file from the Rtools/bin folder), and reinstalled from the murdoch-sutherland site. From what I read there I think it's the same version, and I actually get a warning that I already have a newer version installed on my machine (1.3.1) anyways. Just for good measure I installed it to C:\HTMLHelpWorkshop, instead of the default location in Program Files\HTML Help Workshop, in case the spaces in the folder names was an issue. I updated the Path variable and voila, everything seems to be working fine. So, whatever the actual problem was, it's gone now. Magic. Thanks!! On a related note, now that I seem to be on top of installing packages from source files, is there any advantage to installing the R software itself from source files? From the help files that sounds even trickier... Tyler -- Tyler Smith PhD Candidate Department of Plant Science McGill University CANADA [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
[R] density estimation
hello sorry for my english I would like estimate density for multivariate variable,( f(x,y) , f(x,y ,z) for example) ; for calculate mutual information how is posible with R? thanks Bernard Bernard Palagos Unité Mixte de Recherche Cemagref - Agro.M - CIRAD Information et Technologie pour les Agro-Procédés Cemagref - BP 5095 34033 MONTPELLIER Cedex 1 France http://www.montpellier.cemagref.fr/teap/default.htm Tel: 04 67 04 63 13 Fax: 04 67 04 37 82 [[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] ugly loop
On Fri, 22 Apr 2005, Marc Schwartz wrote: Thus, I just need to use t(ver) instead of ver: x - pt$x[t(ver)] y - pt$y[t(ver)] z - pt$z[t(ver)] That should do it? Yep!! Thanks very much Marc and others who suggested this. Cheers Bill __ 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] Installing packages from source on WindowsXP
Tyler Smith wrote: Ok, I uninstalled my copy of HHW (and deleted the extra file from the Rtools/bin folder), and reinstalled from the murdoch-sutherland site. From what I read there I think it's the same version, and I actually get a warning that I already have a newer version installed on my machine (1.3.1) anyways. Just for good measure I installed it to C:\HTMLHelpWorkshop, instead of the default location in Program Files\HTML Help Workshop, in case the spaces in the folder names was an issue. I updated the Path variable and voila, everything seems to be working fine. So, whatever the actual problem was, it's gone now. Magic. Thanks!! On a related note, now that I seem to be on top of installing packages from source files, is there any advantage to installing the R software itself from source files? From the help files that sounds even trickier... Yes, there some advantages, for example: - if you want to change something in the sources - if you want to link against some CPU optimized linear algebra system such as Goto's BLAS, etc. But if you want to use R as is anyway (as most several users do), you won't have advantages from my point of view. Uwe Ligges Tyler __ 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] hi: I am newbie for R too...
I have so much questions about using R...but i will try my best to solve myself before bothering you guys firstly...yes no maleold 13070 young34 48 female old5060 young7923 can I do a chisq.test for such contingency table?cuz...it is not 2 dimension is there any other method to test the independency to the answer for the factors (male, female) (old, young) or you guys will suggest me to add them up and do chosq.test 2 times.. thank you... [[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] Installing packages from source on WindowsXP
On Fri, 2005-04-22 at 09:46 -0400, Tyler Smith wrote: Ok, I uninstalled my copy of HHW (and deleted the extra file from the Rtools/bin folder), and reinstalled from the murdoch-sutherland site. From what I read there I think it's the same version, and I actually get a warning that I already have a newer version installed on my machine (1.3.1) anyways. Just for good measure I installed it to C:\HTMLHelpWorkshop, instead of the default location in Program Files\HTML Help Workshop, in case the spaces in the folder names was an issue. I updated the Path variable and voila, everything seems to be working fine. So, whatever the actual problem was, it's gone now. Magic. Thanks!! On a related note, now that I seem to be on top of installing packages from source files, is there any advantage to installing the R software itself from source files? From the help files that sounds even trickier... Tyler R Windows FAQ 2.17 R can't find my file, but I know it is there! ... Another possible source of grief is spaces in folder names. ... Also, from the R Admin Manual (page 35): Do not use filepaths containing spaces If you want to compile from source, be sure to completely review the R Admin Manual for details on this process under Windows. There are some potential advantages relative to using optimized libraries (ie. BLAS). These are mentioned in the Admin Manual. 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] Factor Analysis functions...
hi all, In the library ade4, there are two eigenanalysis which enable the ordination of the categorical variables. 1- Multiple Correspondence Analysis (MCA, Tenenhaus Young 1985) performs the multiple correspondence analysis of a factor table (see the function dudi.acm). this function is equivalent to functions mca of the library(MASS) 2- the mixed factorial analysis (Hill Smith 1976) enables the ordination of tables mixing quantitative variables and factors (functions dudi.mix or dudi.hillsmith). I hope this helps, P.BADY At 15:47 21/04/2005 -0500, Chris Bergstresser wrote: Hi all -- I'm running a Factor Analysis on my dataset, and I've located the factanal() and princomp() methods. I don't want to do a PCA, so it looks like I should use factanal(), but factanal() requires specifying the number of factors you expect from the analysis. Are there any packages out there explicitly for Exploratory Factor Analysis that do not require specifying the number of expected factors? -- Chris __ 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 Pierre BADY °) Université Claude Bernard Lyon 1 UMR CNRS 5023, LEHF bat Alphonse Forel 43 boulevard du 11 novembre 1918 F-69622 VILLEURBANNE CEDEX FRANCE TEL : +33 (0)4 72 44 62 34 FAX : +33 (0)4 72 43 28 92 MEL : [EMAIL PROTECTED] http://limnologie.univ-lyon1.fr http://pierre.bady.free.fr (in construction) [[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] Problem with R-2.1.0: install.packages() doesn't work
Waichler, Scott R wrote: I installed R-2.1.0 from source on a Linux box running Red Hat Enterprise Linux WS release 4 but install.packages() wouldn't work (see below). When I install R-2.0.1 from RPM on the same system, everything is fine. Version 2.1.0 (2005-04-18), ISBN 3-900051-07-0 . . . options(CRAN = http://cran.fhcrc.org/;) options(CRAN = ...) is outdated. See ?options. install.packages(rgenoud) --- Please select a CRAN mirror for use in this session --- Error in inherits(x, factor) : Object res not found Quite probably you have no X11 connection to this machine. R tries to ask you which CRAN mirror you are going to choose, and it fails to present the tcltk window. You might want to call chooseCRANmirror(graphics=FALSE) and setRepositories(graphics=FALSE) prior to install.packages(). Uwe Ligges Scott Waichler Pacific Northwest National Laboratory [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 __ 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 R-2.1.0: install.packages() doesn't work
Manuel Morales [EMAIL PROTECTED] writes: On Fri, 2005-04-22 at 17:48 +0200, Uwe Ligges wrote: Waichler, Scott R wrote: I installed R-2.1.0 from source on a Linux box running Red Hat Enterprise Linux WS release 4 but install.packages() wouldn't work (see below). install.packages(rgenoud) --- Please select a CRAN mirror for use in this session --- Error in inherits(x, factor) : Object res not found Quite probably you have no X11 connection to this machine. R tries to ask you which CRAN mirror you are going to choose, and it fails to present the tcltk window. You might want to call chooseCRANmirror(graphics=FALSE) and setRepositories(graphics=FALSE) prior to install.packages(). Uwe Ligges I have the same problem after building R-2.1.0 from source on Fedora Core 3. The suggestion above fixes this, but what do you mean by Quite probably you have no X11 connection on this machine? I'm guessing you don't mean that X11 is not running (I use Gnome for my desktop). Gnome runs on top of X11, so that's not possible. However, if you're running remotely, or for some reason lost your DISPLAY setting, you might not have a connection to X11. There's a buglet somewhere. AFAICS, we end up calling chooseCRANmirror() with the default graphics=TRUE, even when capabilities(X11) is FALSE. Probably easiest to fix inside menu(), so that it produces the text menu if asked for a graphics menu with insufficient capabilities. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- 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] Problem with R-2.1.0: install.packages() doesn't work
On Fri, 2005-04-22 at 15:44 -0400, Manuel Morales wrote: On Fri, 2005-04-22 at 17:48 +0200, Uwe Ligges wrote: Waichler, Scott R wrote: I installed R-2.1.0 from source on a Linux box running Red Hat Enterprise Linux WS release 4 but install.packages() wouldn't work (see below). install.packages(rgenoud) --- Please select a CRAN mirror for use in this session --- Error in inherits(x, factor) : Object res not found Quite probably you have no X11 connection to this machine. R tries to ask you which CRAN mirror you are going to choose, and it fails to present the tcltk window. You might want to call chooseCRANmirror(graphics=FALSE) and setRepositories(graphics=FALSE) prior to install.packages(). Uwe Ligges I have the same problem after building R-2.1.0 from source on Fedora Core 3. The suggestion above fixes this, but what do you mean by Quite probably you have no X11 connection on this machine? I'm guessing you don't mean that X11 is not running (I use Gnome for my desktop). Manuel For both Scott and Manuel, Can you post back with the output of: capabilities() It should look something like: capabilities() jpeg pngtcltk X11 http/ftp sockets libxml fifo TRUE TRUE TRUE TRUE TRUE TRUE TRUE TRUE cledit IEEE754iconv TRUE TRUE TRUE Pay attention specifically to the values under 'tcltk' and 'X11'. Having built from source tarballs, I am wondering if something got borked in the build of the tcltk package or you don't have the X11 (xorg) devel RPMS installed. If the latter problem (X11) is the issue, you should not be able to create any plots to the screen either so try: plot(1:10) and see if a graphic window comes up. 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] Problem with R-2.1.0: install.packages() doesn't work
Roger D. Peng wrote: What happens if you don't set the 'CRAN' option via 'options()' first and just run 'install.packages()'? Should be the same as long as no CRAN mirror has been choosen and X11 is not accessible (see my other message). The code needs to be a bit more defensive here - or present a better error message. Uwe Ligges -roger Waichler, Scott R wrote: I installed R-2.1.0 from source on a Linux box running Red Hat Enterprise Linux WS release 4 but install.packages() wouldn't work (see below). When I install R-2.0.1 from RPM on the same system, everything is fine. Version 2.1.0 (2005-04-18), ISBN 3-900051-07-0 . . . options(CRAN = http://cran.fhcrc.org/;) install.packages(rgenoud) --- Please select a CRAN mirror for use in this session --- Error in inherits(x, factor) : Object res not found Scott Waichler Pacific Northwest National Laboratory [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 __ 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] an interesting qqnorm question
Hi, r-gurus: I happened to have a question in my work: I have a dataset, which has only one dimention, like 0.99037297527605 0.991179836732708 0.995635340631367 0.997186769599305 0.991632565640424 0.984047197106486 0.99225943762649 1.00555642128421 0.993725402926564 the data is saved in a file called f392.txt. I used the following codes to play around :) k-read.table(f392.txt, header=F)# read into k kk-k[[1]] l-qqnorm(kk) diff=c() lenk-length(kk) i=1 while (i=lenk){ diff[i]=l$y[i]-l$x[i] # save the difference of therotical quantile and sample quantile # remember, my sample mean is around 1 while the therotical one, 0 i-i+1 } hist(diff, breaks=300) # analyze the distr of such diff qqnorm(diff) my question is: from l-qqnorm(kk), I wanted to know, from which point (or cut), the sample points start to become away from therotical ones. That's the reason I played around the diff list, which gives me the difference. To my surprise, the diff is perfectly normal. I tried to use some kk-c(1, 2, 5, -1 , ...) to test, I concluded it must be some distribution my sample follows gives this finding. So, any suggestion on the distribution of my sample? I think there might be some mathematical inference which can leads this observation, but not quite sure. btw, fitdistr(kk, 't') m s df 9.65e-01 7.630770e-03 3.742244e+00 (5.317674e-05) (5.373884e-05) (8.584725e-02) btw2, can anyone suggest a way to find the cut or threshold from my sample to discretize them into 3 groups: two tail-group and one main group.- my focus. Thanks, Ed __ 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] if(foo == TRUE) .. etc
Great suggestion; it made me change all my Ts/Fs to TRUE/FALSE. Given F - TRUE T - FALSE is it possible to forbid T to stand for TRUE, and F for FALSE in function(...,something=T)? Or, alternatively, never allow F - whatever and T - whatever? I don't know what the technical side is, but I think it would be much better if this particular blunder (major, yet rather easy to overlook) was impossible to make. -Original Message- From: Martin Maechler [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 20, 2005 8:31 AM To: R-help@stat.math.ethz.ch Subject: [R] if(foo == TRUE) .. etc Andy == Andy Bunn [EMAIL PROTECTED] on Tue, 19 Apr 2005 10:27:04 -0400 writes: . Andy is.tuesday - as.POSIXlt(Sys.time())$wday == 2 Andy if (is.tuesday == T) { } . aaah, this really hurts my eyes or rather the brain behind! And it's by far not the first such instance... Rather use if (is.tuesday) { } More generally, please, please, everyone : Replace if (something == TRUE) withif (something) and if (something.or.other == FALSE) withif (!something.or.other) {and even more for cases where you have 'T' and 'F' instead of 'TRUE' and 'FALSE' - which is against all recommendations, since F - TRUE T - FALSE are valid statements, probably not common, but think what happens when you accidentally have the equivalent of T - 0 somewhere in your global enviroment! } Martin Maechler, ETH Zurich __ 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] Help needed with lattice graph!
Well done ! The result of your work has been uploaded to the gallery (graph 48). Romain Le 22.04.2005 22:39, Paul Murrell a écrit : Hi Deepayan Sarkar wrote: On Friday 22 April 2005 03:29, Sander Oom wrote: Dear R users, If I manage to sort out this graph, it is certainly a candidate for the new R graph gallery (http://addictedtor.free.fr/graphiques/displayGallery.php)! I created the following lattice graph: library(lattice) tmp - expand.grid(geology = c(Sand,Clay,Silt,Rock), species = c(ArisDiff,BracSera,CynDact,ElioMuti,EragCurS,EragPseu), dist = seq(1,9,1) ) tmp$height - rnorm(216) sps - trellis.par.get(superpose.symbol) sps$pch - 1:6 trellis.par.set(superpose.symbol, sps) xyplot( height ~ dist | geology, data = tmp, groups = species, type = b, cex = 1.2, layout = c(2,2), lines = list(col=grey), key = list(columns = 2, type = b, cex = 1.2, text = list(paste(unique(tmp$species))), points = Rows(sps, 1:6) ) ) I would do something like this instead: --- library(lattice) lattice.options(default.theme = canonical.theme(color = FALSE)) tmp - expand.grid(geology = c(Sand,Clay,Silt,Rock), species = c(ArisDiff, BracSera, CynDact, ElioMuti, EragCurS, EragPseu), dist = seq(1,9,1) ) tmp$height - rnorm(216) sp - list(superpose.symbol = list(pch = 1:6, cex = 1.2), superpose.line = list(col = grey, lty = 1)) xyplot(height ~ dist | geology, data = tmp, groups = species, type = b,layout = c(2,2), par.settings = sp, auto.key = list(columns = 2, lines = TRUE)) - However, for once, the R defaults are not to my liking. I plot the graph to postscript and the result is less then optimal. I would like to plot the point symbols in black and white, both in the graphs and the key. I would like the lines to be a single style (grey or a light dash) and preferably the lines do not go through the symbols (like figure 4.11 in the MASS book). type='b' is the right choice, and it works in standard graphics, but not in lattice (where it's same as type='o'). If you really want it, bug Paul to add support for it in grid. [Paul exhibits bug-avoidance behaviour by suggesting a low-level workaround ...] xyplot(height ~ dist | geology, data = tmp, groups = species, layout = c(2,2), panel = function(x, y, type, ...) { panel.superpose(x, y, type=l, ...) lpoints(x, y, pch=16, col=white, cex=2) panel.superpose(x, y, type=p...) }, par.settings = sp, auto.key = list(columns = 2, lines = TRUE)) To get the points and lines combined in the key, you could do xyplot(height ~ dist | geology, data = tmp, groups = species, type = b,layout = c(2,2), par.settings = sp, key = list(columns = 2, lines = list(col=grey, type = b, cex = 1.2, pch = 1:6), text = list(levels(tmp$species but evidently there's no way to separately control the color of the line and the points on it. 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 -- ~ ~~ Romain FRANCOIS - http://addictedtor.free.fr ~~ Etudiant ISUP - CS3 - Industrie et Services ~~http://www.isup.cicrp.jussieu.fr/ ~~ Stagiaire INRIA Futurs - Equipe SELECT ~~ http://www.inria.fr/recherche/equipes/select.fr.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] Error when downloading and installing ALL R packages
Bernd Weiss wrote: Hi, after updating to 2.1 (see below) I am no longer able to install all R packages as mentioned at http://support.stat.ucla.edu/view.php?supportid=30. After finishing the download, I received the following error: [...] trying URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.1/xgobi_1.2- 13.zip' Content type 'application/zip' length 102623 bytes opened URL downloaded 100Kb trying URL 'http://www.stats.ox.ac.uk/pub/RWin/bin/windows/contrib/2.1/yags_4.0- 1.zip' Content type 'application/zip' length 168770 bytes opened URL downloaded 164Kb package 'AMORE' successfully unpacked and MD5 sums checked package 'AlgDesign' successfully unpacked and MD5 sums checked Error in sprintf(gettext(unable to move temp installation '%d' to '%s'), : use format %s for character objects Maybe your disc is full or a package is already in use and one of its files is locked? Unfortunately, we don't know which packages comes after AlgDesign, because of the bug in sprintf(gettext(unable to move temp installation '%d' to '%s')) you just have discovered. Uwe Ligges TIA, Bernd version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status Patched major2 minor1.0 year 2005 month04 day 18 language R __ 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] Problem with R-2.1.0: install.packages() doesn't work
On Fri, 2005-04-22 at 15:42 -0500, Marc Schwartz wrote: On Fri, 2005-04-22 at 15:44 -0400, Manuel Morales wrote: On Fri, 2005-04-22 at 17:48 +0200, Uwe Ligges wrote: Waichler, Scott R wrote: I installed R-2.1.0 from source on a Linux box running Red Hat Enterprise Linux WS release 4 but install.packages() wouldn't work (see below). install.packages(rgenoud) --- Please select a CRAN mirror for use in this session --- Error in inherits(x, factor) : Object res not found Quite probably you have no X11 connection to this machine. R tries to ask you which CRAN mirror you are going to choose, and it fails to present the tcltk window. You might want to call chooseCRANmirror(graphics=FALSE) and setRepositories(graphics=FALSE) prior to install.packages(). Uwe Ligges I have the same problem after building R-2.1.0 from source on Fedora Core 3. The suggestion above fixes this, but what do you mean by Quite probably you have no X11 connection on this machine? I'm guessing you don't mean that X11 is not running (I use Gnome for my desktop). Manuel For both Scott and Manuel, Can you post back with the output of: capabilities() This is what I got: capabilities() jpeg pngtcltk X11 http/ftp sockets libxml fifo TRUE TRUEFALSE TRUE TRUE TRUE TRUE TRUE cledit IEEE754iconv TRUE TRUE TRUE I recompiled after downloading the tc and tk development packages, which gave tcltk as TRUE. update.packages() works if tcltk is enabled, but it seems not to revert to the non-graphical interface otherwise... __ 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 R-2.1.0: install.packages() doesn't work
On Fri, 2005-04-22 at 17:48 +0200, Uwe Ligges wrote: Waichler, Scott R wrote: I installed R-2.1.0 from source on a Linux box running Red Hat Enterprise Linux WS release 4 but install.packages() wouldn't work (see below). install.packages(rgenoud) --- Please select a CRAN mirror for use in this session --- Error in inherits(x, factor) : Object res not found Quite probably you have no X11 connection to this machine. R tries to ask you which CRAN mirror you are going to choose, and it fails to present the tcltk window. You might want to call chooseCRANmirror(graphics=FALSE) and setRepositories(graphics=FALSE) prior to install.packages(). Uwe Ligges I have the same problem after building R-2.1.0 from source on Fedora Core 3. The suggestion above fixes this, but what do you mean by Quite probably you have no X11 connection on this machine? I'm guessing you don't mean that X11 is not running (I use Gnome for my desktop). Manuel __ 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 R-2.1.0: install.packages() doesn't work
From: Uwe Ligges Waichler, Scott R wrote: I installed R-2.1.0 from source on a Linux box running Red Hat Enterprise Linux WS release 4 but install.packages() wouldn't work (see below). When I install R-2.0.1 from RPM on the same system, everything is fine. Version 2.1.0 (2005-04-18), ISBN 3-900051-07-0 . . . options(CRAN = http://cran.fhcrc.org/;) options(CRAN = ...) is outdated. See ?options. But section 5.1 of R-admin still has: quote Alternatively, packages can be downloaded and installed from within R. First set the option CRAN to your nearest CRAN mirror, for example options(CRAN = http://cran.us.r-project.org/;) (You can also supply this as the repos argument.) /quote This should probably be updated, too... Cheers, Andy install.packages(rgenoud) --- Please select a CRAN mirror for use in this session --- Error in inherits(x, factor) : Object res not found Quite probably you have no X11 connection to this machine. R tries to ask you which CRAN mirror you are going to choose, and it fails to present the tcltk window. You might want to call chooseCRANmirror(graphics=FALSE) and setRepositories(graphics=FALSE) prior to install.packages(). Uwe Ligges Scott Waichler Pacific Northwest National Laboratory [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 __ 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] Re: an interesting qqnorm question
hope it is not b/c some central limit therory, otherwise my initial plan will fail :) On 4/22/05, WeiWei Shi [EMAIL PROTECTED] wrote: Hi, r-gurus: I happened to have a question in my work: I have a dataset, which has only one dimention, like 0.99037297527605 0.991179836732708 0.995635340631367 0.997186769599305 0.991632565640424 0.984047197106486 0.99225943762649 1.00555642128421 0.993725402926564 the data is saved in a file called f392.txt. I used the following codes to play around :) k-read.table(f392.txt, header=F)# read into k kk-k[[1]] l-qqnorm(kk) diff=c() lenk-length(kk) i=1 while (i=lenk){ diff[i]=l$y[i]-l$x[i] # save the difference of therotical quantile and sample quantile # remember, my sample mean is around 1 while the therotical one, 0 i-i+1 } hist(diff, breaks=300) # analyze the distr of such diff qqnorm(diff) my question is: from l-qqnorm(kk), I wanted to know, from which point (or cut), the sample points start to become away from therotical ones. That's the reason I played around the diff list, which gives me the difference. To my surprise, the diff is perfectly normal. I tried to use some kk-c(1, 2, 5, -1 , ...) to test, I concluded it must be some distribution my sample follows gives this finding. So, any suggestion on the distribution of my sample? I think there might be some mathematical inference which can leads this observation, but not quite sure. btw, fitdistr(kk, 't') m s df 9.65e-01 7.630770e-03 3.742244e+00 (5.317674e-05) (5.373884e-05) (8.584725e-02) btw2, can anyone suggest a way to find the cut or threshold from my sample to discretize them into 3 groups: two tail-group and one main group.- my focus. Thanks, Ed __ 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] Help needed with lattice graph!
On Friday 22 April 2005 03:29, Sander Oom wrote: Dear R users, If I manage to sort out this graph, it is certainly a candidate for the new R graph gallery (http://addictedtor.free.fr/graphiques/displayGallery.php)! I created the following lattice graph: library(lattice) tmp - expand.grid(geology = c(Sand,Clay,Silt,Rock), species = c(ArisDiff,BracSera,CynDact,ElioMuti,EragCurS,EragPseu), dist = seq(1,9,1) ) tmp$height - rnorm(216) sps - trellis.par.get(superpose.symbol) sps$pch - 1:6 trellis.par.set(superpose.symbol, sps) xyplot( height ~ dist | geology, data = tmp, groups = species, type = b, cex = 1.2, layout = c(2,2), lines = list(col=grey), key = list(columns = 2, type = b, cex = 1.2, text = list(paste(unique(tmp$species))), points = Rows(sps, 1:6) ) ) I would do something like this instead: --- library(lattice) lattice.options(default.theme = canonical.theme(color = FALSE)) tmp - expand.grid(geology = c(Sand,Clay,Silt,Rock), species = c(ArisDiff, BracSera, CynDact, ElioMuti, EragCurS, EragPseu), dist = seq(1,9,1) ) tmp$height - rnorm(216) sp - list(superpose.symbol = list(pch = 1:6, cex = 1.2), superpose.line = list(col = grey, lty = 1)) xyplot(height ~ dist | geology, data = tmp, groups = species, type = b, layout = c(2,2), par.settings = sp, auto.key = list(columns = 2, lines = TRUE)) - However, for once, the R defaults are not to my liking. I plot the graph to postscript and the result is less then optimal. I would like to plot the point symbols in black and white, both in the graphs and the key. I would like the lines to be a single style (grey or a light dash) and preferably the lines do not go through the symbols (like figure 4.11 in the MASS book). type='b' is the right choice, and it works in standard graphics, but not in lattice (where it's same as type='o'). If you really want it, bug Paul to add support for it in grid. To get the points and lines combined in the key, you could do xyplot(height ~ dist | geology, data = tmp, groups = species, type = b, layout = c(2,2), par.settings = sp, key = list(columns = 2, lines = list(col=grey, type = b, cex = 1.2, pch = 1:6), text = list(levels(tmp$species but evidently there's no way to separately control the color of the line and the points on it. 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] R 2.1.0 for Windows installation error? atanh not in R.dll?
[EMAIL PROTECTED] wrote: Could someone please tell me what I did wrong to create this message or what I should do to correct this problem? I downloaded 2.1.0 Windows binary and installed into C:/R/rw2010, using the installer. I ran md5check.exe in C:/R/rw2010/bin/ and got No errors. The problem is this: When I start up Rgui.exe from its shortcut (target= C:\R\rw2010\bin\Rgui.exe --save -sdi, Start in C:\R\rw2010), I get a message box with: R Console: Rgui.exe - Entry Point Not Found The procedure entry point atanh could not be located in the dynamic link library R.dll. and the console shows: Error in dyn.load(x, as.logical(local), as.logical(now)) : unable to load shared library 'C:/R/rw2001pat/library/stats/libs/stats.dll': ^^ So may I guess that you have an R session of R-2.0.1 patched still *running* that uses stats.dll, and since Windows caches this file, it doesn't load the correct one when trying to access the one for R-2.1.0. If not: Which version of Windows is this, and is the message above the right one you got from R-2.1.0? Why do you have installed it in rw2001pat, then? LoadLibrary failure: The specified procedure could not be found. During startup - Warning message: package stats in options(defaultPackages) was not found I also tried 2.1.0 patched and got the same results. Of course, I cannot do much without the stats package. stats.dll does exist in that location: [EMAIL PROTECTED] /cygdrive/c/R/rw2010/library/stats/libs R for Windows is *not* supposed to run in a cygwin environment. Uwe Ligges $ ls -lA total 207 -rwx--+ 1 davidr 211456 Apr 18 08:19 stats.dll version info: platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor1.0 year 2005 month04 day 18 language R I do have several other versions of R installed in other subdirectories under C:/R/. I have searched the archives to no avail. Thanks in advance for any assistance. David L. Reiner Rho Trading 440 S. LaSalle St -- Suite 620 Chicago IL 60605 312-362-4963 (voice) 312-362-4941 (fax) __ 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] Hoaglin Outlier Method
That looks just like how `outliers' are determined in boxplots. You can use the output of boxplot.stats() to compute the limits. [EDA purists would tell you that those shound be letter values (or `F' for fourths), not quartiles.] HTH, Andy -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Friday, April 22, 2005 11:23 AM To: r-help@stat.math.ethz.ch Subject: [R] Hoaglin Outlier Method I am a new user of R so please bear with me. I have reviewed some R books, FAQs and such but the volume of material is great. I am in the process of porting my current SAS and SVS Script code to Lotus Approach, R and WordPerfect. My question is, can you help me determine the best R method to implement the Hoaglin Outlier Method? It is used in the Appendix A and B of the fo llowing link. http://trb.org/publications/nchrp/nchrp_w71.pdf The sample data from Appendix A for determining outliers in R: T314Data - structure(list(Lab = as.integer(c(1:60)), X = c(4.89, 3.82, 2.57, 2.3, 2.034, 2, 1.97, 1.85, 1.85, 1.85, 1.84, 1.82, 1.82, 1.77, 1.76, 1.67, 1.66, 1.63, 1.62, 1.62, 1.55, 1.54, 1.54, 1.53, 1.53, 1.44, 1.428, 1.42, 1.39, 1.36, 1.35, 1.31, 1.28, 1.24, 1.24, 1.23, 1.22, 1.21, 1.19, 1.18, 1.18, 1.18, 1.17, 1.16, 1.13, 1.13, 1.099, 1.09, 1.09, 1.08, 1.07, 1.05, 0.98, 0.97, 0.84, 0.808, 0.69, 0.63, 0.6, 0.5), Y = c(5.28, 3.82, 2.41, 2.32, 2.211, 1.46, 2.24, 1.91, 1.78, 1.63, 1.81, 1.92, 1.2, 1.67, 1.28, 1.59, 1.45, 2.06, 1.91, 1.19, 1.26, 1.79, 1.39, 1.48, 0.72, 1.29, 1.517, 1.71, 1.12, 1.38, 0.93, 1.36, 1.2, 1.23, 0.71, 1.29, 1.26, 1.48, 1.26, 1.33, 1.21, 1.04, 1.57, 1.42, 1.08, 1.04, 1.33, 1.33, 1.2, 1.05, 1.24, 0.91, 0.99, 1.06, 1.27, 0.702, 0.77, 0.58, 1, 0.38)), .Names = c(Lab, X, Y ), class = data.frame, row.names = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60 )) From this point on, I could use your advise. There are several other methods for determining outliers in R. I'd rather not re-invent the wheel or use a brute strength and force method if there is a better way in R. Our usual method for determining outliers is a student's T test as in ASTM E 178 or when the standard deviation for a lab is 3 or more. We normally have 120 labs to evaluate for outliers similar what is shown in T312Data. On occasion, I have used the Wilk-Shapiro W statistic in SAS. A point in the right direction or an R code example would help greatly. After I trim the outliers, I will need to show which labs were eliminated but that should be fairly trivial. The reference in Appendix A is: Hoaglin, D. C., Iglewicz, B., Tukey, J. W., Performance of Some Resistant Rules for Outlier Labeling, Journal of the American Statistical Association, Vol. 81, No. 396 (Dec., 1986), pp. 991-999. The ASTM E 178 reference is: Shapiro, S. S., and Wilk, M. B., An Analysis of Variance Test for Non-Normality (Complete Samples), Biometrika, BIOKA, Vol 52, 1965, pp. 591-611. Kenneth Ray Hobson, P.E. Oklahoma DOT - QA IAS Manager 200 N.E. 21st Street Oklahoma City, OK 73105-3204 (405) 522-4985, (405) 522-0552 fax __ 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] Help needed with lattice graph!
Hi Deepayan Sarkar wrote: On Friday 22 April 2005 03:29, Sander Oom wrote: Dear R users, If I manage to sort out this graph, it is certainly a candidate for the new R graph gallery (http://addictedtor.free.fr/graphiques/displayGallery.php)! I created the following lattice graph: library(lattice) tmp - expand.grid(geology = c(Sand,Clay,Silt,Rock), species = c(ArisDiff,BracSera,CynDact,ElioMuti,EragCurS,EragPseu), dist = seq(1,9,1) ) tmp$height - rnorm(216) sps - trellis.par.get(superpose.symbol) sps$pch - 1:6 trellis.par.set(superpose.symbol, sps) xyplot( height ~ dist | geology, data = tmp, groups = species, type = b, cex = 1.2, layout = c(2,2), lines = list(col=grey), key = list(columns = 2, type = b, cex = 1.2, text = list(paste(unique(tmp$species))), points = Rows(sps, 1:6) ) ) I would do something like this instead: --- library(lattice) lattice.options(default.theme = canonical.theme(color = FALSE)) tmp - expand.grid(geology = c(Sand,Clay,Silt,Rock), species = c(ArisDiff, BracSera, CynDact, ElioMuti, EragCurS, EragPseu), dist = seq(1,9,1) ) tmp$height - rnorm(216) sp - list(superpose.symbol = list(pch = 1:6, cex = 1.2), superpose.line = list(col = grey, lty = 1)) xyplot(height ~ dist | geology, data = tmp, groups = species, type = b, layout = c(2,2), par.settings = sp, auto.key = list(columns = 2, lines = TRUE)) - However, for once, the R defaults are not to my liking. I plot the graph to postscript and the result is less then optimal. I would like to plot the point symbols in black and white, both in the graphs and the key. I would like the lines to be a single style (grey or a light dash) and preferably the lines do not go through the symbols (like figure 4.11 in the MASS book). type='b' is the right choice, and it works in standard graphics, but not in lattice (where it's same as type='o'). If you really want it, bug Paul to add support for it in grid. [Paul exhibits bug-avoidance behaviour by suggesting a low-level workaround ...] xyplot(height ~ dist | geology, data = tmp, groups = species, layout = c(2,2), panel = function(x, y, type, ...) { panel.superpose(x, y, type=l, ...) lpoints(x, y, pch=16, col=white, cex=2) panel.superpose(x, y, type=p...) }, par.settings = sp, auto.key = list(columns = 2, lines = TRUE)) To get the points and lines combined in the key, you could do xyplot(height ~ dist | geology, data = tmp, groups = species, type = b, layout = c(2,2), par.settings = sp, key = list(columns = 2, lines = list(col=grey, type = b, cex = 1.2, pch = 1:6), text = list(levels(tmp$species but evidently there's no way to separately control the color of the line and the points on it. 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 -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [EMAIL PROTECTED] http://www.stat.auckland.ac.nz/~paul/ __ 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] shared library configuration; Gnome GUI
Hello, everybody: On a Fedora Core 3 Linux system, I built R-2.1 using an updated version of the spec file that was used to make the RPMs for version 2.0.1 on the CRAN system. The build was fine, and packages updates perfectly. Thanks! Then I got curious about the package gnomeGUI. While trying to build that, I see errors = * Installing *Frontend* package 'gnomeGUI' ... Using R Installation in R_HOME=/usr/lib/R R was not built as a shared library Need a shared R library ERROR: configuration failed for package 'gnomeGUI' === So then I look back at re-building R, and see ./configure --help I see these two items that seem to contradict each other. Why is the first defaulted to no and the second one yes? What's the difference? --enable-R-shlibbuild R as a shared library [no] [...snip...] --enable-shared[=PKGS] build shared libraries [default=yes] I built with --enable-R-shlib and all seemed fine. Anyway, it turns out it was all for nothing, because the Gnome package wants the Gnome-1.4 libraries, whereas I have 2.0X. So, I'm going to forget about gnomeGUI, but I wonder: did I do any harm by building R with the non-default --enable-R-shared? Can it potentially break something? As far as I can see, new R runs great. -- Paul E. Johnson email: [EMAIL PROTECTED] Dept. of Political Sciencehttp://lark.cc.ku.edu/~pauljohn 1541 Lilac Lane, Rm 504 University of Kansas Office: (785) 864-9086 Lawrence, Kansas 66044-3177 FAX: (785) 864-5700 __ 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] dr ()
Hi all-- A quick question about the dr () function. I am using this function to reduce the dimensions of a data set I have that involves 14 predictor variables and one predictant or response. The goal is to discover which variables play the most important role in determining the response and, thus, to reduce the variables. I would like to use the sliced inverse regression method (SIR) within this function but each time I specify 8 slices, it only performs 5 slices. Any suggestions/thoughts? THanks, Jessica __ 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] if(foo == TRUE) .. etc
From: bogdan romocea Great suggestion; it made me change all my Ts/Fs to TRUE/FALSE. Given F - TRUE T - FALSE is it possible to forbid T to stand for TRUE, and F for FALSE in function(...,something=T)? Or, alternatively, never allow F - whatever and T - whatever? I don't know what the technical side is, but I think it would be much better if this particular blunder (major, yet rather easy to overlook) was impossible to make. R FAQ 3.3, bullet #3: In R, T and F are just variables being set to TRUE and FALSE, respectively, but are not reserved words as in S and hence can be overwritten by the user. (This helps e.g. when you have factors with levels T or F.) Hence, when writing code you should always use TRUE and FALSE. If T and F are changed as you suggested above, it will break S compatibility in lots of code. Andy -Original Message- From: Martin Maechler [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 20, 2005 8:31 AM To: R-help@stat.math.ethz.ch Subject: [R] if(foo == TRUE) .. etc Andy == Andy Bunn [EMAIL PROTECTED] on Tue, 19 Apr 2005 10:27:04 -0400 writes: . Andy is.tuesday - as.POSIXlt(Sys.time())$wday == 2 Andy if (is.tuesday == T) { } . aaah, this really hurts my eyes or rather the brain behind! And it's by far not the first such instance... Rather use if (is.tuesday) { } More generally, please, please, everyone : Replace if (something == TRUE) withif (something) and if (something.or.other == FALSE) withif (!something.or.other) {and even more for cases where you have 'T' and 'F' instead of 'TRUE' and 'FALSE' - which is against all recommendations, since F - TRUE T - FALSE are valid statements, probably not common, but think what happens when you accidentally have the equivalent of T - 0 somewhere in your global enviroment! } Martin Maechler, ETH Zurich __ 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
[R] Need help arranging the plot in different fashion than the default format
I want to change the way the plot is appearing in the barchart .. testdata - as.data.frame(t(structure(c(1,2004,LV1,3.8,2,87,2,2004,LV1,3.2,3,28,3,2004,LV1,3.4,3,88,4,2004,LV1,3,2,26,5,2004,LV1,3.8,2,87,6,2004,LV1,3.2,3,28,7,2004,LV1,3.4,3,88,8,2004,LV1,3,2,26,9,2004,LV1,3.8,2,87,10,2004,LV1,3.2,3,28,11,2004,LV1,3.4,3,88,12,2004,LV1,3,2,26,1,2005,LV1,3.8,2,87,2,2005,LV1,3.2,3,28,3,2005,LV1,3.4,3,88,4,2005,LV1,3,2,26), .Dim=c(6,16; colnames(testdata) - c('month', 'year', 'dataset','mean','stdDev','miceCount'); testdata[c(month, mean)] - lapply(testdata[c(month, mean)], function(x) as.numeric(levels(x)[x])); testdata - testdata[do.call(order, testdata), ]; trellis.par.set(theme = col.whitebg()); barchart(month ~ mean | year, data=testdata) I want to have the years come one below the other rather than next to each other which can be achieved by layout(c(1,2)), and the x axis to be the month and the y axis to be the mean. I would really appreciate if someone can tell me how to achieve this barchart(mean ~ month | year, data=testdata, layout=c(1,2)) #doing this is not producing the intended result Any suggestion and help is greatly appreciated.. -Sandeep [[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] Problems with help.start()
Hi R users and developers: I just install the new R version 2.1.0 in a linux platform. I get this error when I call the function help.start() Making links in per-session dir ... Error in gsub(pattern, replacement, x, ignore.case, extended, fixed) : input string 28 is invalid in this locale What am I missing? (It works fine with version 2.0.1) -- Kenneth Roy Cabrera Torres Uninversidad Nacional de Colombia Sede Medellin Tel 430 9351 Cel 315 504 9339 __ 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 with POSIX
For the r script below datestr - 01/01/2004 as.POSIXct(as.Date(datestr, %d/%m/%Y)) I get the following output 2003-12-31 18:00:00 Central Standard Time Why is the date a day before. I guess its something to do with the time, but is there a way to get it to return 2004-01-01 instead? Thanks in advance... -Sandeep [[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] algorithm used in k-mean clustering
Asha Jayanthi wrote: Hi, I have used the kmean fucntion in R to produce some results for my analysis. I like to know the specific underlying algorithm used for the implementation of the function kmean in R. I tried looking for some documents but could not find any. I obtained the kmean result for k ranging from 2 to 10. When i did this initally it worked perfectly. When i tried running again i get the error Error: empty cluster: try a better set of initial centers and i have not changed anything in the code. And i get this error only for k = 2 and 10. does anyone know why it worked well intially and failed now? Asha help for all R functions available on your system can be viewed using ?function_name - e.g. in your case ?kmeans displays the help for the kmeans function. Doing this gives: ... centers: Either the number of clusters or a set of initial (distinct) cluster centres. If a number, a random set of (distinct) rows in 'x' is chosen as the initial centres. So the randomness you are experiencing is related to the choice of centers. Search the archives of this mailing list as this question was asked recently - e.g. http://tolstoy.newcastle.edu.au/R/help/05/04/1692.html Read all of ?kmeans as it has references for the algorithm used. Gav __ 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] Problem with R-2.1.0: install.packages() doesn't work
I installed R-2.1.0 from source on a Linux box running Red Hat Enterprise Linux WS release 4 but install.packages() wouldn't work (see below). When I install R-2.0.1 from RPM on the same system, everything is fine. Version 2.1.0 (2005-04-18), ISBN 3-900051-07-0 . . . options(CRAN = http://cran.fhcrc.org/;) install.packages(rgenoud) --- Please select a CRAN mirror for use in this session --- Error in inherits(x, factor) : Object res not found Scott Waichler Pacific Northwest National Laboratory [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
[R] Alternative to aggregate() for averaging
Hello, I am working with very large matrices 1 by 2000 and for each row I have a grouping vector and I would like to average each row by groups... Presently I am using this command and it behaves correctly even with NA values is the groupvector: data-aggregate(mymatrix,list(groupvector),mean) Is there a faster method Thanks! Sébastien -- Sébastien Durand Maîtrise en biologie Université de Montréal (514) 343-6864 Université du Québec à Montréal (514) 987-3000 (1572#) __ 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] defining custom survreg distributions
Dear R Helpers, I am trying to carry out survival analysis in the presence of long term survivors (immunes/cureds). This involves using a split population model (some call it a mixture model) where the assumption of eventual failure is relaxed. I am following closely the formulation by Maller and Zhou (1996). Parametric modelling in this situation involves the introduction of a new parameter, p: the proportion of susceptibles. For the Weibull the cumulative distribution function would look like: F(t) = p*[1 e^(-lambda*t)^scale] where [...] is the conventional CDF for the Weibull distribution. I have spent a fair deal of time trying to create a new survreg distribution but have made next to no progress. I understand that there are four 'primary' distributions and any other distribution can be derived from transformations of these. I am unclear how I might 'declare' this new parameter in the newly defined distribution. I am keen to establish how to do this for more than just the Weibull. Searching R-Help hasn't led me to any obvious solution. The survreg.distribution help page has an example for user-defined distributions but it only looks like a name change. Can anyone point me in the right direction? It had occurred to me that I could define the likelihood function myself and use mle() but I am uncertain whether this is appropriate for censored data. Thanks for any advice (and great software..and support), MT Michael Townsley Email: [EMAIL PROTECTED] [[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] if(foo == TRUE) .. etc
Le 22 Avril 2005 13:41, Liaw, Andy a écrit : From: bogdan romocea Great suggestion; it made me change all my Ts/Fs to TRUE/FALSE. Given F - TRUE T - FALSE is it possible to forbid T to stand for TRUE, and F for FALSE in function(...,something=T)? Or, alternatively, never allow F - whatever and T - whatever? I don't know what the technical side is, but I think it would be much better if this particular blunder (major, yet rather easy to overlook) was impossible to make. R FAQ 3.3, bullet #3: In R, T and F are just variables being set to TRUE and FALSE, respectively, but are not reserved words as in S and hence can be overwritten by the user. (This helps e.g. when you have factors with levels T or F.) Hence, when writing code you should always use TRUE and FALSE. If T and F are changed as you suggested above, it will break S compatibility in lots of code. Andy I think it used to be that the situation about T/TRUE and F/FALSE being preassigned/reserved was exactly the opposite between R and S-Plus. However, in S-Plus 6.1.2 for Linux and S-Plus 6.2.1 for Windows, TRUE and FALSE and still preassigned values of T and F, respectively, but one cannot redefine them. In other words, TRUE and FALSE are also reserved names in S-Plus. So, using TRUE and FALSE seems to be a common denominator for R and S-Plus (and a sensible choice, for that matter). That's what I teach my students. Vincent -- Vincent Goulet, Associate Professor École d'actuariat Université Laval, Québec __ 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] algorithm used in k-mean clustering
Hi, I have used the kmean fucntion in R to produce some results for my analysis. I like to know the specific underlying algorithm used for the implementation of the function kmean in R. I tried looking for some documents but could not find any. I obtained the kmean result for k ranging from 2 to 10. When i did this initally it worked perfectly. When i tried running again i get the error Error: empty cluster: try a better set of initial centers and i have not changed anything in the code. And i get this error only for k = 2 and 10. does anyone know why it worked well intially and failed now? Asha Will he be rookie of the year? __ 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] Tool for update
Em Sex 25 Mar 2005 11:16, abunn escreveu: I edited Rprofile to update everything on Tuesdays. I've been doing this since 2.0 and I think I've had R running almost every Tuesday, which begs the question of what I would be doing if R hadn't come into existence. In any case, It works pretty well: ## This script gets all the packages I don't already have # Run this once a week - say Tuesdays if (interactive() ) { library(utils)} is.tuesday - as.POSIXlt(Sys.time())$wday == 2 if (is.tuesday == T) { cat(Running a package check...\nOccurs once a week, on Tuesdays\n) cat(Upgrade existing packages and check for new packages (y/N)? ) check.new - as.character(readLines(n = 1)) if (any(check.new == y, check.new == Y)) { options(CRAN = http://cran.us.r-project.org/;) cat(This can take a few seconds...\n) x - packageStatus(repositories = getOption(repositories)()[[1]]) print(x) install.packages(x$avail$Package[x$avail$Status == not installed]) cat(Upgrading to new versions if available\n) upgrade(x) } } Hi, I make a little adapt to this script and try to use. But, when a file dont exist, the installation is aborted. trying URL `http://cran.us.r-project.org/src/contrib/assist_0.1.2.tar.gz' Error in download.file(url, destfile, method) : cannot open URL `http://cran.us.r-project.org/src/contrib/assist_0.1.2.tar.gz' In addition: Warning message: cannot open: HTTP status was `404 Not Found' Is possible to force R to continue the installation. Thanks Ronaldo -- | // | \\ [***] | ( õ õ ) [Ronaldo Reis Júnior] | V [UFV/DBA-Entomologia] |/ \ [36571-000 Viçosa - MG ] | /(.''`.)\ [Fone: 31-3899-4007 ] | /(: :' :)\ [EMAIL PROTECTED]] |/ (`. `'` ) \[ICQ#: 5692561 | LinuxUser#: 205366 ] |( `- ) [***] | _/ \_Powered by GNU/Debian Woody/Sarge __ 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] when can we expect Prof Tierney's compiled R?
On Wed, 20 Apr 2005, Peter Dalgaard wrote: Luke Tierney [EMAIL PROTECTED] writes: Vectorized operations in R are also as fast as compiled C (because that is what they are :-)). A compiler such as the one I'm working on will be able to make most difference for non-vectorizable or not very vectorizable code. It may also be able to reduce the need for intermediate allocations in vectorizable code, which may have other benefits beyond just speed improvements. Actually, it has struck me a couple of times that these operations are not as fast as they could be, since they are outside the scope of fast BLAS routines, but embarrassingly parallel code could easily be written for the relevant hardware. Even on uniprocessor systems there might be speedups that the C compiler cannot find (e.g. because it cannot assume that source and destination of the operation are distinct). My guess is that for anything beyond basic operations we are doing OK on uniprocessors. but it would be useful to do some testing to be sure. For the basic operations I suspect we are paying a heavy price for the way we handle recycling, both in terms of overhead as such and in terms of inhibiting compiler optimizations. For performance it would probably be better to code the scalar-vector, equal-length-vector, and general cases separately, though keeping the code maintainable may be a bit of a challenge. Again testing on a range of platforms and compilers would be useful. With multiprocessors likely to become more widely available it would be good to look into ways of factoring the vectorized math code so we can slide in one that uses threads when approprate. This should dovetail nicely with compilation to identify larger vectorized expressions that can be parallelized as a unit; I hope to look into this a bit this summer. luke -- Luke Tierney Chair, Statistics and Actuarial Science Ralph E. Wareham Professor of Mathematical Sciences University of Iowa Phone: 319-335-3386 Department of Statistics andFax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: [EMAIL PROTECTED] Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu __ 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] density
Hi, I used the density function in the R package, and got the following results. I just wonder how to explain them. What is Min, 1st Qu, Median, and so on? I could not find an explanation from help(density). The plot doesn't seem to match the x and y value either. Thanks in advance for any help that you can give me! Hui Call: density(x = x2, kernel = gaussian) Data: x2 (6437 obs.); Bandwidth 'bw' = 0.1209 x y Min. :-1.8856 Min. :5.851e-06 1st Qu.:-0.1629 1st Qu.:2.262e-03 Median : 1.5599 Median :3.945e-02 Mean : 1.5599 Mean :1.450e-01 3rd Qu.: 3.2826 3rd Qu.:2.738e-01 Max. : 5.0054 Max. :5.761e-01 __ 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] How to override coerion error in 'scan'
I am using 'read.csv' in V2.0.1 to read in a CSV file with the colClasses option and am getting an error from 'scan' when it encounters a non-numeric value for a 'numeric' column, i.e. ds - read.csv(in_file, nrows=irow, row.names=NULL, colClasses=zclass, comment.char=) Error in scan(file = file, what = what, sep = sep, quote = quote, dec = dec, : scan expected a real, got 03/15/200523:56:03 Is there a way to override this and just have it convert those values to NA? The dataset is large so I would prefer not to have to import the columns as character and convert them to numeric afterward. --Rich Richard Kittler AMD TDG 408-749-4099 __ 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] Hoaglin Outlier Method
I am a new user of R so please bear with me. I have reviewed some R books, FAQs and such but the volume of material is great. I am in the process of porting my current SAS and SVS Script code to Lotus Approach, R and WordPerfect. My question is, can you help me determine the best R method to implement the Hoaglin Outlier Method? It is used in the Appendix A and B of the fo llowing link. http://trb.org/publications/nchrp/nchrp_w71.pdf The sample data from Appendix A for determining outliers in R: T314Data - structure(list(Lab = as.integer(c(1:60)), X = c(4.89, 3.82, 2.57, 2.3, 2.034, 2, 1.97, 1.85, 1.85, 1.85, 1.84, 1.82, 1.82, 1.77, 1.76, 1.67, 1.66, 1.63, 1.62, 1.62, 1.55, 1.54, 1.54, 1.53, 1.53, 1.44, 1.428, 1.42, 1.39, 1.36, 1.35, 1.31, 1.28, 1.24, 1.24, 1.23, 1.22, 1.21, 1.19, 1.18, 1.18, 1.18, 1.17, 1.16, 1.13, 1.13, 1.099, 1.09, 1.09, 1.08, 1.07, 1.05, 0.98, 0.97, 0.84, 0.808, 0.69, 0.63, 0.6, 0.5), Y = c(5.28, 3.82, 2.41, 2.32, 2.211, 1.46, 2.24, 1.91, 1.78, 1.63, 1.81, 1.92, 1.2, 1.67, 1.28, 1.59, 1.45, 2.06, 1.91, 1.19, 1.26, 1.79, 1.39, 1.48, 0.72, 1.29, 1.517, 1.71, 1.12, 1.38, 0.93, 1.36, 1.2, 1.23, 0.71, 1.29, 1.26, 1.48, 1.26, 1.33, 1.21, 1.04, 1.57, 1.42, 1.08, 1.04, 1.33, 1.33, 1.2, 1.05, 1.24, 0.91, 0.99, 1.06, 1.27, 0.702, 0.77, 0.58, 1, 0.38)), .Names = c(Lab, X, Y ), class = data.frame, row.names = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 46, 47, 48, 49, 50, 51, 52, 53, 54, 55, 56, 57, 58, 59, 60 )) From this point on, I could use your advise. There are several other methods for determining outliers in R. I'd rather not re-invent the wheel or use a brute strength and force method if there is a better way in R. Our usual method for determining outliers is a student's T test as in ASTM E 178 or when the standard deviation for a lab is 3 or more. We normally have 120 labs to evaluate for outliers similar what is shown in T312Data. On occasion, I have used the Wilk-Shapiro W statistic in SAS. A point in the right direction or an R code example would help greatly. After I trim the outliers, I will need to show which labs were eliminated but that should be fairly trivial. The reference in Appendix A is: Hoaglin, D. C., Iglewicz, B., Tukey, J. W., Performance of Some Resistant Rules for Outlier Labeling, Journal of the American Statistical Association, Vol. 81, No. 396 (Dec., 1986), pp. 991-999. The ASTM E 178 reference is: Shapiro, S. S., and Wilk, M. B., An Analysis of Variance Test for Non-Normality (Complete Samples), Biometrika, BIOKA, Vol 52, 1965, pp. 591611. Kenneth Ray Hobson, P.E. Oklahoma DOT - QA IAS Manager 200 N.E. 21st Street Oklahoma City, OK 73105-3204 (405) 522-4985, (405) 522-0552 fax __ 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] help with POSIX
Ghosh, Sandeep [EMAIL PROTECTED] writes: For the r script below datestr - 01/01/2004 as.POSIXct(as.Date(datestr, %d/%m/%Y)) I get the following output 2003-12-31 18:00:00 Central Standard Time Why is the date a day before. I guess its something to do with the time, but is there a way to get it to return 2004-01-01 instead? Just move to Denmark: datestr - 01/01/2004 as.POSIXct(as.Date(datestr, %d/%m/%Y)) [1] 2004-01-01 01:00:00 CET The convention is that Date objects are pegged to 0:00 GMT (not sure what the rationale is -- ISOdate uses 12:00 GMT -- but Brian probably thought about it). An easy workaround is to add 12 hours... -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- 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] Problem with R-2.1.0: install.packages() doesn't work
On Fri, 2005-04-22 at 18:00 -0400, Manuel Morales wrote: On Fri, 2005-04-22 at 15:42 -0500, Marc Schwartz wrote: On Fri, 2005-04-22 at 15:44 -0400, Manuel Morales wrote: On Fri, 2005-04-22 at 17:48 +0200, Uwe Ligges wrote: Waichler, Scott R wrote: I installed R-2.1.0 from source on a Linux box running Red Hat Enterprise Linux WS release 4 but install.packages() wouldn't work (see below). install.packages(rgenoud) --- Please select a CRAN mirror for use in this session --- Error in inherits(x, factor) : Object res not found Quite probably you have no X11 connection to this machine. R tries to ask you which CRAN mirror you are going to choose, and it fails to present the tcltk window. You might want to call chooseCRANmirror(graphics=FALSE) and setRepositories(graphics=FALSE) prior to install.packages(). Uwe Ligges I have the same problem after building R-2.1.0 from source on Fedora Core 3. The suggestion above fixes this, but what do you mean by Quite probably you have no X11 connection on this machine? I'm guessing you don't mean that X11 is not running (I use Gnome for my desktop). Manuel For both Scott and Manuel, Can you post back with the output of: capabilities() This is what I got: capabilities() jpeg pngtcltk X11 http/ftp sockets libxml fifo TRUE TRUEFALSE TRUE TRUE TRUE TRUE TRUE cledit IEEE754iconv TRUE TRUE TRUE I recompiled after downloading the tc and tk development packages, which gave tcltk as TRUE. update.packages() works if tcltk is enabled, but it seems not to revert to the non-graphical interface otherwise... Ok. So that suggests a problem with capabilities(tcltk) == FALSE, which will be the result of not having the tcl/tk devel RPMS installed. To Peter's prior post, my read of the code for menu() suggests that there is a problem in the conditional code: menu function (choices, graphics = FALSE, title = ) ... The code check there is: if (graphics) { if (.Platform$OS.type == windows || .Platform$GUI == AQUA) { res - select.list(choices, multiple = FALSE, title = title) return(match(res, choices, nomatch = 0)) } else if (.Platform$OS.type == unix capabilities(tcltk) capabilities(X11)) res - tcltk::tk_select.list(choices, multiple = FALSE, title = title) return(match(res, choices, nomatch = 0)) } If my read is correct, it looks like there might be a missing brace pair for the 'else if' part? Shouldn't that section read: if (graphics) { if (.Platform$OS.type == windows || .Platform$GUI == AQUA) { res - select.list(choices, multiple = FALSE, title = title) return(match(res, choices, nomatch = 0)) } else if (.Platform$OS.type == unix capabilities(tcltk) capabilities(X11)) { # NOTE OPEN BRACE HERE res - tcltk::tk_select.list(choices, multiple = FALSE, title = title) return(match(res, choices, nomatch = 0)) } # NOTE CLOSE BRACE HERE } Without the braces, it will get to: return(match(res, choices, nomatch = 0)) whether all of the checks are TRUE or not, the latter being the case at least for Manuel. 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] if(foo == TRUE) .. etc
On Fri, 22 Apr 2005, bogdan romocea wrote: Great suggestion; it made me change all my Ts/Fs to TRUE/FALSE. Given F - TRUE T - FALSE is it possible to forbid T to stand for TRUE, and F for FALSE in function(...,something=T)? Or, alternatively, never allow F - whatever and T - whatever? Allowing T and F to be used as variables is deliberate. R CMD check will check to see if you use T and F without defining them, which catches most examples. This is done using makeActiveBinding, see the help to find out how you can use it yourself. -thomas __ 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] Tool for update
Hi Ronaldo: First, this script was discussed a few days ago. Note that under 2.1 update.packages() has changed for the better. Look at the NEWS file. So, if you want to keep updating on Tuesdays, despite sensible advice to the contrary offered in this thread http://finzi.psych.upenn.edu/R/Rhelp02a/archive/48390.html you'll have to change the script to something like this: # Run this once a week - say Tuesdays if (interactive() ) { library(utils)} is.tuesday - as.POSIXlt(Sys.time())$wday == 2 if (is.tuesday == T) { cat(Running a package check...\nOccurs once a week, on Tuesdays\n) cat(Upgrade existing packages and check for new packages (y/N)? ) check.new - as.character(readLines(n = 1)) if (any(check.new == y, check.new == Y)) { cat(This can take a few seconds...\n) update.packages(ask=FALSE) } } Second, you wrote: I make a little adapt to this script and try to use. But, when a file dont exist, the installation is aborted. If you really need to automate this and use download.file then look at using try() to catch errors. I suggest you look at the file structure of the src/contrib folder at CRAN and modify your code if you need to. For instance, point to src/contrib/assist_1.0.tar.gz and not assist_0.1.2.tar.gz as the source version is now 1.0 for assist. But, as mentioned earlier, it would be better to move this all to a chron job. HTH, Andy __ 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] hi: I am newbie for R too...
i think the log-linear model can deal with this. and the glm with poisson family,loglin,loglm from MASS packages can estimate log-linear model. hope help:) On Fri, 22 Apr 2005 22:15:23 +0800 hau chung chan [EMAIL PROTECTED] wrote: I have so much questions about using R...but i will try my best to solve myself before bothering you guys firstly...yes no maleold 13070 young34 48 female old5060 young7923 can I do a chisq.test for such contingency table?cuz...it is not 2 dimension is there any other method to test the independency to the answer for the factors (male, female) (old, young) or you guys will suggest me to add them up and do chosq.test 2 times.. thank you... [[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] Need help arranging the plot in different fashion than the default format
On Fri, 2005-04-22 at 16:19 -0500, Ghosh, Sandeep wrote: I want to change the way the plot is appearing in the barchart .. testdata - as.data.frame(t(structure(c (1,2004,LV1,3.8,2,87,2,2004,LV1,3.2,3,28,3,2004,LV1,3.4,3,88,4,2004, LV1,3,2,26,5,2004,LV1,3.8,2,87,6,2004,LV1,3.2,3,28,7,2004,LV1,3.4,3, 88,8,2004,LV1,3,2,26,9,2004,LV1,3.8,2,87,10,2004,LV1,3.2,3,28,11,2004, LV1,3.4,3,88,12,2004,LV1,3,2,26,1,2005,LV1,3.8,2,87,2,2005,LV1,3.2,3, 28,3,2005,LV1,3.4,3,88,4,2005,LV1,3,2,26), .Dim=c(6,16; colnames(testdata) - c('month', 'year', 'dataset','mean','stdDev','miceCount'); testdata[c(month, mean)] - lapply(testdata[c(month, mean)], function(x) as.numeric(levels(x)[x])); testdata - testdata[do.call(order, testdata), ]; trellis.par.set(theme = col.whitebg()); barchart(month ~ mean | year, data=testdata) I want to have the years come one below the other rather than next to each other which can be achieved by layout(c(1,2)), and the x axis to be the month and the y axis to be the mean. I would really appreciate if someone can tell me how to achieve this barchart(mean ~ month | year, data=testdata, layout=c(1,2)) #doing this is not producing the intended result Any suggestion and help is greatly appreciated.. I suspect you want: barchart(mean ~ month | year, data = testdata, horizontal = FALSE, layout=c(1,2) Note the use of 'horizontal = FALSE' 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] Expression in panel.text
Hi, I've got a lattice xyplot and I want to superimpose correlation coefficients and p values on each panel. I've been trying to get this to work using something of the form: x - rnorm(400) y - rnorm(400) a - gl(4, 100) xyplot(y~x | a, panel=function(x,y, ...){ panel.xyplot(x,y, ...) curr.cor - cor.test(x,y) crho - round(curr.cor$estimate,2) cpv - format.pval(curr.cor$p.value, eps = 0.01, digits=2) exprrho - substitute(rho == crho, list(crho=crho)) exprpv - substitute(italic(p) == cpv, list(cpv=cpv)) panel.text(-2, 2, label=exprrho) panel.text(2, 2, label=exprpv) }) The two expressions (expprho and exprpv) plot as expected on a normal text() call but in the panels, all that appears at the coordinates is ==. This is the first element in exprrho; other than that, I can't figure out what is going wrong. Any suggestions? Thanks in advance. David version _ platform powerpc-apple-darwin6.8 arch powerpc os darwin6.8 system powerpc, darwin6.8 status major2 minor0.0 year 2004 month10 day 04 language R __ 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 R-2.1.0: install.packages() doesn't work
What happens if you don't set the 'CRAN' option via 'options()' first and just run 'install.packages()'? -roger Waichler, Scott R wrote: I installed R-2.1.0 from source on a Linux box running Red Hat Enterprise Linux WS release 4 but install.packages() wouldn't work (see below). When I install R-2.0.1 from RPM on the same system, everything is fine. Version 2.1.0 (2005-04-18), ISBN 3-900051-07-0 . . . options(CRAN = http://cran.fhcrc.org/;) install.packages(rgenoud) --- Please select a CRAN mirror for use in this session --- Error in inherits(x, factor) : Object res not found Scott Waichler Pacific Northwest National Laboratory [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 __ 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] Expression in panel.text
On Friday 22 April 2005 10:12, David Orme wrote: Hi, I've got a lattice xyplot and I want to superimpose correlation coefficients and p values on each panel. I've been trying to get this to work using something of the form: x - rnorm(400) y - rnorm(400) a - gl(4, 100) xyplot(y~x | a, panel=function(x,y, ...){ panel.xyplot(x,y, ...) curr.cor - cor.test(x,y) crho - round(curr.cor$estimate,2) cpv - format.pval(curr.cor$p.value, eps = 0.01, digits=2) exprrho - substitute(rho == crho, list(crho=crho)) exprpv - substitute(italic(p) == cpv, list(cpv=cpv)) panel.text(-2, 2, label=exprrho) panel.text(2, 2, label=exprpv) }) The two expressions (expprho and exprpv) plot as expected on a normal text() call but in the panels, all that appears at the coordinates is ==. This is the first element in exprrho; other than that, I can't figure out what is going wrong. Any suggestions? I believe this came up a few days back. exprrho - substitute(rho == crho, list(crho=.12)) is.expression(exprrho) [1] FALSE i.e., the label you are using is not an expression. The 'panel.text' you have didn't take this possibility into account (unlike 'text'). The good news is that this has been fixed in R 2.1.0. 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
[R] Cyrillic R: how can I help? (or Re: R 2.1.0, Windows, non-Latin locales)
Dear R-experts, I am using R in Russia since 2000. One can find some Russian documentation for R (including the reference card) on: http://herba.msu.ru/shipunov/software/r/r-en.htm All your criticism would be appreciated. We really do need help from the users in the beta-test period, especially in languages not used by the core team... I think that I can help in: (1) translation of messages to Russian (I see that only introductory message is now translated); (2) testing R on Windows98 SE and XP Professional, maybe also on Linux (Debian Woody and Sarge). Please explain how to do this. With best wishes and regards, Alexey B. Shipunov Institute of Information Technologies, Moscow e-mail: [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] Anova - interpretation of the interaction term
: -Original Message- : From: [EMAIL PROTECTED] : [mailto:[EMAIL PROTECTED] On Behalf Of : michael watson (IAH-C) : Sent: Friday, 22 April 2005 7:47 PM : To: r-help@stat.math.ethz.ch : Subject: [R] Anova - interpretation of the interaction term : : : Hi : : So carrying on my use of analysis of variance to check for the effects : of two factors. It's made simpler by the fact that both my : factors have : only two levels each, creating four unique groups. : : I have a highly significant interaction term. In the context of the : experiment, this makes sense. I can visualise the data : graphically, and : sure enough I can see that both factors have different effects on the : data DEPENDING on what the value of the other factor is. : : I explain this all to my colleague - and she asks but which ones are : different? This is best illustrated with an example. We have either : infected | uninfected, and vaccinated | unvaccinated (the two : factors). : We're measuring expression of a gene. Graphically, in the infected : group, vaccination makes expression go up. In the uninfected group, : vaccination makes expression go down. In both the vaccinated and : unvaccinated groups, infection makes expression go down, but it goes : down further in unvaccinated than it does in vaccinated. : : So from a statistical point of view, I can see exactly why the : interaction term is significant, but what my colleage wants to know is : that WITHIN the vaccinated group, does infection decrease expression : significantly? And within the unvaccinated group, does infection : decrease expression significantly? Etc etc etc Can I get this : information from the output of the ANOVA, or do I carry out a separate : test on e.g. just the vaccinated group? (seems a cop out to me) No, you can't get this kind of specific information out of the anova table and yes, anova tables *are* a bit of a cop out. (I sometimes think they should only be allowed between consenting adults in private.) What you are asking for is a non-standard, but perfectly reasonable partition of the degrees of freedom between the classes of a single factor with four levels got by pairing up the levels of vaccination and innoculation. Of course you can get this information, but you have to do a bit of work for it. Before I give the example which I don't expect too many people to read entirely, let me issue a little challenge, namely to write tools to automate a generalized version of the procedure below. Here is the example, (drawing from the explanation given in a certain book, to wit chapter 6): dat - expand.grid(vac = c(N, Y), inf = c(-, +)) dat - rbind(dat, dat) # to get a bit of replication Now we make a 4-level factor from vaccination and infection and generate a bit of data with an infection effect built into it: dat - transform(dat, vac_inf = vac:inf, y = as.numeric(inf) + rnorm(8)) dat vac inf vac_inf y 1N - N:- 0.2285096 2Y - Y:- 1.3504610 3N + N:+ 2.5581254 4Y + Y:+ 2.9208313 11 N - N:- -0.8403039 21 Y - Y:- -0.2440574 31 N + N:+ 2.4844055 41 Y + Y:+ 2.0772671 Now give the joint factor contrasts reflecting the partition we want to effect: levels(dat$vac_inf) [1] N:- N:+ Y:- Y:+ m - matrix(scan(), ncol = 4, byrow = T) 1: -1 1 0 0 5: 0 0 -1 1 9: 1 1 -1 -1 13: Read 12 items fractions(ginv(m)) ## just to see what it looks like [,1] [,2] [,3] [1,] -1/20 1/4 [2,] 1/20 1/4 [3,]0 -1/2 -1/4 [4,]0 1/2 -1/4 Note that we could have simply used t(m), but this is not always possible. Associate these contrasts, fit and analyse: contrasts(dat$vac_inf) - ginv(m) gm - aov(y ~ vac_inf, dat) summary(gm) Df Sum Sq Mean Sq F value Pr(F) vac_inf 3 12.1294 4.0431 7.348 0.04190 Residuals4 2.2009 0.5502 This doesn't tell us too much other than there are differences, probably. Now to specify the partition: summary(gm, split = list(vac_inf = list(- vs +|N = 1, - vs +|Y = 2))) Df Sum Sq Mean Sq F value Pr(F) vac_inf 3 12.1294 4.0431 7.3480 0.04190 vac_inf: - vs +|N 1 7.9928 7.9928 14.5262 0.01892 vac_inf: - vs +|Y 1 3.7863 3.7863 6.8813 0.05860 Residuals4 2.2009 0.5502 As expected, infection changes the mean for both vaccinated and unvaccinated, as we arranged when we generated the data. : : Many thanks, and sorry, but it's Friday. : : Mick : : __ : 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
Re: [R] Problem with R-2.1.0: install.packages() doesn't work
Hi all, In follow up to my message earlier, I spent some time applying the modification to the menu() function that I referenced earlier. I also recompiled a local copy of R on my FC3 system using: ./configure --without-tcltk This results in: capabilities() jpeg pngtcltk X11 http/ftp sockets libxml fifo TRUE TRUEFALSE TRUE TRUE TRUE TRUE TRUE cledit IEEE754iconv TRUE TRUE TRUE The first time around, I ran the menu() function unchanged and got the same error that Scott and Manuel reported earlier: Error in inherits(x, factor) : Object res not found 'res' is the value returned from the tcltk function tk.select.list() used in menu(). This appeared for the series of functions that call menu(), such as update.packages(), install.packages(), chooseCRANmirror(), contrib.url (), etc. After modifying the menu function, I was able to get: install.packages(rgenoud) --- Please select a CRAN mirror for use in this session --- CRAN mirror 1: Australia 2: Austria 3: Brasil (PR) 4: Brasil (MG) 5: Brasil (SP 1) 6: Brasil (SP 2) 7: Canada (BC) 8: Canada (ON) 9: Denmark10: France (Toulouse) 11: France (Lyon) 12: France (Paris) 13: Germany (Berlin) 14: Germany (Koeln) 15: Germany (Mainz)16: Germany (Muenchen) 17: Hungary18: Italy (Arezzo) 19: Italy (Ferrara)20: Japan (Aizu) 21: Japan (Tsukuba)22: Poland 23: Portugal 24: Slovenia (Besnica) 25: Slovenia (Ljubljana) 26: South Africa 27: Spain 28: Switzerland (Zuerich) 29: Switzerland (Bern 1) 30: Switzerland (Bern 2) 31: Turkey 32: Taiwan 33: UK (Bristol) 34: UK (London) 35: USA (CA 1) 36: USA (CA 2) 37: USA (MA) 38: USA (MI) 39: USA (NC) 40: USA (PA 1) 41: USA (PA 2) 42: USA (WA) Selection: So, with the modification in menu() and without tcltk available, the text menu now comes up properly. The proposed patch for .../src/library/utils/menu.R is attached. HTH, Marc Schwartz --- R-2.1.0/src/library/utils/R/menu.R 2005-04-18 05:18:57.0 -0500 +++ R-2.1.0-patch/src/library/utils/R/menu.R2005-04-22 22:08:23.0 -0500 @@ -6,9 +6,10 @@ res - select.list(choices, multiple=FALSE, title=title) return(match(res, choices, nomatch = 0)) } else if(.Platform$OS.type == unix - capabilities(tcltk) capabilities(X11)) + capabilities(tcltk) capabilities(X11)) { res - tcltk::tk_select.list(choices, multiple=FALSE, title=title) return(match(res, choices, nomatch = 0)) +} } nc - length(choices) if(length(title) nchar(title[1])) cat(title[1], \n) __ 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] ANOVA with both discreet and continuous variable
Hi all, I have dataset with 2 independent variable, one (x1) is continuous, the other (x2) is a categorical variable with 2 levels. The dependent variable (y) is continuous. When I run linear regression y~x1*x2, I found that the p value for the continuous independent variable x1 changes when different contrasts was used (helmert vs. treatment), while the p values for the categorical x2 and interaction are independent of the contrasts used. Can anyone explain why? I guess the p value for x1 is testing different hypothesis under different contrasts? If the interaction is NOT significant, what contrast should I use to test the hypothesis that x1 is not significantly related with y? x1-rnorm(50,9,2) x2-as.factor(as.numeric(runif(50)0.35)) y-rnorm(50,30,5) options(contrasts=c('contr.treatment','contr.poly')) summary(lm(y~x1*x2)) options(contrasts=c('contr.helmert','contr.poly')) summary(lm(y~x1*x2)) __ 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