Re: [R] hex format
> "David" == David Forrest <[EMAIL PROTECTED]> > on Thu, 7 Apr 2005 16:19:33 -0500 (CDT) writes: David> I think R has the hex to decimal OK, but might be David> lacking in the decimal to hex case David> zz<-function(x){ x<-as.numeric(sub("#",'0x',x)); David> c(x%/%256^2, x%/%256%%256, x%%256) } >> zz('#0f0e0d') David> [1] 15 14 13 >> zz('#ff0080') David> [1] 255 0 128 I think you have overlooked the col2rgb() function which does this (and more). David> If you already have the 3 byte triplet in read in as David> a binary, the same integer arithmetic does the David> extraction. __ 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] Zipping Rdata Files
On Thu, 7 Apr 2005 [EMAIL PROTECTED] wrote: Saving Rdata files in a zip archive form can in some cases save a considerable amount of disk space. Not if they were saved with compress=TRUE: it is likely to increase the size of compressed saved images. R has the zip.file.extract function to extract files from zip archives, but appears not to have any corresponding function to save in zipped form. (At least I have not been able to find anything in the help files or through searching the mail archives.) That is true, but I think you are looking for gzip format. If you want zip format, just use a system call to zip (if you have it). zip.file.extract is provided only because R for Windows needs to unzip on systems without unzip. (On other platforms it calls unzip.) The system function can be used to call gzip or some other utility, but perhaps there is a more direct method. Yes, for gzip (not zip). gzfile() connections, as used by save(compress=TRUE) and by load(). Also, when I use gzip to zip a file, I get an error message when using That's because gzip >g zip.file.extract to extract the file as follows: > save(trips, file="trips.Rdata") > system("gzip trips.Rdata") # saves trips.Rdata in an archive named trips.Rdata.gz > load(zip.file.extract("trips.Rdata", "trips.Rdata.gz")) [1] "trips.Rdata" Warning message: error 1 in extracting from zip file Setting options(unzip="gunzip") or options(unzip="gunzip.exe") does not solve the error. > load(zip.file.extract("trips.Rdata", "trips.Rdata.gz")) Error in open.connection(con, "rb") : unable to open connection In addition: Warning message: cannot open compressed file `trips.Rdata' Of course I could reverse the process with, system("gunzip trips.Rdata.gz") load("trips.Rdata") but perhaps there is a simpler solution. P.S. I'm running R 2.0.1 on a Windows XP computer. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] axis colors in pairs plot
Hi Anne, Here's one suggestion, use a simple panel function: cols <- c("red", "green3", "blue") with(iris, pairs(iris[, -5], main = "Andersons Iris Data - 3 species", panel = function(x, y, ...) points(x, y, pch = (2:4)[Species], col = cols[Species], ...) )) Bill Venables -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Anne York Sent: Friday, 8 April 2005 8:51 AM To: Help R Subject: [R] axis colors in pairs plot The following command produces red axis line in a pairs plot: pairs(iris[1:4], main = "Anderson's Iris Data -- 3 species", pch = "+", col = c("red", "green3", "blue")[unclass(iris$Species)]) Trying to fool pairs in the following way produces the same plot as above: pairs(iris[1:4], main = "Anderson's Iris Data -- 3 species",pch = "+", col = c("black", "red", "green3", "blue")[ 1+ unclass(iris$Species)]) One very kludgy work-around is to define a new level 1, say "foo" in the first row of iris: iris2=iris iris2$Species = as.character(iris2$Species) iris2$Species[1]="foo" iris2$Species = factor(iris2$Species) pairs(iris2[1:4], main = "Anderson's Iris Data -- 3 species", pch = "+", col = c( "black","red", "green3","blue")[ unclass(iris2$Species)]) However, if any other row is redefined, the red-axis persists. For example: iris2=iris iris2$Species = as.character(iris2$Species) iris2$Species[3]="foo" iris2$Species = factor(iris2$Species) pairs(iris2[1:4], main = "Anderson's Iris Data -- 3 species", pch = "+", col = c( "black","red", "green3","blue")[ unclass(iris2$Species)]) I'd appreciate suggestions for a simpler work-around. Thanks, Anne __ 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] axis colors in pairs plot
On Thursday 07 April 2005 17:51, Anne York wrote: > The following command produces red axis line in a pairs > plot: > > pairs(iris[1:4], main = "Anderson's Iris Data -- 3 species", > pch = "+", col = c("red", "green3", "blue")[unclass(iris$Species)]) > > > Trying to fool pairs in the following way produces the > same plot as above: > > pairs(iris[1:4], main = "Anderson's Iris Data -- 3 species",pch = > "+", col = c("black", "red", "green3", "blue")[ 1+ > unclass(iris$Species)]) > > One very kludgy work-around is to define a new level 1, say > "foo" in the first row of iris: > > iris2=iris > iris2$Species = as.character(iris2$Species) > iris2$Species[1]="foo" > iris2$Species = factor(iris2$Species) > > pairs(iris2[1:4], main = "Anderson's Iris Data -- 3 > species", pch = "+", > col = c( "black","red", "green3","blue")[ unclass(iris2$Species)]) > > However, if any other row is redefined, the red-axis > persists. For example: > > iris2=iris > iris2$Species = as.character(iris2$Species) > iris2$Species[3]="foo" > iris2$Species = factor(iris2$Species) > > > pairs(iris2[1:4], main = "Anderson's Iris Data -- 3 > species", pch = "+", > col = c( "black","red", "green3","blue")[ unclass(iris2$Species)]) > > I'd appreciate suggestions for a simpler work-around. One possibility is something along the lines of pairs(iris[1:4], panel = function(...) points(..., col = c("red", "green3", "blue") [unclass(iris$Species)] )) 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] NA in table with integer types
Hi -- I am having the following problem with table() when applied to vectors of type (mode) integer. When I use the table() command, I can *only obtain an entry in the table for NA values by using exclude=NULL*. Just issuing exclude=NaN will not do it. See below, where x is double at first, and then coerced to integer and notice the difference. Is this a bug or is there something that I do not understand about the integer data type? That is, is there some other value besides NA and NaN that "missing integers" take? Thanks -- pr -- > x <- c(1,2,3,3,NA) > is.double(x) [1] TRUE > table(x,exclude=NA) x 1 2 3 1 1 2 > table(x,exclude=NaN) x 123 1121 > table(x,exclude=NULL) x 123 1121 > > x <- as.integer(x) > x [1] 1 2 3 3 NA > is.na(x) [1] FALSE FALSE FALSE FALSE TRUE > is.integer(x) [1] TRUE > table(x,exclude=NA) x 1 2 3 1 1 2 > table(x,exclude=NaN) x 1 2 3 1 1 2 > table(x,exclude=NULL) x 123 1121 > > R.version _ platform powerpc-apple-darwin6.8 arch powerpc os darwin6.8 system powerpc, darwin6.8 status major2 minor0.1 year 2004 month11 day 15 language R -- == Paul Rathouz, Assoc. Professor ph 773-834-1970 Dept. of Health Studies, Rm. W-264 fax 773-702-1979 University of Chicago[EMAIL PROTECTED] 5841 S. Maryland Ave. MC 2007 Chicago, IL 60637 __ 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] axis colors in pairs plot
The following command produces red axis line in a pairs plot: pairs(iris[1:4], main = "Anderson's Iris Data -- 3 species", pch = "+", col = c("red", "green3", "blue")[unclass(iris$Species)]) Trying to fool pairs in the following way produces the same plot as above: pairs(iris[1:4], main = "Anderson's Iris Data -- 3 species",pch = "+", col = c("black", "red", "green3", "blue")[ 1+ unclass(iris$Species)]) One very kludgy work-around is to define a new level 1, say "foo" in the first row of iris: iris2=iris iris2$Species = as.character(iris2$Species) iris2$Species[1]="foo" iris2$Species = factor(iris2$Species) pairs(iris2[1:4], main = "Anderson's Iris Data -- 3 species", pch = "+", col = c( "black","red", "green3","blue")[ unclass(iris2$Species)]) However, if any other row is redefined, the red-axis persists. For example: iris2=iris iris2$Species = as.character(iris2$Species) iris2$Species[3]="foo" iris2$Species = factor(iris2$Species) pairs(iris2[1:4], main = "Anderson's Iris Data -- 3 species", pch = "+", col = c( "black","red", "green3","blue")[ unclass(iris2$Species)]) I'd appreciate suggestions for a simpler work-around. Thanks, Anne __ 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] half-normal residual plots
Dear Malcolm, I don't think that anyone fielded this question earlier today: see the halfnorm function in the faraway package. I hope this helps, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of MJ > Price, Social Medicine > Sent: Thursday, April 07, 2005 8:43 AM > To: r-help@stat.math.ethz.ch > Subject: [R] half-normal residual plots > > Hi all, > > I am trying to produce a half-normal plot of residuals from a > GLM. I have found the qqnorm function for producing a normal > plot but can't figure out how to produce a half-normal. Can > anyone help with this? > > Thanks > > Malcolm > > -- > MJ Price, Social Medicine > [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] error in save.image (addendum)
Some further remarks: The problem is not in executing save.image as I get the same error when I try to simply print out the function. I managed to quit and save my workspace using save(list = ls(all=TRUE), file = ".RData"); q("no") On restarting R with the same workspace save.image works fine. Even though I have managed to solve the problem for now, I would still be interested in knowing why it happened so that I can avoid whatever it was I did! Thanks, 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 | __ 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] HTML Help Browser in R Mac OS X Aqua GUI
I'm using R 2.0.1 with the Aqua R GUI 1.0 for Mac OS X, and I would like very much to use a firefox browser window for viewing help topics. options("htmlhelp") = TRUE options("browser") = "/Applications/Connections/Firefox.app/Contents/MacOS/firefox-bin" Java Embedding Plugin 0.9.0 is installed (the Java Embedding Plugin (JavaEmbeddingPlugin.bundle) and the MRJ Plugin JEP (MRJPlugin.plugin), are in the /Library/Internet Plug-Ins folder, and MRJ Plugin's timestamp is more recent than the Java Embedding Plugin's timestamp) help.start() launches firefox and displays the initial html help page. however, the following error message is displayed: /Applications/Connections/Firefox.app/Contents/MacOS/firefox-bin: can't map file: /Library/Internet Plug-Ins/MRJPlugin.plugin ((os/kern) invalid argument) subsequent calls to help in the form ?help.topic do not open html help documentation for help.topic. instead, the documentation is displayed in the internal help browser for the Aqua GUI. has anyone encountered this problem and found a solution? thanks Tony __ 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 in save.image
Hi, I just came across an error that I haven't seen before and hope someone can help me. When I try to save my current workspace (using save.image or on quitting) I get the error message Error in save.image() : recursive default argument reference Does anyone know what is going on and how I can quit R without losing the contents of my current workspace? I am running R2.0.1 on a windows XP Pro platform. Thanks, 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 | __ 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] off-topic question: Latex and R in industries
Greetings, Adobe Illustrator works with PDFs, either directly or by converting them to Illustrator format. These vector graphics have "infinite" resolution (can be enlarged 64 fold). I find that graphics passed through MS intermediary programs lose resolution. Illustrator can also convert single-page PostScript documents (most of the time, I have seen some instrument parts diagrams with a large number of crazy loopy lines). PS documents can also be converted with Adobe Acrobat (full version). Gerard. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Donald Ingram Sent: Thursday, April 07, 2005 19:13 To: r-help@stat.math.ethz.ch Subject: Re: [R] off-topic question: Latex and R in industries Hi Bert and Jonathan, When I want a quality report - I write it with pdfLaTeX ( TexShop or TeXnicCenter) with postscript generated diagrams and R plots as pdf's - ( so I can use PC / UNIX / OS X inter-changeably with no problems ) The quality and readability of the pdf document is liked but, and it's a big but is . When someone else in the team needs to extract quality vector graphics from the report, I have to give it to them in powerpoint or word document , which means running R again on a PC to get WMF's. Not impossible just extra work. ( Is there a universal vector format I could use ? ) However, and this is probably off topic-R, when I use drawings / schematics in native postscript from a Unix box, using them is fine in LaTeX, but they can't be pasted into MS applications without first rasterizing. The other option I tried - Ghostview seems to mess up line angles and fonts in attempting conversion into WMF. ( If anyone knows a way to avoid this, I will be forever grateful ) My problems - are not R but with general UNIX - PC interoperability Thanks for the nsf links - it's good to see Latex accepted, I also think the IEEE takes LaTeX, but for the business world it's Word only. Donald On 7 Apr 2005, at 22:56, Jonathan Baron wrote: > On 04/07/05 22:46, Donald Ingram wrote: > However LaTeX generated pdfs sent out as reports are much disliked. > > Really? I don't have this problem. It may have something to do > with how you make them. With TeTeX, I use either pdflatex or > dvips followed by dvipdfm. The latter is required when I have > figures in eps. (ps2pdf is BAD.) > > I believe that these meet the standards of NSF > (http://www.fastlane.nsf.gov). Unfortunately, > https://www.fastlane.nsf.gov/servlet/faq.Faq; > jsessionid=a8301381731112910739147?areaIndex=3&faqIndex=12 > now recommends that you just send the dvi file. They have given > up on the possibility of users getting it right, but I think this > is what they do. > > But all my papers on http://papers.ssrn.com are done this way. > > Jon > -- > Jonathan Baron, Professor of Psychology, University of Pennsylvania > Home page: http://www.sas.upenn.edu/~baron On 7 Apr 2005, at 22:56, Berton Gunter wrote: > ?? > R and MS coexist quite nicely. I frequently import R graphics as > .wmf's into > e.g. Word and Powerpoint. So I don't understand your remarks. > > Of course, there's no question about R's superiority for data analysis, > graphs, etc. from any MS product. Incidentally, it is possible to use > R via > DCOM to generate data analyses and plots within Excel -- I don't know > enough > to be able to do this myself, but I know it can be done. > > -- Bert Gunter > Genentech Non-Clinical Statistics > South San Francisco, CA > > "The business of the statistician is to catalyze the scientific > learning > process." - George E. P. Box > > > >> -Original Message- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On Behalf Of Donald Ingram >> Sent: Thursday, April 07, 2005 2:46 PM >> To: r-help@stat.math.ethz.ch >> Subject: Re: [R] off-topic question: Latex and R in industries >> >> Wensui, >> >> I work for 'A' electronics test equipment corporation. >> I have been using R ( since 1.6 ) instead of MATLAB etc. as a general >> language for data analysis and graph generation. >> On they way to R I tried Python/Scipy, Scilab and others - >> but R wins >> in quality and ease of use (it just needs DSP and GPIB/HPIB >> libraries >> to be perfect ). >> >> LaTeX is also my document tool of choice .. >> >> However LaTeX generated pdfs sent out as reports are much disliked. >> >> MS Word, PowerPoint and Excel are the standards, and very importantly >> they offer cut and paste ability across the larger team. >> MS's offerings comes no where near to the quality of LaTex / >> R, but in >> world of shared authorship - it's a one sided battle. >> >> My other PC universe vs Unix/OS X problem is vector / Meta-file >> graphics - essential for quality reports. >> Postscript, PDF and MS products just don't play. The newest >> Office and >> Visio versions seem to be dropping even more of the postscript >> import and export filters ( which never work very well anyway ). >> >> I have never met any
[R] Principle Component Loadings
Dear R Could you help here I'm trying to decifer what the principle component loadings are in an R output. Are they in any way related to eigen vectors or eigen values? Brett Stansfield __ 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] off-topic question: Latex and R in industries
On 7 Apr 2005, at 22:56, Jonathan Baron wrote: On 04/07/05 22:46, Donald Ingram wrote: However LaTeX generated pdfs sent out as reports are much disliked. Really? I don't have this problem. It may have something to do with how you make them. With TeTeX, I use either pdflatex or dvips followed by dvipdfm. The latter is required when I have figures in eps. (ps2pdf is BAD.) I have played around with these converters a bit and I think I can add something important here. As Jonathan says dvipdfm seems to work very well. The only problem I have is that it is not on our unix boxes by default: it is in mikTeX. ps2pdf in my experience is not the problem in dvi to pdf conversion. I used to think that until I delved into it a bit more. The problem as I understand it is that fonts can be bitmapped and hence disgusting and slow. The trick is to make sure dvips uses Type I fonts. An incantation such as dvips -Pwww -o file.ps file.dvi followed by ps2pdf -sPAPERSIZE=a4 -dAutoRotatePages=/None file.ps file.pdf works for me just as well as dvipdfm dvipdfm has an advantage over this two-step route to pdf because it knows straight off that it is producing a pdf. dvips plus ps2pdf needs tweaking. US readers will need letter instead of a4 above. The -dAutoRotatePages is to avoid pages being rotated to make the longest side of the graph coincide with the longest side of the page. References for this stuff are the LaTeX Graphics Companion and the LaTeX Web Companion. Off-topic a bit I guess, but in my experience very useful to know, including when you start playing around with seminar, prosper, beamer, pdfscreen etc. David Scott _ David Scott Department of Statistics, Tamaki Campus The University of Auckland, PB 92019 AucklandNEW ZEALAND Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000 Email: [EMAIL PROTECTED] Graduate Officer, Department of Statistics __ 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] off-topic question: Latex and R in industries
Hi Bert and Jonathan, When I want a quality report - I write it with pdfLaTeX ( TexShop or TeXnicCenter) with postscript generated diagrams and R plots as pdf's - ( so I can use PC / UNIX / OS X inter-changeably with no problems ) The quality and readability of the pdf document is liked but, and it's a big but is . When someone else in the team needs to extract quality vector graphics from the report, I have to give it to them in powerpoint or word document , which means running R again on a PC to get WMF's. Not impossible just extra work. ( Is there a universal vector format I could use ? ) However, and this is probably off topic-R, when I use drawings / schematics in native postscript from a Unix box, using them is fine in LaTeX, but they can't be pasted into MS applications without first rasterizing. The other option I tried - Ghostview seems to mess up line angles and fonts in attempting conversion into WMF. ( If anyone knows a way to avoid this, I will be forever grateful ) My problems - are not R but with general UNIX - PC interoperability Thanks for the nsf links - it's good to see Latex accepted, I also think the IEEE takes LaTeX, but for the business world it's Word only. Donald On 7 Apr 2005, at 22:56, Jonathan Baron wrote: > On 04/07/05 22:46, Donald Ingram wrote: > However LaTeX generated pdfs sent out as reports are much disliked. > > Really? I don't have this problem. It may have something to do > with how you make them. With TeTeX, I use either pdflatex or > dvips followed by dvipdfm. The latter is required when I have > figures in eps. (ps2pdf is BAD.) > > I believe that these meet the standards of NSF > (http://www.fastlane.nsf.gov). Unfortunately, > https://www.fastlane.nsf.gov/servlet/faq.Faq; > jsessionid=a8301381731112910739147?areaIndex=3&faqIndex=12 > now recommends that you just send the dvi file. They have given > up on the possibility of users getting it right, but I think this > is what they do. > > But all my papers on http://papers.ssrn.com are done this way. > > Jon > -- > Jonathan Baron, Professor of Psychology, University of Pennsylvania > Home page: http://www.sas.upenn.edu/~baron On 7 Apr 2005, at 22:56, Berton Gunter wrote: > ?? > R and MS coexist quite nicely. I frequently import R graphics as > .wmf's into > e.g. Word and Powerpoint. So I don't understand your remarks. > > Of course, there's no question about R's superiority for data analysis, > graphs, etc. from any MS product. Incidentally, it is possible to use > R via > DCOM to generate data analyses and plots within Excel -- I don't know > enough > to be able to do this myself, but I know it can be done. > > -- Bert Gunter > Genentech Non-Clinical Statistics > South San Francisco, CA > > "The business of the statistician is to catalyze the scientific > learning > process." - George E. P. Box > > > >> -Original Message- >> From: [EMAIL PROTECTED] >> [mailto:[EMAIL PROTECTED] On Behalf Of Donald Ingram >> Sent: Thursday, April 07, 2005 2:46 PM >> To: r-help@stat.math.ethz.ch >> Subject: Re: [R] off-topic question: Latex and R in industries >> >> Wensui, >> >> I work for 'A' electronics test equipment corporation. >> I have been using R ( since 1.6 ) instead of MATLAB etc. as a general >> language for data analysis and graph generation. >> On they way to R I tried Python/Scipy, Scilab and others - >> but R wins >> in quality and ease of use (it just needs DSP and GPIB/HPIB >> libraries >> to be perfect ). >> >> LaTeX is also my document tool of choice .. >> >> However LaTeX generated pdfs sent out as reports are much disliked. >> >> MS Word, PowerPoint and Excel are the standards, and very importantly >> they offer cut and paste ability across the larger team. >> MS's offerings comes no where near to the quality of LaTex / >> R, but in >> world of shared authorship - it's a one sided battle. >> >> My other PC universe vs Unix/OS X problem is vector / Meta-file >> graphics - essential for quality reports. >> Postscript, PDF and MS products just don't play. The newest >> Office and >> Visio versions seem to be dropping even more of the postscript >> import and export filters ( which never work very well anyway ). >> >> I have never met any other colleagues who use LaTeX or R. >> >> Any one else sharing the same experiences ? >> >> >> >> Message: 37 >> Date: Wed, 6 Apr 2005 11:38:55 -0400 >> From: Wensui Liu <[EMAIL PROTECTED]> >> Subject: [R] off-topic question: Latex and R in industries >> To: r-help@stat.math.ethz.ch >> Message-ID: <[EMAIL PROTECTED]> >> Content-Type: text/plain; charset=ISO-8859-1 >> >> Latex and R are really cool stuff. I am just wondering how they are >> used in industry. But based on my own experience, very rare. Why? >> >> How about the opinion of other listers? Thanks. >> >> __ >> R-help@stat.math.ethz.ch mailing list >> https://stat.ethz.ch/mailman/listinfo
Re: [R] Zipping Rdata Files
odot.state.or.us> writes: > Saving Rdata files in a zip archive form can in some cases save a > considerable amount of disk space. R has the zip.file.extract function to I suspect you may want to read up on the compress=TRUE option to the save() function. Hth, Dirk __ 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] vectorized approach to cumulative sampling
On 07-Apr-05 Daniel E. Bunker wrote: > Hi All, > > I need to sample a vector ("old"), with replacement, up to the point > where my vector of samples ("new") sums to a predefined value > ("target"), shortening the last sample if necessary so that the total > sum ("newsum") of the samples matches the predefined value. > > While I can easily do this with a "while" loop (see below for example > code), because the length of both "old" and "new" may be > 20,000, a > vectorized approach will save me lots of CPU time. > > Any suggestions would be greatly appreciated. > > Thanks, Dan Hi Dan, You should be able to adapt the following vectorised approach to your specific needs: old<-0.001*(1:1000) new<-sample(old,1,replace=TRUE,prob=p) target<-200 min(which(cumsum(new)>target)) ## [1] 385 This took only a fraction of a second on my medium-speed machine. If you get an "Inf" as result, then 'new' doesn't add up to 'target', so you have to extend it. Hoping this helps, Ted. E-Mail: (Ted Harding) <[EMAIL PROTECTED]> Fax-to-email: +44 (0)870 094 0861 Date: 07-Apr-05 Time: 22:46:12 -- 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] vectorized approach to cumulative sampling
Hi, sample() takes a "replace" argument, so you can take large samples, with replacement, like this: (In the sample() call, the 50*target/mean(old) should make it sample 50 times more than likely. This means the while loop will probably get executed only once. This could be tuned easily, and there may be better ways of guessing how much to take). old <- c(1:2000) p <- runif(1:2000) target <- 4000 new <- 0 while ( sum(new) < target ) new <- sample(old, 50*target/mean(old), TRUE, p) i <- which(cumsum(new) >= target)[1] new <- new[1:i] new[i] <- new[i] - (sum(new)-target) Cheers, Rich On Apr 8, 2005 9:19 AM, Daniel E. Bunker <[EMAIL PROTECTED]> wrote: > Hi All, > > I need to sample a vector ("old"), with replacement, up to the point > where my vector of samples ("new") sums to a predefined value > ("target"), shortening the last sample if necessary so that the total > sum ("newsum") of the samples matches the predefined value. > > While I can easily do this with a "while" loop (see below for example > code), because the length of both "old" and "new" may be > 20,000, a > vectorized approach will save me lots of CPU time. > > Any suggestions would be greatly appreciated. > > Thanks, Dan > > # loop approach > old=c(1:10) > p=runif(1:10) > target=20 > > newsum=0 > new=NULL > while (newsumi=sample(old, size=1, prob=p); >new[length(new)+1]=i; >newsum=sum(new) >} > new > newsum > target > if(newsum>target){new[length(new)]=target-sum(new[-length(new)])} > new > newsum=sum(new); newsum > target > -- Rich FitzJohn rich.fitzjohn gmail.com |http://homepages.paradise.net.nz/richa183 You are in a maze of twisty little functions, all alike __ 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] off-topic question: Latex and R in industries
Wensui, I work for 'A' electronics test equipment corporation. I have been using R ( since 1.6 ) instead of MATLAB etc. as a general language for data analysis and graph generation. On they way to R I tried Python/Scipy, Scilab and others - but R wins in quality and ease of use (it just needs DSP and GPIB/HPIB libraries to be perfect ). LaTeX is also my document tool of choice .. However LaTeX generated pdfs sent out as reports are much disliked. MS Word, PowerPoint and Excel are the standards, and very importantly they offer cut and paste ability across the larger team. MS's offerings comes no where near to the quality of LaTex / R, but in world of shared authorship - it's a one sided battle. My other PC universe vs Unix/OS X problem is vector / Meta-file graphics - essential for quality reports. Postscript, PDF and MS products just don't play. The newest Office and Visio versions seem to be dropping even more of the postscript import and export filters ( which never work very well anyway ). I have never met any other colleagues who use LaTeX or R. Any one else sharing the same experiences ? >> Message: 37 Date: Wed, 6 Apr 2005 11:38:55 -0400 From: Wensui Liu <[EMAIL PROTECTED]> Subject: [R] off-topic question: Latex and R in industries To: r-help@stat.math.ethz.ch Message-ID: <[EMAIL PROTECTED]> Content-Type: text/plain; charset=ISO-8859-1 Latex and R are really cool stuff. I am just wondering how they are used in industry. But based on my own experience, very rare. Why? How about the opinion of other listers? Thanks. __ 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] Zipping Rdata Files
Saving Rdata files in a zip archive form can in some cases save a considerable amount of disk space. R has the zip.file.extract function to extract files from zip archives, but appears not to have any corresponding function to save in zipped form. (At least I have not been able to find anything in the help files or through searching the mail archives.) The system function can be used to call gzip or some other utility, but perhaps there is a more direct method. Also, when I use gzip to zip a file, I get an error message when using zip.file.extract to extract the file as follows: > save(trips, file="trips.Rdata") > system("gzip trips.Rdata") # saves trips.Rdata in an archive named trips.Rdata.gz > load(zip.file.extract("trips.Rdata", "trips.Rdata.gz")) [1] "trips.Rdata" Warning message: error 1 in extracting from zip file Setting options(unzip="gunzip") or options(unzip="gunzip.exe") does not solve the error. > load(zip.file.extract("trips.Rdata", "trips.Rdata.gz")) Error in open.connection(con, "rb") : unable to open connection In addition: Warning message: cannot open compressed file `trips.Rdata' Of course I could reverse the process with, system("gunzip trips.Rdata.gz") load("trips.Rdata") but perhaps there is a simpler solution. P.S. I'm running R 2.0.1 on a Windows XP computer. Brian Gregor, P.E. Transportation Planning Analysis Unit Oregon Department of Transportation [EMAIL PROTECTED] (503) 986-4120 __ 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] hex format
On Thu, 7 Apr 2005, Earl F. Glynn wrote: ... > picture, don't you "see" numbers? > > Maybe you don't see a number here, but I do. #ff0080 is interpreted in some > (non-R) contexts as a single number. In many contexts, including HTML, > colors are represented as three bytes in hex with this notation and the "#" > means "hexadecimal". The RGB color componets can be discerned quite easily: > hex FF is decimal 255 (red), hex 00 is decimal 0 (green), hex 80 is decimal > 128 (blue). Some programs, e.g., Dreamweaver, allow specification of colors > in this hex 3-byte form directly. The "16 million" colors you seen on a > "true color" display are from the 256*256*256 (or in hex FF*FF*FF) possible > RGB triples. > > > For example, R already provides both hsv() and rgb() to create colours > > from vectors of three numbers, but the correspondence is different in each > > case. > > Sorry if some consider this off topic: > HSV as a color space is really only liked by computer scientists. Image > processing and color engineers rarely if ever use HSV. > > There are MANY other color spaces and computations possible (see "color > spaces" or "color conversions" or other color topics on this page > http://www.efg2.com/Lab/Library/Color/Science.htm). Most of these color > manipulations in R are not easy because the very first step, converting > colors, I mean numbers , like #ff0080 to the red, green components is > hindered because one must reinvent the wheel of hex-to-decimal conversion. I think R has the hex to decimal OK, but might be lacking in the decimal to hex case zz<-function(x){ x<-as.numeric(sub("#",'0x',x)); c(x%/%256^2, x%/%256%%256, x%%256) } > zz('#0f0e0d') [1] 15 14 13 > zz('#ff0080') [1] 255 0 128 If you already have the 3 byte triplet in read in as a binary, the same integer arithmetic does the extraction. > Perhaps R will someday introduce a "pixel" type that would encapsulate the > three color components (for color images at least). A matrix of pixels > could easily be made into an image. Some color computations such a Maxwell > Triangle, or a CIE Chromaticity Chart (sorry the links are currently broken, > but the image can be seen on this Chinese translation page) > http://bluemoon.myrice.com/efg/color/chromaticity.htm in R is more difficult > than it should be because of how R is designed now. Many image processing > statistical problems could be tackled directly in R if there were an easier > way to manipulate pixels and images. > > But the hex manipulations I'm advocating could be used for variety of other > purposes. E.g, I must periodically deal with a binary data stream of flow > cytometery data -- part ASCII, part binary. Reading this stream directly > from R would be nice and is almost doable. Working with raw data and > understanding exactly what you've got would be facilitated by better > conversion capabilities within R. I'm still not sure what you mean by hex manipulations. R has string manipulations, hex-to-number manipulations, binary-file-to-number manipulations, mixed file to number manipulations, and number to number manipulations. What I think you are asking for is /displaying/ numbers. Since R's sprintf() doesn't support the %x, (or %o, or %u) formats, I'm not sure how to use R to translate the number 257 into #000101 zzinv<-function(x){} # such that: > zzinv(257) #or zzinv(c(0,1,1)) "#000101" Is zzinv() the operation you need? Dave -- Dr. David Forrest [EMAIL PROTECTED](804)684-7900w [EMAIL PROTECTED] (804)642-0662h http://maplepark.com/~drf5n/ __ 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] vectorized approach to cumulative sampling
Hi All, I need to sample a vector ("old"), with replacement, up to the point where my vector of samples ("new") sums to a predefined value ("target"), shortening the last sample if necessary so that the total sum ("newsum") of the samples matches the predefined value. While I can easily do this with a "while" loop (see below for example code), because the length of both "old" and "new" may be > 20,000, a vectorized approach will save me lots of CPU time. Any suggestions would be greatly appreciated. Thanks, Dan # loop approach old=c(1:10) p=runif(1:10) target=20 newsum=0 new=NULL while (newsumtarget){new[length(new)]=target-sum(new[-length(new)])} new newsum=sum(new); newsum target -- Daniel E. Bunker Associate Coordinator - BioMERGE Post-Doctoral Research Scientist Columbia University Department of Ecology, Evolution and Environmental Biology 1020 Schermerhorn Extension 1200 Amsterdam Avenue New York, NY 10027-5557 212-854-9881 212-854-8188 fax deb37ATcolumbiaDOTedu __ 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] hex format
On Thu, 7 Apr 2005, Earl F. Glynn wrote: For example, R already provides both hsv() and rgb() to create colours from vectors of three numbers, but the correspondence is different in each case. Sorry if some consider this off topic: HSV as a color space is really only liked by computer scientists. Image processing and color engineers rarely if ever use HSV. There are MANY other color spaces and computations possible (see "color spaces" or "color conversions" or other color topics on this page http://www.efg2.com/Lab/Library/Color/Science.htm). Most of these color manipulations in R are not easy because the very first step, converting colors, I mean numbers , like #ff0080 to the red, green components is hindered because one must reinvent the wheel of hex-to-decimal conversion. Yes, and convertColor in R-devel does quite a few of these (XYZ tristimulus space; CIE Lab and Luv; sRGB, Apple RGB and roll-your-own RGB based on chromaticities of the primaries; and chromatic adaptation for changing the white point). The "colorspace" package has a more elegant implementation of a somewhat different set of color space computations, and R-devel also has hcl() for specifying colors based on hue, chroma, and luminance (polar coordinates in Luv space). Basing R graphics on these (and so making them colours rather than just data about colours) requires a further step of considering the characteristics of the output device. This might be as simple as declaring R's output to be sRGB or as complicated as worrying about ICC profiles. -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
[R] /bin/exec/R: No such file or directory
I have just installed R-2.0.1 from R-2.0.1.tar.gz on SUSe 9.1 64bit. When I am trying to launch R: R_HOME_DIR/bin/R; I am getting following message: ./R: line 151: /R_HOME_DIR/bin/exec/R: No such file or directory ./R: line 151: exec: /R_HOME_DIR/bin/exec/R: cannot execute: No such file or directory I do not have exec directory in bin directory. Does anybody know what went wrong? Thank you. Jarmila. Jarmila Bohmanova University of Georgia Department of Animal and Dairy Science Athens, GA __ 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] Adapt Function Examples
I have read the help file for Adapt, but I cannot create a functn that works. I believe this is because I do not understand how to do this, and I have not found any working examples posted in the help. I have recieved many different errors in my attempts. Please post a simple but working use of the adapt function in 2 dimensions other than the one in the help(adapt) or explain it differently. Thank you __ 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] hex format
"Thomas Lumley" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > The convertColor function in R 2.1.0 provides colorspace conversion, > including "hex". > #ff0080 isn't a number, it's a colour (or perhaps a color). If it were > converted to numeric form it would be a vector of three numbers, and which > three numbers would depend on the coordinate system used for colour space. Colo(u)rs and numbers are interchangeable to me. When you look at a picture, don't you "see" numbers? Maybe you don't see a number here, but I do. #ff0080 is interpreted in some (non-R) contexts as a single number. In many contexts, including HTML, colors are represented as three bytes in hex with this notation and the "#" means "hexadecimal". The RGB color componets can be discerned quite easily: hex FF is decimal 255 (red), hex 00 is decimal 0 (green), hex 80 is decimal 128 (blue). Some programs, e.g., Dreamweaver, allow specification of colors in this hex 3-byte form directly. The "16 million" colors you seen on a "true color" display are from the 256*256*256 (or in hex FF*FF*FF) possible RGB triples. > For example, R already provides both hsv() and rgb() to create colours > from vectors of three numbers, but the correspondence is different in each > case. Sorry if some consider this off topic: HSV as a color space is really only liked by computer scientists. Image processing and color engineers rarely if ever use HSV. There are MANY other color spaces and computations possible (see "color spaces" or "color conversions" or other color topics on this page http://www.efg2.com/Lab/Library/Color/Science.htm). Most of these color manipulations in R are not easy because the very first step, converting colors, I mean numbers , like #ff0080 to the red, green components is hindered because one must reinvent the wheel of hex-to-decimal conversion. Perhaps R will someday introduce a "pixel" type that would encapsulate the three color components (for color images at least). A matrix of pixels could easily be made into an image. Some color computations such a Maxwell Triangle, or a CIE Chromaticity Chart (sorry the links are currently broken, but the image can be seen on this Chinese translation page) http://bluemoon.myrice.com/efg/color/chromaticity.htm in R is more difficult than it should be because of how R is designed now. Many image processing statistical problems could be tackled directly in R if there were an easier way to manipulate pixels and images. But the hex manipulations I'm advocating could be used for variety of other purposes. E.g, I must periodically deal with a binary data stream of flow cytometery data -- part ASCII, part binary. Reading this stream directly from R would be nice and is almost doable. Working with raw data and understanding exactly what you've got would be facilitated by better conversion capabilities within R. efg __ 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] ks.test for conditional distribution Y|x
Couldn't you do this by subtracting 0.5 + x from your y values and checking for normality with mean 0 and sd = 1 (using ks.test or another test of normality). If you fail, you'll have to do additional work to find out whether pairs with some particular x value (or range of x values) is causing the problem, but I think this fits the question as stated. Of course, if you have discrete x values, and enough data at each one, you could just run the check for each x. Hope this helps, Matt Wiener -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Vicky Landsman Sent: Thursday, April 07, 2005 3:16 PM To: R-help list Subject: [R] ks.test for conditional distribution Y|x Dear experts, Is it possible to use ks.test function to check the goodness of fit of the conditional distribution Y|X=x? For example, I would like to check that my data (Y,X) come from Norm(0.5+x,1) using KS. Thank you in advance, Victoria Landsman. [[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] Stratified Bootstrap question
Dear Tim, Thank you very much for taking time giving me advices on my questions. I talked with my professor about this bootstrapping question whether to resample clinic or resample clinic + resample patients within clinic. I was told that the second method might destroy the correlation structure between the patients within a clinic. So I am thinking if it is worthy that I do a simulation to compare the two kinds of bootstrapping method. I mean, is this comparision meaningful and is it worth of doing? What do you think? Thank you. Qian On 1 Apr 2005, Tim Hesterberg wrote: > Qian wrote: > >I talked with my advisor yesterday about how to do bootstrapping for my > >scenario: random clinic + random subject within clinic. She suggested that > >only clinic are independent units, so I can only resample clinic. But I > >think that since subjects are also independent within clinic, shall I > >resample subjects within clinic, which means I have two-stage resampling? > >Which one do you think makes sense? > > This is a tough issue; I don't have a complete answer. I'd > appreciate input from other r-help readers. > > If you randomly select clinics, then randomly select patients within > the clinics: > (1) by bootstrapping just clinics, you capture both sources of > variation -- the between-subject variation is incorporated in the > results for each clinic. > > (2) by bootstrapping clinics, then subjects within clinics, you > end up double-counting the between-subject variation > That argues for resampling just clinics. > > By analogy, if you have multiple subjects, and multiple measurements > per subject, you should just resample subjects. > > However, I'm not comfortable with this if you have a small number of > clinics, and relatively large numbers of patients in each clinic, and > think that the between-clinic variation should be small. Then it > seems better to resample both clinics and patients. > > I'm leery about resampling just clinics if there are a small number > of clinics. Bootstrapping isn't particularly effective for small > samples -- it is subject to skewness in small samples, and it > underestimates variances (it's advantages over classical methods > really show up with medium size samples). > There are remedies for the small variance, see > Hesterberg, Tim C. (2004), "Unbiasing the Bootstrap-Bootknife Sampling > vs. Smoothing", Proceedings of the Section on Statistics and the > Environment, American Statistical Association, 2924-2930 > www.insightful.com/Hesterberg/articles/JSM04-bootknife.pdf > > Tim Hesterberg > > > | Tim Hesterberg Research Scientist | > | [EMAIL PROTECTED] Insightful Corp.| > | (206)802-23191700 Westlake Ave. N, Suite 500 | > | (206)283-8691 (fax) Seattle, WA 98109-3044, U.S.A. | > | www.insightful.com/Hesterberg | > > Download the S+Resample library from www.insightful.com/downloads/libraries > > *** Qian An Division of Biostatistics University of Minnesota (phone) 612-626-2263 (fax) 612-626-8892 Email: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] ks.test for conditional distribution Y|x
Dear experts, Is it possible to use ks.test function to check the goodness of fit of the conditional distribution Y|X=x? For example, I would like to check that my data (Y,X) come from Norm(0.5+x,1) using KS. Thank you in advance, Victoria Landsman. [[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] hex format
On Thu, Apr 07, 2005 at 11:58:48AM -0500, Earl F. Glynn wrote: > "Duncan Murdoch" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > > > Seems to me the conversion from hex to decimal should be system > independent > > > (and makes working with colors much more convenient). Why isn't this > system > > > independent now? > > > > Presumably because nobody thought it was important enough to make it so. > > R isn't a low level system programming language, so why should it > > treat hex specially? > > 1) While generally I'd agree with your statement, manipulating colors is one > place the ability to convert to/from hex would be quite nice. > > > rgb(1,0,0.5) > [1] "#FF0080" > > rgb returns a hex string and then R makes manipulating this string somewhat > difficult. I'd like to second this opinion. It just occasionally happens that data are available in some variant of hex format, and I've had the impression that getting such data into R is a bit less convenient than it could be. > One might want to use such color values to convert to a > different color space, perform some sort of manipulation in that other color > space, and then convert back to rgb. > > 2) I would think that one of R's mathematical abilities would be to provide > a way to convert from any base to base 10, and from base 10 to any base. I > haven't found this general math tool yet in R. Working with base-16 (or > even base 2 sometimes) could be done with such a general math tool. In fact, the ANSI C function strtol already provides conversion to any base between 2 and 36, so R's mathematical capabilities don't even need to be invoked here. An R function strtol(x, base), x being a character variable and base an integer between 2 and 36, would probably add a bit of convenience. I've never programmed that, though -- seems that I'm one of those to whom this hasn't been important enough. If it is done some day, I'd favour the strtol function over having as.numeric interpret the (rather C-ish) 0x prefix. I wasn't aware that this currently works on some platforms (and I'm glad it doesn't interpret the 0 prefix for octal, as C does, making 007 legal and 008 not. ;-) ) Best regards, Jan -- +- Jan T. Kim ---+ |*NEW*email: [EMAIL PROTECTED] | |*NEW*WWW: http://www.cmp.uea.ac.uk/people/jtk | *-=< hierarchical systems are for files, not for humans >=-* __ 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] hex format
On Thu, 7 Apr 2005, Earl F. Glynn wrote: 1) While generally I'd agree with your statement, manipulating colors is one place the ability to convert to/from hex would be quite nice. rgb(1,0,0.5) [1] "#FF0080" rgb returns a hex string and then R makes manipulating this string somewhat difficult. One might want to use such color values to convert to a different color space, perform some sort of manipulation in that other color space, and then convert back to rgb. The convertColor function in R 2.1.0 provides colorspace conversion, including "hex". 5) Does R have a hex consistency problem? The color values start with a "#" for hex, but the as.numeric("#FF0080") isn't allowed? #ff0080 isn't a number, it's a colour (or perhaps a color). If it were converted to numeric form it would be a vector of three numbers, and which three numbers would depend on the coordinate system used for colour space. For example, R already provides both hsv() and rgb() to create colours from vectors of three numbers, but the correspondence is different in each case. -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] hex format
I understand that point. Again: I would like to have numbers represented to me in hexidecimal format, not decimal format. This was my original query and I think it's clear. Let me try another variation: I would like R to recognize that I am using hexadecimal notation when I type a number at the keyboard. I would like R to have the ability to show me an integer expressed in hexadecimal format. On Thu, 2005-04-07 at 12:12, Liaw, Andy wrote: > > From: Steve Vejcik > > > > On Thu, 2005-04-07 at 11:06, Prof Brian Ripley wrote: > > > On Thu, 7 Apr 2005, Steve Vejcik wrote: > > > > > > > Thanks for your advice. Unfortunately, your answers are > > inconsistent: > > > > as.numeric("0x1AF0") returns a decimal value for a hex > > string. I'd like > > > > > > You don't understand how R works: > > > > > > x <- as.numeric("0x1AF0") > > > > > > produces an number, not its decimal representation. A > > number is a number > > > is a number irrepsective of the the base of its character > > representation. > > > > > "as.numeric("0x1AF0") returns a decimal value for a hex string. > > If you prefer, substitute the word "shows" for "returns". > > You don't seem to get the point. as.numeric() is a function that _returns_ > a _value_. How you want that _value_ to be _shown_ is a different matter. > Would you substitute `I gave the money to the cashier' with `I showed the > money to the cashier'? > > Andy > > > > > > to dothe opposite-use hex notation to represent a decimal. > > > > e.g. > > > >x<-0x000A > > > >y<-0x0001 > > > >x+y=0x00B > > > > > > > > Cheers. > > > > > > > > On Thu, 2005-04-07 at 08:45, Prof Brian Ripley wrote: > > > >> On Thu, 7 Apr 2005, Steve Vejcik wrote: > > > >> > > > >>> Hello world: > > > >>> Has anyone used hex notation within R to > > represents integers? > > > >> > > > >> That's a spectacularly vague question. Short answer: yes. > > > >> > > > >>> as.numeric("0x1AF0") > > > >> [1] 6896 > > > >> > > > >> (which BTW is system-dependent, but one person used it > > as you asked). > > > >> > > > >> PLEASE read the posting guide and try for a `smarter' question. > > > > > > > > > > > > __ > > 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 attachment...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Fitting a mixed negative binomial model
Dear list members, I want to fit a nonlinear mixed model using the nlme command. My dependent variable takes the form of event counts for different countries over a number of years, and hence I was going to fit a mixed effects negative binomial model. The problem, as far as I can glean from Pinheiro & Bates 2000, is that I need a model that is not normal in the errors. All the models they discuss have linear error structures. Is there a package in the R language that fits a negative binomial mixed effects model? Thank you, Jose Aleman PhD Candidate Politics Department 130 Corwin Hall Princeton, NJ 08544 609.937.0190 __ 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] hex format
> From: Steve Vejcik > > On Thu, 2005-04-07 at 11:06, Prof Brian Ripley wrote: > > On Thu, 7 Apr 2005, Steve Vejcik wrote: > > > > > Thanks for your advice. Unfortunately, your answers are > inconsistent: > > > as.numeric("0x1AF0") returns a decimal value for a hex > string. I'd like > > > > You don't understand how R works: > > > > x <- as.numeric("0x1AF0") > > > > produces an number, not its decimal representation. A > number is a number > > is a number irrepsective of the the base of its character > representation. > > > "as.numeric("0x1AF0") returns a decimal value for a hex string. > If you prefer, substitute the word "shows" for "returns". You don't seem to get the point. as.numeric() is a function that _returns_ a _value_. How you want that _value_ to be _shown_ is a different matter. Would you substitute `I gave the money to the cashier' with `I showed the money to the cashier'? Andy > > > to dothe opposite-use hex notation to represent a decimal. > > > e.g. > > >x<-0x000A > > >y<-0x0001 > > >x+y=0x00B > > > > > > Cheers. > > > > > > On Thu, 2005-04-07 at 08:45, Prof Brian Ripley wrote: > > >> On Thu, 7 Apr 2005, Steve Vejcik wrote: > > >> > > >>> Hello world: > > >>> Has anyone used hex notation within R to > represents integers? > > >> > > >> That's a spectacularly vague question. Short answer: yes. > > >> > > >>> as.numeric("0x1AF0") > > >> [1] 6896 > > >> > > >> (which BTW is system-dependent, but one person used it > as you asked). > > >> > > >> PLEASE read the posting guide and try for a `smarter' question. > > > > > > > > __ > 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] hex format
On Thu, 2005-04-07 at 11:06, Prof Brian Ripley wrote: > On Thu, 7 Apr 2005, Steve Vejcik wrote: > > > Thanks for your advice. Unfortunately, your answers are inconsistent: > > as.numeric("0x1AF0") returns a decimal value for a hex string. I'd like > > You don't understand how R works: > > x <- as.numeric("0x1AF0") > > produces an number, not its decimal representation. A number is a number > is a number irrepsective of the the base of its character representation. > "as.numeric("0x1AF0") returns a decimal value for a hex string. If you prefer, substitute the word "shows" for "returns". > > to dothe opposite-use hex notation to represent a decimal. > > e.g. > >x<-0x000A > >y<-0x0001 > >x+y=0x00B > > > > Cheers. > > > > On Thu, 2005-04-07 at 08:45, Prof Brian Ripley wrote: > >> On Thu, 7 Apr 2005, Steve Vejcik wrote: > >> > >>> Hello world: > >>> Has anyone used hex notation within R to represents integers? > >> > >> That's a spectacularly vague question. Short answer: yes. > >> > >>> as.numeric("0x1AF0") > >> [1] 6896 > >> > >> (which BTW is system-dependent, but one person used it as you asked). > >> > >> PLEASE read the posting guide and try for a `smarter' question. > > > > __ 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] hex format
"Duncan Murdoch" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Seems to me the conversion from hex to decimal should be system independent > > (and makes working with colors much more convenient). Why isn't this system > > independent now? > > Presumably because nobody thought it was important enough to make it so. > R isn't a low level system programming language, so why should it > treat hex specially? 1) While generally I'd agree with your statement, manipulating colors is one place the ability to convert to/from hex would be quite nice. > rgb(1,0,0.5) [1] "#FF0080" rgb returns a hex string and then R makes manipulating this string somewhat difficult. One might want to use such color values to convert to a different color space, perform some sort of manipulation in that other color space, and then convert back to rgb. 2) I would think that one of R's mathematical abilities would be to provide a way to convert from any base to base 10, and from base 10 to any base. I haven't found this general math tool yet in R. Working with base-16 (or even base 2 sometimes) could be done with such a general math tool. 3) While I may be in a minority, I would even consider exporting IEEE floating-point numbers in hex form as a way to avoid any additional conversion losses converting to/from decimal. 4) Why not make working with "raw" data a little easier? readbin shows hex values but they are not easy to work with inside of R. > IntegerSize <- 4# How do I get this value from R? > i <- -2:2 > i [1] -2 -1 0 1 2 > length(i) [1] 5 > object.size(i) [1] 52 > > writeBin(i, "big.bin", endian="big") > big <- readBin("big.bin", "raw", length(i)*IntegerSize) > big [1] ff ff ff fe ff ff ff ff 00 00 00 00 00 00 00 01 00 00 00 02 > > writeBin(i, "little.bin", endian="little") > little <- readBin("little.bin", "raw", length(i)*IntegerSize) > little [1] fe ff ff ff ff ff ff ff 00 00 00 00 01 00 00 00 02 00 00 00 > 5) Does R have a hex consistency problem? The color values start with a "#" for hex, but the as.numeric("#FF0080") isn't allowed? Thanks for your time. efg __ 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] analyse des correspondances multiples
hi all, You can use the functions mca of the library(MASS) and dudi.acm of the library(ade4). these two functions are equivalent. # exemple 1 require(MASS) data(farms) ?mca #analysis mca1 <- mca(farms,nf=4) mca1 # singular values mca1$d # eigenvalues (mca1$d)^2 # graphic plot(mca1) # example 2 require(ade4) ?dudi.acm #analysis mca2 <- dudi.acm(farms,nf=4, scannf=F) mca2 # singular values sqrt(mca2$eig[1:4]) # eigenvalues mca2$eig[1:4] #graphic x11() scatter(mca2) hope this help ;') P.BADY At 14:07 07/04/2005 +0200, Faouzi LYAZRHI wrote: >bonjour, >Je voudrais faire une analyse des correspondances multiples avec R. avec >les représentation graphiques correspondantes avec R. >je ne sais pas comment procéder .. >en vour remerciant par avance >Faouzi > >__ >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] 2d plotting and colours
And does this work? n <- 5 par(mfrow = c(2,2)) palette("default") barplot(1:25,col = 1:25) pal <- rainbow(n) barplot(1:25,col = pal[(1:25-1)%%n+1]) pal <- rgb((0:15)/15, g=0,b=0, names=paste("red",0:15,sep=".")) barplot(1:25,col = pal[(1:25-1)%%n+1]) Earl F. Glynn wrote: "Mulholland, Tom" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] Since I was only concentrating on colour issues and not on your specific problem I was just showing the possibilities. Does this code help n <- 5 par(mfrow = c(2,2)) palette("default") barplot(1:25,col = 1:25) palette(rainbow(n)) barplot(1:25,col = 1:25) palette(rgb((0:15)/15, g=0,b=0, names=paste("red",0:15,sep="."))) barplot(1:25,col = 1:25) require(cluster) x <- runif(100) * 8 + 2 cl <- kmeans(x, n) palette(rainbow(n)) plot(x, col = cl$cluster) abline(h = cl$centers, lty = 2,col = "grey" ) palette(palette()[order(cl$centers)]) points(x,col = cl$cluster,pch = 20,cex = 0.4) Using Windows with R 2.0.1 this looks fine at first. But when I resize the graphic, copy the graphic to a metafile and paste it into Word, or go to an earlier graphic and come back using "History", the colors ae all messed up. It's as if only the last palette is being used for all four plots in the figure. Oddly, if I copy the graphic as a bitmap, the colors are preseved in the bitmap. Is this a quirk of my machine or does this happen for others? Is it possible that the Windows palette manager is being used (which is such about obsolete) and that true color graphics are not being used (which is the easist way to avoid headaches from the Windows palette manager)? efg __ 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] hex format
On Thu, 7 Apr 2005, Duncan Murdoch wrote: [...] If you want an integer vector to always display in hex, assign a class to it and define a print method. I don't think there's a standard library function to display in hex, but there are probably packages to do so. In R 2.1.0-to-be x <- as.numeric("0x00B") # this is platform-specific x [1] 11 sprintf("0x%X", as.integer(x)) # this is not [1] "0xB" -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Importing data into R
I don't know if it does what you want, however you might try package RExcel. However it is not on CRAN. You can find it on http://sunsite.univie.ac.at/rcom/download/. I belive it might be obsolete and replaced by R (D)COM Server V1.35 (previously you needed this package to use RExcel) which you can find on http://cran.planetmirror.com/contrib/extra/dcom/RSrv135.html (description) or http://cran.planetmirror.com/contrib/extra/dcom/RSrv135.exe (add-on). I hope this helps! Ales Ziberna - Original Message - From: "Dave Evens" <[EMAIL PROTECTED]> To: Sent: Thursday, April 07, 2005 4:47 PM Subject: [R] Importing data into R I have a highly formated Excel with multiple tabs. Is it currently possible to read this data into R without changing the format of the Excel file? Also, is it possible to write back to the same Excel file or at least create a new Excel file with the same formatting as before with modified data which has been processed in R. Thanks in advance for any help that you can provide. Dave __ 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] hex format
On Thu, 7 Apr 2005, Steve Vejcik wrote: Thanks for your advice. Unfortunately, your answers are inconsistent: as.numeric("0x1AF0") returns a decimal value for a hex string. I'd like You don't understand how R works: x <- as.numeric("0x1AF0") produces an number, not its decimal representation. A number is a number is a number irrepsective of the the base of its character representation. to dothe opposite-use hex notation to represent a decimal. e.g. x<-0x000A y<-0x0001 x+y=0x00B Cheers. On Thu, 2005-04-07 at 08:45, Prof Brian Ripley wrote: On Thu, 7 Apr 2005, Steve Vejcik wrote: Hello world: Has anyone used hex notation within R to represents integers? That's a spectacularly vague question. Short answer: yes. as.numeric("0x1AF0") [1] 6896 (which BTW is system-dependent, but one person used it as you asked). PLEASE read the posting guide and try for a `smarter' question. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Assigning "dates" attribute
On Thu, 7 Apr 2005 08:26:41 -0700 (PDT) JTW wrote: > Dear List, > > I have a one-column data set in .csv format. > > I used read.csv to import the data into R, as follows: > > x <- read.csv("data.csv", header = TRUE, sep = ",") > > The data points have a 'dates' attribute, which is in > a separatel .csv file. I used the same command as > above to import it into R. > > To assoicate the 'dates' attribute with the data > points, I did: > > > attributes(x)<-date > > Which resulted in: > > Error in "attributes<-"(`*tmp*`, value = date) : > attributes must be in a list > > So then I did: > > > attributes(x)<-list(date) > > Again, got an error, though slightly different this > time: > > Error in "attributes<-"(`*tmp*`, value = list(date)) : > attributes must be named > > Any help is appreciated. The error message is pretty informative, the assignment needs a named list, e.g.: R> x <- 1:10 R> attributes(x) <- list(foo = letters[1:10]) R> x [1] 1 2 3 4 5 6 7 8 9 10 attr(,"foo") [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" Note, that this will strip off all other attributes. To add one attribute, you can do R> attr(x, "bar") <- LETTERS[1:10] R> x [1] 1 2 3 4 5 6 7 8 9 10 attr(,"foo") [1] "a" "b" "c" "d" "e" "f" "g" "h" "i" "j" attr(,"bar") [1] "A" "B" "C" "D" "E" "F" "G" "H" "I" "J" Furthermore, the data you describe look like a time series. So you might want to store the data as a time series. For time series with a date attribute of class "Date", look at the zoo package. Z > __ > 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] hex format
Steve Vejcik wrote: Thanks for your advice. Unfortunately, your answers are inconsistent: as.numeric("0x1AF0") returns a decimal value for a hex string. I'd like to do the opposite-use hex notation to represent a decimal. e.g. x<-0x000A y<-0x0001 x+y=0x00B Cheers. you can use chcode() to define hex.to.dec(), dec.to.hex() and sum.hex() to operate with hex numbers. Peter Wolf -- <>= chcode <- function(b, base.in=2, base.out=10, digits="0123456789ABCDEF"){ # change of number systems, pwolf 10/02 # e.g.: from 2 2 2 2 ... -> 16 16 16 ... digits<-substring(digits,1:nchar(digits),1:nchar(digits)) if(length(base.in)==1) base.in <- rep(base.in, max(nchar(b)-1)) if(is.numeric(b)) b <- as.character(as.integer(b)) b.num <- lapply(strsplit(b,""), function(x) match(x,digits)-1 ) result <- lapply(b.num, function(x){ cumprod(rev(c(base.in,1))[ 1:length(x) ] ) %*% rev(x) } ) number<-unlist(result) cat("decimal representation:",number,"\n") if(length(base.out)==1){ base.out<-rep(base.out,1+ceiling(log( max(number), base=base.out ) ) ) } n.base <- length(base.out); result <- NULL for(i in n.base:1){ result <- rbind(number %% base.out[i], result) number <- floor(number/base.out[i]) } result[]<-digits[result+1] apply(result, 2, paste, collapse="") } @ <>= hex.to.dec<-function(x) as.numeric(chcode(x, base.in=16, base.out=10)) dec.to.hex<-function(x) chcode(x, base.in=10, base.out=16) sum.hex<-function(x,y) dec.to.hex(hex.to.dec(x) + hex.to.dec(y)) @ quick test: <>= a<-dec.to.hex(10); print(a) b<-dec.to.hex(3);print(b) @ output-start decimal representation: 10 [1] "0A" decimal representation: 3 [1] "03" output-end @ <>= sum.hex(a,b) @ output-start decimal representation: 10 decimal representation: 3 decimal representation: 13 Thu Apr 7 17:31:42 2005 [1] "0D" output-end __ 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] hex format
Earl F. Glynn wrote: "Prof Brian Ripley" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] On Thu, 7 Apr 2005, Steve Vejcik wrote: Has anyone used hex notation within R to represents integers? Short answer: yes. as.numeric("0x1AF0") [1] 6896 (which BTW is system-dependent, but one person used it as you asked). I see this works fine with R 2.0.0 on a Linux platform, but doesn't work at all under R 2.0.1 on Windows. as.numeric("0x1AF0") [1] NA Warning message: NAs introduced by coercion Seems to me the conversion from hex to decimal should be system independent (and makes working with colors much more convenient). Why isn't this system independent now? Presumably because nobody thought it was important enough to make it so. R isn't a low level system programming language, so why should it treat hex specially? Duncan Murdoch __ 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] Dta structure of LOADINGS class in factanal
At 9:44 AM -0400 4/7/05, Tamas Gal wrote: Hi R users, I need some help in the followings: I'm doing factor analysis and I need to extract the loading values and the Proportion Var and Cumulative Var values one by one. Here is what I am doing: fact <- factanal(na.omit(gnome_freq_r2),factors=5); fact$loadings Loadings: Factor1 Factor2 Factor3 Factor4 Factor5 b1freqr2 0.246 0.486 0.145 ... b9freqr2 0.148 0.449 0.103 0.327 Factor1 Factor2 Factor3 Factor4 Factor5 SS loadings 1.294 1.268 1.008 0.927 0.730 Proportion Var 0.144 0.141 0.112 0.103 0.081 Cumulative Var 0.144 0.285 0.397 0.500 0.581 I can get the loadings using: fact$loadings[1,1] [1] 0.2459635 but I couldn't find the way to do the same with the Proportion Var and Cumulative Var values. Although not pretty, try colSums(fact$loading*fact$loading)/dim(fact$loading)[1] for the proportion Var and cumsum(colSums(fact$loading*fact$loading)/dim(fact$loading)[1]) to get the cumulative Var values Bill -- William Revelle http://pmc.psych.northwestern.edu/revelle.html Professor http://personality-project.org/personality.html Department of Psychology http://www.wcas.northwestern.edu/psych/ Northwestern University http://www.northwestern.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] Assigning "dates" attribute
Dear List, I have a one-column data set in .csv format. I used read.csv to import the data into R, as follows: x <- read.csv("data.csv", header = TRUE, sep = ",") The data points have a 'dates' attribute, which is in a separatel .csv file. I used the same command as above to import it into R. To assoicate the 'dates' attribute with the data points, I did: > attributes(x)<-date Which resulted in: Error in "attributes<-"(`*tmp*`, value = date) : attributes must be in a list So then I did: > attributes(x)<-list(date) Again, got an error, though slightly different this time: Error in "attributes<-"(`*tmp*`, value = list(date)) : attributes must be named Any help is appreciated. __ 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] package
You may want to think about using a package NAMESPACE. I don't know if that is what you mean, but it is something available for making some functions "public" and others "package private", but it doesn't give a mechanism to ABSOLUTELY hide code. Sean On Apr 7, 2005, at 11:08 AM, Gabor Grothendieck wrote: On Apr 7, 2005 8:43 AM, Gregory BENMENZER <[EMAIL PROTECTED]> wrote: hello, I created a package with my functions, and i wand to hide the code of some functions. Could you help me ? Grégory There was some discussion on the list that there is work being done on an R compiler. I don't know what the status is or whether it would indeed solve your problem but you could try googling around for it or maybe someone else on the list can provide more info. __ 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] 4D Plot ??
Hi Mike, I've done a bit of playing around with these kind of plots for visualising microarray data (to eventually go into a bioconductor package). I've attached my code for producing surfaceplots (my name for the type of plots that includes both image and contour plots) - it's all lattice based, so you'll need some familiarity with how lattice works to understand how it all works. The key function is panel.superpose.surface which you can use as follows: levelplot(surfacevar + contourvar ~ x * y, data, panel=panel.surface.smooth, asp="iso") (note that the contours are automatically smoothed using image.smooth from the fields package - you can control the amount of smoothing use contour.theta) You can supply multiple contour variables, but be advised it gets messy really quickly! You can also smooth the surface by setting panel.base = panel.surface.smooth Hope this is helpful! Hadley # Microarray surface plot # Surface plot with sensible defaults for microarrays surfaceplot.ma <- function( formula, data, aspect = "xy", prepanel = function() {list(dx=1, dy=1)}, allow.multiple = TRUE, as.table = TRUE, panel = panel.ma.surface, col.regions = pal(), tipRows = NULL, tipCols = 0, main = NULL, ylab = NULL, ... ) { #if plot x vs. y, draw tip grid lf <- latticeParseFormula(formula, data, dim=3) if (lf$right.x.name == "x" && lf$right.y.name %in% c("y","-y")) { try({ tipCols = seq(0,max(data$x), by=max(data$spotCol))+0.5 tipRows = seq(0,max(data$y), by=max(data$spotRow))+0.5 }) } if (missing(main)) { main <- paste("Surface plot of", lf$left.name) } levelplot(formula, data, allow.multiple=allow.multiple, as.table = as.table, panel=panel, main=main, prepanel=prepanel, aspect=aspect, col.regions=col.regions, ylab=ylab, tipRows = tipRows, tipCols = tipCols, ...) } panel.ma.surface <- function(..., tipRows, tipCols, grid.col = "grey80") { panel.superpose.surface(...) if (!missing(tipRows)) { panel.abline(h = tipRows, col = grid.col) } if (!missing(tipCols)) { panel.abline(v = tipCols, col = grid.col) } } panel.superpose.surface <- function ( x, y, z, groups, subscripts, panel.base = panel.levelplot, panel.superpose = panel.contour.smooth, contour.col = "#BF2828", ..., region, contour, at ) { if (missing(groups)) { panel.base(x = x, y = y, z = z, subscripts = subscripts, contour=FALSE, at=at, ...) return() } x <- x[subscripts]; y <- y[subscripts]; z <- z[subscripts] groups <- groups[subscripts] if (is.factor(groups)) { vals <- levels(groups) } else { vals <- sort(unique(groups)) } nvals <- length(vals) first <- TRUE for (i in seq(along = vals)) { id <- (groups == vals[i]) if (first) { panel.base(x = x[id], y = y[id], z = z[id], groups = groups[id], subscripts = TRUE, contour=FALSE, region=TRUE, col=col, at=at, ...) first <- FALSE } else { panel.superpose(x = x[id], y = y[id], z = z[id], groups = groups[id], subscripts = TRUE, contour=TRUE, region=FALSE, col=contour.col, at = seq(min(z[id]), max(z[id]), length=10), ...) } } } panel.surface.smooth <- function(x, y, z, zcol, at, subscripts, surface.theta = 3, ..., contour, region, col.regions) { x <- x[subscripts]; y <- y[subscripts]; z <- z[subscripts]; z.smooth <- smooth.grid(x, y, z, surface.theta) zcol <- cut(z.smooth, at, labels=FALSE) panel.levelplot(x, y, z.smooth, zcol=zcol, subscripts=TRUE, ..., at=at, contour = FALSE, region = TRUE, col.regions=col.regions) } panel.contour.smooth <- function(x, y, z, zcol, at, subscripts, contour.theta = 3, ..., contour, region, col.regions) { x <- x[subscripts]; y <- y[subscripts]; z <- z[subscripts]; z.smooth <- smooth.grid(x, y, z, contour.theta) zcol <- cut(z.smooth, at, labels=FALSE) panel.levelplot(x, y, z.smooth, zcol=zcol, subscripts=TRUE, ..., at=at, contour = TRUE, region = FALSE, col.regions=col.regions) } smooth.grid <- function(x, y, z, theta=2) { if (!require("fields")) {stop("Fields library required for smoothed panels")} image.smooth(matrix(z[order(y, x)], nrow=max(x)), theta=theta)[(y-1)*max(x) + x] } # Modified xy panel function that scales spots to z values panel.spot <- function (x, y, z, subscripts, col, ...) { z.range <- range(z, na.rm = TRUE)
Re: [R] 4D Plot ??
On Thu, 7 Apr 2005, Mike Prager wrote: Tried to post this last night, but it doesn't seem to have appeared. Using R 2.0.1 on Windows XP + SP2. I am traveling, away from my usual references. I'm trying to make a 4-dimensional plot: a levelplot with overlaid contours, with different response variables represented by (1) colors on the levelplot and (2) the contour lines. First try was filled.contour + contour but the key printed by the first means that the scales differ. You could put the contour() call in the plot.axes argument in the filled.contour() call. This is a useful trick for getting the right scales for an overlay. -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] package
On Apr 7, 2005 8:43 AM, Gregory BENMENZER <[EMAIL PROTECTED]> wrote: > hello, > > I created a package with my functions, and i wand to hide the code of some > functions. > > Could you help me ? > > Grégory There was some discussion on the list that there is work being done on an R compiler. I don't know what the status is or whether it would indeed solve your problem but you could try googling around for it or maybe someone else on the list can provide more info. __ 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] hex format
"Prof Brian Ripley" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On Thu, 7 Apr 2005, Steve Vejcik wrote: > > Has anyone used hex notation within R to represents integers? > Short answer: yes. > > > as.numeric("0x1AF0") > [1] 6896 > > (which BTW is system-dependent, but one person used it as you asked). I see this works fine with R 2.0.0 on a Linux platform, but doesn't work at all under R 2.0.1 on Windows. > as.numeric("0x1AF0") [1] NA Warning message: NAs introduced by coercion Seems to me the conversion from hex to decimal should be system independent (and makes working with colors much more convenient). Why isn't this system independent now? The "prefix" on hex numbers is somewhat language dependent ("0x" or $) perhaps but I didn't think this conversion should be system dependent. I don't remember where I got this, but this hex2dec works under both Linux and Windows (and doesn't need the "0x" prefix). hex2dec <- function(hexadecimal) { hexdigits <- c(0:9, LETTERS[1:6]) hexadecimal <- toupper(hexadecimal)# treat upper/lower case the same decimal <- rep(0, length(hexadecimal)) for (i in 1:length(hexadecimal)) { digits <- match(strsplit(hexadecimal[i],"")[[1]], hexdigits) - 1 decimal[i] <- sum(digits * 16^((length(digits)-1):0)) } return(decimal) } Example: > hex2dec(c("1AF0", "")) [1] 6896 65535 "" can be interpreted as 65535 as unsigned and -1 as signed on the same system depending on context. This isn't system dependent, but rather context dependent. I suggest "as.numeric" should perform the unsigned conversion on all systems. What am I missing? efg -- Earl F. Glynn Scientific Programmer Bioinformatics Department Stowers Institute for Medical Research __ 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] hex format
Steve Vejcik wrote: Thanks for your advice. Unfortunately, your answers are inconsistent: as.numeric("0x1AF0") returns a decimal value for a hex string. I'd like to do the opposite-use hex notation to represent a decimal. e.g. x<-0x000A y<-0x0001 x+y=0x00B R doesn't use decimal or hex values internally, it stores values in the native format (which is 64 bit floating point or 32 bit binary integers on most platforms). You're talking about string conversions on input and output, which is a different issue. R doesn't support C-style hex notation on input (though you can use "as.numeric" on input, as Brian said). If you want an integer vector to always display in hex, assign a class to it and define a print method. I don't think there's a standard library function to display in hex, but there are probably packages to do so. Duncan Murdoch __ 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] Importing data into R
I have a highly formated Excel with multiple tabs. Is it currently possible to read this data into R without changing the format of the Excel file? Also, is it possible to write back to the same Excel file or at least create a new Excel file with the same formatting as before with modified data which has been processed in R. Thanks in advance for any help that you can provide. Dave __ 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] half-normal residual plots
There is a halfnorm function in the faraway package. Andy __ Andy Jaworski 518-1-01 Process Laboratory 3M Corporate Research Laboratory - E-mail: [EMAIL PROTECTED] Tel: (651) 733-6092 Fax: (651) 736-3122 "MJ Price, Social Medicine" <[EMAIL PROTECTED] To istol.ac.uk> r-help@stat.math.ethz.ch Sent by: cc [EMAIL PROTECTED] at.math.ethz.ch Subject [R] half-normal residual plots 04/07/2005 08:43 AM Hi all, I am trying to produce a half-normal plot of residuals from a GLM. I have found the qqnorm function for producing a normal plot but can't figure out how to produce a half-normal. Can anyone help with this? Thanks Malcolm -- MJ Price, Social Medicine [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] apply
On 7 Apr 2005 at 14:27, malte wrote: > Hi, > > simple question I guess: > > the following line works well: > > aveBehav=c(apply(sdata, 2, mean)) Hallo try aveBehav=c(apply(sdata, 2, mean, na.rm=T)) Cheers Petr > > However, I would like to pass an argument to the function mean, > namely na.rm=TRUE > > Does anyone knows how to do this? > > Thanks in advance, > > Jan > > __ > 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 Petr Pikal [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] hex format
Thanks for your advice. Unfortunately, your answers are inconsistent: as.numeric("0x1AF0") returns a decimal value for a hex string. I'd like to do the opposite-use hex notation to represent a decimal. e.g. x<-0x000A y<-0x0001 x+y=0x00B Cheers. On Thu, 2005-04-07 at 08:45, Prof Brian Ripley wrote: > On Thu, 7 Apr 2005, Steve Vejcik wrote: > > > Hello world: > > Has anyone used hex notation within R to represents integers? > > That's a spectacularly vague question. Short answer: yes. > > > as.numeric("0x1AF0") > [1] 6896 > > (which BTW is system-dependent, but one person used it as you asked). > > PLEASE read the posting guide and try for a `smarter' question. __ 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] parameterisation of Factor levels
Hi all, I am trying to fit simple 2 factor (factors A and B - 3 and 2 levels respectively) poisson regression model. Inititially a pure error model is fitted and significance tests are performed on each parameter. I wish to remove an individual parameter from the model - the interaction between the second level of factor A and factor B. However i only seem to be able to remove the AB (all interactions between A and B) term, which is no use as it also removes the interaction term between level 3 of Factor A and factor B. Can anyone help with this. Thanks Malcolm -- MJ Price, Social Medicine [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] apply
malte <[EMAIL PROTECTED]> writes: > aveBehav=c(apply(sdata, 2, mean)) aveBehav= apply(sdata, 2, mean, na.rm=TRUE) and ?apply will tell you about this. + seth __ 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] hex format
On Thu, 7 Apr 2005, Steve Vejcik wrote: Hello world: Has anyone used hex notation within R to represents integers? That's a spectacularly vague question. Short answer: yes. as.numeric("0x1AF0") [1] 6896 (which BTW is system-dependent, but one person used it as you asked). PLEASE read the posting guide and try for a `smarter' question. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] how to analysis this kind of data set?
hi,everybody I have a *time course* data set about a CML cell line treated by two drugs and their combination.The experiment was performed on cDNA microarray platform.The green channel of all the arrays are common,the untreated cell.Here follows the experiment design: a_0hr,a_3hr,a_8hr,a_12hr,a_24hr,a_48hr,a_72hr, b_3hr,b_8hr,b_12hr,b_24hr,b_48hr,b_72hr, ab_3hr,ab_8hr,ab_12hr,ab_24hr,ab_48hr,ab_72hr. A total of 19 *cDNA microarrays*.a_0hr means* *drug *a *treament *0 hours vs. control. *And a_3hrs means drug a treatment 3 hours vs. control.So for drug *b *and their combination *ab*(drug a and drug b added together).My goal is to identify the three sets of genes,the genes differentially expressed by drug a,the genes by drug b ,and their combination. i am thinking about *ANOVA* ,but i am not sure whether it is correct. Any comments,suggestions?Any R/bioconductor packages can be used?Thanks in advance [[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] 4D Plot ??
Tried to post this last night, but it doesn't seem to have appeared. Using R 2.0.1 on Windows XP + SP2. I am traveling, away from my usual references. I'm trying to make a 4-dimensional plot: a levelplot with overlaid contours, with different response variables represented by (1) colors on the levelplot and (2) the contour lines. First try was filled.contour + contour but the key printed by the first means that the scales differ. Then I tried levelplot. I couldn't figure out how to pass > 3 variables to levelplot, so I duplicated all rows of the data frame and changed the z data for the second half, in order to plot one half at a time. #-- # Try at a 4D contourplot: y = x = 1:50 grid <- expand.grid(x=x, y=y) grid$z = sqrt(x*y) n1 = nrow(grid) grid2 = rbind(grid,grid) grid2$z[(n1+1):(n1*2)] = log(grid2$x[1:n1] * grid2$y[1:n1] + 10) panel.4d <- function(x,y,z,subscripts) { n1 = 1; n2 = length(x)/2 panel.levelplot(x[n1:n2],y[n1:n2],z[n1:n2],subscripts,region=TRUE) n1 = n2 + 1 ; n2 = length(x) panel.levelplot(x[n1:n2],y[n1:n2],z[n1:n2],subscripts,region=FALSE,contour=TRUE) } aa = levelplot(z~x*y, data=grid2, cuts = 20, panel=panel.4d) print(aa) # This gives the following error message: Error in panel.levelplot(x[n1:n2], y[n1:n2], z[n1:n2], subscripts, region = FALSE, : NAs are not allowed in subscripted assignments although that it completes when the second levelplot is set to region=TRUE, contour=FALSE (though then the second plot then hides the first). Hints or sample code will be most welcome. Once this works, the next refinement will be to replace the colored levelplot with something similar but with smooth edges produced by contouring, so advice on that is also welcome. Michael Prager, Ph.D. NOAA Center for Coastal Fisheries & Habitat Research Beaufort, North Carolina, USA __ 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] Dta structure of LOADINGS class in factanal
Hi R users, I need some help in the followings: I'm doing factor analysis and I need to extract the loading values and the Proportion Var and Cumulative Var values one by one. Here is what I am doing: fact <- factanal(na.omit(gnome_freq_r2),factors=5); fact$loadings Loadings: Factor1 Factor2 Factor3 Factor4 Factor5 b1freqr2 0.246 0.486 0.145 b2freqr2 0.129 0.575 0.175 0.130 0.175 b3freqr2 0.605 0.253 0.166 0.138 0.134 b4freqr2 0.191 0.220 0.949 b5freqr2 0.286 0.265 0.113 0.891 0.190 b6freqr2 0.317 0.460 0.151 b7freqr2 0.138 0.199 0.119 0.711 b8freqr2 0.769 0.258 0.195 0.137 b9freqr2 0.148 0.449 0.103 0.327 Factor1 Factor2 Factor3 Factor4 Factor5 SS loadings 1.294 1.268 1.008 0.927 0.730 Proportion Var 0.144 0.141 0.112 0.103 0.081 Cumulative Var 0.144 0.285 0.397 0.500 0.581 I can get the loadings using: fact$loadings[1,1] [1] 0.2459635 but I couldn't find the way to do the same with the Proportion Var and Cumulative Var values. Thanks, Tamas __ 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] half-normal residual plots
Hi all, I am trying to produce a half-normal plot of residuals from a GLM. I have found the qqnorm function for producing a normal plot but can't figure out how to produce a half-normal. Can anyone help with this? Thanks Malcolm -- MJ Price, Social Medicine [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] apply
try, apply(sdata, 2, mean, na.rm=TRUE) or # assuming `sdata' is a matrix colMeans(sdata, na.rm=TRUE) I hope it helps. Best, Dimitris 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: "malte" <[EMAIL PROTECTED]> To: Sent: Thursday, April 07, 2005 2:27 PM Subject: [R] apply Hi, simple question I guess: the following line works well: aveBehav=c(apply(sdata, 2, mean)) However, I would like to pass an argument to the function mean, namely na.rm=TRUE Does anyone knows how to do this? Thanks in advance, Jan __ 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] apply
> From: malte > > Hi, > > simple question I guess: > > the following line works well: > > aveBehav=c(apply(sdata, 2, mean)) > > However, I would like to pass an argument to the function > mean, namely > na.rm=TRUE > > Does anyone knows how to do this? aveBehav <- apply(sdata, 2, mean, na.rm=TRUE) or more efficiently: aveBehav <- colMeans(sdata, na.rm=TRUE) Read ?apply and look at the "..." argument. If you don't understand how it works, try the example on that page. Andy > Thanks in advance, > > Jan > > __ > 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] apply
On Apr 7, 2005, at 8:27 AM, malte wrote: Hi, simple question I guess: the following line works well: aveBehav=c(apply(sdata, 2, mean)) However, I would like to pass an argument to the function mean, namely na.rm=TRUE apply(sdata,2,function(x) {mean(x,na.rm=TRUE)}) Sean __ 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] Is a .R script file name available inside the script?
I think you might want 'commandArgs()' which gives you the original command line call. -roger Darren Weber wrote: Hi, if we have a file called Rscript.R that contains the following, for example: x <- 1:100 outfile = "Rscript.Rout" sink(outfile) print(x) and then we run source("Rscript.R") we get an output file called Rscript.Rout - great! Is there an internal variable, something like .Platform, that holds the script name when it is being executed? I would like to use that variable to define the output file name. Best, Darren __ 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] hex format
Hello world: Has anyone used hex notation within R to represents integers? Cheers, Steve Vejcik __ 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] apply
Hi, simple question I guess: the following line works well: aveBehav=c(apply(sdata, 2, mean)) However, I would like to pass an argument to the function mean, namely na.rm=TRUE Does anyone knows how to do this? Thanks in advance, Jan __ 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] analyse des correspondances multiples
Also, library(ade4) Best Marwan --- Marwan Khawaja http://staff.aub.edu.lb/~mk36/ --- > -Original Message- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf Of Prof > Brian Ripley > Sent: Thursday, April 07, 2005 3:45 PM > To: Faouzi LYAZRHI > Cc: R-help@stat.math.ethz.ch > Subject: Re: [R] analyse des correspondances multiples > > library(MASS) > ?mca > > On Thu, 7 Apr 2005, Faouzi LYAZRHI wrote: > > > Je voudrais faire une analyse des correspondances multiples avec R. > > avec les représentation graphiques correspondantes avec R. > > je ne sais pas comment procéder .. > > en vour remerciant par avance > > -- > Brian D. Ripley, [EMAIL PROTECTED] > Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ > University of Oxford, Tel: +44 1865 272861 (self) > 1 South Parks Road, +44 1865 272866 (PA) > Oxford OX1 3TG, UKFax: +44 1865 272595 > __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] package
you could use a namespace, look at "Writing R extensions" doc, section 1.6 I hope it helps. Best, Dimitris 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: "Gregory BENMENZER" <[EMAIL PROTECTED]> To: Sent: Thursday, April 07, 2005 2:43 PM Subject: [R] package hello, I created a package with my functions, and i wand to hide the code of some functions. Could you help me ? Grégory -- GAZ DE FRANCE Grégory Benmenzer DIRECTION DE LA RECHERCHE Pôle Economie Statistiques et Sociologie 361 Avenue du président Wilson - BP 33 93211 La Plaine Saint Denis cedex tel : 01 49 22 55 07 fax : 01 49 22 57 10 __ 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] package
Please define what you mean by `hide'. If the functions are not to be called by users directly, just create a NAMESPACE and export only the ones you want to expose to the users. However, the users can still get to those not exported if they really want to. If you don't want the users to be able to see the code through any means, I don't know if that's possible. Andy > From: Gregory BENMENZER > > hello, > > I created a package with my functions, and i wand to hide the > code of some functions. > > Could you help me ? > > Grégory > > > > -- > GAZ DE FRANCE > > Grégory Benmenzer > > DIRECTION DE LA RECHERCHE > Pôle Economie Statistiques et Sociologie > 361 Avenue du président Wilson - BP 33 > 93211 La Plaine Saint Denis cedex > > tel : 01 49 22 55 07 > fax : 01 49 22 57 10 > > __ > R-help@stat.math.ethz.ch mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! > http://www.R-project.org/posting-guide.html > > > __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to print error message in batch mode
On Thu, 7 Apr 2005, Jan T. Kim wrote: On Thu, Apr 07, 2005 at 01:58:55PM +0200, Elio Mineo wrote: This solution is fine, too. The Achim's solution is what I have asked with this slight modification: $ R -q --no-save < prova > prova.out 2>> prova.out The canonical and perhaps "more correct" way to redirect stderr into stdout is 2>&1, as in R -q --no-save < prova > prova.out 2>&1 Which as I have already pointed out, is what R CMD BATCH does. [I hope you replied to Elio as well as to the list: the headers do not show it.] -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] package
hello, I created a package with my functions, and i wand to hide the code of some functions. Could you help me ? Grégory -- GAZ DE FRANCE Grégory Benmenzer DIRECTION DE LA RECHERCHE Pôle Economie Statistiques et Sociologie 361 Avenue du président Wilson - BP 33 93211 La Plaine Saint Denis cedex tel : 01 49 22 55 07 fax : 01 49 22 57 10 __ 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] analyse des correspondances multiples
library(MASS) ?mca On Thu, 7 Apr 2005, Faouzi LYAZRHI wrote: Je voudrais faire une analyse des correspondances multiples avec R. avec les représentation graphiques correspondantes avec R. je ne sais pas comment procéder .. en vour remerciant par avance -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to print error message in batch mode
On Thu, Apr 07, 2005 at 01:58:55PM +0200, Elio Mineo wrote: > This solution is fine, too. > The Achim's solution is what I have asked with this slight modification: > > $ R -q --no-save < prova > prova.out 2>> prova.out The canonical and perhaps "more correct" way to redirect stderr into stdout is 2>&1, as in R -q --no-save < prova > prova.out 2>&1 Best regards, Jan -- +- Jan T. Kim ---+ |*NEW*email: [EMAIL PROTECTED] | |*NEW*WWW: http://www.cmp.uea.ac.uk/people/jtk | *-=< hierarchical systems are for files, not for humans >=-* __ 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 command line flags with TINN-R
Philippe, I have no idea what "R call-tip server" means, but I will invoke it and see what happens. I will also read the FAQ more. Thanks for your help. Thanks, Roger On Apr 7, 2005 1:53 AM, Philippe Grosjean <[EMAIL PROTECTED]> wrote: > roger bos wrote: > > This is a TINN-R editor question rather than an R question, but can > > anyone tell me how to use command line flags with TINN-R. There is a > > space to fill in the path to Rgui, and I have "C:\Program > > Files\R\rw2001pat\bin\Rgui.exe". If I try to add a command line flag > > after that, such as " --no-save" or " --max-mem-size" then TINN-R will > > not open the application. > > No that does not work, but you can consider working in the other way: > starting Tinn-R while you start R. Then you have all the flexibility to > define whatever command line argument you want for R. > > There are many ways to do so, but I personally use the following one: > > 1) I define: > > > options(IDE = "c:/program files/tinn-R/bin/tinn-R.exe") > > (of course, the path should reflect the place you actually installed > Tinn-R!) > > and then, I start the svGUI package (from the SciViews bundle available > on CRAN). > > > library(svGUI) > > Tinn-R is started (if not already running), and also, the R call-tip > server (live calculation of call-tips for the syntax of R functions) is > activated behind the scene. > > If you are happy with this, and would like to start Tinn-R and activate > the R call-tip server automatically everytime you start R, just add > those two lines of code in your 'Rprofile' file (the general 'Rprofile' > is in /etc subdirectory of the R directory). > > Once it is done, do not worry about starting Tinn-R, or R from within > Tinn-R, just start R with all the command line options you like, and you > get Tinn-R started automatically (if it is not running yet)! > > Note that this tip is in FAQ 3.8, in the new version of Tinn-R FAQ to be > released soon, together with the latest stable Tinn-R 1.15.1.7 next > week or so ;-) > > Best, > > Philippe > > ..<°}))>< > ) ) ) ) ) > ( ( ( ( (Prof. Philippe Grosjean > ) ) ) ) ) > ( ( ( ( (Numerical Ecology of Aquatic Systems > ) ) ) ) ) Mons-Hainaut University, Pentagone (3D08) > ( ( ( ( (Academie Universitaire Wallonie-Bruxelles > ) ) ) ) ) 8, av du Champ de Mars, 7000 Mons, Belgium > ( ( ( ( ( > ) ) ) ) ) phone: + 32.65.37.34.97, fax: + 32.65.37.30.54 > ( ( ( ( (email: [EMAIL PROTECTED] > ) ) ) ) ) > ( ( ( ( (web: http://www.umh.ac.be/~econum > ) ) ) ) ) http://www.sciviews.org > ( ( ( ( ( > .. > > __ 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] analyse des correspondances multiples
bonjour, Je voudrais faire une analyse des correspondances multiples avec R. avec les représentation graphiques correspondantes avec R. je ne sais pas comment procéder .. en vour remerciant par avance Faouzi __ 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 print error message in batch mode
This solution is fine, too. The Achim's solution is what I have asked with this slight modification: $ R -q --no-save < prova > prova.out 2>> prova.out Again, thanks to Achim and Prof. Ripley. Best, Elio Prof Brian Ripley wrote: It is probably easier to use BATCH as in R CMD BATCH prova output See ?BATCH. That does what Elio actually asked for. On Thu, 7 Apr 2005, Achim Zeileis wrote: On Thu, 07 Apr 2005 12:45:16 +0200 Elio Mineo wrote: Dear list, I am using R in batch mode: $ R -q --no-save < prova > output the input file "prova" has these commands: data(USArrests) x<-USArrests hist(x) of course, the command hist(x) produces an error. The error message is: Error in hist.default(x) : `x' must be numeric. Is there the possibility to save this error massage in the "output" file? You could do something like $ R -q --no-save < prova > prova.out 2> prova.err Best, Z Thanks in advance, Angelo __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Order of boxes in boxplot()
It is the order of the levels of the grouping factor. If `grp' is not a factor, it will be made into one (with levels in alphabetical order). On Thu, 7 Apr 2005, michael watson (IAH-C) wrote: Sorry for such an inane question - how do I control the order in which the boxes are plotted using boxplot() when I pass it a formula and a data.frame? It seems that the groups are plotted in alphabetical order... I want to change this -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] how to print error message in batch mode
It is probably easier to use BATCH as in R CMD BATCH prova output See ?BATCH. That does what Elio actually asked for. On Thu, 7 Apr 2005, Achim Zeileis wrote: On Thu, 07 Apr 2005 12:45:16 +0200 Elio Mineo wrote: Dear list, I am using R in batch mode: $ R -q --no-save < prova > output the input file "prova" has these commands: data(USArrests) x<-USArrests hist(x) of course, the command hist(x) produces an error. The error message is: Error in hist.default(x) : `x' must be numeric. Is there the possibility to save this error massage in the "output" file? You could do something like $ R -q --no-save < prova > prova.out 2> prova.err Best, Z Thanks in advance, Angelo __ 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 -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] build rpvm under cygwin
Read the FAQs, etc, about building R on Windows. Summary: stay away from Cygwin when it comes to R. On Apr 7, 2005 11:34 AM, Lars Schouw <[EMAIL PROTECTED]> wrote: > I tried ot build rpvm in my own makefile. > But runs into some linker errors like e.g. > undefined reference to `_R_alloc' > > My enviornment looks like this: > CYGWIN > pvm 3.4 compiled under cygwin myself > R installed from the rw2001.exe setup file. > > I guess that the R under rw2001.exe was build with > some other compiler? > > I then tried to compile R myself under CYGWIN but runs > into the following problem: > building from src typing make > gcc -I. -I../../src/include -I../../src/include > -I/usr/local/include -DHAVE_CON > FIG_H -D__NO_MATH_INLINES -g -O2 -c dynload.c -o > dynload.o > In file included from dynload.c:35: > ../../src/include/Defn.h:60:22: psignal.h: No such > file or directory > > I found the psignal.h header file under > gnuwin32/fixed/h/psignal.h how do incoperate this > udner cygwin? > > I also tried to type build under src/gnuwin32 but get > another error: > > $ make > make: ./Rpwd.exe: Command not found > make[1]: ./Rpwd.exe: Command not found > make --no-print-directory -C front-ends Rpwd > make -C ../../include -f Makefile.win version > make[3]: Nothing to be done for `version'. > make Rpwd.exe > gcc -O2 -Wall -pedantic -I../../include -c rpwd.c -o > rpwd.o > rpwd.c:22:20: direct.h: No such file or directory > rpwd.c: In function `main': > rpwd.c:38: warning: implicit declaration of function > `chdir' > rpwd.c:41: warning: implicit declaration of function > `getcwd' > make[3]: *** [rpwd.o] Error 1 > make[2]: *** [Rpwd] Error 2 > make[1]: *** [front-ends/Rpwd.exe] Error 2 > make: *** [all] Error 2 > > Ideas would be appreciated. > > Regards > Lars Schouw > > --- Lars Schouw <[EMAIL PROTECTED]> wrote: > > Dear Professor Ripley > > > > The good news is that I fot PVM up and running one > > two > > Windows nodes now. I had to connect them with each > > other manually . for now not using rsh or ssh. > > > > Now building RPVM for Windows might not be so easy > > as > > it sounds. Did anyone try this out before > > successfully? > > > > Also the SNOW package but that did not look so bad. > > > > Regards > > Lars > > --- Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > > > On Thu, 24 Mar 2005, A.J. Rossini wrote: > > > > > > > Looks like you are trying to install source > > > tarball on Windows without > > > > the relevant toolset (compiler, etc)? > > > > > > To save further hassle, rpvm is not going to build > > > on Windows > > > unless you have PVM installed and working on > > > Windows. > > > > > > If that is the case, this looks like the use of > > the > > > wrong make, with the > > > wrong shell (that message is coming from a Windows > > > shell, not sh.exe). > > > Do see the warnings in README.packages about the > > > MinGW make. > > > > > > > On Thu, 24 Mar 2005 00:11:34 -0800 (PST), Lars > > > Schouw > > > > <[EMAIL PROTECTED]> wrote: > > > >> I am trying to install the rpvm package doing > > > this: > > > >> > > > >> C:\R\rw2000\bin>rcmd install rpvm_0.6-2.tar.gz > > > >> > > > >> '.' is not recognized as an internal or > > external > > > >> command, > > > >> operable program or batch file. > > > >> '.' is not recognized as an internal or > > external > > > >> command, > > > >> operable program or batch file. > > > >> make: *** /rpvm: No such file or directory. > > > Stop. > > > >> make: *** [pkg-rpvm] Error 2 > > > >> *** Installation of rpvm failed *** > > > >> > > > >> Removing 'C:/R/rw2000/library/rpvm' > > > >> > > > >> What does this error message tell me? > > > > > > > > > -- > > > 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 > > > > > > > > > > > __ > > > Show us what our next emoticon should look like. > > Join the fun. > > http://www.advision.webevents.yahoo.com/emoticontest > > > > __ > 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 > -- best, -tony "Commit early,commit often, and commit in a repository from which we can easily roll-back your mistakes" (AJR, 4Jan05). A.J. Rossini [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] sweave bwplot error
On Thu, Apr 07, 2005 at 01:24:42PM +0200, Christoph Lehmann wrote: > \begin{figure}[H] > \begin{center} > <>= > lset(col.whitebg()) > bwplot(x2 ~x1, data = tt) > @ > \caption{xxx} > \end{center} > \end{figure} > > PROBLEM: > the pdf of the figure is not correctly created (neither the esp) and the > error I get from sweave is: > pdf inclusion: required page does not exist <0> You need a print() statement around bwplot() -- see the FAQ. Dirk -- Better to have an approximate answer to the right question than a precise answer to the wrong question. -- John Tukey as quoted by John Chambers __ 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] sweave bwplot error
Christoph Lehmann wrote: Hi I use sweave and have a problem with the following figure, but not with other figures: tt <- data.frame(c("a", "b", "c"), c(1.2, 3, 4.5)) names(tt) <- c("x1", "x2") bwplot(x2 ~x1, data = tt) ok now in sweave: \begin{figure}[H] \begin{center} <>= lset(col.whitebg()) bwplot(x2 ~x1, data = tt) @ \caption{xxx} \end{center} \end{figure} PROBLEM: the pdf of the figure is not correctly created (neither the esp) and the error I get from sweave is: pdf inclusion: required page does not exist <0> thanks for help christoph You need wrap print() round lattice functions to get them to do anything in situations like this. See the Sweave FAQ for this FAQ: http://www.ci.tuwien.ac.at/~leisch/Sweave/FAQ.html#x1-8000A.6 G -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [T] +44 (0)20 7679 5522 ENSIS Research Fellow [F] +44 (0)20 7679 7565 ENSIS Ltd. & ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/ 26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/ London. WC1H 0AP. %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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] sweave bwplot error
> On Thu, 07 Apr 2005 13:24:42 +0200, > Christoph Lehmann (CL) wrote: > Hi > I use sweave and have a problem with the following figure, but not with > other figures: > tt <- data.frame(c("a", "b", "c"), c(1.2, 3, 4.5)) > names(tt) <- c("x1", "x2") > bwplot(x2 ~x1, data = tt) > ok now in sweave: > \begin{figure}[H] >\begin{center} > <>= > lset(col.whitebg()) > bwplot(x2 ~x1, data = tt) > @ > \caption{xxx} >\end{center} > \end{figure} > PROBLEM: > the pdf of the figure is not correctly created (neither the esp) and the > error I get from sweave is: > pdf inclusion: required page does not exist <0> >From the Sweave FAQ: A.6 Why do R lattice graphics not work? The commands in package lattice have different behavior than the standard plot commands in the base package: lattice commands return an object of class "trellis", the actual plotting is performed by the print method for the class. Encapsulating calls to lattice functions in print() statements should do the trick, e.g.: <>= library(lattice) print(bwplot(1:10)) @ should work. -- --- Friedrich Leisch Institut für Statistik Tel: (+43 1) 58801 10715 Technische Universität WienFax: (+43 1) 58801 10798 Wiedner Hauptstraße 8-10/1071 A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch __ 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] sweave bwplot error
On Thu, 07 Apr 2005 13:24:42 +0200 Christoph Lehmann wrote: > Hi > I use sweave and have a problem with the following figure, but not > with other figures: > > tt <- data.frame(c("a", "b", "c"), c(1.2, 3, 4.5)) > names(tt) <- c("x1", "x2") > bwplot(x2 ~x1, data = tt) > > ok now in sweave: > > \begin{figure}[H] >\begin{center} > <>= > lset(col.whitebg()) > bwplot(x2 ~x1, data = tt) > @ > \caption{xxx} >\end{center} > \end{figure} > > PROBLEM: > the pdf of the figure is not correctly created (neither the esp) and > the error I get from sweave is: > pdf inclusion: required page does not exist <0> This is covered by FAQ 7.22. (you need to print() the plot) Z > thanks for help > > 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
[R] Order of boxes in boxplot()
Hi Sorry for such an inane question - how do I control the order in which the boxes are plotted using boxplot() when I pass it a formula and a data.frame? It seems that the groups are plotted in alphabetical order... I want to change this Many thanks 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] how to print error message in batch mode
That's fine! Thanks a lot. Angelo Achim Zeileis wrote: On Thu, 07 Apr 2005 12:45:16 +0200 Elio Mineo wrote: Dear list, I am using R in batch mode: $ R -q --no-save < prova > output the input file "prova" has these commands: data(USArrests) x<-USArrests hist(x) of course, the command hist(x) produces an error. The error message is: Error in hist.default(x) : `x' must be numeric. Is there the possibility to save this error massage in the "output" file? You could do something like $ R -q --no-save < prova > prova.out 2> prova.err Best, Z Thanks in advance, Angelo __ 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] sweave bwplot error
Hi I use sweave and have a problem with the following figure, but not with other figures: tt <- data.frame(c("a", "b", "c"), c(1.2, 3, 4.5)) names(tt) <- c("x1", "x2") bwplot(x2 ~x1, data = tt) ok now in sweave: \begin{figure}[H] \begin{center} <>= lset(col.whitebg()) bwplot(x2 ~x1, data = tt) @ \caption{xxx} \end{center} \end{figure} PROBLEM: the pdf of the figure is not correctly created (neither the esp) and the error I get from sweave is: pdf inclusion: required page does not exist <0> thanks for help 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] how to print error message in batch mode
On Thu, 07 Apr 2005 12:45:16 +0200 Elio Mineo wrote: > Dear list, > I am using R in batch mode: > > $ R -q --no-save < prova > output > > the input file "prova" has these commands: > > data(USArrests) > x<-USArrests > hist(x) > > of course, the command hist(x) produces an error. The error message > is: Error in hist.default(x) : `x' must be numeric. > Is there the possibility to save this error massage in the "output" > file? You could do something like $ R -q --no-save < prova > prova.out 2> prova.err Best, Z > Thanks in advance, > Angelo > > __ > 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] how to print error message in batch mode
Dear list, I am using R in batch mode: $ R -q --no-save < prova > output the input file "prova" has these commands: data(USArrests) x<-USArrests hist(x) of course, the command hist(x) produces an error. The error message is: Error in hist.default(x) : `x' must be numeric. Is there the possibility to save this error massage in the "output" file? Thanks in advance, Angelo __ 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] (no subject)
__ 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] build rpvm under cygwin
I tried ot build rpvm in my own makefile. But runs into some linker errors like e.g. undefined reference to `_R_alloc' My enviornment looks like this: CYGWIN pvm 3.4 compiled under cygwin myself R installed from the rw2001.exe setup file. I guess that the R under rw2001.exe was build with some other compiler? I then tried to compile R myself under CYGWIN but runs into the following problem: building from src typing make gcc -I. -I../../src/include -I../../src/include -I/usr/local/include -DHAVE_CON FIG_H -D__NO_MATH_INLINES -g -O2 -c dynload.c -o dynload.o In file included from dynload.c:35: ../../src/include/Defn.h:60:22: psignal.h: No such file or directory I found the psignal.h header file under gnuwin32/fixed/h/psignal.h how do incoperate this udner cygwin? I also tried to type build under src/gnuwin32 but get another error: $ make make: ./Rpwd.exe: Command not found make[1]: ./Rpwd.exe: Command not found make --no-print-directory -C front-ends Rpwd make -C ../../include -f Makefile.win version make[3]: Nothing to be done for `version'. make Rpwd.exe gcc -O2 -Wall -pedantic -I../../include -c rpwd.c -o rpwd.o rpwd.c:22:20: direct.h: No such file or directory rpwd.c: In function `main': rpwd.c:38: warning: implicit declaration of function `chdir' rpwd.c:41: warning: implicit declaration of function `getcwd' make[3]: *** [rpwd.o] Error 1 make[2]: *** [Rpwd] Error 2 make[1]: *** [front-ends/Rpwd.exe] Error 2 make: *** [all] Error 2 Ideas would be appreciated. Regards Lars Schouw --- Lars Schouw <[EMAIL PROTECTED]> wrote: > Dear Professor Ripley > > The good news is that I fot PVM up and running one > two > Windows nodes now. I had to connect them with each > other manually . for now not using rsh or ssh. > > Now building RPVM for Windows might not be so easy > as > it sounds. Did anyone try this out before > successfully? > > Also the SNOW package but that did not look so bad. > > Regards > Lars > --- Prof Brian Ripley <[EMAIL PROTECTED]> wrote: > > On Thu, 24 Mar 2005, A.J. Rossini wrote: > > > > > Looks like you are trying to install source > > tarball on Windows without > > > the relevant toolset (compiler, etc)? > > > > To save further hassle, rpvm is not going to build > > on Windows > > unless you have PVM installed and working on > > Windows. > > > > If that is the case, this looks like the use of > the > > wrong make, with the > > wrong shell (that message is coming from a Windows > > shell, not sh.exe). > > Do see the warnings in README.packages about the > > MinGW make. > > > > > On Thu, 24 Mar 2005 00:11:34 -0800 (PST), Lars > > Schouw > > > <[EMAIL PROTECTED]> wrote: > > >> I am trying to install the rpvm package doing > > this: > > >> > > >> C:\R\rw2000\bin>rcmd install rpvm_0.6-2.tar.gz > > >> > > >> '.' is not recognized as an internal or > external > > >> command, > > >> operable program or batch file. > > >> '.' is not recognized as an internal or > external > > >> command, > > >> operable program or batch file. > > >> make: *** /rpvm: No such file or directory. > > Stop. > > >> make: *** [pkg-rpvm] Error 2 > > >> *** Installation of rpvm failed *** > > >> > > >> Removing 'C:/R/rw2000/library/rpvm' > > >> > > >> What does this error message tell me? > > > > > > -- > > 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 > > > > > > __ > Show us what our next emoticon should look like. > Join the fun. > http://www.advision.webevents.yahoo.com/emoticontest > __ 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] density estimation with weighted sample
On Thu, 7 Apr 2005, Tomassini, Lorenzo wrote: I would like to perform density estimation with a weighted sample (output of an Importance Sampling procedure) in R. Could anybody give me an advice on what function to use (in which package)? This could mean 1) You have a sample with weights w, so `w=4' means `I have 4 of those'. 2) You have a sample from a density proportional to w(x)f(x) and want to estimate f. Your title suggests the first, your comment the second. If it is the second, use any package (even density() in R) to estimate the density g of the sampled distribution, for ghat/w and rescale to unit area. If you know a lot about w (e.g. in stereology) there are specialized methods which are better. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] density estimation with weighted sample
Dear all I would like to perform density estimation with a weighted sample (output of an Importance Sampling procedure) in R. Could anybody give me an advice on what function to use (in which package)? Thanks a lot, Lorenzo __ 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