[R] r-ish ? how can i improve my code?
Hi Folks, I'm trying to learn R. One of my intentions is to do some Monte-Carlo type modelling of road accidents. Below, to simplify things, I've appended a little program which does a 'monte-carlo' type simulation. However, it is written in a way which seems a bit un-natural in R. Could someone help me make this a bit more R-ish please? Or is there a completely different approach I should be taking? Many thanks in advance, Sean O'Riordain seanpor AT acm.org n - 900; # number of valid items required... x - numeric(n); y - numeric(n); z - numeric(n); c - 1; # current 'array' pointer tc - 0; # total items actually looked at... while (c = n) { x[c] = runif(1, 0, 1); y[c] = runif(1, 0, 1); z[c] = sqrt(x[c]^2 + y[c]^2); if (z[c] 1) c - c + 1; tc - tc + 1; } print('overwork' ratio); print(tc/(c-1)); plot(x,y); __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: is.na(v)-b (was: Re: [R] Beginner's query - segmentation fault)
I think the thread ended up with several people (not only me) feeling certain they didn't like `is.na-` but with the developers defending it and me not really understanding why. Uwe Ligges was going to come up with an example of `- NA` going wrong (sorry Brian R, I mean behaving unexpectedly), but never did, and I think the problem has been fixed. It was apparently a problem with assigning NAs to an existing factor, but the code for `[-.factor` looks pretty robust to me [not that I'm at all qualified to say that, be warned]. Interestingly, at some point both methods for `is.na-` perform this operation: x[value] - NA. Ahem. By the way, `is.na(x) - FALSE` will leave x unchanged (including leaving it as NA ! how bad is that ?!) -Original Message- From: Paul Lemmens [mailto:[EMAIL PROTECTED] Sent: 14 October 2003 16:10 To: [EMAIL PROTECTED] Subject: RE: is.na(v)-b (was: Re: [R] Beginner's query - segmentation fault) Security Warning: If you are not sure an attachment is safe to open please contact Andy on x234. There are 0 attachments with this message. By accident I'm also toying around with NA's, so I started reading up on this thread but failed to find a 'concluding' remark or advice. As a naive R user I would have loved to see a comment do it like this. The prevailing opinion seemed to be that is.na() might be better (safer) but x - NA is much clearer to understand. Can I relatively safely use the easy form, or is it better to remember (the hard way) the safer version? Has the discussion continued privately or just stopped here? Personally I still find the fragments below (taken from the thread) very counter intuitive, not to say scary. x - 1:10 is.na(x) - 1:5 and is.na(x) - FALSE It's very hard to understand what happens (as layman) because the assignment seems to reverse in meaning in the first example (actually taking indices 1:5 of x and assigning those the value NA) whereas in the second case it's not obvious what happens to x: will it get the value FALSE or will the original value remain(*). IMHO the - NA construct is much easier to understand and should be made safe in all possible situations (whatever the underlying safety problem or other difficulties might be). kind regards, Paul (*) Such a remark will probably lead to some kind of reprimand because it's probably somewhere within the 10e6 manual pages but I'm trying my luck here. -- Paul Lemmens NICI, University of Nijmegen ASCII Ribbon Campaign /\ Montessorilaan 3 (B.01.03)Against HTML Mail \ / NL-6525 HR Nijmegen X The Netherlands / \ Phonenumber+31-24-3612648 Fax+31-24-3616066 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help Simon Fear Senior Statistician Syne qua non Ltd Tel: +44 (0) 1379 69 Fax: +44 (0) 1379 65 email: [EMAIL PROTECTED] web: http://www.synequanon.com Number of attachments included with this message: 0 This message (and any associated files) is confidential and\...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] r-ish ? how can i improve my code?
1. I suggest you avoid using c as a loop index, as it conflicts with the name of a function. R is smart enough to figure out the difference in some cases but not in all. 2. How about the following: n - 900 x - runif(n) y - runif(n) z - sqrt(x^2+y^2) print(list(Overwork.ratio = n/sum(z1))) plot(x, y) theta - seq(0, pi/2, length=31) lines(sin(theta), cos(theta)) ## This won't give you n numbers z 1. If you need exactly that, what about first generating, say, 2*n, then either throwing away the excess or generating another 2*n if you don't have enough? You can use a recursive function for this, which would almost never recurse with 2*n but might with 1.1*n. hope this helps. spencer graves Sean O'Riordain wrote: Hi Folks, I'm trying to learn R. One of my intentions is to do some Monte-Carlo type modelling of road accidents. Below, to simplify things, I've appended a little program which does a 'monte-carlo' type simulation. However, it is written in a way which seems a bit un-natural in R. Could someone help me make this a bit more R-ish please? Or is there a completely different approach I should be taking? Many thanks in advance, Sean O'Riordain seanpor AT acm.org n - 900; # number of valid items required... x - numeric(n); y - numeric(n); z - numeric(n); c - 1; # current 'array' pointer tc - 0; # total items actually looked at... while (c = n) { x[c] = runif(1, 0, 1); y[c] = runif(1, 0, 1); z[c] = sqrt(x[c]^2 + y[c]^2); if (z[c] 1) c - c + 1; tc - tc + 1; } print('overwork' ratio); print(tc/(c-1)); plot(x,y); __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] r-ish ? how can i improve my code?
For this particular problem you can probably use polar coordinates. But something similar to your code could be: x - runif(900) y - runif(900) z - sqrt(x^2 + y^2) okay - z 1 while(any(!okay)) { n.bad - sum(!okay) x[!okay] - runif(n.bad) y[!okay] - runif(n.bad) z - sqrt(x^2 + y^2) # restricting to !okay may or may not be useful okay - z 1 } Patrick Burns Burns Statistics [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Sean O'Riordain wrote: Hi Folks, I'm trying to learn R. One of my intentions is to do some Monte-Carlo type modelling of road accidents. Below, to simplify things, I've appended a little program which does a 'monte-carlo' type simulation. However, it is written in a way which seems a bit un-natural in R. Could someone help me make this a bit more R-ish please? Or is there a completely different approach I should be taking? Many thanks in advance, Sean O'Riordain seanpor AT acm.org n - 900; # number of valid items required... x - numeric(n); y - numeric(n); z - numeric(n); c - 1; # current 'array' pointer tc - 0; # total items actually looked at... while (c = n) { x[c] = runif(1, 0, 1); y[c] = runif(1, 0, 1); z[c] = sqrt(x[c]^2 + y[c]^2); if (z[c] 1) c - c + 1; tc - tc + 1; } print('overwork' ratio); print(tc/(c-1)); plot(x,y); __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] r-ish ? how can i improve my code?
On Wed, Oct 15, 2003 at 10:06:36AM +0100, Sean O'Riordain wrote: n - 900; # number of valid items required... x - numeric(n); y - numeric(n); z - numeric(n); c - 1; # current 'array' pointer tc - 0; # total items actually looked at... while (c = n) { x[c] = runif(1, 0, 1); y[c] = runif(1, 0, 1); z[c] = sqrt(x[c]^2 + y[c]^2); if (z[c] 1) c - c + 1; tc - tc + 1; } print('overwork' ratio); print(tc/(c-1)); plot(x,y); If I read this correctly you want to find the frequency of the event sqrt(x^2 + y^2) 1 where 0 = x, y = 1 right? How about this: n - 1000 z - sqrt(runif(n,0,1)^2 + runif(n,0,1)^2) ratio - (length(z)-1) / (length( z[z1] )) The main difference of course is that I uses a fixed number of total items rather than valid items. If that's a problem and you need exactly 900 valid items things get a bit more complicated... cu Philipp -- Dr. Philipp PagelTel. +49-89-3187-3675 Institute for Bioinformatics / MIPS Fax. +49-89-3187-3585 GSF - National Research Center for Environment and Health Ingolstaedter Landstrasse 1 85764 Neuherberg, Germany __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] r-ish ? how can i improve my code?
Hi Patrick, Spencer, Thanks for that! Both your solutions are MUCH quicker! afaik overwork_ratio = 4/pi # what a hard way to calculate this :-) The real problem I'm actually working on is a little more complicated :-) - 6 'random' variables, and 18 dependant variables (at last count)... currently only 4 computed terms in the 'if() c-c+1' statement... I just created the x,y area problem as a simple example of the style I was using. In the past I've worked on other 'accident' related problems and one difficulty was in getting enough final 'z' values to be statistically significant as there was an enormous rejection ratio - but it was running on a 486 written in compiled turbo pascal and it would take days of work... I'll have a go at recoding using your techniques. Many Thanks, Sean Patrick Burns wrote: For this particular problem you can probably use polar coordinates. But something similar to your code could be: x - runif(900) y - runif(900) z - sqrt(x^2 + y^2) okay - z 1 while(any(!okay)) { n.bad - sum(!okay) x[!okay] - runif(n.bad) y[!okay] - runif(n.bad) z - sqrt(x^2 + y^2) # restricting to !okay may or may not be useful okay - z 1 } Patrick Burns Burns Statistics [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Sean O'Riordain wrote: Hi Folks, I'm trying to learn R. One of my intentions is to do some Monte-Carlo type modelling of road accidents. Below, to simplify things, I've appended a little program which does a 'monte-carlo' type simulation. However, it is written in a way which seems a bit un-natural in R. Could someone help me make this a bit more R-ish please? Or is there a completely different approach I should be taking? Many thanks in advance, Sean O'Riordain seanpor AT acm.org n - 900; # number of valid items required... x - numeric(n); y - numeric(n); z - numeric(n); c - 1; # current 'array' pointer tc - 0; # total items actually looked at... while (c = n) { x[c] = runif(1, 0, 1); y[c] = runif(1, 0, 1); z[c] = sqrt(x[c]^2 + y[c]^2); if (z[c] 1) c - c + 1; tc - tc + 1; } print('overwork' ratio); print(tc/(c-1)); plot(x,y); __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Fw: [R] SIMCA algorithm implementation
I have used PCA for data classification by visual examination of the 3D scatter plot of the first 3 principal components. I now want to use the results to predict the class for new data. I have used predict.princomp to predict the scores and then visualise the results on a 3D scatter plot using the rgl library. However, is there an R function that will fit the new data to the class assignments derived from PCA? I think this is similar to what the SIMCA algoirthm does. Thanks Mike - Original Message - From: Mike White [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 08, 2003 9:25 AM Subject: Re: [R] SIMCA algorithm implementation Dear All Is there a SIMCA (Soft Independent Modelling Class Analogy) implementation on R or does anyone know if is it possible to replicate the SIMCA algorithm using existing R functions? Thanks Mike White __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: is.na(v)-b (was: Re: [R] Beginner's query - segmentation fault)
Hello Simon, --On woensdag 15 oktober 2003 10:08 +0100 Simon Fear [EMAIL PROTECTED] wrote: By the way, `is.na(x) - FALSE` will leave x unchanged (including leaving it as NA ! how bad is that ?!) Twilight Zone (Golden Earring). But with that remark I'm getting off topic, so thank you for your summary. I've already memorized the is.na() construct, so I should be safe for the time being : kind regards, Paul -- Paul Lemmens NICI, University of Nijmegen ASCII Ribbon Campaign /\ Montessorilaan 3 (B.01.03)Against HTML Mail \ / NL-6525 HR Nijmegen X The Netherlands / \ Phonenumber+31-24-3612648 Fax+31-24-3616066 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] [OFF] Dataset for extra Crawley Chapter
Em Ter 14 Out 2003 12:01, Yang, Richard escreveu: Ronaldo; You can download all datasets used in Crawley's book from his web site. -- Richard In the web site dont have the dataset for extra chapters, only for the printed book's chapters. Thanks Ronaldo -- Todo mundo precisa crer em algo. Creio que vou tomar outra cerveja. -- Grouxo Marx -- | // | \\ [***] | ( õ õ ) [Ronaldo Reis Júnior] | V [UFV/DBA-Entomologia] |/ \ [36571-000 Viçosa - MG ] | /(.''`.)\ [Fone: 31-3899-2532 ] | /(: :' :)\ [EMAIL PROTECTED]] |/ (`. `'` ) \[ICQ#: 5692561 | LinuxUser#: 205366 ] |( `- ) [***] | _/ \_Powered by GNU/Debian Woody/Sarge __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] mapply() gives seg fault
Thanks for this everyone. I didn't know that a seg fault was an operating system error message (in fact, I don't really know what a seg fault is... I'm not a C programmer, just plain Mr Joe Q Public, R user). I would say the FAQ makes sense only if you know what kind of error messages operating systems are likely to report. Mentioning seg faults explicitly in FAQ-9.1 might be helpful for nonprogrammers like me. Something like a seg fault is always a bug would be good. best wishes robin On Tue, 14 Oct 2003, Robin Hankin wrote: Hello again thanks for this. What I should have asked is, should one always report repeatable seg faults (even if functions are called with inappropriate arguments)? Yes. Reproducible segfaults that occur `in the wild' are fairly important bugs even if they result from errors. Segfaults from trying to break the system are a much lower priority, but even they should probably be reported. The FAQ (9.1) says If R executes an illegal instruction, or dies with an operating system error message that indicates a problem in the program (as opposed to something like disk full), then it is certainly a bug. and goes on to explain that the only time this doesn't apply is when you call compiled code with the wrong arguments or call your own compiled code. -thomas __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Where is R_PHP_Online available?
Hi. Currently, I couldn't access following sites. Where is R_PHP_Online available? R_PHP_Online is a PHP CGI web interface to run R programs online, with the capability to show graphics online. You can get current version of R_PHP_Online from http://steve-chen.net/R_PHP/ or http://steve.stat.tku.edu.tw/R_PHP/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Design and Hmisc
I'm looking for design and hmisc version 2.0 for R 1.8 for windows. I've found design 2.0 in the downloads for R1.7 but not hmisc. I've also checked Dr. Harrell's site and it only goes to 1.6 for windows. Any thoughts? Shawn Way __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Re: Where is R_PHP_Online available?
Hi All, I re-organized my site few days ago and forgot to keep the directory of R_PHP_Online. It's now back again and you can find it at http://steve-chen.net/R_PHP Steve On Wed, 15 Oct 2003, Hisaji Ono wrote: Hi. Currently, I couldn't access following sites. Where is R_PHP_Online available? R_PHP_Online is a PHP CGI web interface to run R programs online, with the capability to show graphics online. You can get current version of R_PHP_Online from http://steve-chen.net/R_PHP/ or http://steve.stat.tku.edu.tw/R_PHP/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Where is R_PHP_Online available?
Thanks! - Original Message - From: Sean O'Riordain [EMAIL PROTECTED] To: Hisaji Ono [EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 9:29 PM Subject: Re: [R] Where is R_PHP_Online available? Hi! Try going to http://steve-chen.net/ and folling the link for R at the top of the page. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Design and Hmisc
Shawn Way wrote: I'm looking for design and hmisc version 2.0 for R 1.8 for windows. I've found design 2.0 in the downloads for R1.7 but not hmisc. I've also checked Dr. Harrell's site and it only goes to 1.6 for windows. Any thoughts? Yes. The ReadMe at CRAN/bin/windows/contrib/1.8 (for R-1.8.x) tells us: 'Packages that do not compile out of the box or do not pass Rcmd check with OK or at least a WARNING will *not* be published. This Status, i.e. result of Rcmd check, is listed in file Status. Possible values are OK, WARN, and ERROR. Corresponding check.log files can be found in subdirectory ./check.' And you'll find that both packages produce errors: For Hmisc: * checking Hmisc-manual.tex ... ERROR LaTeX errors when creating DVI version. This typically indicates Rd problems. And therefore Design has: * checking package dependencies ... ERROR Packages required but not available: Hmisc Frank E Harrell (in CC), the maintainer of those packages, might want to fix it the problem. Frank, does Hmisc pass make check on another OS? Can you fix it (easily)? Uwe Ligges Shawn Way __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: Fw: [R] SIMCA algorithm implementation
Mike - For predicting class membership, I would use either lda() or qda() from the MASS package. See the Venables and Ripley book for detailed description of the methods. You'll have to rely on your own references for what the 'SIMCA' algorithm actually does. I've never heard of it. Sounds like some sort of discriminant analysis to me. Maybe its authors would like to contribute an implementation of it to R. - tom blackwell - u michigan medical school - ann arbor - On Wed, 15 Oct 2003, Mike White wrote: I have used PCA for data classification by visual examination of the 3D scatter plot of the first 3 principal components. I now want to use the results to predict the class for new data. I have used predict.princomp to predict the scores and then visualise the results on a 3D scatter plot using the rgl library. However, is there an R function that will fit the new data to the class assignments derived from PCA? I think this is similar to what the SIMCA algoirthm does. Thanks Mike - Original Message - From: Mike White [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 08, 2003 9:25 AM Subject: Re: [R] SIMCA algorithm implementation Dear All Is there a SIMCA (Soft Independent Modelling Class Analogy) implementation on R or does anyone know if is it possible to replicate the SIMCA algorithm using existing R functions? Thanks Mike White __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] tkcanvas/bitmap for Turtle World
To represent a turtle inside a canvas (tcltk package), I have a serie of bitmaps representing the turtle heading in different directions and I would like to display the one that corresponds to the current direction of the turtle (function below). I have created with Paint a bitmap representing the turtle in BMP format and succeeded displaying it on canvas after converting it into XBM format with XBM-BMP utility by Allen Lam :). However, I have a problem with the rotated versions (rotation done in Adobe Illustrator and file saved as BMP). When I try to convert the rotated BMP into XBM, the turtle is not centered anymore, its size changes and background becomes black. I know that is not easy to rotate bitmaps but there should be better solution than Adobe Illustrator (part of the problem might be to know exactly how to save it to keep the same size and appearance). - does canvas in tcltk support other bitmap formats than BMP on a PC (Windows) ? - is there an utility to rotate bitmap in BMP format (2 colors) working on the PC? (found some for UNIX/LINUX but none on PC). - is there a simpler way? Sorry if the question is not exactly R but I am learning to use canvas widget from tcltk package (thanks to Barry Rowlings and Damon Wischik for their replies to my previous post). Gabriel Here is my function: setTurtle-function(turtle,x,y,angle) { if(angle!=turtle$angle) { path-@c:/Docume~1/Owner/MyDocu~1/MyWork~1/MILAN/UNIHSR/R/turtle_bitmap/ # select bitmap file (turtle000.xbm, turtle045.xbm, ...) heading-(45*(angle*180/pi+22.5)%/%45)%%360 file-paste(turtle,paste(rep(0,3-nchar(heading)),collapse=),heading,.xbm,sep=) # redraw tkdelete(turtle$canvas,turtle$turtle) turtle$turtle-tkcreate(turtle$canvas,bitmap,x,y,anchor=center,bitmap=paste(path,file,sep=)) turtle$angle - angle } if(x!=turtle$x || y!=turtle$y) { tkmove(turtle$canvas,turtle$turtle,x-turtle$x,y-turtle$y) turtle$x - x turtle$y - y } turtle } Gabriel Baud-Bovy Assistant Professor UHSR University via Olgettina, 58 tel: (+39) 02 2643 4839 20132 Milan, Italy fax: (+39) 02 2643 4892 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] nlme and multinomial choice
I am trying to estimate a multinomial choice model with three levels of data. I am wondering if I can do this in R, as the nlme command does not seem to be able to do this? Thank you, Martin Battle -- Martin Battle Ph.D. Student in Political Science Washington University in St. Louis Department of Political Science Box 1063 St. Louis MO 63130 When people agree with me I always feel that I must be wrong. Oscar Wilde __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Example of cell means model
This is an example from chapter 11 of the 6th edition of Devore's engineering statistics text. It happens to be a balanced data set in two factors but the calculations will also work for unbalanced data. I create a factor called 'cell' from the text representation of the Variety level and the Density level using '/' as the separator character. The coefficients for the linear model 'Yield ~ cell - 1' are exactly the cell means. library(Devore6) data(xmp11.07) str(xmp11.07) `data.frame': 36 obs. of 3 variables: $ Yield : num 10.5 9.2 7.9 12.8 11.2 13.3 12.1 12.6 14 10.8 ... $ Variety: Factor w/ 3 levels 1,2,3: 1 1 1 1 1 1 1 1 1 1 ... $ Density: Factor w/ 4 levels 1,2,3,4: 1 1 1 2 2 2 3 3 3 4 ... xmp11.07$cell = with(xmp11.07, factor(paste(Variety, Density, sep = '/'))) xtabs(~ Variety + Density, xmp11.07) Density Variety 1 2 3 4 1 3 3 3 3 2 3 3 3 3 3 3 3 3 3 means = xtabs(Yield ~ Variety+Density, xmp11.07)/xtabs(~ Variety + Density, xmp11.07) means Density Variety 1 2 3 4 1 9.20 12.43 12.90 10.80 2 8.93 12.63 14.50 12.77 3 16.30 18.10 19.93 18.17 coef(fm1 - lm(Yield ~ cell - 1, xmp11.07)) cell1/1 cell1/2 cell1/3 cell1/4 cell2/1 cell2/2 cell2/3 cell2/4 9.20 12.43 12.90 10.80 8.93 12.63 14.50 12.77 cell3/1 cell3/2 cell3/3 cell3/4 16.30 18.10 19.93 18.17 The residual sum of squares for this model is the same as that for the model with crossed terms deviance(fm1) [1] 38.04 deviance(fm2 - lm(Yield ~ Variety * Density, xmp11.07)) [1] 38.04 but the coefficients are quite different because they represent a different parameterization. coef(fm2) (Intercept) Variety2 Variety3 Density2 9.2000 -0.26677.10003.2333 Density3 Density4 Variety2:Density2 Variety3:Density2 3.70001.60000.4667 -1.4333 Variety2:Density3 Variety3:Density3 Variety2:Density4 Variety3:Density4 1.8667 -0.06672.23330.2667 I hope this answers your question. Sorry for the delay in responding to you. Francisco Vergara [EMAIL PROTECTED] writes: Many thanks for your reply. An example would be very helpful to make sure that I understand correctly what you described. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
R-WinEdt, [R] 1.8, deprecating warning
When I load R-WinEdt (library(RWinEdt), I get the warning: Warning message: multi-argument returns are deprecated in: return(InstallRoot, RWinEdtInstalled) I have upgraded to R 1. 8 on Windows, by copying non-base libraries into the 1.8 library folder and updating the help. I also reinstalled R-WinEdt from the zip file as detailed in RWinEdt ReadMe file using the recommend (A) installation and still get the same warning. I have a few questions: 1) Should I be concerned about this warning? 1a) What is deprecating? 2) Is there a way fix it so that the warning message is fixed and RWinEdt loads properly? 2a) I read the help file on the return function which mentions, Prior to R 1.8.0, 'value' could be a series of non-empty expressions separated by commas Would the fix be to find the part of some code that is executing (whatever and where ever that might be) when the editor loads and change it to some thing like return(InstallRoot); return(RWinEdtInstalled)? Thanks for you comments and assistance, Jason Higbee Research Analyst Federal Reserve Bank of St. Louis E: [EMAIL PROTECTED] [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: Fw: [R] SIMCA algorithm implementation
SIMCA, I believe, is Svante Wold's invention, and extensively used in the chemometrics area (analysis of data from analytic chemistry). My vague impression of what it does is PCA in the individual classes. I have not been able to locate a detail description of the algorithm. (I'd appreciate it very much if some one can help.) One feature of the methodology that distinguish it from others, I believe, is its ability to classify new observations as belonging to classes other than what appeared in the training data. Contribution from it's author? Fat chance. Svante sells (stand-alone) SIMCA at a premium price. Best, Andy -Original Message- From: Thomas W Blackwell [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 10:53 AM To: Mike White Cc: [EMAIL PROTECTED] Subject: Re: Fw: [R] SIMCA algorithm implementation Mike - For predicting class membership, I would use either lda() or qda() from the MASS package. See the Venables and Ripley book for detailed description of the methods. You'll have to rely on your own references for what the 'SIMCA' algorithm actually does. I've never heard of it. Sounds like some sort of discriminant analysis to me. Maybe its authors would like to contribute an implementation of it to R. - tom blackwell - u michigan medical school - ann arbor - On Wed, 15 Oct 2003, Mike White wrote: I have used PCA for data classification by visual examination of the 3D scatter plot of the first 3 principal components. I now want to use the results to predict the class for new data. I have used predict.princomp to predict the scores and then visualise the results on a 3D scatter plot using the rgl library. However, is there an R function that will fit the new data to the class assignments derived from PCA? I think this is similar to what the SIMCA algoirthm does. Thanks Mike - Original Message - From: Mike White [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Wednesday, October 08, 2003 9:25 AM Subject: Re: [R] SIMCA algorithm implementation Dear All Is there a SIMCA (Soft Independent Modelling Class Analogy) implementation on R or does anyone know if is it possible to replicate the SIMCA algorithm using existing R functions? Thanks Mike White __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo /r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] aov and non-categorical variables
It is unclear to me how aov() handles non-categorical variables. I mean it works and produces results that I would expect, but I was under impression that ANOVA is only defined for categorical variables. In addition, help(aov) says that it call to 'lm' for each stratum, which I presume means that it calls to lm() for every group of the categorical variable, however I don't quite understand what this means for non-categorical variable. Thanks __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Subseting in a 3D array
Hoi Agustin, --On woensdag 15 oktober 2003 18:47 +0200 Agustin Lobo [EMAIL PROTECTED] wrote: Could anyone suggest the way of subseting the 3D array to get a vector of z values for each position recorded in ib5km.lincol.random? (avoiding the use of for loops). Is section 5.3 from the Introduction to R (p21) helpfull? regards, Paul -- Paul Lemmens NICI, University of Nijmegen ASCII Ribbon Campaign /\ Montessorilaan 3 (B.01.03)Against HTML Mail \ / NL-6525 HR Nijmegen X The Netherlands / \ Phonenumber+31-24-3612648 Fax+31-24-3616066 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Subseting in a 3D array
One way would be: apply(ib5km.lincol.random[1:3,], 1, function(i) ib5km15.dbc[i[1],i[2],]) (untested) -- Tony Plate At Wednesday 06:47 PM 10/15/2003 +0200, Agustin Lobo wrote: Hi! I have a 3d array: dim(ib5km15.dbc) [1] 190 241 19 and a set of positions to extract: ib5km.lincol.random[1:3,] [,1] [,2] [1,] 78 70 [2,] 29 213 [3,] 180 22 Geting the values of a 2D array for that set of positions would be: ima - ib5km15.dbc[,,1] ima[ib5km.lincol.random[1:10,]] but don't find the way for the case of the 3D array: ib5km15.dbc[ib5km.lincol.random[1:10,],] Error in ib5km15.dbc[ib5km.lincol.random[1:10, ], ] : incorrect number of dimensions Could anyone suggest the way of subseting the 3D array to get a vector of z values for each position recorded in ib5km.lincol.random? (avoiding the use of for loops). Thanks Agus Dr. Agustin Lobo Instituto de Ciencias de la Tierra (CSIC) Lluis Sole Sabaris s/n 08028 Barcelona SPAIN tel 34 93409 5410 fax 34 93411 0012 [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] help with aggregate.survey.design
I am trying to modify aggregate.data.frame to create an aggregate method for survey design objects. I am running into problems because survey design objects are lists, with the variables and other design information stored in separate dataframes, or objects of other classes, in this list. *Apply and split functions do not seem to work on the design objects. How do I approach this, without having to rewrite *apply and split (and what would that involve?)? I thought of creating lots of subsets, using subset, but that does not seem to be a good approach. For example, the following line which does most of the work in the aggregate.data.frame does not work for design objects: y - lapply(income, tapply, list(age,sex), svymean, brf.d.na,simplify = FALSE) neither does the following: y - lapply(split(income, list(age,sex)), svymean,brf.d.na) [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] SOM library for R
Doing help.search(SOM) in R gives batchSOM(class) Self-Organizing Maps: Batch Algorithm SOM(class) Self-Organizing Maps: Online Algorithm somgrid(class) Plot SOM Fits so you ought to have it in your (recent enough) version of R. The class package is part of the VR bundle, which is shipped with R. Andy -Original Message- From: Hisaji Ono [mailto:[EMAIL PROTECTED] Sent: Wednesday, October 15, 2003 12:52 PM To: [EMAIL PROTECTED] Subject: [R] SOM library for R Hi. Three years ago, I've read the question of availability of SOM library for R using Kohonen's SOM_PAK in this mailing-list. This answer was no availability. And no package dealing with SOM in CRAN. Is this situation same? Could you tell me availability this library? Best Regards. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] SOM library for R
On Thu, 16 Oct 2003, Hisaji Ono wrote: Hi. Three years ago, I've read the question of availability of SOM library for R using Kohonen's SOM_PAK in this mailing-list. This answer was no availability. And no package dealing with SOM in CRAN. There are two SOM methods in package class (bundled with R) and a package som (formerly GeneSOM) on CRAN. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Problems Building RMySQL in Windows
Hi all, Unfortunately I must use winXP at my job, so I'm trying install from source RMySQL. Here are some details about this problem: - R 1.7.1 - RMySQL 0.5-2 - mysql 4.1.0-alpha-max-nt I followed the instructions posted in http://www.biostat.jhsph.edu/~kbroman/Rintro/Rwinpack.html and the following messages appeared. BTW, thanks in advance for your help and comments. C:\Program Files\R\rw1071\src\gnuwin32make pkg-RMySQL -- Making package RMySQL ** WARNING: this package has a configure script It probably needs manual configuration ** installing inst files adding build stamp to DESCRIPTION making DLL ... making RS-DBI.d from RS-DBI.c making RS-MySQL.d from RS-MySQL.c gcc -Ic:/mysql/include -IC:/PROGRA~1/R/rw1071/src/include -Wall -O2 -c RS-DBI.c -o RS-DBI.o gcc -Ic:/mysql/include -IC:/PROGRA~1/R/rw1071/src/include -Wall -O2 -c RS-MySQL.c -o RS-MySQL.o ar cr RMySQL.a *.o ranlib RMySQL.a windres --include-dir C:/PROGRA~1/R/rw1071/src/include -i RMySQL_res.rc -o RMySQL_res.o gcc --shared -s -o RMySQL.dll RMySQL.def RMySQL.a RMySQL_res.o -LC:/PROGRA~1/R/rw1071/src/gnuwin32 -Lc:/mysql/lib/opt -lmysql -liberty -lg2c -lR RMySQL.a(RS-MySQL.o)(.text+0x216):RS-MySQL.c: undefined reference to `_mysql_get_client_info' RMySQL.a(RS-MySQL.o)(.text+0x7f9):RS-MySQL.c: undefined reference to `_mysql_init' RMySQL.a(RS-MySQL.o)(.text+0x817):RS-MySQL.c: undefined reference to `_mysql_options' RMySQL.a(RS-MySQL.o)(.text+0x879):RS-MySQL.c: undefined reference to `_mysql_options' RMySQL.a(RS-MySQL.o)(.text+0x8e4):RS-MySQL.c: undefined reference to `_load_defaults' RMySQL.a(RS-MySQL.o)(.text+0xb39):RS-MySQL.c: undefined reference to `_mysql_real_connect' RMySQL.a(RS-MySQL.o)(.text+0xc3d):RS-MySQL.c: undefined reference to `_mysql_close' RMySQL.a(RS-MySQL.o)(.text+0xd31):RS-MySQL.c: undefined reference to `_mysql_options' RMySQL.a(RS-MySQL.o)(.text+0xde1):RS-MySQL.c: undefined reference to `_mysql_close' RMySQL.a(RS-MySQL.o)(.text+0xf89):RS-MySQL.c: undefined reference to `_mysql_query' RMySQL.a(RS-MySQL.o)(.text+0xfa4):RS-MySQL.c: undefined reference to `_mysql_use_result' RMySQL.a(RS-MySQL.o)(.text+0xfbe):RS-MySQL.c: undefined reference to `_mysql_field_count' RMySQL.a(RS-MySQL.o)(.text+0x106a):RS-MySQL.c: undefined reference to `_mysql_affected_rows' RMySQL.a(RS-MySQL.o)(.text+0x10de):RS-MySQL.c: undefined reference to `_mysql_error' RMySQL.a(RS-MySQL.o)(.text+0x116f):RS-MySQL.c: undefined reference to `_mysql_fetch_fields' RMySQL.a(RS-MySQL.o)(.text+0x1188):RS-MySQL.c: undefined reference to `_mysql_field_count' RMySQL.a(RS-MySQL.o)(.text+0x155c):RS-MySQL.c: undefined reference to `_mysql_fetch_row' RMySQL.a(RS-MySQL.o)(.text+0x1576):RS-MySQL.c: undefined reference to `_mysql_fetch_lengths' RMySQL.a(RS-MySQL.o)(.text+0x17c3):RS-MySQL.c: undefined reference to `_mysql_errno' RMySQL.a(RS-MySQL.o)(.text+0x19e4):RS-MySQL.c: undefined reference to `_mysql_errno' RMySQL.a(RS-MySQL.o)(.text+0x19ef):RS-MySQL.c: undefined reference to `_mysql_error' RMySQL.a(RS-MySQL.o)(.text+0x1a64):RS-MySQL.c: undefined reference to `_mysql_fetch_row' RMySQL.a(RS-MySQL.o)(.text+0x1a74):RS-MySQL.c: undefined reference to `_mysql_free_result' RMySQL.a(RS-MySQL.o)(.text+0x1d1b):RS-MySQL.c: undefined reference to `_mysql_get_client_info' RMySQL.a(RS-MySQL.o)(.text+0x1f4e):RS-MySQL.c: undefined reference to `_mysql_get_host_info' RMySQL.a(RS-MySQL.o)(.text+0x1f78):RS-MySQL.c: undefined reference to `_mysql_get_server_info' RMySQL.a(RS-MySQL.o)(.text+0x1fa5):RS-MySQL.c: undefined reference to `_mysql_get_proto_info' RMySQL.a(RS-MySQL.o)(.text+0x1fb6):RS-MySQL.c: undefined reference to `_mysql_thread_id' RMySQL.a(RS-MySQL.o)(.text+0x2c32):RS-MySQL.c: undefined reference to `_mysql_fetch_lengths' RMySQL.a(RS-MySQL.o)(.text+0x2c59):RS-MySQL.c: undefined reference to `_mysql_errno' RMySQL.a(RS-MySQL.o)(.text+0x2eda):RS-MySQL.c: undefined reference to `_mysql_fetch_row' collect2: ld returned 1 exit status make[2]: *** [RMySQL.dll] Error 1 make[1]: *** [src/RMySQL.dll] Error 2 make: *** [pkg-RMySQL] Error 2 C:\Program Files\R\rw1071\src\gnuwin32 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Subseting in a 3D array
That does use a for loop inside apply. I would make use of dim shuffling: you have an array indexed by (x,y,z) and you want (I presume) a matrix indexed by ((x,y), z) for specified pairs (x,y). X - ib5km15.dbc dim(X) - c(190*241, 19) X[ib5km.lincol.random %*% c(1, 240) - 240, ] should be something close to what you want if I have read the runes correctly. On Wed, 15 Oct 2003, Tony Plate wrote: One way would be: apply(ib5km.lincol.random[1:3,], 1, function(i) ib5km15.dbc[i[1],i[2],]) (untested) -- Tony Plate At Wednesday 06:47 PM 10/15/2003 +0200, Agustin Lobo wrote: Hi! I have a 3d array: dim(ib5km15.dbc) [1] 190 241 19 and a set of positions to extract: ib5km.lincol.random[1:3,] [,1] [,2] [1,] 78 70 [2,] 29 213 [3,] 180 22 Geting the values of a 2D array for that set of positions would be: ima - ib5km15.dbc[,,1] ima[ib5km.lincol.random[1:10,]] but don't find the way for the case of the 3D array: ib5km15.dbc[ib5km.lincol.random[1:10,],] Error in ib5km15.dbc[ib5km.lincol.random[1:10, ], ] : incorrect number of dimensions Could anyone suggest the way of subseting the 3D array to get a vector of z values for each position recorded in ib5km.lincol.random? (avoiding the use of for loops). Thanks Agus Dr. Agustin Lobo Instituto de Ciencias de la Tierra (CSIC) Lluis Sole Sabaris s/n 08028 Barcelona SPAIN tel 34 93409 5410 fax 34 93411 0012 [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Problems Building RMySQL in Windows
On Wed, 15 Oct 2003, Héctor Villafuerte D. wrote: Hi all, Unfortunately I must use winXP at my job, so I'm trying install from source RMySQL. Here are some details about this problem: - R 1.7.1 - RMySQL 0.5-2 - mysql 4.1.0-alpha-max-nt I followed the instructions posted in http://www.biostat.jhsph.edu/~kbroman/Rintro/Rwinpack.html and the following messages appeared. BTW, thanks in advance for your help and comments. It hasn't found the mysql entry points: have you built an import library for the mysql client and is it in c:/mysql/lib/opt, for example. Error messages very similar to these are covered in the README.windows file in the RMySQL package. Please read the documentation in the RMySQL package and in the current R for Windows relase (that web page is long out of date and I believe was never as accurate as the official documentation). C:\Program Files\R\rw1071\src\gnuwin32make pkg-RMySQL -- Making package RMySQL ** WARNING: this package has a configure script It probably needs manual configuration ** installing inst files adding build stamp to DESCRIPTION making DLL ... making RS-DBI.d from RS-DBI.c making RS-MySQL.d from RS-MySQL.c gcc -Ic:/mysql/include -IC:/PROGRA~1/R/rw1071/src/include -Wall -O2 -c RS-DBI.c -o RS-DBI.o gcc -Ic:/mysql/include -IC:/PROGRA~1/R/rw1071/src/include -Wall -O2 -c RS-MySQL.c -o RS-MySQL.o ar cr RMySQL.a *.o ranlib RMySQL.a windres --include-dir C:/PROGRA~1/R/rw1071/src/include -i RMySQL_res.rc -o RMySQL_res.o gcc --shared -s -o RMySQL.dll RMySQL.def RMySQL.a RMySQL_res.o -LC:/PROGRA~1/R/rw1071/src/gnuwin32 -Lc:/mysql/lib/opt -lmysql -liberty -lg2c -lR RMySQL.a(RS-MySQL.o)(.text+0x216):RS-MySQL.c: undefined reference to `_mysql_get_client_info' RMySQL.a(RS-MySQL.o)(.text+0x7f9):RS-MySQL.c: undefined reference to `_mysql_init' RMySQL.a(RS-MySQL.o)(.text+0x817):RS-MySQL.c: undefined reference to `_mysql_options' RMySQL.a(RS-MySQL.o)(.text+0x879):RS-MySQL.c: undefined reference to `_mysql_options' RMySQL.a(RS-MySQL.o)(.text+0x8e4):RS-MySQL.c: undefined reference to `_load_defaults' RMySQL.a(RS-MySQL.o)(.text+0xb39):RS-MySQL.c: undefined reference to `_mysql_real_connect' RMySQL.a(RS-MySQL.o)(.text+0xc3d):RS-MySQL.c: undefined reference to `_mysql_close' RMySQL.a(RS-MySQL.o)(.text+0xd31):RS-MySQL.c: undefined reference to `_mysql_options' RMySQL.a(RS-MySQL.o)(.text+0xde1):RS-MySQL.c: undefined reference to `_mysql_close' RMySQL.a(RS-MySQL.o)(.text+0xf89):RS-MySQL.c: undefined reference to `_mysql_query' RMySQL.a(RS-MySQL.o)(.text+0xfa4):RS-MySQL.c: undefined reference to `_mysql_use_result' RMySQL.a(RS-MySQL.o)(.text+0xfbe):RS-MySQL.c: undefined reference to `_mysql_field_count' RMySQL.a(RS-MySQL.o)(.text+0x106a):RS-MySQL.c: undefined reference to `_mysql_affected_rows' RMySQL.a(RS-MySQL.o)(.text+0x10de):RS-MySQL.c: undefined reference to `_mysql_error' RMySQL.a(RS-MySQL.o)(.text+0x116f):RS-MySQL.c: undefined reference to `_mysql_fetch_fields' RMySQL.a(RS-MySQL.o)(.text+0x1188):RS-MySQL.c: undefined reference to `_mysql_field_count' RMySQL.a(RS-MySQL.o)(.text+0x155c):RS-MySQL.c: undefined reference to `_mysql_fetch_row' RMySQL.a(RS-MySQL.o)(.text+0x1576):RS-MySQL.c: undefined reference to `_mysql_fetch_lengths' RMySQL.a(RS-MySQL.o)(.text+0x17c3):RS-MySQL.c: undefined reference to `_mysql_errno' RMySQL.a(RS-MySQL.o)(.text+0x19e4):RS-MySQL.c: undefined reference to `_mysql_errno' RMySQL.a(RS-MySQL.o)(.text+0x19ef):RS-MySQL.c: undefined reference to `_mysql_error' RMySQL.a(RS-MySQL.o)(.text+0x1a64):RS-MySQL.c: undefined reference to `_mysql_fetch_row' RMySQL.a(RS-MySQL.o)(.text+0x1a74):RS-MySQL.c: undefined reference to `_mysql_free_result' RMySQL.a(RS-MySQL.o)(.text+0x1d1b):RS-MySQL.c: undefined reference to `_mysql_get_client_info' RMySQL.a(RS-MySQL.o)(.text+0x1f4e):RS-MySQL.c: undefined reference to `_mysql_get_host_info' RMySQL.a(RS-MySQL.o)(.text+0x1f78):RS-MySQL.c: undefined reference to `_mysql_get_server_info' RMySQL.a(RS-MySQL.o)(.text+0x1fa5):RS-MySQL.c: undefined reference to `_mysql_get_proto_info' RMySQL.a(RS-MySQL.o)(.text+0x1fb6):RS-MySQL.c: undefined reference to `_mysql_thread_id' RMySQL.a(RS-MySQL.o)(.text+0x2c32):RS-MySQL.c: undefined reference to `_mysql_fetch_lengths' RMySQL.a(RS-MySQL.o)(.text+0x2c59):RS-MySQL.c: undefined reference to `_mysql_errno' RMySQL.a(RS-MySQL.o)(.text+0x2eda):RS-MySQL.c: undefined reference to `_mysql_fetch_row' collect2: ld returned 1 exit status make[2]: *** [RMySQL.dll] Error 1 make[1]: *** [src/RMySQL.dll] Error 2 make: *** [pkg-RMySQL] Error 2 C:\Program Files\R\rw1071\src\gnuwin32 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Brian
Re: [R] aov and non-categorical variables
On 15 Oct 2003 at 9:32, Alexander Sirotkin [at Yahoo] wrote: It is unclear to me how aov() handles non-categorical variables. aov is an interface to lm, so it can estimate every model lm can, the difference is that it produces the results (summary) in the classical way for anova. I mean it works and produces results that I would expect, but I was under impression that ANOVA is only defined for categorical variables. In addition, help(aov) says that it call to 'lm' for each stratum, which I presume means that it calls to lm() for every group of the categorical variable, No. With anova you can also define error strata using Error() as part of the formula, lm() cannot do that. If you don't use Error() in the formula, lm() is called only once. Kjetil Halvorsen however I don't quite understand what this means for non-categorical variable. Thanks __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Problems Building RMySQL in Windows
Thanks Prof., I forgot to mention that I had already read README.windows. So I downloaded reimp.exe and did: C:\mysql\lib\optreimp.exe libmysql.lib And the output was: liblibmysql.a which I renamed to: libmysql.a And then I got the errors of my previous mail. I've just found the R Installation and Administration manual (oops) so I'll try to find some answers in there. Thanks again. Hector Prof Brian Ripley wrote: It hasn't found the mysql entry points: have you built an import library for the mysql client and is it in c:/mysql/lib/opt, for example. Error messages very similar to these are covered in the README.windows file in the RMySQL package. Please read the documentation in the RMySQL package and in the current R for Windows relase (that web page is long out of date and I believe was never as accurate as the official documentation). __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] (no subject)
Hello, Does anyone know of any Stochastic Dynamic Programming functions/packages for R? Thanks! Martin -- Martin Biuw Sea Mammal Research Unit Gatty Marine Laboratory, University of St Andrews St Andrews, Fife KY16 8PA Scotland Ph: +44-(0)1334-462637 Fax: +44-(0)1334-462632 Web: http://smub.st.and.ac.uk __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] help with legend()
I am converting some S-PLUS scripts that I use for creating manuscript figures to R so that I can take advantage of the plotmath capabilities. In my S-PLUS scripts I like to use the key() function for adding legends to plots, and I have a couple of questions regarding using the legend() function in R. 1) is there a way to specify different colors for the legend vector of text values? 2) is there a way to reverse the order of the legend items so that the text values precede the symbols? Thanks for your time and patience. -Paul Paul A. Schwarz, Ph.D. Department of Forest Science 342 Richardson Hall Oregon State University Corvallis, Oregon 97331-5752 [EMAIL PROTECTED] (541) 737-8481 (office) (541) 737-1393 (fax) __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Windows binaries for DCluster updated
Hi, As Frank M. Howell noticed (and probably other users), the Windows binaries for DCluster I put in my web page are not working... I have compiled the source code again and know it does. Please, download it again, and sorry for the inconvenience. The URL is http://matheron.uv.es/~virgil/Rpackages/DCluster DCluster is a package that implements some methods for the detection of spatial clusters of diseases. Best regards, Virgilio __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Solaris 2.9
I've compiled the 1.8.0 R on Solaris 2.9 and when trying to use plot command I get the Bus error and a core dump. Anybody experienced something like this? If yes, what should I patch? Janusz. [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Re: [R-sig-Geo] Windows binaries for DCluster updated
Hi. (B (B DCluster is very nice tool, especially Stan Openshaw's GAM. (B (B DCluster's GAM's testing function is different from original GAM whose (Btesting function used Monte Carlo method. (B (B Could you tell me how I can execute original GAM using DCluster? (B (B And can I execute GAM/K using DCluster? (B (B Regards. (B (B- Original Message - (BFrom: "Virgilio G$B N(Bez Rubio" <[EMAIL PROTECTED]> (BTo: [EMAIL PROTECTED]; [EMAIL PROTECTED] (BSent: Thursday, October 16, 2003 4:27 AM (BSubject: [R-sig-Geo] Windows binaries for DCluster updated (B (B (B Hi, (B (B As Frank M. Howell noticed (and probably other users), the Windows (B binaries for DCluster I put in my web page are not working... I have (B compiled the source code (B again and know it does. Please, download it again, and sorry for the (B inconvenience. (B (B The URL is http://matheron.uv.es/~virgil/Rpackages/DCluster (B (B DCluster is a package that implements some methods for the detection of (B spatial clusters of diseases. (B (B__ (B[EMAIL PROTECTED] mailing list (Bhttps://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Problems Building RMySQL in Windows
David James wrote: Hi, I'm attaching a Windows binary version of RMySQL. It was compiled against MySQL 2.23.56 (recall that you must also install the DBI package). Let me know if it works. Hope this helps, -- David Thanks David, I tried the binaries you sent me. Here's the warning it gave me: library(RMySQL) Warning message: DLL attempted to change FPU control word from 8001f to 9001f Then I tried to do this: con - dbConnect(dbDriver(MySQL), dbname = test) but it crashed R. I got back to the sources then (but now using RCMD.EXE)... but again it seems I'm missing something important: C:\Program Files\R\rw1071\binrcmd INSTALL ..\src\library\RMySQL make: *** No rule to make target `Files/R/rw1071/src/library'. Stop. *** Installation of RMySQL failed *** C:\Program Files\R\rw1071\bin Thank you so much for your help. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Solaris 2.9
What was the command that caused the problem (reproducible example please). What was the error message ? Try the same command with R 1.7.1 and see if you get the same error. -Original Message- From: Janusz Kawczak [mailto:[EMAIL PROTECTED] Sent: Thu 10/16/2003 4:11 AM To: [EMAIL PROTECTED] Cc: Subject: [R] Solaris 2.9 I've compiled the 1.8.0 R on Solaris 2.9 and when trying to use plot command I get the Bus error and a core dump. Anybody experienced something like this? If yes, what should I patch? Janusz. [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Re: [R-sig-Geo] Windows binaries for DCluster updated
Hi, DCluster is very nice tool, especially Stan Openshaw's GAM. Thank you! DCluster's GAM's testing function is different from original GAM whose testing function used Monte Carlo method. Could you tell me how I can execute original GAM using DCluster? Well, I think you can write your own function to do that and pass it to opgam as argument 'iscluster'. The default value is 'opgam.iscluster.default': opgam.iscluster.default-function (data, idx, idxorder, alpha, ...) { localO - sum(data$Observed[idx]) localE - sum(data$Expected[idx]) if (localE == 0) return(c(localO, NA, NA)) localP - sum(data$Population[idx]) pvalue - ppois(localO, localE, lower.tail = FALSE) return(c(localO, alpha pvalue, pvalue)) } What you can do is to change the line where the pvalue is calculated and, instead of using 'ppois' use a function that performs a Monte Carlo test. Probably you will not need localR nor localP if you use Monte Carlo. So, the function could be simething like: montecarlo.iscluster-function(data, idx, idxorder, alpha, ...) { localO - sum(data$Observed[idx]) pvalue - return_pvalue_from_monte_carlo_simulations(data, localO) return(c(localO, alpha pvalue, pvalue)) } where 'return_pvalue_from_monte_carlo_simulations' performs the M.C. simulations and compare localO with the values obtained to compute the pvalue. I hope it's clear... if not, just tell me. :D And can I execute GAM/K using DCluster? Not at the moment, but 'opgam' returns the coordinates of the centres of the balls that were significant, so I guess that you can use other R packages to calculate a density from this table. I have also written some code (not released yet) to calculate how many times a centroid is included in these circles, in case you are interested. I know it's not GAM/K but it can be useful for some purposes... Best regards, -- Virgilio Gómez Rubio Grup d'Estadística espacial i temporal en Epidemiologia i medi ambient Dpto. Estadística e I. O. - Facultat de Matemàtiques Avda. Vicent A. Estellés, 1 - 46100 Burjassot Valencia - SPAIN http://matheron.uv.es/~virgil TLF: 00 34 96 354 43 62 - FAX: 00 34 96 354 47 35 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Solaris 2.9
I've experienced that problem on Solaris 2.8 with gcc prior to gcc 3.2.3. Paul Gilbert Janusz Kawczak wrote: I've compiled the 1.8.0 R on Solaris 2.9 and when trying to use plot command I get the Bus error and a core dump. Anybody experienced something like this? If yes, what should I patch? Janusz. [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] nnet: Too many weights?
I am using library(nnet) to train up an ANN with what I believe is a moderately sized dataset, but R is complaining about too many weights: --- nn.1 - nnet(t(data), targets, size = 4, rang = 0.1, decay = 5e-4, maxit = 200) Error in nnet.default(t(data), targets, size = 4, rang = 0.1, decay = 5e-04, : Too many (1614) weights dim(targets) [1] 146 2 dim(data) ## Note I'm using the transpose as input [1] 400 146 --- Is there a way around this? Pointers to relevant docs/code or the source of the problem would be greatly appreciated. Thanks, _Taku --- Taku A. Tokuyasu, PhD UCSF Cancer Center, Box 0128 San Francisco, CA 94143-0128 Tel: (415) 514-1530 Fax: (415) 502-3179 Email: [EMAIL PROTECTED] [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Example of cell means model
Thanks a lot for your reply. This helps a lot! Just to confirm, using lm this model will give me the mean yield value for each cell in the two way array. Now if I want to obtain the mean of group means (like a SS type III approach) using LME (since I have random effects in the model) how can I parametrize this? I could definitivelly use xtabs in a two-way case but in my case I have 2 other (continuous) covariates that are potential confounders in the model so I need to keep them to obtain the corrected means. I added a continuous variable (NewVar) to the dataset Newxmp11.07 and obtaned a model with the covariate (fm4) and another without it (fm3) Newxmp11.07-fix(xmp11.07) str(Newxmp11.07) `data.frame': 36 obs. of 4 variables: $ Yield : num 10.5 9.2 7.9 12.8 11.2 13.3 12.1 12.6 14 10.8 ... $ Variety: Factor w/ 3 levels 1,2,3: 1 1 1 1 1 1 1 1 1 1 ... $ Density: Factor w/ 4 levels 1,2,3,4: 1 1 1 2 2 2 3 3 3 4 ... $ NewVar : num 10 9 7 12 11 11 12 11 15 16 ... fm3-gls(Yield~-1+Variety + Density, xmp11.07) fm4-gls(Yield~-1+Variety + Density+NewVar, Newxmp11.07) fm3 Coefficients: Variety1 Variety2 Variety3 Density2 Density3 Density4 8.92 9.797222 15.713889 2.91 4.30 2.43 Degrees of freedom: 36 total; 30 residual Residual standard error: 1.239243 fm4 Coefficients: Variety1Variety2Variety3Density2Density3Density4 8.75757265 9.70589316 15.43347009 2.88152564 4.32186752 2.40117521 NewVar 0.01157692 Degrees of freedom: 36 total; 29 residual Residual standard error: 1.252991 fm4 gives me the mean of the group means for all the varieties but apparently it gives me the treatment contrasts for the densities. If I change the order of the factors in the model specification I get coef(fm5-gls(Yield~-1+ Density+Variety+NewVar, Newxmp11.07)) Density1Density2Density3Density4Variety2Variety3 8.75757265 11.63909829 13.07944017 11.15874786 0.94832051 6.67589744 NewVar 0.01157692 This, just like fm4 will include the original intercept value in Density 1 which is not the actual density 1 mean. What am I missing? I am sorry if these questions are very basic but I want to make sure that I understand what I am doing. I guess that this is the price that I am paying for having used in the past packages like SAS where you just ask for lsmeans and the software will give you a black box answer! Best regards Francisco From: Douglas Bates [EMAIL PROTECTED] To: Francisco Vergara [EMAIL PROTECTED] CC: [EMAIL PROTECTED] Subject: Re: [R] Example of cell means model Date: 15 Oct 2003 08:40:33 -0500 This is an example from chapter 11 of the 6th edition of Devore's engineering statistics text. It happens to be a balanced data set in two factors but the calculations will also work for unbalanced data. I create a factor called 'cell' from the text representation of the Variety level and the Density level using '/' as the separator character. The coefficients for the linear model 'Yield ~ cell - 1' are exactly the cell means. library(Devore6) data(xmp11.07) str(xmp11.07) `data.frame': 36 obs. of 3 variables: $ Yield : num 10.5 9.2 7.9 12.8 11.2 13.3 12.1 12.6 14 10.8 ... $ Variety: Factor w/ 3 levels 1,2,3: 1 1 1 1 1 1 1 1 1 1 ... $ Density: Factor w/ 4 levels 1,2,3,4: 1 1 1 2 2 2 3 3 3 4 ... xmp11.07$cell = with(xmp11.07, factor(paste(Variety, Density, sep = '/'))) xtabs(~ Variety + Density, xmp11.07) Density Variety 1 2 3 4 1 3 3 3 3 2 3 3 3 3 3 3 3 3 3 means = xtabs(Yield ~ Variety+Density, xmp11.07)/xtabs(~ Variety + Density, xmp11.07) means Density Variety 1 2 3 4 1 9.20 12.43 12.90 10.80 2 8.93 12.63 14.50 12.77 3 16.30 18.10 19.93 18.17 coef(fm1 - lm(Yield ~ cell - 1, xmp11.07)) cell1/1 cell1/2 cell1/3 cell1/4 cell2/1 cell2/2 cell2/3 cell2/4 9.20 12.43 12.90 10.80 8.93 12.63 14.50 12.77 cell3/1 cell3/2 cell3/3 cell3/4 16.30 18.10 19.93 18.17 The residual sum of squares for this model is the same as that for the model with crossed terms deviance(fm1) [1] 38.04 deviance(fm2 - lm(Yield ~ Variety * Density, xmp11.07)) [1] 38.04 but the coefficients are quite different because they represent a different parameterization. coef(fm2) (Intercept) Variety2 Variety3 Density2 9.2000 -0.26677.10003.2333 Density3 Density4 Variety2:Density2 Variety3:Density2 3.70001.60000.4667 -1.4333 Variety2:Density3 Variety3:Density3 Variety2:Density4 Variety3:Density4 1.8667 -0.06672.23330.2667 I hope this answers your question. Sorry for the delay in responding to you. Francisco Vergara [EMAIL PROTECTED] writes: Many thanks for your reply. An example would be
Re: [R] aov and non-categorical variables
Thanks. One more question, if you don't mind. If instead of aov(), I call lm() directly it fits a linear regression model and if it encounters categorical variable it does what needs to be done in this case - defines a new indicator variable for each level of categorical var. However, if I call aov() with the same data (categorical and numeric) I don't see all these indicator variables in the ANOVA table. It is unclear to me how the ANOVA table with lots of inidcator variables produced by lm() is transferred into the ANOVA table of aov(). Also, after you mention the Error() term in aov() I tried to find some explaination about it in R manuals, and did not find any. Do you know where the meaning of Error() in aov() is documented ? Thanks. --- [EMAIL PROTECTED] wrote: On 15 Oct 2003 at 9:32, Alexander Sirotkin [at Yahoo] wrote: It is unclear to me how aov() handles non-categorical variables. aov is an interface to lm, so it can estimate every model lm can, the difference is that it produces the results (summary) in the classical way for anova. I mean it works and produces results that I would expect, but I was under impression that ANOVA is only defined for categorical variables. In addition, help(aov) says that it call to 'lm' for each stratum, which I presume means that it calls to lm() for every group of the categorical variable, No. With anova you can also define error strata using Error() as part of the formula, lm() cannot do that. If you don't use Error() in the formula, lm() is called only once. Kjetil Halvorsen however I don't quite understand what this means for non-categorical variable. Thanks __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Problems Building RMySQL in Windows
David James wrote: Héctor Villafuerte D. wrote: Thanks David, I tried the binaries you sent me. Here's the warning it gave me: library(RMySQL) Warning message: DLL attempted to change FPU control word from 8001f to 9001f I have seen this, but it has not caused any problem to me, so my reaction is that it may be ok to ignore. Then I tried to do this: con - dbConnect(dbDriver(MySQL), dbname = test) but it crashed R. I've seen this too. Typically it is a *.dll conflict between the version of the MySQL library included and used for compiling RMySQL (MySQL 3.23.56) and the runtime MySQL library you use (say, 4.0.x). If this is the problem, you can easily fix it by making sure your PATH variable picks the *.dll used in the RMySQL package first (ahead of the 4.0.x *.dll). Hope this helps, -- David Here is a copy of my PATH environment variable: C:\Perl\bin\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem; C:\Program Files\NMapWin\bin;c:\cygwin\bin;C:\Python23; C:\Program Files\R\rw1071\library\RMySQL\libs;C:\mysql\bin And yes... running dbConnect still crashes R... Thanks again for your help. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Strange scope problem
Hi, I have come across the following problem which seems to be a scoping issue but I'm at a loss to see why this is so or to find a good workaround. Suppose I have a function to get a prediction after model selection using the step function. step.pred - function(dat, x0) { fit.model - step(lm(y~., data=dat), trace=F) predict(fit.model, x0, se.fit=T) } This function works sometimes for example set.seed(1) X.1 - data.frame(x1=rnorm(20), x2=rnorm(20), x3=rnorm(20)) y.1 - 5+as.matrix(X.1[,1:2])%*%matrix(c(1,1))+rnorm(20) Xy.1 - data.frame(X.1,y=y.1) x0.1 - data.frame(x1=-1,x2=-1, x3=-1) step.pred(Xy.1, x0.1) $fit [1] 3.359540 $se.fit [1] 0.523629 $df [1] 16 $residual.scale [1] 1.093526 but most often it crashes as in set.seed(2) X.2 - data.frame(x1=rnorm(20), x2=rnorm(20), x3=rnorm(20)) y.2 - 5+as.matrix(X.2[,1:2])%*%matrix(c(1,1))+rnorm(20) Xy.2 - data.frame(X.2,y=y.2) x0.2 - data.frame(x1=-1,x2=-1, x3=-1) step.pred(Xy.2, x0.2) Error in model.frame.default(formula = y ~ x1 + x2, data = dat, drop.unused.levels = TRUE) : Object dat not found The difference seems to be that for the first dataset, step retains all three variables whereas for the second it drops one of them. step(lm(y~.,data=Xy.1), trace=F) Call: lm(formula = y ~ x1 + x2 + x3, data = Xy.1) Coefficients: (Intercept) x1 x2 x3 4.8347 0.8937 1.0331 -0.4516 step(lm(y~.,data=Xy.2), trace=F) Call: lm(formula = y ~ x1 + x2, data = Xy.2) Coefficients: (Intercept) x1 x2 5.0802 0.9763 1.1369 One possible workaround is to explicitely assign the local variable dat in the .GlobalEnv as in step.pred1 - function(dat, x0) { assign(dat,dat, envir=.GlobalEnv) fit.model - step(lm(y~., data=dat), trace=F) predict(fit.model, x0, se.fit=T) } I don't like this method since it would overwrite anything else called dat in .GlobalEnv. I realize that I could give it an obscure name but the potential for damage still remains. Am I missing something obvious here? If not, is it possible to work around this problem in such a way that .GlobalEnv does not need to be touched? In S-Plus I would use assign(dat,dat, frame=1) which works but that is not available (AFAIK) in R. Is there something similar that I can use? I am using R 1.6.1 for Unix on a Sun Workstation. I know that I need to upgrade but our sysadmin doesn't regard it as priority! Thanks for any help you can give for this. Angelo -- | Angelo J. CantyEmail: [EMAIL PROTECTED] | | Mathematics and Statistics Phone: (905) 525-9140 x 27079 | | McMaster UniversityFax : (905) 522-0935 | | 1280 Main St. W. | | Hamilton ON L8S 4K1 | __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] aov and non-categorical variables
From: Alexander Sirotkin [at Yahoo] [mailto:[EMAIL PROTECTED] Thanks. One more question, if you don't mind. If instead of aov(), I call lm() directly it fits a linear regression model and if it encounters categorical variable it does what needs to be done in this case - defines a new indicator variable for each level of categorical var. What ANOVA table are you talking about; i.e., from which function? There is no anova() method for aov objects, so you will see identical result for anova(fit) whether `fit' is fitted by direct call to lm() or aov(). The difference is the the output of summary. For an aov object, summary() just prints the ANOVA table, which gives the same answer as anova(). For an lm object, summary() prints the coefficients, se's and the associated t-tests for each term (or contrasts, for categorical variables). That's not ANOVA table. BTW (for the developers), the labels for the terms shown below (output of summary.lm) look rather confusing: summary(fit2) Call: lm(formula = y ~ x + x2) Residuals: Min 1Q Median 3Q Max -1.2779 -0.7437 0.3228 0.7196 0.8628 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 0.8287 0.4990 1.661 0.1353 x2 -0.6625 0.6817 -0.972 0.3596 x3 -1.6203 0.6843 -2.368 0.0454 * x20.5110 0.2150 2.377 0.0448 * --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Residual standard error: 0.9604 on 8 degrees of freedom Multiple R-Squared: 0.5587, Adjusted R-squared: 0.3933 F-statistic: 3.377 on 3 and 8 DF, p-value: 0.07493 Notice `x2' appear twice! Is there a better way to label the contrasts so as to avoid this confusion? Andy However, if I call aov() with the same data (categorical and numeric) I don't see all these indicator variables in the ANOVA table. It is unclear to me how the ANOVA table with lots of inidcator variables produced by lm() is transferred into the ANOVA table of aov(). Also, after you mention the Error() term in aov() I tried to find some explaination about it in R manuals, and did not find any. Do you know where the meaning of Error() in aov() is documented ? Thanks. --- [EMAIL PROTECTED] wrote: On 15 Oct 2003 at 9:32, Alexander Sirotkin [at Yahoo] wrote: It is unclear to me how aov() handles non-categorical variables. aov is an interface to lm, so it can estimate every model lm can, the difference is that it produces the results (summary) in the classical way for anova. I mean it works and produces results that I would expect, but I was under impression that ANOVA is only defined for categorical variables. In addition, help(aov) says that it call to 'lm' for each stratum, which I presume means that it calls to lm() for every group of the categorical variable, No. With anova you can also define error strata using Error() as part of the formula, lm() cannot do that. If you don't use Error() in the formula, lm() is called only once. Kjetil Halvorsen however I don't quite understand what this means for non-categorical variable. Thanks __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo /r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] help with aggregate.survey.design
On Wed, 15 Oct 2003 [EMAIL PROTECTED] wrote: I am trying to modify aggregate.data.frame to create an aggregate method for survey design objects. I am running into problems because survey design objects are lists, with the variables and other design information stored in separate dataframes, or objects of other classes, in this list. *Apply and split functions do not seem to work on the design objects. How do I approach this, without having to rewrite *apply and split (and what would that involve?)? I thought of creating lots of subsets, using subset, but that does not seem to be a good approach. I think the right approach is to extract the `variables' component of the survey.design, use aggregate on it, and then work out how to attach the right design metadata (weights, clusters, c) to it. This is not completely trivial, or I would have done it already. -thomas __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] indexing a particular element in a list of vectors
I have a list of character vectors. I'm trying to see if there is a way (in a single line, without a loop) to pull out the first element of all the vectors contained in the list. listOfVectors[1:length(listOfVectors][1] doesn't work. == If you want more details.. Here is my listOfVectors which is called uuu uuu[order(uuu)] [[1]] [1] pt1pg multi.expr [[2]] [1] 1ngml fluor.expr [[3]] [1] 1pgml fluor.expr [[4]] [1] 10ng ml fluor.expr [[5]] [1] 10pg ml fluor.expr I'm basically interested in getting the following elements: pt1pg, 1ng, 1pg, etc. as a list (or character vector) Note, this might have an obvious solution but I claim Newbie status! Thanks in advance! -Scott Scott Norton, Ph.D. Engineering Manager Nanoplex Technologies, Inc. 2375 Garcia Ave. Mountain View, CA 94043 www.nanoplextech.com [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] indexing a particular element in a list of vectors
How about: lst - list(c(a, b, c), c(d, e, f)) sapply(lst, function (x) x[1]) [1] a d Cheers, Simon. Simon Blomberg, PhD Depression Anxiety Consumer Research Unit Centre for Mental Health Research Australian National University http://www.anu.edu.au/cmhr/ [EMAIL PROTECTED] +61 (2) 6125 3379 -Original Message- From: Scott Norton [mailto:[EMAIL PROTECTED] Sent: Thursday, 16 October 2003 1:58 PM To: [EMAIL PROTECTED] Subject: [R] indexing a particular element in a list of vectors I have a list of character vectors. I'm trying to see if there is a way (in a single line, without a loop) to pull out the first element of all the vectors contained in the list. listOfVectors[1:length(listOfVectors][1] doesn't work. == If you want more details.. Here is my listOfVectors which is called uuu uuu[order(uuu)] [[1]] [1] pt1pg multi.expr [[2]] [1] 1ngml fluor.expr [[3]] [1] 1pgml fluor.expr [[4]] [1] 10ng ml fluor.expr [[5]] [1] 10pg ml fluor.expr I'm basically interested in getting the following elements: pt1pg, 1ng, 1pg, etc. as a list (or character vector) Note, this might have an obvious solution but I claim Newbie status! Thanks in advance! -Scott Scott Norton, Ph.D. Engineering Manager Nanoplex Technologies, Inc. 2375 Garcia Ave. Mountain View, CA 94043 www.nanoplextech.com [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Problems Building RMySQL in Windows
I get the same, library(RMySQL) Warning message: DLL attempted to change FPU control word from 8001f to 9001f ...but until now this never occur in a crash and i develope a complex direct-marketing-system what get's and put's dynamically ~ 100.000 cases and 50 ~ variables with this tools! I experiment something, how i get runing mysql 4.1.0.alpha! (1.) Install with the reimport description and the different path settings mysql4.0 and RMySQL. Now, when this works it is possible to unzip the mysql-4.1.0-alpha.zip and overwrite your Mysql4.0 installation. (2.) Doing the remip libmysql.lib etc. direct for the 4.1.0-alpha occur for me in problems!? MySQLConnection:(620,0) User: root Host: localhost Dbname: test Connection type: localhost via TCP/IP MySQL server version: 4.1.0-alpha-max-nt MySQL client version: 4.0.15 MySQL protocol version: 10 MySQL server thread id: 5 No resultSet available regards,christian - Original Message - From: Héctor Villafuerte D. [EMAIL PROTECTED] To: [EMAIL PROTECTED] Sent: Thursday, October 16, 2003 3:19 AM Subject: Re: [R] Problems Building RMySQL in Windows David James wrote: Héctor Villafuerte D. wrote: Thanks David, I tried the binaries you sent me. Here's the warning it gave me: library(RMySQL) Warning message: DLL attempted to change FPU control word from 8001f to 9001f I have seen this, but it has not caused any problem to me, so my reaction is that it may be ok to ignore. Then I tried to do this: con - dbConnect(dbDriver(MySQL), dbname = test) but it crashed R. I've seen this too. Typically it is a *.dll conflict between the version of the MySQL library included and used for compiling RMySQL (MySQL 3.23.56) and the runtime MySQL library you use (say, 4.0.x). If this is the problem, you can easily fix it by making sure your PATH variable picks the *.dll used in the RMySQL package first (ahead of the 4.0.x *.dll). Hope this helps, -- David Here is a copy of my PATH environment variable: C:\Perl\bin\;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem; C:\Program Files\NMapWin\bin;c:\cygwin\bin;C:\Python23; C:\Program Files\R\rw1071\library\RMySQL\libs;C:\mysql\bin And yes... running dbConnect still crashes R... Thanks again for your help. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] fit.contrast and groupedData-derived lme-objects: inheritance problem
Dear List, I have to use a groupedData-object as input for lme and run fit.contrast from gregmisc on it like this: myData - groupedData(y ~ 1 | group, subdata) ... lmeRes - lme(y ~ dye + treatment, myData, random = pdBlocked(list(~slide-1, ~animal-1), pdClass = pdIdent),na.action=na.omit) myContrasts - fit.contrast(lmeRes, treatment, c(1,-1,0)) This works fine in interactive mode on a single dataset, but NOT within an lapply over a list of groupedData-objects, where fit.contrast does not handle the lme-class-object lmeRes properly: either it cannot inherit myData anymore, or (if I use a for-loop as a workaround) it computes the contrasts for the first lme-object for all objects (which I find totally confusing). Other functions working with the lme-object (line anova) work perfectly OK and deal properly with the inheritance of groupedData via the lme-object. So I guess there is some grouedData-related bug in fit.contrast. How can I proceed? 1. Does anyone know how to extract contrastst from an lme-model avoiding fit.contrast? 2. Can someone tell me how to hack fit.contrast to make it work properly with groupedData-derived lme-objects? Thanks in advance, Jobst Dr. Jobst Landgrebe Universitaet Goettingen Zentrum Biochemie Humboldtallee 23 37073 Goettingen Germany tel: 0551/39-2316 oder -2223 fax: 0551/39-5960 web: http://www.microarrays.med.uni-goettingen.de mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help