[R] Howto view function's source code of an installed package
Hi, Is there a way I can view the functions source code of a package I installed in my PC. For example I downloaded the great mixtools package. I want to see the source code of one of its function normalmixEM Is there a way to do it? Presumably from R command prompt? I tried to take a look at the zip file, but somehow I can't seem to find the file on which I can find the source code. Please advice. - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R logo
CG == Christophe Genolini [EMAIL PROTECTED] on Wed, 16 Jul 2008 02:40:01 +0200 writes: CG Hi the list, I like the R logo (grey C and blue R) very CG much, specialy the drawing of the letter with border and CG shadow. I would like to make something closed with some CG other letters. Does anyone know how to get a similar CG result ? If we knew an elegant one, we'd have an R function to do it ... The R Logo was done manually (using software) in several phases IIRC. But yes, indeed, an 'Rfont' package on CRAN would be neat... Martin Maechler, ETH Zurich and R Core Team. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Howto view function's source code of an installed package
Gundala Viswanath wrote: Hi, Is there a way I can view the functions source code of a package I installed in my PC. For example I downloaded the great mixtools package. I want to see the source code of one of its function normalmixEM Is there a way to do it? Presumably from R command prompt? I tried to take a look at the zip file, but somehow I can't seem to find the file on which I can find the source code. Please advice. - Gundala Viswanath Jakarta - Indonesia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Hi, You can see the R-source code of a function if you give the command without the brackets. For example: sort function (x, decreasing = FALSE, ...) { if (!is.logical(decreasing) || length(decreasing) != 1) stop('decreasing' must be a length-1 logical vector.\nDid you intend to set 'partial'?) UseMethod(sort) } environment: namespace:base Another option is to download the .tar.gz source package from CRAN, unpack it and the R source code is available in the R subdirectory. cheers, Paul -- Drs. Paul Hiemstra Department of Physical Geography Faculty of Geosciences University of Utrecht Heidelberglaan 2 P.O. Box 80.115 3508 TC Utrecht Phone: +31302535773 Fax:+31302531145 http://intamap.geo.uu.nl/~paul __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R logo
The R Logo was done manually (using software) in several phases IIRC. Well, that's not a surprise. Let me rephrase my question : is the logo drawer still on this list ? Did you use gimp ? A specific filter ? or a scriptfu ? Christophe __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Group level frequencies
Dear List, I have Multi-level Data i= Indivitual Level g= Group Level var1= First Variable of interest var2= Second Variable of interest and I want to count the frequency of var1 and var2 on the group level. I found a way, but there must be a much simpler way. data.ml - data.frame(i=c(1:8),g=as.factor(c(1,1,1,2,2,3,3,3)),var1=c(3,3,3,4,4,4,4 ,4), var2=c(8,8,8,2,2,4,4,4)) therefore the data looks like i g var1 var2 1 1 138 2 2 138 3 3 138 4 4 242 5 5 242 6 6 344 7 7 344 8 8 344 1. I used tapply to get the (Group)mean of var1 and var2 in separate Equations. The result will be two one-dimensional Array with rownames. 2. I Transformed the Arrays in two data.frames 3. I merged the data.frames d.var1 - data.frame(id=rownames(tapply(data.ml$var1,data.ml$g,mean)),var1=as.nume ric(tapply(data.ml$var1,data.ml$g,mean))) d.var2 - data.frame(id=rownames(tapply(data.ml$var2,data.ml$g,mean)),var2=as.nume ric(tapply(data.ml$var2,data.ml$g,mean))) data.gl - d.var1 data.gl$var2 - d.var2$var2 By putting the data.frames d.var1 and d.var2 together in a new data.frame data.gl I would like to take control of the id-factor There must be an easier way. Thank you. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Group level frequencies
well, I'm not completely sure I understand what you want to compute but you may try the following: data.ml - data.frame(i = 1:8, g = factor(c(1,1,1,2,2,3,3,3)), var1 = c(3,3,3,4,4,4,4,4), var2 = c(8,8,8,2,2,4,4,4)) data.ml[!duplicated(data.ml$g), -1] # or t(sapply(split(data.ml[c(var1, var2)], data.ml$g), colMeans)) I hope it helps. Best, Dimitris Dimitris Rizopoulos Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: Kunzler, Andreas [EMAIL PROTECTED] To: r-help@r-project.org Sent: Wednesday, July 16, 2008 10:21 AM Subject: [R] Group level frequencies Dear List, I have Multi-level Data i= Indivitual Level g= Group Level var1= First Variable of interest var2= Second Variable of interest and I want to count the frequency of var1 and var2 on the group level. I found a way, but there must be a much simpler way. data.ml - data.frame(i=c(1:8),g=as.factor(c(1,1,1,2,2,3,3,3)),var1=c(3,3,3,4,4,4,4 ,4), var2=c(8,8,8,2,2,4,4,4)) therefore the data looks like i g var1 var2 1 1 138 2 2 138 3 3 138 4 4 242 5 5 242 6 6 344 7 7 344 8 8 344 1. I used tapply to get the (Group)mean of var1 and var2 in separate Equations. The result will be two one-dimensional Array with rownames. 2. I Transformed the Arrays in two data.frames 3. I merged the data.frames d.var1 - data.frame(id=rownames(tapply(data.ml$var1,data.ml$g,mean)),var1=as.nume ric(tapply(data.ml$var1,data.ml$g,mean))) d.var2 - data.frame(id=rownames(tapply(data.ml$var2,data.ml$g,mean)),var2=as.nume ric(tapply(data.ml$var2,data.ml$g,mean))) data.gl - d.var1 data.gl$var2 - d.var2$var2 By putting the data.frames d.var1 and d.var2 together in a new data.frame data.gl I would like to take control of the id-factor There must be an easier way. Thank you. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Group level frequencies
Is this what you were asking about: aggregate(data.ml[,c('var1','var2')], list(data.ml$g), mean) Group.1 var1 var2 1 138 2 242 3 344 On Wed, Jul 16, 2008 at 4:21 AM, Kunzler, Andreas [EMAIL PROTECTED] wrote: Dear List, I have Multi-level Data i= Indivitual Level g= Group Level var1= First Variable of interest var2= Second Variable of interest and I want to count the frequency of var1 and var2 on the group level. I found a way, but there must be a much simpler way. data.ml - data.frame(i=c(1:8),g=as.factor(c(1,1,1,2,2,3,3,3)),var1=c(3,3,3,4,4,4,4 ,4), var2=c(8,8,8,2,2,4,4,4)) therefore the data looks like i g var1 var2 1 1 138 2 2 138 3 3 138 4 4 242 5 5 242 6 6 344 7 7 344 8 8 344 1. I used tapply to get the (Group)mean of var1 and var2 in separate Equations. The result will be two one-dimensional Array with rownames. 2. I Transformed the Arrays in two data.frames 3. I merged the data.frames d.var1 - data.frame(id=rownames(tapply(data.ml$var1,data.ml$g,mean)),var1=as.nume ric(tapply(data.ml$var1,data.ml$g,mean))) d.var2 - data.frame(id=rownames(tapply(data.ml$var2,data.ml$g,mean)),var2=as.nume ric(tapply(data.ml$var2,data.ml$g,mean))) data.gl - d.var1 data.gl$var2 - d.var2$var2 By putting the data.frames d.var1 and d.var2 together in a new data.frame data.gl I would like to take control of the id-factor There must be an easier way. Thank you. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Font quality in base graphics
Hi willemf, Glad to hear that it helped. Years ago (late-90s) I Linuxed, but have since been forced into the Windows environment (where, however, I have the great pleasure of being able to use MiKTeX and LyX, i.e. TeX/LaTeX). I therefore can't help you further, except to say that I have never had a problem controlling font sizes c to my admittedly very demanding --- some people say excessively demanding --- standards (and that's on Windows!). And I have never had a problem with labels c not being where they should be, or of the size I want them to be, when I have built the graphic from scratch. And only very rarely have I encountered such problems when using canned graph types. In brief, what I am saying is that the problem almost certainly lies with the way fonts c are set up on your Linux box. Were this not the case, then I can assure you that there would have many and varied sharply worded statements on this list relating to the poor quality of R's graphs. And there would have been just as many pointed, well-written rebukes, pointing that Yet there aren't. If you search the archives you will find that a good many users migrated to R from other systems because of R's excellent graphical subsystems. Look at the graphics in any of the many books now published on using R, or that use R to elucidate problems Set your mind at rest: look at your system setup, and the tools outside R that you are using. Hope it all works out. OpenOffice is now a very good suite of programs, but if you want true quality of output then you really should be TeXing. Check it out. Bye, Mark. willemf wrote: Mark, your suggestion results in about 75% control over the plot. This is the best that I have managed to get it at, so thank you very much. In Linux you create a X11() device for screen output. Specifying identical device characteristics results in a fair degree of similarity between screen version and EPS version. However in this case, for instance, some labels along the X axis are omitted in the screen version and (thankfullly!) included in the Postscript version. Also, the relative sizes of caption font size and label font size are not identical in the two versions. I have learnt a few things in this exercise, so thanks you very much for the advice. -- View this message in context: http://www.nabble.com/Font-quality-in-base-graphics-tp18465608p18483719.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Font quality in base graphics
Hi willemf, And perhaps I should have added (in case you are moving across systems) that you should take a look at ?embedFonts http://cran.r-project.org/doc/Rnews/Rnews_2006-2.pdf Ghostscript should be installed on your box, so there shouldn't be a problem. Without additional information, it's not possible to help further. Of course, you could send me the data and a script showing how you want it plotted, and I would send you a PDF in return, showing you what R can do ;). HTH, Mark. Mark Difford wrote: Hi willemf, Glad to hear that it helped. Years ago (late-90s) I Linuxed, but have since been forced into the Windows environment (where, however, I have the great pleasure of being able to use MiKTeX and LyX, i.e. TeX/LaTeX). I therefore can't help you further, except to say that I have never had a problem controlling font sizes c to my admittedly very demanding --- some people say excessively demanding --- standards (and that's on Windows!). And I have never had a problem with labels c not being where they should be, or of the size I want them to be, when I have built the graphic from scratch. And only very rarely have I encountered such problems when using canned graph types. In brief, what I am saying is that the problem almost certainly lies with the way fonts c are set up on your Linux box. Were this not the case, then I can assure you that there would have many and varied sharply worded statements on this list relating to the poor quality of R's graphs. And there would have been just as many pointed, well-written rebukes, pointing that Yet there aren't. If you search the archives you will find that a good many users migrated to R from other systems because of R's excellent graphical subsystems. Look at the graphics in any of the many books now published on using R, or that use R to elucidate problems Set your mind at rest: look at your system setup, and the tools outside R that you are using. Hope it all works out. OpenOffice is now a very good suite of programs, but if you want true quality of output then you really should be TeXing. Check it out. Bye, Mark. willemf wrote: Mark, your suggestion results in about 75% control over the plot. This is the best that I have managed to get it at, so thank you very much. In Linux you create a X11() device for screen output. Specifying identical device characteristics results in a fair degree of similarity between screen version and EPS version. However in this case, for instance, some labels along the X axis are omitted in the screen version and (thankfullly!) included in the Postscript version. Also, the relative sizes of caption font size and label font size are not identical in the two versions. I have learnt a few things in this exercise, so thanks you very much for the advice. -- View this message in context: http://www.nabble.com/Font-quality-in-base-graphics-tp18465608p18483965.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Font quality in base graphics
Hmmm, I did not follow this thread closely, sorry for that, just want to share my 2c. If it is about quality, then I create EPS files and use the psfrag latex package to replace the PS fonts with TeX's fonts. This has the following advantages: 1) The figures have the same font as the text itself. The same size as well. If you resize the figure the fonts stay the same! 2) You can write fancy TeX formulae in the figures. 3) You can have any font TeX supports. Disadvantages: 1) The same as before, if you resize the figure the fonts stay the same! This is quite far from WYSIWYG. 2) You cannot use pdfLaTeX. I have a little script that automates this for .fig files (this is based on figtex, another script that I found somewhere online and can't find it any more), and another one for SVG files. So you save the file with xfig() or svg() and then the script does everything, all you have to do is to include it into the .tex file with a small custom macro. Gabor On Wed, Jul 16, 2008 at 02:25:52AM -0700, Mark Difford wrote: Hi willemf, Glad to hear that it helped. Years ago (late-90s) I Linuxed, but have since been forced into the Windows environment (where, however, I have the great pleasure of being able to use MiKTeX and LyX, i.e. TeX/LaTeX). I therefore can't help you further, except to say that I have never had a problem controlling font sizes c to my admittedly very demanding --- some people say excessively demanding --- standards (and that's on Windows!). And I have never had a problem with labels c not being where they should be, or of the size I want them to be, when I have built the graphic from scratch. And only very rarely have I encountered such problems when using canned graph types. In brief, what I am saying is that the problem almost certainly lies with the way fonts c are set up on your Linux box. Were this not the case, then I can assure you that there would have many and varied sharply worded statements on this list relating to the poor quality of R's graphs. And there would have been just as many pointed, well-written rebukes, pointing that Yet there aren't. If you search the archives you will find that a good many users migrated to R from other systems because of R's excellent graphical subsystems. Look at the graphics in any of the many books now published on using R, or that use R to elucidate problems Set your mind at rest: look at your system setup, and the tools outside R that you are using. Hope it all works out. OpenOffice is now a very good suite of programs, but if you want true quality of output then you really should be TeXing. Check it out. Bye, Mark. willemf wrote: Mark, your suggestion results in about 75% control over the plot. This is the best that I have managed to get it at, so thank you very much. In Linux you create a X11() device for screen output. Specifying identical device characteristics results in a fair degree of similarity between screen version and EPS version. However in this case, for instance, some labels along the X axis are omitted in the screen version and (thankfullly!) included in the Postscript version. Also, the relative sizes of caption font size and label font size are not identical in the two versions. I have learnt a few things in this exercise, so thanks you very much for the advice. -- View this message in context: http://www.nabble.com/Font-quality-in-base-graphics-tp18465608p18483719.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Csardi Gabor [EMAIL PROTECTED]UNIL DGM __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Font quality in base graphics
On Wed, Jul 16, 2008 at 04:48:28AM -0500, Gabor Csardi wrote: [...] I have a little script that automates this for .fig files (this is based on figtex, another script that I found somewhere online and can't find it any more) [...] Ok, it is called figfrag, and it is on CTAN. [...] -- Csardi Gabor [EMAIL PROTECTED]UNIL DGM __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] eval.wih.vis
I solved my problem. I had to delete stop() It doesn't make sense to have a stop() in if. stop() is to stop the execution of the code once the condition is met. the else does the job of stop() in this case. mysimbaa wrote: Hello, I have an error since I run my R code. This error is : Fehler in eval.with.vis(expr, envir, enclos) : My code is: #CONDITION1 : check if the right logfile is chosen c1=log(z[,3],n) if (c1==FALSE) { plot(0:1,0:1,type = n, axes=FALSE,xlab=,ylab=) text(0.4,0.8,adj=0,paste(FEHLER),col=red) text(0.4,0.6,adj=0,paste(Falsche Logfile gewählt)) stop()} else {...} z[,3] is a vector of n values. And log is a function which returns TRUE/FALSE #Detection whether the Right Logfile was chosen log-function(col,Len){ vLog=ifelse(sum(col)(5000*Len),TRUE,FALSE)} I think the error comes from stop(), but not sure. Can anyone help to avoid this error? Thanks. Adel -- View this message in context: http://www.nabble.com/eval.wih.vis-tp18439974p18480900.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem installing R on openSUSE 10.3
On Tue, 15 Jul 2008 09:58:28 -0700 (PDT) A Ezhil [EMAIL PROTECTED] wrote: Hi, I didn't try automatic dependency resolution instead installed each library one by one. It seems that tcl is installed and the libtcl8.4.so exists. Below is the info from the system: rpm -q tcl tcl-8.4.15-22 whereis libtcl8.4.so libtcl8.4: /usr/lib64/libtcl8.4.so rpm -i R-base-2.7.1-6.1.i586.rpm error: Failed dependencies: libtcl8.4.so is needed by R-base-2.7.1-6.1.i586 Am I missing something? Ah, yes! You have a 64-bit version of tcl but an i586 version of R. You must choose the same architecture for all components. Regards Detlef Thanks, Ezhil --- On Tue, 7/15/08, Detlef Steuer [EMAIL PROTECTED] wrote: From: Detlef Steuer [EMAIL PROTECTED] Subject: Re: [R] Problem installing R on openSUSE 10.3 To: r-help@r-project.org Cc: [EMAIL PROTECTED] Date: Tuesday, July 15, 2008, 9:46 PM On Tue, 15 Jul 2008 07:08:24 -0700 (PDT) A Ezhil [EMAIL PROTECTED] wrote: Dear All, I am trying to install R 2.7 on my openSUSE 10.3. I have faithfully followed instruction at http://cran.r-project.org/bin/linux/suse/ReadMe.txt. I have downloaded all the RPMs but still R complains about: libtcl8.4.so is needed by R-base-2.7.1-6.1.i586 Did you try automatic dependency resolution or did you download piece by piece? I searched for this library and found a one, tcl-8.4.15-22.i586.rpm at openSUSE distribution site and installed. But R still complains about the same missing library. What gives rpm -q tcl ? libtcl is provided by that package. I suspect somthing went wrong when you installed tcl. If tcl indeed is installed. Does libtcl physically exist ? Here I get: whereis libtcl8.4.so libtcl8.4: /usr/lib/libtcl8.4.so Just wild guesses, but it's a new error ... Best regards Detlef Steuer I don't know what I have to do now. Could please help me fixing this? Thanks. Best regards, Ezhil __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Regression problem
On 7/15/08, Angila Albaros [EMAIL PROTECTED] wrote: Dear Sir, Thanks for your reply but my data is very huge 100 x 550 ( for x ) and 100 x 1010 ( for y). So, I think that time , I need to take one column of x ($x1)and do multiple regreesion with y data set.i.e x1 will be my response and y data set is predictor, then $x2 with whole y data set and so on. Can I use some loop ? if yes how? Just for an example, I have put this example. Thanks and regards Angila A. On 7/15/08, Patrick Burns [EMAIL PROTECTED] wrote: That can be accomplished with 8 keystrokes. A hint is to do the 4 keystrokes: ?lm Patrick Burns [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Angila Albaros wrote: Hello all, I am new to r programmeand need help. I want to do multiple linear regression analysis. say, I have two matrix 'x' and 'y'. I want, 'x' as my response variable and 'y' as predictor. Each time one column of 'x' will be the response, say x[,1], then next x[,2] and so on. And also I need to store the coefficients in a matrix form. Please help me. x [,1] [,2] [,3] [,4] [1,] -1000 [2,]0 -100 [3,]00 -10 [4,]000 -1 y [,1] [,2] [,3] [,4] [1,] 0.6748156 0.266461216 -0.6883143 2.1332456 [2,] 0.5668101 0.295578807 0.1743760 0.4730689 [3,] -2.9465207 -2.313246341 -0.6060058 0.6236515 [4,] -1.5882276 0.002852312 -1.3152300 0.9082773 Thanks in advance Angila A. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] barchart with bars attached to y=0-line
Dear R users, i am using the following code to produce barcharts with lattice: Compound-c(Glutamine, Arginine, Glutamate, Glycine, Serine, Glucose, Fructose, Raffinose, Glycerol, Galacglycerol, Threitol, Galactinol, Galactitol) Class-c(aminos,aminos,aminos,aminos,aminos,sugars,sugars,sugars,glycerols,glycerols,sugar alcohols,sugar alcohols,sugar alcohols) set.seed(5) Ratio-rnorm(13, 0.5, 3) df-data.frame(Compound, Class,Ratio) library(lattice) P-barchart(data=df,Ratio~Compound|Class) However, I would like to have the bars attached to an imaginary y=0-line so that they go up if Ratio0 and down if Ratio0. I saw some older entries in the mailing list supposing to use panel.barchart. However, I did not fully understand the usage of this function. Also, it was annouced to add an option to barchart to make it easier to get this type of plot. Has anyone an idea what the easiest solution might be? A second problem is concerning the display of the Compound-objects in accordance with the conditioning variable Class. In other words: Is it possible to use the whole space of each panel for only those Compound-objects which belong to the Class displayed in that particular panel? Of course, for this purpose the panels have to be detached to allow appropiate labling of the x-axis. Many thanks for your help, Henning -- [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Font quality in base graphics
Mark, your suggestion results in about 75% control over the plot. This is the best that I have managed to get it at, so thank you very much. In Linux you create a X11() device for screen output. Specifying identical device characteristics results in a fair degree of similarity between screen version and EPS version. However in this case, for instance, some labels along the X axis are omitted in the screen version and (thankfullly!) included in the Postscript version. Also, the relative sizes of caption font size and label font size are not identical in the two versions. I have learnt a few things in this exercise, so thanks you very much for the advice. -- View this message in context: http://www.nabble.com/Font-quality-in-base-graphics-tp18465608p18481835.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] code reduction (if anyone feels like it)
thanks that is a slim version. Stephen On Tue, Jul 15, 2008 at 9:03 PM, jim holtman [EMAIL PROTECTED] wrote: Typo in the last one: (resend) #GPS in Decimal Degrees in the form longitude latitude (raw data) library(maptools) # create a list of the coords coordList - list( RM215 = matrix(c(-82.1461363, 33.5959109), nrow=1), SC = matrix(c(-82.025888, 33.606454), nrow=1) , RM202 = matrix(c(-81.9906723, 33.5027653), nrow=1), RM198 = matrix(c(-81.926823, 33.4634678), nrow=1), HC = matrix(c(-81.920505, 33.46192), nrow=1) , RM190 = matrix(c(-81.9317347, 33.3839097), nrow=1), BC = matrix(c(-81.948189, 33.373043), nrow=1) , RM185 = matrix(c(-81.941, 33.3453), nrow=1), RM179 = matrix(c(-81.890929, 33.317914), nrow=1), RM148 = matrix(c(-81.7547337, 33.1514072), nrow=1) , RM119 = matrix(c(-81.501919, 32.94038), nrow=1), RM61 = matrix(c(-81.262388, 32.524739), nrow=1)) #start time for the sequence d060101 - as.POSIXct(2006-01-01, tz=EST) #sequence in days study_seq - seq(from=d060101, length.out=761, by=days) # process the list by name so you can use it in the column headings times - lapply(names(coordList), function(.name){ .sp - SpatialPoints(coordList[[.name]], proj4string=CRS(+proj=longlat +datum=WGS84)) .time - data.frame( sunriset(.sp, study_seq, direction=sunrise, POSIXct.out=TRUE)$time, sunriset(.sp, study_seq, direction=sunset, POSIXct.out=TRUE)$time) colnames(.time) - paste(.name, c('sr', 'ss'), sep='') .time }) sunriseset - do.call(cbind, times) head(sunriseset) On Tue, Jul 15, 2008 at 7:20 PM, stephen sefick [EMAIL PROTECTED] wrote: #GPS in Decimal Degrees in the form longitude latitude (raw data) library(maptools) RM215 - matrix(c(-82.1461363, 33.5959109), nrow=1) SC - matrix(c(-82.025888, 33.606454), nrow=1) RM202 - matrix(c(-81.9906723, 33.5027653), nrow=1) RM198 - matrix(c(-81.926823, 33.4634678), nrow=1) HC - matrix(c(-81.920505, 33.46192), nrow=1) RM190 - matrix(c(-81.9317347, 33.3839097), nrow=1) BC - matrix(c(-81.948189, 33.373043), nrow=1) RM185 - matrix(c(-81.941, 33.3453), nrow=1) RM179 - matrix(c(-81.890929, 33.317914), nrow=1) RM148 - matrix(c(-81.7547337, 33.1514072), nrow=1) RM119 - matrix(c(-81.501919, 32.94038), nrow=1) RM61 - matrix(c(-81.262388, 32.524739), nrow=1) #making the points into a map projection (latlong in WGS84) RM215.sp - SpatialPoints(RM215, proj4string=CRS(+proj=longlat +datum=WGS84)) #start time for the sequence d060101 - as.POSIXct(2006-01-01, tz=EST) #sequence in days study_seq - seq(from=d060101, length.out=761, by=days) #sunrise up.215 - sunriset(RM215.sp, study_seq, direction=sunrise, POSIXct.out=TRUE) #sunset down.215 - sunriset(RM215.sp, study_seq, direction=sunset, POSIXct.out=TRUE) SC.sp - SpatialPoints(SC, proj4string=CRS(+proj=longlat +datum=WGS84)) up.SC - sunriset(SC.sp, study_seq, direction=sunrise, POSIXct.out=TRUE) down.SC - sunriset(SC.sp, study_seq, direction=sunset, POSIXct.out=TRUE) RM202.sp - SpatialPoints(RM202, proj4string=CRS(+proj=longlat +datum=WGS84)) up.202 - sunriset(RM202.sp, study_seq, direction=sunrise, POSIXct.out=TRUE) down.202 - sunriset(RM202.sp, study_seq, direction=sunset, POSIXct.out=TRUE) RM198.sp - SpatialPoints(RM198, proj4string=CRS(+proj=longlat +datum=WGS84)) up.198 - sunriset(RM198.sp, study_seq, direction=sunrise, POSIXct.out=TRUE) down.198 - sunriset(RM198.sp, study_seq, direction=sunset, POSIXct.out=TRUE) HC.sp - SpatialPoints(HC, proj4string=CRS(+proj=longlat +datum=WGS84)) up.HC - sunriset(HC.sp, study_seq, direction=sunrise, POSIXct.out=TRUE) down.HC - sunriset(HC.sp, study_seq, direction=sunset, POSIXct.out=TRUE) RM190.sp - SpatialPoints(RM190, proj4string=CRS(+proj=longlat +datum=WGS84)) up.190 - sunriset(RM190.sp, study_seq, direction=sunrise, POSIXct.out=TRUE) down.190 - sunriset(RM190.sp, study_seq, direction=sunset, POSIXct.out=TRUE) BC.sp - SpatialPoints(BC, proj4string=CRS(+proj=longlat +datum=WGS84)) up.BC - sunriset(BC.sp, study_seq, direction=sunrise, POSIXct.out=TRUE) down.BC - sunriset(BC.sp, study_seq, direction=sunset, POSIXct.out=TRUE) RM185.sp - SpatialPoints(RM185, proj4string=CRS(+proj=longlat +datum=WGS84)) up.185 - sunriset(RM185.sp, study_seq, direction=sunrise, POSIXct.out=TRUE) down.185 - sunriset(RM185.sp, study_seq, direction=sunset, POSIXct.out=TRUE) RM179.sp - SpatialPoints(RM179, proj4string=CRS(+proj=longlat +datum=WGS84)) up.179 - sunriset(RM179.sp, study_seq, direction=sunrise, POSIXct.out=TRUE) down.179 - sunriset(RM179.sp, study_seq, direction=sunset, POSIXct.out=TRUE) RM148.sp - SpatialPoints(RM148, proj4string=CRS(+proj=longlat +datum=WGS84)) up.148 - sunriset(RM148.sp, study_seq, direction=sunrise, POSIXct.out=TRUE) down.148 -
Re: [R] How to extract component number of RMSEP in RMSEP plot
Hi R-listers, I would like to know how can i extract (ncomps) component no. when the RMSEP is lowest for PLS package? Currently, I only plot it manually, validationplot(pls) and then only feed the ncomp to the jack knife command. However, I would like to automate this step. Please let me know. Many thanks. Rgrds, [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] barchart with bars attached to y=0-line
You could do it without a panel function using xyplot and type h : df2 - transform(df, Compound = factor(abbreviate(Compound))) xyplot(Ratio ~ Compound | Class, df2, type = c(h, g), lwd = 7, par.settings = list(grid.pars = list(lineend = 1))) On Wed, Jul 16, 2008 at 6:48 AM, Henning Wildhagen [EMAIL PROTECTED] wrote: Dear R users, i am using the following code to produce barcharts with lattice: Compound-c(Glutamine, Arginine, Glutamate, Glycine, Serine, Glucose, Fructose, Raffinose, Glycerol, Galacglycerol, Threitol, Galactinol, Galactitol) Class-c(aminos,aminos,aminos,aminos,aminos,sugars,sugars,sugars,glycerols,glycerols,sugar alcohols,sugar alcohols,sugar alcohols) set.seed(5) Ratio-rnorm(13, 0.5, 3) df-data.frame(Compound, Class,Ratio) library(lattice) P-barchart(data=df,Ratio~Compound|Class) However, I would like to have the bars attached to an imaginary y=0-line so that they go up if Ratio0 and down if Ratio0. I saw some older entries in the mailing list supposing to use panel.barchart. However, I did not fully understand the usage of this function. Also, it was annouced to add an option to barchart to make it easier to get this type of plot. Has anyone an idea what the easiest solution might be? A second problem is concerning the display of the Compound-objects in accordance with the conditioning variable Class. In other words: Is it possible to use the whole space of each panel for only those Compound-objects which belong to the Class displayed in that particular panel? Of course, for this purpose the panels have to be detached to allow appropiate labling of the x-axis. Many thanks for your help, Henning -- [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] randomForest outlier
Perhaps if you follow the posting guide more closely, you might get more (useful) replies, but without looking at your data, I doubt there's much anyone can do for you. The fact that the range of the outlying measures is -1 to 2 would tell me there are no potential outliers by this measure. Please see the value section of ?outlier to see how this measure is computed. Andy From: Birgitle Still the same question: Birgitle wrote: I try to use ?randomForest to find variables that are the most important to divide my dataset (continuous, categorical variables) in two given groups. But when I plot the outlier: plot(outlier(rfObject, cls=groupingVariable), type=p,col=c(red,green)[as.numeric(groupingVariable)]) it seems to me that all my values appear as outliers. Has anybody suggestions what is going wrong in my analysis? Additonal remark The scaling of the y-axis is quite small between -1 and 2. - The art of living is more like wrestling than dancing. (Marcus Aurelius) -- View this message in context: http://www.nabble.com/randomForest-outlier-tp17979182p18466832.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Notice: This e-mail message, together with any attachme...{{dropped:12}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R-source code of a function
Hi, I know that if i want to see the SPLUS or R-source code of a function,i should give the command without the brackets.For example: rsquared.lmRobMM function(x) { str0 - Initial S-estimate str1 - Final M-estimate if(x$est == final) { z - x$r.squared attr(z, info) - str1 } if(x$est == initial) { z - x$r.squared attr(z, info) - str0 } oldClass(z) - lmRobMM.info z } Is there anybody knows how can i access all linked code which maybe written in the other languages such as c in above program? Bests, Arezoo [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] randomForest outlier
Thanks anyway for your answer. That was also an option that I took into account (no potential outliers) and I will have a look at the value section of ?outliers. B. Am 16.07.2008 um 14:11 schrieb Liaw, Andy: Perhaps if you follow the posting guide more closely, you might get more (useful) replies, but without looking at your data, I doubt there's much anyone can do for you. The fact that the range of the outlying measures is -1 to 2 would tell me there are no potential outliers by this measure. Please see the value section of ?outlier to see how this measure is computed. Andy From: Birgitle Still the same question: Birgitle wrote: I try to use ?randomForest to find variables that are the most important to divide my dataset (continuous, categorical variables) in two given groups. But when I plot the outlier: plot(outlier(rfObject, cls=groupingVariable), type=p,col=c(red,green)[as.numeric(groupingVariable)]) it seems to me that all my values appear as outliers. Has anybody suggestions what is going wrong in my analysis? Additonal remark The scaling of the y-axis is quite small between -1 and 2. - The art of living is more like wrestling than dancing. (Marcus Aurelius) -- View this message in context: http://www.nabble.com/randomForest-outlier-tp17979182p18466832.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu - direct contact information for affiliates is available at http://www.merck.com/contact/contacts.html) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. === Birgit Lemcke Institut of Systematic Botany University of Zurich Zollikerstrasse 107 CH-8008 Zürich Switzerland Ph: +41 (0)44 634 8351 mail: [EMAIL PROTECTED] === __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R-source code of a function
On 7/16/2008 8:29 AM, arezoo bagheri wrote: Hi, I know that if i want to see the SPLUS or R-source code of a function,i should give the command without the brackets.For example: rsquared.lmRobMM function(x) { str0 - Initial S-estimate str1 - Final M-estimate if(x$est == final) { z - x$r.squared attr(z, info) - str1 } if(x$est == initial) { z - x$r.squared attr(z, info) - str0 } oldClass(z) - lmRobMM.info z } Is there anybody knows how can i access all linked code which maybe written in the other languages such as c in above program? There is no linked C in the example above: it would be called using .C() or a few other related functions. But if you see one of those in some other function, you'll want to follow Uwe Ligge's advice in RNews on locating the source. His article is online here: http://cran.r-project.org/doc/Rnews/Rnews_2006-4.pdf, on page 43-45. Duncan Murdoch __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] NAMESPACE vs internal.Rd
Hi the list, When we use package.skeleton, it create some file in the man directorie. - If we use package.skeleton with namespace=FALSE, it create a file toto-internal.Rd - If we use package.skeleton with namespace=TRUE, it does not create the file toto-internal.Rd Why is that ? Christophe __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] randomForest outlier
I use a different dissimlarity measure (library(analogue);Gowers Index). I just wanted to look if there are similar values in both tables. I mainly try to find a way to find the best model to explain my predefined groups (using a bunch of different variables: factors,count,numeric, ordered factors) I am also fiddling around with a logistic regression. B. Am 16.07.2008 um 14:58 schrieb Liaw, Andy: Note that I did say by this measure: what you may want to consider as an outlier may not be what this measure picks out. After all, RF proximities are a bit unusual as a similarity measure. -Original Message- From: Birgit Lemcke [mailto:[EMAIL PROTECTED] Sent: Wednesday, July 16, 2008 8:55 AM To: Liaw, Andy Cc: R Hilfe Subject: Re: [R] randomForest outlier Thanks anyway for your answer. That was also an option that I took into account (no potential outliers) and I will have a look at the value section of ?outliers. B. Am 16.07.2008 um 14:11 schrieb Liaw, Andy: Perhaps if you follow the posting guide more closely, you might get more (useful) replies, but without looking at your data, I doubt there's much anyone can do for you. The fact that the range of the outlying measures is -1 to 2 would tell me there are no potential outliers by this measure. Please see the value section of ?outlier to see how this measure is computed. Andy From: Birgitle Still the same question: Birgitle wrote: I try to use ?randomForest to find variables that are the most important to divide my dataset (continuous, categorical variables) in two given groups. But when I plot the outlier: plot(outlier(rfObject, cls=groupingVariable), type=p,col=c(red,green)[as.numeric(groupingVariable)]) it seems to me that all my values appear as outliers. Has anybody suggestions what is going wrong in my analysis? Additonal remark The scaling of the y-axis is quite small between -1 and 2. - The art of living is more like wrestling than dancing. (Marcus Aurelius) -- View this message in context: http://www.nabble.com/randomForest-outlier-tp17979182p18466832.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu - direct contact information for affiliates is available at http://www.merck.com/contact/contacts.html) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. === Birgit Lemcke Institut of Systematic Botany University of Zurich Zollikerstrasse 107 CH-8008 Zürich Switzerland Ph: +41 (0)44 634 8351 mail: [EMAIL PROTECTED] === Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (One Merck Drive, Whitehouse Station, New Jersey, USA 08889), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD and in Japan, as Banyu - direct contact information for affiliates is available at http://www.merck.com/contact/contacts.html) that may be confidential, proprietary copyrighted and/or legally privileged. It is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please notify us immediately by reply e-mail and then delete it from your system. === Birgit Lemcke Institut of Systematic Botany University of Zurich Zollikerstrasse 107 CH-8008 Zürich Switzerland Ph: +41 (0)44 634 8351 mail: [EMAIL PROTECTED] === __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] NAMESPACE vs internal.Rd
G'day Christophe, On Wed, 16 Jul 2008 15:10:05 +0200 [EMAIL PROTECTED] wrote: Hi the list, When we use package.skeleton, it create some file in the man directorie. - If we use package.skeleton with namespace=FALSE, it create a file toto-internal.Rd - If we use package.skeleton with namespace=TRUE, it does not create the file toto-internal.Rd Why is that ? My understanding from my reading of Writing R Extension is : 1) All functions/objects of a package that a user can call/see have to be documented in order for the package passing R CMD check without warnings/errors. 2) Users can see all functions/objects in packages without a namespace, hence everything has to be documented. For functions that you do not want users to call directly, since they are help functions for the main functions of your package, you can just create entries in internal.Rd (or toto-internal.Rd) without writing a complete help page for these functions. R CMD check will accept this as documentation. 3) In packages with a namespace, you decide which function/objects the user can see by exporting them. Everything not exported is supposed to be internal to the package and should not be accessed directly by users (though they can via :::). Functions/objects that are not exported do not need to be documented, hence no need for the toto-internal.Rd stub. HTH (and HTIC). Cheers, Berwin === Full address = Berwin A TurlachTel.: +65 6516 4416 (secr) Dept of Statistics and Applied Probability+65 6516 6650 (self) Faculty of Science FAX : +65 6872 3919 National University of Singapore 6 Science Drive 2, Blk S16, Level 7 e-mail: [EMAIL PROTECTED] Singapore 117546http://www.stat.nus.edu.sg/~statba __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] NAMESPACE vs internal.Rd
Thanks, Berwin, So the main idea is - With NAMESPACE, you do not document the not-for-user because they don't have to be documented - Witout NAMESPACE, you document the not-for-user with a toto-internal.Rd that say not for user That's clear. Is it stupid to consider to use both technique at the same time ? - some fonction will be accessible (regular function) - some function will be hidden (function starting with .) - some function will be forbiden (function not in namespace) I am just asking as a beginner that try to understand how pacakge works, I do not say that it is a good way to do... Christophe G'day Christophe, On Wed, 16 Jul 2008 15:10:05 +0200 [EMAIL PROTECTED] wrote: Hi the list, When we use package.skeleton, it create some file in the man directorie. - If we use package.skeleton with namespace=FALSE, it create a file toto-internal.Rd - If we use package.skeleton with namespace=TRUE, it does not create the file toto-internal.Rd Why is that ? My understanding from my reading of Writing R Extension is : 1) All functions/objects of a package that a user can call/see have to be documented in order for the package passing R CMD check without warnings/errors. 2) Users can see all functions/objects in packages without a namespace, hence everything has to be documented. For functions that you do not want users to call directly, since they are help functions for the main functions of your package, you can just create entries in internal.Rd (or toto-internal.Rd) without writing a complete help page for these functions. R CMD check will accept this as documentation. 3) In packages with a namespace, you decide which function/objects the user can see by exporting them. Everything not exported is supposed to be internal to the package and should not be accessed directly by users (though they can via :::). Functions/objects that are not exported do not need to be documented, hence no need for the toto-internal.Rd stub. HTH (and HTIC). Cheers, Berwin === Full address = Berwin A TurlachTel.: +65 6516 4416 (secr) Dept of Statistics and Applied Probability+65 6516 6650 (self) Faculty of Science FAX : +65 6872 3919 National University of Singapore 6 Science Drive 2, Blk S16, Level 7 e-mail: [EMAIL PROTECTED] Singapore 117546http://www.stat.nus.edu.sg/~statba __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] extracting elements from print object of Manova()
Michael, If you mean Manova in the car package (or manova in stats), just use str() on the resulting object to see the slots. However, Manova() doesn't return F values, since these depend on the type of test statistic used for the multivariate test. library(car) ?Manova soils.mod - lm(cbind(pH,N,Dens,P,Ca,Mg,K,Na,Conduc) ~ Block + Contour*Depth, + data=Soils) man -Manova(soils.mod) str(man) List of 8 $ SSP :List of 4 ..$ Block: num [1:9, 1:9] 1.2325 -0.0466 0.2716 -62.6558 -0.6192 ... .. ..- attr(*, dimnames)=List of 2 .. .. ..$ : chr [1:9] pH N Dens P ... .. .. ..$ : chr [1:9] pH N Dens P ... ..$ Contour : num [1:9, 1:9] 0.2607 -0.0172 0.1002 23.9644 -1.5842 ... .. ..- attr(*, dimnames)=List of 2 .. .. ..$ : chr [1:9] pH N Dens P ... .. .. ..$ : chr [1:9] pH N Dens P ... ..$ Depth: num [1:9, 1:9] 14.961.45 -4.30 1703.12 74.47 ... .. ..- attr(*, dimnames)=List of 2 .. .. ..$ : chr [1:9] pH N Dens P ... .. .. ..$ : chr [1:9] pH N Dens P ... ..$ Contour:Depth: num [1:9, 1:9] 0.5159 0.0137 0.0457 -30.9419 1.5070 ... .. ..- attr(*, dimnames)=List of 2 .. .. ..$ : chr [1:9] pH N Dens P ... .. .. ..$ : chr [1:9] pH N Dens P ... $ SSPE: num [1:9, 1:9]4.247 -0.049 -0.201 -118.777 9.368 ... ..- attr(*, dimnames)=List of 2 .. ..$ : chr [1:9] pH N Dens P ... .. ..$ : chr [1:9] pH N Dens P ... $ df : Named num [1:4] 3 2 3 6 ..- attr(*, names)= chr [1:4] Block Contour Depth Contour:Depth $ error.df: int 33 $ terms : chr [1:4] Block Contour Depth Contour:Depth $ repeated: logi FALSE $ type: chr II $ test: chr Pillai - attr(*, class)= chr Anova.mlm Michael Rennie wrote: Hi there, Does anyone know how to extract elements from the table returned by Manova()? Using the univariate equivalent, Anova(), it's easy: a.an-Anova(lm(y~x1*x2)) a.an$F This will return a vector of the F-values in order of the terms of the model. However, a similar application using Manova(): m.an-Manova(lm(Y~x1~x2)) m.an$F Returns NULL. So does any attempt at calling the headers in the MANOVA table. Any thoughts? Mike -- Michael Friendly Email: friendly AT yorku DOT ca Professor, Psychology Dept. York University Voice: 416 736-5115 x66249 Fax: 416 736-5814 4700 Keele Streethttp://www.math.yorku.ca/SCS/friendly.html Toronto, ONT M3J 1P3 CANADA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] NAMESPACE vs internal.Rd
G'day Christophe, On Wed, 16 Jul 2008 16:11:15 +0200 [EMAIL PROTECTED] wrote: So the main idea is - With NAMESPACE, you do not document the not-for-user because they don't have to be documented - Witout NAMESPACE, you document the not-for-user with a toto-internal.Rd that say not for user That's clear. Is it stupid to consider to use both technique at the same time ? As far as I know, R will not complain if you write documentation for objects that you do not have to document. R CMD check will complain if an object accessible to a user of the package is not documented. A quick perusal of the packages installed on my machine shows that there are several packages that have a namesspace and a -internal file, e.g. the MASS package (from the VR bundle) and the sm package. But both these packages existed before the namespace mechanism was introduced. So the MASS-internal.Rd and sm-internal.Rd may be remainders from the time before namespaces were introduced. You would have to ask the maintainer(s) of such packages why they use a namespace and a -internal.Rd file. I can see no reason but a historical one that the -internal.Rd file stems from the time before namespaces and was not deleted after their introduction (I know that I wouldn't delete such a file if it weren't necessary). - some fonction will be accessible (regular function) - some function will be hidden (function starting with .) - some function will be forbiden (function not in namespace) We are actually talking objects (everything in R is an object) which could be anything, a function, a data frame or ... But if you want to keep the discussion restricted to functions then I would want to point out that functions that start with a . are only hidden from the ls() function and that this has nothing to do with a namespace. According to my understanding, if your package has a namespace, then everything that you do not export explicitly is not visible to users of your package. The Writing R Extensions manual has an example for an exportPattern() directive that exports all variables that do not start with a period, but that would export everything else. I guess writing a regular expression that says export everything that does not start with a dot but do not export foo and bar would be not trivial to write (at least not for me). And your distinction between hidden and forbidden functions is spurious because either function could be accessed via the ::: operator if the user knows that it is in the package (though not exported). Thus, if you use a namespace, then all the objects that you export are visible to the users of the package; all other objects are not visible (but can be accessed via :::). Objects that are not visible do not need to be documented (for R CMD check to succeed), but it is no error to document them. Objects that are visible to the users of the package have to be documented. HTH (and HTIC). Cheers, Berwin === Full address = Berwin A TurlachTel.: +65 6516 4416 (secr) Dept of Statistics and Applied Probability+65 6516 6650 (self) Faculty of Science FAX : +65 6872 3919 National University of Singapore 6 Science Drive 2, Blk S16, Level 7 e-mail: [EMAIL PROTECTED] Singapore 117546http://www.stat.nus.edu.sg/~statba __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Output design question
Dear R-helpers, I was curious why the output of summary (and many other functions in R) does not add a separator between the name of a factor and the label of a level (e.g., in the example below, 'group Trt'). If the user had lower case labels (e.g., 'trt'), the output would be particularly hard to read. ctl - c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt - c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group - gl(2,10,20, labels=c(Ctl,Trt)) weight - c(ctl, trt) summary(lm.D9 - lm(weight ~ group)) gives Call: lm(formula = weight ~ group) Residuals: Min 1Q Median 3Q Max -1.0710 -0.4938 0.0685 0.2462 1.3690 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 5.0320 0.2202 22.850 9.55e-15 *** groupTrt -0.3710 0.3114 -1.1910.249 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.6964 on 18 degrees of freedom Multiple R-squared: 0.07308,Adjusted R-squared: 0.02158 F-statistic: 1.419 on 1 and 18 DF, p-value: 0.249 Why notgroup Trt? _ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400Charlottesville, VA 22904-4400 Parcels:Room 102Gilmer Hall McCormick RoadCharlottesville, VA 22903 Office:B011+1-434-982-4729 Lab:B019+1-434-982-4751 Fax:+1-434-982-4766 WWW:http://www.people.virginia.edu/~mk9y/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Forecasting enrollments with fuzzy time series
Has anybody used fuzzy time series to forecast enrollments? I have some code that does not work so well. Thanks. Kate [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Help regarding arules package
Dear R experts,  I need help to make my little program efficient which now takes 2hrs to complete.  Using arules package I developed set of rules consisted of 900 rules. Now I want to check whether a lower rule is a subset of a higher premises rule. And if it is a subset of higher premises rule then drop this rule. I am using following code but it takes too much time.    nor-length(rules) k-rep(T, nor) for(i in 1:(nor-1)){      for(j in (i+1):nor){         if((is.subset(lhs(rules[i]),lhs(rules[j])) is.subset(rhs(rules[i]), rhs(rules[j])))==T){            k[i]-F            break         }     } }  Could somebody help me.  Thanks  Daniel Amsterdam  Send instant messages to your online friends http://uk.messenger.yahoo.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] negative P-values with shapiro.test
MC == Mark Cowley [EMAIL PROTECTED] on Wed, 16 Jul 2008 15:32:30 +1000 writes: MC Dear list, MC I am analysing a set of quantitative proteomics data MC from 16 patients which has a large numbers of missing MC data, thus some proteins are only detected once, upto a MC maximum of 16. I want to test each protein for MC normality by the Shapiro Wilk test (function MC shapiro.test in package stats), which can only be MC applied to data with at least 3 measurements, which is MC fine. In the case where I have only 3 observations, and MC two of those observations are identical, then the MC shapiro.test produces negative P-values, which should MC never happen. This occurs for all of the situations MC that I have tried for 3 values, where 2 are the same. Yes. Since all such tests are location- and scale-invariant, you can reproduce it with shapiro.test(c(0,0,1)) The irony is that the original papers by Roydon and the R help page all assert that the P-value for n = 3 is exact ! OTOH, the paper [Roydon (1982), Appl.Stat 31, p115-124] clearly states that X(1) X(2) X(3) ... X(n) i.e., does not allow ties (two equal values). If the exact formula in the paper were evaluated exactly (instead with a rounded value of about 6 digits), the exact P-value would be exactly 0. Now that would count as a bug in the paper I think. More about this tomorrow or so. Martin Maechler, ETH Zurich MC Reproducible code below: MC # these are the data points that raised the problem shapiro.test(c(-0.644, 0.0566, 0.0566)) MC Shapiro-Wilk normality test MC data: c(-0.644, 0.0566, 0.0566) MC W = 0.75, p-value 2.2e-16 shapiro.test(c(-0.644, 0.0566, 0.0566))$p.value MC [1] -7.69e-07 MC # note the verbose output shows a small, but positive P-value, but MC when you extract that P using $p.value, it becomes negative MC # various other tests shapiro.test(c(1,1,2))$p.value MC [1] -8.35e-07 shapiro.test(c(-1,-1,2))$p.value MC [1] -1.03e-06 MC cheers, MC Mark sessionInfo() MC R version 2.6.1 (2007-11-26) MC i386-apple-darwin8.10.1 MC locale: MC en_AU.UTF-8/en_AU.UTF-8/en_AU.UTF-8/C/en_AU.UTF-8/en_AU.UTF-8 MC attached base packages: MC [1] tcltk graphics grDevices datasets utils stats MC methods base MC other attached packages: MC [1] qvalue_1.12.0Cairo_1.3-5 RSvgDevice_0.6.3 MC SparseM_0.74 pwbc_0.1 MC [6] mjcdev_0.1 tigrmev_0.1 slfa_0.1 MC sage_0.1 qtlreaper_0.1 MC [11] pajek_0.1mjcstats_0.1 mjcspot_0.1 MC mjcgraphics_0.1 mjcaffy_0.1 MC [16] haselst_0.1 geomi_0.1geo_0.1 MC genomics_0.1 cor_0.1 MC [21] bootstrap_0.1blat_0.1 bitops_1.0-4 MC mjcbase_0.1 gdata_2.3.1 MC [26] gtools_2.4.0 MC - MC Mark Cowley, BSc (Bioinformatics)(Hons) MC Peter Wills Bioinformatics Centre MC Garvan Institute of Medical Research, Sydney, Australia MC __ MC R-help@r-project.org mailing list MC https://stat.ethz.ch/mailman/listinfo/r-help MC PLEASE do read the posting guide http://www.R-project.org/posting-guide.html MC and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Output design question
I don't know, but you can change it by: out_sum - summary(lm.D9 - lm(weight ~ group)) rownames(out_sum$coefficients)[2] - group Trt out_sum On Wed, Jul 16, 2008 at 12:51 PM, Michael Kubovy [EMAIL PROTECTED] wrote: Dear R-helpers, I was curious why the output of summary (and many other functions in R) does not add a separator between the name of a factor and the label of a level (e.g., in the example below, 'group Trt'). If the user had lower case labels (e.g., 'trt'), the output would be particularly hard to read. ctl - c(4.17,5.58,5.18,6.11,4.50,4.61,5.17,4.53,5.33,5.14) trt - c(4.81,4.17,4.41,3.59,5.87,3.83,6.03,4.89,4.32,4.69) group - gl(2,10,20, labels=c(Ctl,Trt)) weight - c(ctl, trt) summary(lm.D9 - lm(weight ~ group)) gives Call: lm(formula = weight ~ group) Residuals: Min 1Q Median 3Q Max -1.0710 -0.4938 0.0685 0.2462 1.3690 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) 5.0320 0.2202 22.850 9.55e-15 *** groupTrt -0.3710 0.3114 -1.1910.249 --- Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1 Residual standard error: 0.6964 on 18 degrees of freedom Multiple R-squared: 0.07308,Adjusted R-squared: 0.02158 F-statistic: 1.419 on 1 and 18 DF, p-value: 0.249 Why notgroup Trt? _ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400Charlottesville, VA 22904-4400 Parcels:Room 102Gilmer Hall McCormick RoadCharlottesville, VA 22903 Office:B011+1-434-982-4729 Lab:B019+1-434-982-4751 Fax:+1-434-982-4766 WWW:http://www.people.virginia.edu/~mk9y/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Likelihood ratio test between glm and glmer fits
Dear list, I am fitting a logistic multi-level regression model and need to test the difference between the ordinary logistic regression from a glm() fit and the mixed effects fit from glmer(), basically I want to do a likelihood ratio test between the two fits. The data are like this: My outcome is a (1,0) for health status, I have several (1,0) dummy variables RURAL, SMOKE, DRINK, EMPLOYED, highereduc, INDIG, male, divorced, SINGLE, chronic, vigor_d and moderat_d and AGE is continuous (20 to 100). My higher level is called munid and has 581 levels. The data have 45243 observations. Here are my program statements: #GLM fit ph.fit.2-glm(poorhealth~RURAL+SMOKE+DRINK+EMPLOYED+highereduc+INDIG+AGE+male+divorced+SINGLE+chronic+vigor_d+moderat_d,family=binomial(), data=mx.merge) #GLMER fit ph.fit.3-glmer(poorhealth~RURAL+SMOKE+DRINK+EMPLOYED+INSURANCE+highereduc+INDIG+AGE+male+divorced+SINGLE+chronic+vigor_d+moderat_d+(1|munid),family=binomial(), data=mx.merge) I cannot find a method in R that will do the LR test between a glm and a glmer fit, so I try to do it using the liklihoods from both models #form the likelihood ratio test between the glm and glmer fits x2--2*(logLik(ph.fit.2)-logLik(ph.fit.3)) ML 79.60454 attr(,nobs) n 45243 attr(,nall) n 45243 attr(,df) [1] 14 attr(,REML) [1] FALSE attr(,class) [1] logLik #Get the associated p-value dchisq(x2,14) ML 5.94849e-15 Which looks like an improvement in model fit to me. Am I seeing this correctly or are the two models even able to be compared? they are both estimated via maximum likelihood, so they should be, I think. Any help would be appreciated. Corey Corey S. Sparks, Ph.D. Assistant Professor Department of Demography and Organization Studies University of Texas San Antonio One UTSA Circle San Antonio, TX 78249 email:[EMAIL PROTECTED] web: https://rowdyspace.utsa.edu/users/ozd504/www/index.htm [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Problem with mpi.close.Rslaves()
I am running R 2.7.0 on a Suse 9.1 linux cluster with a job scheduler dispatching jobs and openmpi-1.0.1. I have tried running one of the examples at http://ace.acadiau.ca/math/ACMMaC/Rmpi/examples.html in Rmpi and they seem to be working, except mpi.close.Rslaves() hangs. The slaves are closed, but the master doesn't finish its script. Below is the example script and the call to R. The job is being run on a single 4 processor machine. Any suggestions? Also is Rmpi using rexec to communicate? Can it use ssh if it doesn't already? mpirun -np 4 -machinefile /var/spool/PBS/aux/90361.head /apps/R/R270/bin/R CMD BATCH --save Rmpi_test4.R # Initialize MPI library(Rmpi) # Function the slaves will call to perform a validation on the # fold equal to their slave number. # Assumes: thedata,fold,foldNumber,p foldslave - function() { # Note the use of the tag for sent messages: # 1=ready_for_task, 2=done_task, 3=exiting # Note the use of the tag for received messages: # 1=task, 2=done_tasks junk - 0 done - 0 while (done != 1) { # Signal being ready to receive a new task mpi.send.Robj(junk,0,1) # Receive a task task - mpi.recv.Robj(mpi.any.source(),mpi.any.tag()) task_info - mpi.get.sourcetag() tag - task_info[2] if (tag == 1) { foldNumber - task$foldNumber rss - double(p) for (i in 1:p) { # produce a linear model on the first i variables on # training data templm - lm(y~.,data=thedata[fold!=foldNumber,1:(i+1)]) # produce predicted data from test data yhat - predict(templm,newdata=thedata[fold==foldNumber,1:(i+1)]) # get rss of yhat-y localrssresult - sum((yhat-thedata[fold==foldNumber,1])^2) rss[i] - localrssresult } # Send a results message back to the master results - list(result=rss,foldNumber=foldNumber) mpi.send.Robj(results,0,2) } else if (tag == 2) { done - 1 } # We'll just ignore any unknown messages } mpi.send.Robj(junk,0,3) } # We're in the parent. # first make some data n - 1000 # number of obs p - 30 # number of variables # Create data as a set of n samples of p independent variables, # make a random beta with higher weights in the front. # Generate y's as y = beta*x + random x - matrix(rnorm(n*p),n,p) beta - c(rnorm(p/2,0,5),rnorm(p/2,0,.25)) y - x %*% beta + rnorm(n,0,20) thedata - data.frame(y=y,x=x) fold - rep(1:10,length=n) fold - sample(fold) summary(lm(y~x)) # Now, send the data to the slaves mpi.bcast.Robj2slave(thedata) mpi.bcast.Robj2slave(fold) mpi.bcast.Robj2slave(p) # Send the function to the slaves mpi.bcast.Robj2slave(foldslave) # Call the function in all the slaves to get them ready to # undertake tasks mpi.bcast.cmd(foldslave()) # Create task list tasks - vector('list') for (i in 1:10) { tasks[[i]] - list(foldNumber=i) } # Create data structure to store the results rssresult = matrix(0,p,10) junk - 0 closed_slaves - 0 n_slaves - mpi.comm.size()-1 while (closed_slaves n_slaves) { # Receive a message from a slave message - mpi.recv.Robj(mpi.any.source(),mpi.any.tag()) message_info - mpi.get.sourcetag() slave_id - message_info[1] tag - message_info[2] if (tag == 1) { # slave is ready for a task. Give it the next task, or tell it tasks # are done if there are none. if (length(tasks) 0) { # Send a task, and then remove it from the task list mpi.send.Robj(tasks[[1]], slave_id, 1); tasks[[1]] - NULL } else { mpi.send.Robj(junk, slave_id, 2) } } else if (tag == 2) { # The message contains results. Do something with the results. # Store them in the data structure foldNumber - message$foldNumber rssresult[,foldNumber] - message$result } else if (tag == 3) { # A slave has closed down. closed_slaves - closed_slaves + 1 } } # plot the results plot(apply(rssresult,1,mean)) mpi.close.Rslaves() mpi.exit() Mark Lyman, Statistician ATK Launch Systems [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] (435) 863-2863 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] NAMESPACE vs internal.Rd
Thanks for your answer. I guess writing a regular expression that says export everything that does not start with a dot but do not export foo and bar would be not trivial to write (at least not for me). The NAMESPACE created by package.skeleton contain a single line : exportPattern(^[[:alpha:]]+) I guess that it is what you just say... Christophe __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] date to decimal date conversion
Hello R Users, I want to convert date (yr, mo, day, hr, min, sec) to decimal date, for example: Date (in six columns): yr mo dy hr minsec 1993 02 13 05 52 00 Converted to Decimal date : 1993.3542 How to write a small code in R so I can convert six column date to decimal date Many thanks, Yogesh -- Yogesh K. Tiwari (Dr.rer.nat), Scientist, Indian Institute of Tropical Meteorology, Homi Bhabha Road, Pashan, Pune-411008 INDIA [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Confidence bands for model estimates using ns() spline basis
Hi, I am using ns() to model the effect of time on some outcome y [ specifically, I am using polr() in a model of the form mod1=polr(y~x1+x2*ns(Year,df=3),...) , with x1 and x2 denoting several covariates each ] I understand how to use the spline basis as recorded in the model matrix in order to reproduce the model fit and to generate curves of the point estimates of the time effect, including its interactions with other covariates. My question is about confidence bands. So far, I tried to calculate these in a straightforward manner using the coefficients' estimated covariance matrix. [ e.g., Var (a+b) = Var(a) + Var(b) + 2Cov(a,b) ] Common sense suggests that the bands will be narrowest in the middle of the time period studied and widening towards the edges. However, the model fit seems to default to zero time-effect errors at the start of the period, gradually widening as time progresses - which is not supported by the data (in my case the data are almost evenly distributed across time by design). In my application the time effect is of major importance and not a nuisance variable, so it is crucial for me to get this right. I tried to add an intercept to the ns() function, but this appears to interfere with the model's intercept estimate and generates errors. Any suggestions welcome... Thanks in advance, Assaf Oron [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Help with rpart.predict?
Hi all, I am trying to use rpart.predict to test rpart models built with both numeric and character variables. The rpart trees appear to come out fine, but then when I try to use the rpart model to predict on a different dataset (same variables) I get error messages that claim the character variables are no good: Warning messages: 1: In model.frame.default(Terms, newdata, na.action = na.action, xlev = attr(object, : variable 'L3' is not a factor 2: In model.frame.default(Terms, newdata, na.action = na.action, xlev = attr(object, : variable 'Range' is not a factor When I build the original rpart models without these variables rpart.predict will work fine. Example of the R code I'm using: OVENrpart.pa - rpart(OVENsites ~ L3 + BAavg + DBH + CACL + CanDecid + CanRich + CanDiv + SubcanCov + SubcanDecid + SubcanRich + SubcanDiv + Size + UpLow + Plantation + Range, data = sites1pabuild) OVEN.pa - predict(OVENrpart.pa, newdata = sites1patest) L3, Plantation, and Range are all character variables, the rest are numeric. Thanks! Jay [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] barchart with bars attached to y=0-line
On 7/16/08, Henning Wildhagen [EMAIL PROTECTED] wrote: Dear R users, i am using the following code to produce barcharts with lattice: Compound-c(Glutamine, Arginine, Glutamate, Glycine, Serine, Glucose, Fructose, Raffinose, Glycerol, Galacglycerol, Threitol, Galactinol, Galactitol) Class-c(aminos,aminos,aminos,aminos,aminos,sugars,sugars,sugars,glycerols,glycerols,sugar alcohols,sugar alcohols,sugar alcohols) set.seed(5) Ratio-rnorm(13, 0.5, 3) df-data.frame(Compound, Class,Ratio) library(lattice) P-barchart(data=df,Ratio~Compound|Class) However, I would like to have the bars attached to an imaginary y=0-line so that they go up if Ratio0 and down if Ratio0. I saw some older entries in the mailing list supposing to use panel.barchart. However, I did not fully understand the usage of this function. Also, it was annouced to add an option to barchart to make it easier to get this type of plot. Has anyone an idea what the easiest solution might be? barchart(data=df,Ratio~Compound|Class, origin = 0) A second problem is concerning the display of the Compound-objects in accordance with the conditioning variable Class. In other words: Is it possible to use the whole space of each panel for only those Compound-objects which belong to the Class displayed in that particular panel? Of course, for this purpose the panels have to be detached to allow appropiate labling of the x-axis. barchart(data=df,Ratio~Compound|Class, origin = 0, scales = list(x = free)) But this would work better if the levels of Compound are adjacent within Class; e.g. barchart(data=df,Ratio~reorder(Compound, as.numeric(Class))|Class, origin = 0, scales = list(x = free)) -Deepayan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] date to decimal date conversion
Its not clear from your post what the decimal portion is supposed to represent since Feb is not 35% of the way through the year but in any case see R News 4/1 and the full page table at the end of that article, in particular, for some date idioms that you can use. On Wed, Jul 16, 2008 at 7:41 AM, Yogesh Tiwari [EMAIL PROTECTED] wrote: Hello R Users, I want to convert date (yr, mo, day, hr, min, sec) to decimal date, for example: Date (in six columns): yr mo dy hr minsec 1993 02 13 05 52 00 Converted to Decimal date : 1993.3542 How to write a small code in R so I can convert six column date to decimal date Many thanks, Yogesh -- Yogesh K. Tiwari (Dr.rer.nat), Scientist, Indian Institute of Tropical Meteorology, Homi Bhabha Road, Pashan, Pune-411008 INDIA [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Likelihood ratio test between glm and glmer fits
well, for computing the p-value you need to use pchisq() and dchisq() (check ?dchisq for more info). For model fits with a logLik method you can directly use the following simple function: lrt - function (obj1, obj2) { L0 - logLik(obj1) L1 - logLik(obj2) L01 - as.vector(- 2 * (L0 - L1)) df - attr(L1, df) - attr(L0, df) list(L01 = L01, df = df, p-value = pchisq(L01, df, lower.tail = FALSE)) } library(lme4) gm0 - glm(cbind(incidence, size - incidence) ~ period, family = binomial, data = cbpp) gm1 - glmer(cbind(incidence, size - incidence) ~ period + (1 | herd), family = binomial, data = cbpp) lrt(gm0, gm1) However, there are some issues regarding this likelihood ratio test. 1) The null hypothesis is on the boundary of the parameter space, i.e., you test whether the variance for the random effect is zero. For this case the assumed chi-squared distribution for the LRT may *not* be totally appropriate and may produce conservative p-values. There is some theory regarding this issue, which has shown that the reference distribution for the LRT in this case is a mixture of a chi-squared(df = 0) and chi-squared(df = 1). Another option is to use simulation-based approach where you can approximate the reference distribution of the LRT under the null using simulation. You may check below for an illustration of this procedure (not-tested): X - model.matrix(gm0) coefs - coef(gm0) pr - plogis(c(X %*% coefs)) n - length(pr) new.dat - cbpp Tobs - lrt(gm0, gm1)$L01 B - 200 out.T - numeric(B) for (b in 1:B) { y - rbinom(n, cbpp$size, pr) new.dat$incidence - y fit0 - glm(formula(gm0), family = binomial, data = new.dat) fit1 - glmer(formula(gm1), family = binomial, data = new.dat) out.T[b] - lrt(fit0, fit1)$L01 } # estimate p-value (sum(out.T = Tobs) + 1) / (B + 1) 2) For the glmer fit you have to note that you work with an approximation to the log-likelihood (obtained using numerical integration) and not the actual log-likelihood. I hope it helps. Best, Dimitris Dimitris Rizopoulos Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm Quoting COREY SPARKS [EMAIL PROTECTED]: Dear list, I am fitting a logistic multi-level regression model and need to test the difference between the ordinary logistic regression from a glm() fit and the mixed effects fit from glmer(), basically I want to do a likelihood ratio test between the two fits. The data are like this: My outcome is a (1,0) for health status, I have several (1,0) dummy variables RURAL, SMOKE, DRINK, EMPLOYED, highereduc, INDIG, male, divorced, SINGLE, chronic, vigor_d and moderat_d and AGE is continuous (20 to 100). My higher level is called munid and has 581 levels. The data have 45243 observations. Here are my program statements: #GLM fit ph.fit.2-glm(poorhealth~RURAL+SMOKE+DRINK+EMPLOYED+highereduc+INDIG+AGE+male+divorced+SINGLE+chronic+vigor_d+moderat_d,family=binomial(), data=mx.merge) #GLMER fit ph.fit.3-glmer(poorhealth~RURAL+SMOKE+DRINK+EMPLOYED+INSURANCE+highereduc+INDIG+AGE+male+divorced+SINGLE+chronic+vigor_d+moderat_d+(1|munid),family=binomial(), data=mx.merge) I cannot find a method in R that will do the LR test between a glm and a glmer fit, so I try to do it using the liklihoods from both models #form the likelihood ratio test between the glm and glmer fits x2--2*(logLik(ph.fit.2)-logLik(ph.fit.3)) ML 79.60454 attr(,nobs) n 45243 attr(,nall) n 45243 attr(,df) [1] 14 attr(,REML) [1] FALSE attr(,class) [1] logLik #Get the associated p-value dchisq(x2,14) ML 5.94849e-15 Which looks like an improvement in model fit to me. Am I seeing this correctly or are the two models even able to be compared? they are both estimated via maximum likelihood, so they should be, I think. Any help would be appreciated. Corey Corey S. Sparks, Ph.D. Assistant Professor Department of Demography and Organization Studies University of Texas San Antonio One UTSA Circle San Antonio, TX 78249 email:[EMAIL PROTECTED] web: https://rowdyspace.utsa.edu/users/ozd504/www/index.htm [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal,
Re: [R] aov error with large data set
Mike Lawrence wrote: I'm looking to analyze a large data set: a within-Ss 2*2*1500 design with 20 Ss. However, aov() gives me an error, reproducible as follows: id = factor(1:20) a = factor(1:2) b = factor(1:2) d = factor(1:1500) temp = expand.grid(id=id, a=a, b=b, d=d) temp$y = rnorm(length(temp[, 1])) #generate some random DV data this_aov = aov( y~a*b*d+Error(id/(a*b*d)) , data=temp ) While yields the following error: Error in model.matrix.default(mt, mf, contrasts) : allocMatrix: too many elements specified Any suggestions? This is an inherent weakness of aov(), or at least the current implementation thereof. You end up fitting a set of linear models with a huge number of parameters, in order to get the separation into strata. The column dimensions of the design matrices are the number of random effects, and if you have 6 of those, you run out of storage. (As written, you even have 12=20*2*2*1500 for the id*a*b*d term, but removing it isn't really going to help.) (30 years ago, a much more efficient algorithm was implemented in Genstat, but we seem to be short of volunteers to reimplement it...) Ideas? Here are three: lme4 should be able to handle such designs. It won't get the df for the F tests, but you could work them out by hand. or, you could try recasting as a multivariate lm problem (see my recent R News paper). This is still pretty huge, but this time the limiting quantity is the 6000*6000 empirical covariance matrix, which could be manageable. or, the most efficient way, but much more work for you: Generate the relevant tables of means and residuals; e.g. by placing your date in a 20*2*2*1500 table and using the relevant combinations of apply() and sweep(). These can be used to generate the relevant sums of squares. Mike -- Mike Lawrence Graduate Student, Department of Psychology, Dalhousie University www.memetic.ca The road to wisdom? Well, it's plain and simple to express: Err and err and err again, but less and less and less. - Piet Hein Problems worthy of attack, prove their worth by hitting back - Piet Hein -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] gstat problem with lidar data
Hey, I am a PhD student in forestry science, and I am a brand new in R. I am working with lidar data (cloud points with X, Y and Z value). I wish to create a spatial map with kriging form points cloud. My problem is the Big data-set (over 5,000,000.00 points) and I always went out of memory. Is there a script to create un subset or modify the radius of variogram? Thanks Ale [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Mapping data onto score
I am trying to apply the solution you mentioned to all columns in a matrix, and output the results to another matrix and append the two using the cbind function. I have written something that works, using a nested For loop to go through all the cells in the target matrix, but the trouble is that the process takes a while to run (3-4 mins). The matrix is large, about 2000 by 1, so this could be a reason for the slow speed. However, I'm convinced there is a faster way of applying this mapping procedure to all columns in a matrix and outoutting into columns in a separate matrix. I would be grateful for any suggestions on this slight modification. Otherwise, I can make do with my version. Thanks, rcoder rcoder wrote: Thank you Ben! This is very clear. rcoder Ben Tupper wrote: On Jul 15, 2008, at 5:16 PM, rcoder wrote: Hi Ben, Yes, this is more or less what I want to do. I want to apply this data in columns in a matrix, and insert the results to additional columns. I am not entirely aware of a good way of doing this. e.g. take data from column B, apply normalisation, and feed output into column C Oh, I think you want to use cbind() to add columns to a matrix. Perhaps like this which works with the second column... v - matrix(data = rnorm(100), nrow = 10, ncol = 10) mm - range(v[,2]) s - 10 * (v[,2]-mm[1])/(mm[2]-mm[1]) v2 - cbind(v, s) Cheers, Ben Thanks, rcoder Ben Tupper wrote: On Jul 15, 2008, at 8:16 AM, rcoder wrote: Hi everyone, I want to score a set of data (-ve to +ve) using a 0-10 scale. I have the data in an R matrix, so I need to add another column, containing the scores and resave. Hi, I am a little fuzzy on what you are asking, but my guess is that you want to normalize the data into the 0-1 range then multiply by 10. values - rnorm(10) #some numbers mm - range(values) #the minmax range scaled - (values-mm[1])/(mm[2]-mm[1]) #normalize into 0-1 scaled10 - 10 * scaled #scale 0-10 Is that what you seek? Ben __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Mapping-data- onto-score-tp18463695p18475083.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. Ben Tupper [EMAIL PROTECTED] I GoodSearch for Ashwood Waldorf School. Raise money for your favorite charity or school just by searching the Internet with GoodSearch - www.goodsearch.com - powered by Yahoo! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Mapping-data-onto-score-tp18463695p18494272.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Mapping data onto score
Here's my code: nc-ncol(mat) #setting end point in counter to number of cols in sm nr-nrow(mat) mm - array(NA, dim=c(2, nc)) #to hold min/max ranges sc - array(NA, dim=c(nr, nc)) #to hold percentile scales for (n in 1:nc) { #now calculate respective ranges for data matrix mm[,n]-range(mat[,n],na.rm=T) #inserts min/max values into sc matrix for (m in 1:nr) { sc[m,n]-100*(mat[m,n]-mm[1,n])/(mm[2,n]-mm[1,n]) #re-scaling onto percentile ranking } } rcoder rcoder wrote: I am trying to apply the solution you mentioned to all columns in a matrix, and output the results to another matrix and append the two using the cbind function. I have written something that works, using a nested For loop to go through all the cells in the target matrix, but the trouble is that the process takes a while to run (3-4 mins). The matrix is large, about 2000 by 1, so this could be a reason for the slow speed. However, I'm convinced there is a faster way of applying this mapping procedure to all columns in a matrix and outoutting into columns in a separate matrix. I would be grateful for any suggestions on this slight modification. Otherwise, I can make do with my version. Thanks, rcoder rcoder wrote: Thank you Ben! This is very clear. rcoder Ben Tupper wrote: On Jul 15, 2008, at 5:16 PM, rcoder wrote: Hi Ben, Yes, this is more or less what I want to do. I want to apply this data in columns in a matrix, and insert the results to additional columns. I am not entirely aware of a good way of doing this. e.g. take data from column B, apply normalisation, and feed output into column C Oh, I think you want to use cbind() to add columns to a matrix. Perhaps like this which works with the second column... v - matrix(data = rnorm(100), nrow = 10, ncol = 10) mm - range(v[,2]) s - 10 * (v[,2]-mm[1])/(mm[2]-mm[1]) v2 - cbind(v, s) Cheers, Ben Thanks, rcoder Ben Tupper wrote: On Jul 15, 2008, at 8:16 AM, rcoder wrote: Hi everyone, I want to score a set of data (-ve to +ve) using a 0-10 scale. I have the data in an R matrix, so I need to add another column, containing the scores and resave. Hi, I am a little fuzzy on what you are asking, but my guess is that you want to normalize the data into the 0-1 range then multiply by 10. values - rnorm(10) #some numbers mm - range(values) #the minmax range scaled - (values-mm[1])/(mm[2]-mm[1]) #normalize into 0-1 scaled10 - 10 * scaled #scale 0-10 Is that what you seek? Ben __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Mapping-data- onto-score-tp18463695p18475083.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. Ben Tupper [EMAIL PROTECTED] I GoodSearch for Ashwood Waldorf School. Raise money for your favorite charity or school just by searching the Internet with GoodSearch - www.goodsearch.com - powered by Yahoo! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Mapping-data-onto-score-tp18463695p18494357.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Mapping data onto score
Try this and see how fast it runs: # x is your input matrix that will be processed by column # y is the scaled output matrix y - t(apply(x, 2, function(.col){ .rang - range(.col) (.col - .rang[1]) / (.rang[2] - .rang[1]) * 100 })) On Wed, Jul 16, 2008 at 3:01 PM, rcoder [EMAIL PROTECTED] wrote: Here's my code: nc-ncol(mat) #setting end point in counter to number of cols in sm nr-nrow(mat) mm - array(NA, dim=c(2, nc)) #to hold min/max ranges sc - array(NA, dim=c(nr, nc)) #to hold percentile scales for (n in 1:nc) { #now calculate respective ranges for data matrix mm[,n]-range(mat[,n],na.rm=T) #inserts min/max values into sc matrix for (m in 1:nr) { sc[m,n]-100*(mat[m,n]-mm[1,n])/(mm[2,n]-mm[1,n]) #re-scaling onto percentile ranking } } rcoder rcoder wrote: I am trying to apply the solution you mentioned to all columns in a matrix, and output the results to another matrix and append the two using the cbind function. I have written something that works, using a nested For loop to go through all the cells in the target matrix, but the trouble is that the process takes a while to run (3-4 mins). The matrix is large, about 2000 by 1, so this could be a reason for the slow speed. However, I'm convinced there is a faster way of applying this mapping procedure to all columns in a matrix and outoutting into columns in a separate matrix. I would be grateful for any suggestions on this slight modification. Otherwise, I can make do with my version. Thanks, rcoder rcoder wrote: Thank you Ben! This is very clear. rcoder Ben Tupper wrote: On Jul 15, 2008, at 5:16 PM, rcoder wrote: Hi Ben, Yes, this is more or less what I want to do. I want to apply this data in columns in a matrix, and insert the results to additional columns. I am not entirely aware of a good way of doing this. e.g. take data from column B, apply normalisation, and feed output into column C Oh, I think you want to use cbind() to add columns to a matrix. Perhaps like this which works with the second column... v - matrix(data = rnorm(100), nrow = 10, ncol = 10) mm - range(v[,2]) s - 10 * (v[,2]-mm[1])/(mm[2]-mm[1]) v2 - cbind(v, s) Cheers, Ben Thanks, rcoder Ben Tupper wrote: On Jul 15, 2008, at 8:16 AM, rcoder wrote: Hi everyone, I want to score a set of data (-ve to +ve) using a 0-10 scale. I have the data in an R matrix, so I need to add another column, containing the scores and resave. Hi, I am a little fuzzy on what you are asking, but my guess is that you want to normalize the data into the 0-1 range then multiply by 10. values - rnorm(10) #some numbers mm - range(values) #the minmax range scaled - (values-mm[1])/(mm[2]-mm[1]) #normalize into 0-1 scaled10 - 10 * scaled #scale 0-10 Is that what you seek? Ben __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Mapping-data- onto-score-tp18463695p18475083.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. Ben Tupper [EMAIL PROTECTED] I GoodSearch for Ashwood Waldorf School. Raise money for your favorite charity or school just by searching the Internet with GoodSearch - www.goodsearch.com - powered by Yahoo! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Mapping-data-onto-score-tp18463695p18494357.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Mapping data onto score
?scale -- Bert Gunter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of jim holtman Sent: Wednesday, July 16, 2008 12:14 PM To: rcoder Cc: r-help@r-project.org Subject: Re: [R] Mapping data onto score Try this and see how fast it runs: # x is your input matrix that will be processed by column # y is the scaled output matrix y - t(apply(x, 2, function(.col){ .rang - range(.col) (.col - .rang[1]) / (.rang[2] - .rang[1]) * 100 })) On Wed, Jul 16, 2008 at 3:01 PM, rcoder [EMAIL PROTECTED] wrote: Here's my code: nc-ncol(mat) #setting end point in counter to number of cols in sm nr-nrow(mat) mm - array(NA, dim=c(2, nc)) #to hold min/max ranges sc - array(NA, dim=c(nr, nc)) #to hold percentile scales for (n in 1:nc) { #now calculate respective ranges for data matrix mm[,n]-range(mat[,n],na.rm=T) #inserts min/max values into sc matrix for (m in 1:nr) { sc[m,n]-100*(mat[m,n]-mm[1,n])/(mm[2,n]-mm[1,n]) #re-scaling onto percentile ranking } } rcoder rcoder wrote: I am trying to apply the solution you mentioned to all columns in a matrix, and output the results to another matrix and append the two using the cbind function. I have written something that works, using a nested For loop to go through all the cells in the target matrix, but the trouble is that the process takes a while to run (3-4 mins). The matrix is large, about 2000 by 1, so this could be a reason for the slow speed. However, I'm convinced there is a faster way of applying this mapping procedure to all columns in a matrix and outoutting into columns in a separate matrix. I would be grateful for any suggestions on this slight modification. Otherwise, I can make do with my version. Thanks, rcoder rcoder wrote: Thank you Ben! This is very clear. rcoder Ben Tupper wrote: On Jul 15, 2008, at 5:16 PM, rcoder wrote: Hi Ben, Yes, this is more or less what I want to do. I want to apply this data in columns in a matrix, and insert the results to additional columns. I am not entirely aware of a good way of doing this. e.g. take data from column B, apply normalisation, and feed output into column C Oh, I think you want to use cbind() to add columns to a matrix. Perhaps like this which works with the second column... v - matrix(data = rnorm(100), nrow = 10, ncol = 10) mm - range(v[,2]) s - 10 * (v[,2]-mm[1])/(mm[2]-mm[1]) v2 - cbind(v, s) Cheers, Ben Thanks, rcoder Ben Tupper wrote: On Jul 15, 2008, at 8:16 AM, rcoder wrote: Hi everyone, I want to score a set of data (-ve to +ve) using a 0-10 scale. I have the data in an R matrix, so I need to add another column, containing the scores and resave. Hi, I am a little fuzzy on what you are asking, but my guess is that you want to normalize the data into the 0-1 range then multiply by 10. values - rnorm(10) #some numbers mm - range(values) #the minmax range scaled - (values-mm[1])/(mm[2]-mm[1]) #normalize into 0-1 scaled10 - 10 * scaled #scale 0-10 Is that what you seek? Ben __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Mapping-data- onto-score-tp18463695p18475083.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. Ben Tupper [EMAIL PROTECTED] I GoodSearch for Ashwood Waldorf School. Raise money for your favorite charity or school just by searching the Internet with GoodSearch - www.goodsearch.com - powered by Yahoo! __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Mapping-data-onto-score-tp18463695p18494357.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve?
[R] RSQLite maximum table size
Hi All, I am trying to make write a table in RSQLite. And I get the error mentioned below mat-as.data.frame(matrix(rnorm(n=24400),nrow=244000,ncol=1000)) dbWriteTable(con, array, mat) [1] FALSE *Warning message: In value[[3]](cond) : RS-DBI driver: (error in statement: too many SQL variables)* Can someone please tell me what is maximum size of a table( max number of rows and cols) we can have in RSQLite and how big the database can grow Thank you Regards Vidhu [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Labelling curves on graphs
Hi Folks, I'd be grateful for good suggestions about the following. I'm plotting a family of (X,Y) curves (for different levels of another variable, Z): say 6 curves in all but could be more or less -- it's a rather variables situation. I'd like to label each curve with the value of Z that it corresponds to. The problem is that the layout (shapes, spacings, ranges of X over which non-NA values of Y get plotted) of the curves are very variable, and somewhat unpredictable beforehand. Of course one could simply wait until the graph was done, and then by hand position one's labels to the best effect. That, given time, is on a certain sense the optimum solution. But I'd like to be able to do a satisfactory job automatically, and quickly! This is the sort of problem already solved, in one particular way, in contour(). But here the curves are broken at the labels and the labels are centred on the curves (though nicely aligned with the curves). It might be satisfactory for me to place each label so that its baseline is on its curve, thus without overlaying the curve with the text. So maybe a displaced analogue of the way contour() does it (including alignment of the text) may be OK. Anothe possibility, for instance, is to draw lines from the ends of the curves to antries in a plotted table of Z-values. This could end up looking very untidym, though. I grant that this is a vague query. I'm still trying to form a clear view of how it ought to be approached; and I don't have R code to refer to and experiment with (that of contour() is hidden in its method). But people out there must have faced it, and I'd be grateful for their own feedback from the coal-face! With thanks, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 16-Jul-08 Time: 21:17:13 -- XFMail -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] RSQLite maximum table size
It depends on what the values for certain variables were set to when it was compiled. See: http://www.sqlite.org/limits.html On Wed, Jul 16, 2008 at 4:14 PM, Vidhu Choudhary [EMAIL PROTECTED] wrote: Hi All, I am trying to make write a table in RSQLite. And I get the error mentioned below mat-as.data.frame(matrix(rnorm(n=24400),nrow=244000,ncol=1000)) dbWriteTable(con, array, mat) [1] FALSE *Warning message: In value[[3]](cond) : RS-DBI driver: (error in statement: too many SQL variables)* Can someone please tell me what is maximum size of a table( max number of rows and cols) we can have in RSQLite and how big the database can grow Thank you Regards Vidhu [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help with bivariate density plot question
Hi Spencer, I have seen your name on the web site, and perhaps you can help me with my R problem. I'm trying to use KernSur to put in evidence a substructure in a bidimensional plot. My problem is that, in order to get the density in the low density areas (in which the substructure is located) I should use different bandwidths. How I can do that? Also, I think that the best choice for my case is to use the function akerdmul which perform the multivariate adaptive kernel density distribution. Are you familiar with this function? Any help would be really appreciated. Thank you very much! Regards, Daniela __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Labelling curves on graphs
Dr. Harrell's Hmisc package has labcurve. --Matt -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ted Harding Sent: Wednesday, July 16, 2008 1:17 PM To: [EMAIL PROTECTED] Subject: [R] Labelling curves on graphs Hi Folks, I'd be grateful for good suggestions about the following. I'm plotting a family of (X,Y) curves (for different levels of another variable, Z): say 6 curves in all but could be more or less -- it's a rather variables situation. I'd like to label each curve with the value of Z that it corresponds to. The problem is that the layout (shapes, spacings, ranges of X over which non-NA values of Y get plotted) of the curves are very variable, and somewhat unpredictable beforehand. Of course one could simply wait until the graph was done, and then by hand position one's labels to the best effect. That, given time, is on a certain sense the optimum solution. But I'd like to be able to do a satisfactory job automatically, and quickly! This is the sort of problem already solved, in one particular way, in contour(). But here the curves are broken at the labels and the labels are centred on the curves (though nicely aligned with the curves). It might be satisfactory for me to place each label so that its baseline is on its curve, thus without overlaying the curve with the text. So maybe a displaced analogue of the way contour() does it (including alignment of the text) may be OK. Anothe possibility, for instance, is to draw lines from the ends of the curves to antries in a plotted table of Z-values. This could end up looking very untidym, though. I grant that this is a vague query. I'm still trying to form a clear view of how it ought to be approached; and I don't have R code to refer to and experiment with (that of contour() is hidden in its method). But people out there must have faced it, and I'd be grateful for their own feedback from the coal-face! With thanks, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 16-Jul-08 Time: 21:17:13 -- XFMail -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Labelling curves on graphs
Many thanks, Matt. for pointing that out. It certainly looks very promising -- but also there is an awful lot to study! [Pause, while I head for the coffee-maker] Ted. On 16-Jul-08 20:31:44, Austin, Matt wrote: Dr. Harrell's Hmisc package has labcurve. --Matt -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ted Harding Sent: Wednesday, July 16, 2008 1:17 PM To: [EMAIL PROTECTED] Subject: [R] Labelling curves on graphs Hi Folks, I'd be grateful for good suggestions about the following. I'm plotting a family of (X,Y) curves (for different levels of another variable, Z): say 6 curves in all but could be more or less -- it's a rather variables situation. I'd like to label each curve with the value of Z that it corresponds to. The problem is that the layout (shapes, spacings, ranges of X over which non-NA values of Y get plotted) of the curves are very variable, and somewhat unpredictable beforehand. Of course one could simply wait until the graph was done, and then by hand position one's labels to the best effect. That, given time, is on a certain sense the optimum solution. But I'd like to be able to do a satisfactory job automatically, and quickly! This is the sort of problem already solved, in one particular way, in contour(). But here the curves are broken at the labels and the labels are centred on the curves (though nicely aligned with the curves). It might be satisfactory for me to place each label so that its baseline is on its curve, thus without overlaying the curve with the text. So maybe a displaced analogue of the way contour() does it (including alignment of the text) may be OK. Anothe possibility, for instance, is to draw lines from the ends of the curves to antries in a plotted table of Z-values. This could end up looking very untidym, though. I grant that this is a vague query. I'm still trying to form a clear view of how it ought to be approached; and I don't have R code to refer to and experiment with (that of contour() is hidden in its method). But people out there must have faced it, and I'd be grateful for their own feedback from the coal-face! With thanks, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 16-Jul-08 Time: 21:17:13 -- XFMail -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 16-Jul-08 Time: 22:03:45 -- XFMail -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R: gstat problem with lidar data
On Wednesday 16 July 2008, Alessandro wrote: Hey Dylan, Thank you. I wish to test for my PhD: TIN (ok, with Arcmap), IDW (ok, with Arcmap) and kriging model (and other if it is possible) to create DSM and DEM, and DCM (DSM-DEM). I tried with gstat in IDRISI, but my PC outs of memory. I wish improve in R the gstat to develop map surface (in grid format for idrisi or arcmap). Unfortunately I have the same problem in R (out of memory), because the dataset is big. Therefore I wish create a random sub sampling set by 5000,000.00 over points. I show you my code (sorry I am a brand new in R) Data type (in *.txt format) X y X ... ... ... ... testground - read.table (file=c:/work_LIDAR_USA/R_kriging/ground26841492694149.txt, header=T, sep= ) summary (testground) plot(testground[,1],testground[,2]) library (sp) class (testground) coordinates (testground)=~X+Y library (gstat) class (testground) V - variogram(z~1, testground) When I arrive in this step appear out of memory If do you help me, it's a very pleasure because I stopped my work. Ale Hi Ale. Please remember to CC the list next time. Since R is memory-bound (for the most part), you should be summarizing your data first, then loading into R. If you can install GRASS, I would highly recommend using the r.in.xyz command to pre-grid your data to a reasonable cell size, such that the resulting raster will fit into memory. If you cannot, and can somehow manage to get the raw data into R, sampling random rows would work. # make some data: x - 1:10 # just some of the data sample(x, 100) # use this idea to extract x,y,z triplets # from some fake data: d - data.frame(x=rnorm(100), y=rnorm(100), z=rnorm(100)) # select 10 random rows: rand_rows - sample(1:nrow(d), 10) # just the selected rows: d.small - d[rand_rows, ] keep in mind you will need enough memory to contain the original data AND your subset data. trash the original data once you have the subset data with rm(). As for the statistical implications of randomly sampling a point cloud for variogram analysis-- someone smarter than I may be helpful. Cheers, Dylan -Messaggio originale- Da: Dylan Beaudette [mailto:[EMAIL PROTECTED] Inviato: mercoledì 16 luglio 2008 12.45 A: r-help@r-project.org Cc: Alessandro Oggetto: Re: [R] gstat problem with lidar data On Wednesday 16 July 2008, Alessandro wrote: Hey, I am a PhD student in forestry science, and I am a brand new in R. I am working with lidar data (cloud points with X, Y and Z value). I wish to create a spatial map with kriging form points cloud. My problem is the Big data-set (over 5,000,000.00 points) and I always went out of memory. Is there a script to create un subset or modify the radius of variogram? Do you have any reason to prefer kriging over some other, less intensive method such as RST (regularized splines with tension)? Check out GRASS or GMT for ideas on how to grid such a massive point set. Specifically the r.in.xyz and v.surf.rst modules from GRASS. Cheers, -- Dylan Beaudette Soil Resource Laboratory http://casoilresource.lawr.ucdavis.edu/ University of California at Davis 530.754.7341 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R logo
I don't know the origin of the logo, but as far as I remember, the current version of the logo has been manually redrawn from the original on photoshop to increase resolution. stefano On 16/lug/08, at 10:50, [EMAIL PROTECTED] wrote: The R Logo was done manually (using software) in several phases IIRC. Well, that's not a surprise. Let me rephrase my question : is the logo drawer still on this list ? Did you use gimp ? A specific filter ? or a scriptfu ? Christophe __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] spectral decomposition for near-singular pd matrices
Hi, I have a matrix M, quite a few ( 1/4th) of its eigen values are of O(10^-16). Analytically I know that M is positive definite, but numerically of course it is not. Some of the small (O(10^-16)) eigen values (as obtained from eigen()) are negative. It is the near-singularity that is causing the numerical errors. I could use svd(), but then the left ($u) and right ($v) vectors are not identical, again numerical errors. Is there any function that imposes pd property while calculating the eigen decomposition. Thanks, PK __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Function to verify existence of an R object
Hello, is there a function to check if an object exists? Thank you, Judith __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Function to verify existence of an R object
On 16/07/2008 6:26 PM, Judith Flores wrote: Hello, is there a function to check if an object exists? exists(foo) checks for foo. (There are a few other optional parameters to tell it where to look, and what sort of thing foo might be.) Duncan Murdoch Thank you, Judith __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Function to verify existence of an R object
Please do your homework before posting: help.search(exists) -- ?exists -- Bert Gunter -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Judith Flores Sent: Wednesday, July 16, 2008 3:27 PM To: RHelp Subject: [R] Function to verify existence of an R object Hello, is there a function to check if an object exists? Thank you, Judith __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Function to verify existence of an R object
Judith Flores [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] is there a function to check if an object exists? ?exists efg Earl F Glynn Stowers Institute for Medical Research __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] R logo
If we knew an elegant one, we'd have an R function to do it ... The R Logo was done manually (using software) in several phases IIRC. But yes, indeed, an 'Rfont' package on CRAN would be neat... Martin Maechler, ETH Zurich and R Core Team. I am not sur of what would be neat : a police with nice letter that have a border ? I do not know how to change a drawing in a police, but making the drawing of the police is not that hard (well I know that I am the one who ask, but it was only to avoid to work on Gimp again, because I did not for a long time and I thaught that I forget almost every thing... I was wrong) With Gimp (which is the free version of photoshop) : http://christophe.genolini.free.fr/kml/images/alphaRouge.jpg http://christophe.genolini.free.fr/kml/images/alphaBleu.jpg http://christophe.genolini.free.fr/kml/images/alphaVert.jpg http://christophe.genolini.free.fr/kml/images/alphaBlanc.jpg Christophe __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Labelling curves on graphs
2008/7/16 Ted Harding [EMAIL PROTECTED]: Hi Folks, I'd be grateful for good suggestions about the following. I'm plotting a family of (X,Y) curves (for different levels of another variable, Z): say 6 curves in all but could be more or less -- it's a rather variables situation. I'd like to label each curve with the value of Z that it corresponds to. But people out there must have faced it, and I'd be grateful for their own feedback from the coal-face! Isn't this why we have colour vision? Just use 6 different colours and a legend. Or use linestyles and colours. Trying to do neat labelling along general lines like contour does is going to fail in edge cases such as if two lines are very close together. Contour can be fairly sure the lines will have sensible spacing unless it's mapping cliffs. I looked at the underlying C code for contour a while back with a view to using the algorithms in another package, but I gave up pretty quickly. The generated contour lines and labels are quite beautiful, but the code gave me a headache. Barry [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Stratified random sample
Dear all, I have two vector: strata response1 11 21 32 12 22 3. .. .. .10 110 210 3. .. .. .100 1100 2100 3 I need to get a stratified random sample of size = 100, such that: if I select response = 1 in strata 1 then I need sample 2 or 3 in strata 2 if I select response = 2 in strata 2 then I need to sample 1 or 3 in strata 3 if I select response = 3 in strata 2 then I need to sample 1 or 2 in strata 3 and so on. Please, how can I do this? Best regards _ Cansado de espaço para só 50 fotos? Conheça o Spaces, o site de relac[[elided Hotmail spam]] [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] R: R: gstat problem with lidar data
Ciao Dylan, THANKS for your help. When I arrive in this step V - variogram(z~1, d.small), appear this note: Error in gstat(formula = object, locations = locations, data = data) : l'argomento data non è specificato e non ha un valore predefinito (data argument it's not specified and it has not a value definied) I show you my code. I hope to improve this code in R, because I believe that R is a solution for this new kind of data (lidar). In fact, for ecological, hidrological and other application is more important to study many solution of processing and testing more software and procedures. Thank you again, your help is very important for me Ale *R** testground - read. table (file=c:/work_LIDAR_USA/R_kriging/ground26841492694149.txt, header=T, sep= ) library (sp) class (testground) [1] data.frame coordinates (testground)=~X+Y library (gstat) class (testground) [1] SpatialPointsDataFrame attr(,package) [1] sp x - 1:10 sample(x, 100) [1] 38465 18997 98968 56905 31535 5297 91034 57374 56148 4407 16033 74842 [13] 49516 91422 31812 94924 44332 30412 21990 61698 53816 51227 24848 26824 [25] 95203 20714 28172 60565 61309 24883 14063 19545 45505 24654 99649 92476 [37] 84208 73181 13319 1559 67268 13935 57486 4162 49480 68167 38897 33295 [49] 83067 47544 73390 9646 73967 81101 97055 96514 28011 99185 95511 98106 [61] 86564 9635 58078 72627 2634 77933 80923 19056 13540 30066 66614 35185 [73] 28856 61629 90387 30456 78108 18232 64321 68473 9021 15150 74326 17764 [85] 98459 38203 62364 86437 65911 14058 27638 86792 82157 13721 15988 62189 [97] 47190 912 33741 95151 d - data.frame(x=rnorm(100), y=rnorm(100), z=rnorm(100)) rand_rows - sample(1:nrow(d), 10) d.small - d[rand_rows, ] summary (d.small) x y z Min. :-1.9838 Min. :-1.7096 Min. :-1.8724 1st Qu.:-0.5412 1st Qu.:-0.3629 1st Qu.:-1.3087 Median : 0.1373 Median : 0.3014 Median :-0.6858 Mean :-0.1825 Mean : 0.0811 Mean :-0.5395 3rd Qu.: 0.5796 3rd Qu.: 0.8645 3rd Qu.: 0.1156 Max. : 1.1075 Max. : 0.9342 Max. : 1.4642 -Messaggio originale- Da: Dylan Beaudette [mailto:[EMAIL PROTECTED] Inviato: mercoledì 16 luglio 2008 14.23 A: Alessandro Cc: r-help@r-project.org Oggetto: Re: R: [R] gstat problem with lidar data On Wednesday 16 July 2008, Alessandro wrote: Hey Dylan, Thank you. I wish to test for my PhD: TIN (ok, with Arcmap), IDW (ok, with Arcmap) and kriging model (and other if it is possible) to create DSM and DEM, and DCM (DSM-DEM). I tried with gstat in IDRISI, but my PC outs of memory. I wish improve in R the gstat to develop map surface (in grid format for idrisi or arcmap). Unfortunately I have the same problem in R (out of memory), because the dataset is big. Therefore I wish create a random sub sampling set by 5000,000.00 over points. I show you my code (sorry I am a brand new in R) Data type (in *.txt format) X y X ... ... ... ... testground - read.table (file=c:/work_LIDAR_USA/R_kriging/ground26841492694149.txt, header=T, sep= ) summary (testground) plot(testground[,1],testground[,2]) library (sp) class (testground) coordinates (testground)=~X+Y library (gstat) class (testground) V - variogram(z~1, testground) When I arrive in this step appear out of memory If do you help me, it's a very pleasure because I stopped my work. Ale Hi Ale. Please remember to CC the list next time. Since R is memory-bound (for the most part), you should be summarizing your data first, then loading into R. If you can install GRASS, I would highly recommend using the r.in.xyz command to pre-grid your data to a reasonable cell size, such that the resulting raster will fit into memory. If you cannot, and can somehow manage to get the raw data into R, sampling random rows would work. # make some data: x - 1:10 # just some of the data sample(x, 100) # use this idea to extract x,y,z triplets # from some fake data: d - data.frame(x=rnorm(100), y=rnorm(100), z=rnorm(100)) # select 10 random rows: rand_rows - sample(1:nrow(d), 10) # just the selected rows: d.small - d[rand_rows, ] keep in mind you will need enough memory to contain the original data AND your subset data. trash the original data once you have the subset data with rm(). As for the statistical implications of randomly sampling a point cloud for variogram analysis-- someone smarter than I may be helpful. Cheers, Dylan -Messaggio originale- Da: Dylan Beaudette [mailto:[EMAIL PROTECTED] Inviato: mercoledì 16 luglio 2008 12.45 A: r-help@r-project.org Cc: Alessandro Oggetto: Re: [R] gstat problem with lidar data On Wednesday 16 July 2008, Alessandro wrote: Hey,
Re: [R] 回复: cch() and coxph() for case-coh ort
I read many literatures and try to find variance estimation of Prentice method in case cohort. Only SelfPrentice variance estimation can be found. Does the jacknife variance using cluster(id) in coxph() only applies to Self Prentice? I can find using [t-e,t] to estimate Beta for Prentice. But How can we implement Prentice jacknife variance estimation in R strictly? Thanks 2008/6/17 Thomas Lumley [EMAIL PROTECTED]: On Mon, 16 Jun 2008, Peter Dalgaard wrote: Jin Wang wrote: I tried to compare if cch() and coxph() can generate same result for same case cohort data Use the standard data in cch(): nwtco Since in cch contains the cohort size=4028, while ccoh.data size =1154 after selection, but coxph does not contain info of cohort size=4028. The rough estimate between coxph() and cch() is same, but the lower and upper CI and P-value are a little different. Can we exactly use coxph() to repeat cch() using with appropriate configuration in coxph()? Is SAS a better way(PHREG,CASECOH.SAS) to implement time-dependent case-cohort? I think you need to read the literature, in particular the paper by Therneau (!) and Li, which among other things details the implementation of the Self-Prentice estimator. With that in mind, it should not be surprising that it is non-trivial how to get correct SE's out of coxph. What _is_ surprising (at least somewhat) is how close the robust SE are to those of the Self-Prentice method -- if I understand correctly, the connection is that Self-Prentice uses jackknifing for the contribution from subcohort sampling plus the standard Cox asymptotic variance and the robust method effectively uses jackknifing for both. Yes. The cch() methods all do a model-based analysis of the full cohort and a finite-sampling analysis of the second-phase sampling. For Cox models the model-based and jackknife variances are usually very close. The nwtco data is actually an unusually bad fit to the Cox model and the differences are larger than usual. (I'm a bit puzzled about why cch() insists on having unique id's, though. Doesn't _look_ like it would be too hard to get rid of that restriction, at least for S-P, which admittedly is the only method I spent enough time studying. And that was a some years ago.) If you have only one event per person the only problem is that the code isn't written that way. On the other hand, if you do have additional time-varying covariates there will be a (possibly useful) efficiency gain from using more efficient methods than cch() provides, with calibration of weights based on covariates inside and outside the subcohort. -thomas Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED]University of Washington, Seattle [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] spectral decomposition for near-singular pd matrices
How large is your matrix? Are the very small eigenvalues well separated? If your matrix is not very small and the lower eigenvalues are clustered, this may be a really hard problem! You may need a special purpose algorithm and/or higher precision arithmetic. If your matrix is A and there exists a sequence of matrices A1,A2,...An = A such that A1 is good, A2 is a bit worse (and is not very different from A1), etc., you may be able to compute the eigensystem for A1 and then track it down to A2, A3,...,An. I have worked on such problems some 15 years ago but I believe that by now there should be packages doing this (I do not know whether they exist in R). --- On Thu, 17/7/08, Prasenjit Kapat [EMAIL PROTECTED] wrote: From: Prasenjit Kapat [EMAIL PROTECTED] Subject: [R] spectral decomposition for near-singular pd matrices To: [EMAIL PROTECTED] Received: Thursday, 17 July, 2008, 7:27 AM Hi, I have a matrix M, quite a few ( 1/4th) of its eigen values are of O(10^-16). Analytically I know that M is positive definite, but numerically of course it is not. Some of the small (O(10^-16)) eigen values (as obtained from eigen()) are negative. It is the near-singularity that is causing the numerical errors. I could use svd(), but then the left ($u) and right ($v) vectors are not identical, again numerical errors. Is there any function that imposes pd property while calculating the eigen decomposition. Thanks, PK __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] plot(linear model) without lines
running R 2.5.1 on WinXP. plot(model formula here) produces 4 useful residual diagnostic plots. Two questions about them: 1. How can I isolate just one of the four, and have only that one be shown? str(plot(model)) didn't give me any insight. 2. How can I make the lines (I guess they are lowess lines) not appear on the plots? Thanks. --Chris Ryan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Stratified random sample
On 17/07/2008, at 11:45 AM, lamack lamack wrote: Dear all, I have two vector: strata response1 11 21 32 12 22 3. .. .. .10 110 210 3. .. .. .100 1100 2100 3 I need to get a stratified random sample of size = 100, such that: if I select response = 1 in strata 1 then I need sample 2 or 3 in strata 2 if I select response = 2 in strata 2 then I need to sample 1 or 3 in strata 3 if I select response = 3 in strata 2 then I need to sample 1 or 2 in strata 3 and so on. Please, how can I do this? You really should do your own homework. cheers, Rolf Turner ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] spectral decomposition for near-singular pd matrices
Moshe Olshansky m_olshansky at yahoo.com writes: How large is your matrix? Right now I am looking at sizes between 30x30 to 150x150, though it will increase in future. Are the very small eigenvalues well separated? If your matrix is not very small and the lower eigenvalues are clustered, this may be a really hard problem! Here are the deciles of the eigenvalues (using eigen()) from a typical random generation (30x30): Min 10th 20th 30th 40th -1.132398e-16 -6.132983e-17 3.262002e-18 1.972702e-17 8.429709e-17 50th 60th 70th 80th 90th Max 2.065645e-13 1.624553e-09 4.730935e-06 0.00443353 0.9171549 16.5156 I am guessing they are *not* well-separated. You may need a special purpose algorithm and/or higher precision arithmetic. If your matrix is A and there exists a sequence of matrices A1,A2,...An = A such that A1 is good, A2 is a bit worse (and is not very different from A1), etc., you may be able to compute the eigensystem for A1 and then track it down to A2, A3,...,An. I have worked on such problems some 15 years ago but I believe that by now there should be packages doing this (I do not know whether they exist in R). I will have to think on the possibility of such a product-decomposition. But even if it were possible, it would be an infinite product (just thinking out loud). Thanks again, PK PS: Kindly CC me when replying. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Stratified random sample
create a vector containing 1,2,3 sample one value remove the sampled value from the initial vector sample again now select the observations belonging to the strata indexed by the two sampled values - not difficult. Most certainly, other approaches work too, maybe even better. Rolf, is he taking a course of yours? :) Best Daniel lamack lamack wrote: Dear all, I have two vector: strata response1 11 21 32 12 22 3. .. .. .10 110 210 3. .. .. .100 1100 2100 3 I need to get a stratified random sample of size = 100, such that: if I select response = 1 in strata 1 then I need sample 2 or 3 in strata 2 if I select response = 2 in strata 2 then I need to sample 1 or 3 in strata 3 if I select response = 3 in strata 2 then I need to sample 1 or 2 in strata 3 and so on. Please, how can I do this? Best regards _ Cansado de espaço para só 50 fotos? Conheça o Spaces, o site de relac[[elided Hotmail spam]] [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- View this message in context: http://www.nabble.com/Stratified-random-sample-tp18499013p18499744.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] create a function from a model
hi, I am sure this is an obvious question, I have a optimized model with coefficients from stepAIC. I can't figure out how to find the max value of a function with those coefficients. Its part of a dynamic web page or else i would have done it by hand. The code works fine, so you probably don't need it, but here it is: library(MASS) dd-read.csv(Guest.dat, header = TRUE, sep = , ) res - stepAIC(glm(Yield ~ (1 + NTP + DNA + T7pol)^2 , data=dd ), list(upper = Yield ~ (1 + NTP + DNA + T7pol )^2 , lower = Yield ~ 1 ) , trace=0 ) coef(res) (Intercept) NTPDNA T7pol DNA:T7pol 1776 -19 -8.64 -10 1.5 I need the function back out y = 1776 - 19*NTP -8.64*DNA -10*T7pol + 1.5 *DNA*T7pol in order to send it to optim() or some optimizer thanks ld __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to extract component number of RMSEP in RMSEP plot
Hi Bjorn, Greetings. I would like to know how can i extract component no. when the RMSEP is lowest? Currently, I only plot it manually and then only feed the ncomp to the jack knife command. However, I would like to automate this step. Please let me know. Many thanks. Rgrds, [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Stratified random sample
On 17/07/2008, at 1:11 PM, Daniel Malter wrote: snip Rolf, is he taking a course of yours? :) No, I don't actually ``teach'' these days. (If ever I did.) It just looked like a homework problem to me. Still does, actually. cheers, Rolf ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] spectral decomposition for near-singular pd matrices
Your problem seems to be pretty hard (for larger dimensions)! When speaking about the A1,A2,...,An sequence I did not mean representing A as a product of A1*A2*...*An. What I mean is that A1,...,An is a sequence of matrices which starts at a good matrix, i.e. it's eigenvalues are well separated, then A2 is not too different from A1 and having already found the eigensystem (or a part of it) for A1 you can use them to find that system for A2 (without doing it from scratch), A3 is not too much different from A2 and so having the eigensystem for A2 you get ne for A3, etc. until you get to the last matrix which is A. We had a matrix arising from elasticity. When the elasticity coefficient mu was small the matrix was good but when mu approached 0.5, half of the eigenvalues approached 0 (for mu = 0.5 half of the eigenvalues are really 0). Starting from something like mu = 0.4 we were able to track several selected (lowest) eigenvalues up to something like mu = 0.4999, while no other program (at that time) could find the eigensystem of such matrix even for much less problematic values of mu. --- On Thu, 17/7/08, Prasenjit Kapat [EMAIL PROTECTED] wrote: From: Prasenjit Kapat [EMAIL PROTECTED] Subject: Re: [R] spectral decomposition for near-singular pd matrices To: [EMAIL PROTECTED] Received: Thursday, 17 July, 2008, 10:56 AM Moshe Olshansky m_olshansky at yahoo.com writes: How large is your matrix? Right now I am looking at sizes between 30x30 to 150x150, though it will increase in future. Are the very small eigenvalues well separated? If your matrix is not very small and the lower eigenvalues are clustered, this may be a really hard problem! Here are the deciles of the eigenvalues (using eigen()) from a typical random generation (30x30): Min 10th 20th 30th 40th -1.132398e-16 -6.132983e-17 3.262002e-18 1.972702e-17 8.429709e-17 50th 60th 70th 80th 90th Max 2.065645e-13 1.624553e-09 4.730935e-06 0.00443353 0.9171549 16.5156 I am guessing they are *not* well-separated. You may need a special purpose algorithm and/or higher precision arithmetic. If your matrix is A and there exists a sequence of matrices A1,A2,...An = A such that A1 is good, A2 is a bit worse (and is not very different from A1), etc., you may be able to compute the eigensystem for A1 and then track it down to A2, A3,...,An. I have worked on such problems some 15 years ago but I believe that by now there should be packages doing this (I do not know whether they exist in R). I will have to think on the possibility of such a product-decomposition. But even if it were possible, it would be an infinite product (just thinking out loud). Thanks again, PK PS: Kindly CC me when replying. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Help regarding arules package
How about computing the 'lhs' of the rules once and then using that information for the subsets. On Wed, Jul 16, 2008 at 11:56 AM, Daniel Wagner [EMAIL PROTECTED] wrote: Dear R experts, I need help to make my little program efficient which now takes 2hrs to complete. Using arules package I developed set of rules consisted of 900 rules. Now I want to check whether a lower rule is a subset of a higher premises rule. And if it is a subset of higher premises rule then drop this rule. I am using following code but it takes too much time. nor-length(rules) k-rep(T, nor) for(i in 1:(nor-1)){ for(j in (i+1):nor){ if((is.subset(lhs(rules[i]),lhs(rules[j])) is.subset(rhs(rules[i]), rhs(rules[j])))==T){ k[i]-F break } } } Could somebody help me. Thanks Daniel Amsterdam Send instant messages to your online friends http://uk.messenger.yahoo.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem you are trying to solve? __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Location of HTML help files
I am using R 2.7.1 under Windows XP, installed at C:/R/R-2.7.1. The location of the HTML SearchEngine is file:///C:/R/R-2.7.1/doc/html/search/SearchEngine.html. Now, when I type a phrase, say reshape, in the search text field, the Search Results page suggest that the location of the reshape HTML help file is file:///C:/R/library/stats/html/reshape.html, while in reality it is file:///C:/R/R-2.7.1/library/stats/html/reshape.html. Is there an easy way in which I can fix this? -- Jan Smit Statistics Division United Nations Economic and Social Commission for Asia and the Pacific (ESCAP) Rajdamnern Nok Avenue Bangkok 10200, Thailand Tel: +66 (0) 2288 1689 Fax: +66 (0) 2288 1082 http://www.unescap.org/stat/index.asp [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Labelling curves on graphs
Barry Rowlingson wrote: 2008/7/16 Ted Harding [EMAIL PROTECTED]: Hi Folks, I'd be grateful for good suggestions about the following. I'm plotting a family of (X,Y) curves (for different levels of another variable, Z): say 6 curves in all but could be more or less -- it's a rather variables situation. I'd like to label each curve with the value of Z that it corresponds to. But people out there must have faced it, and I'd be grateful for their own feedback from the coal-face! Isn't this why we have colour vision? Just use 6 different colours and a legend. Or use linestyles and colours. Trying to do neat labelling along general lines like contour does is going to fail in edge cases such as if two lines are very close together. Contour can be fairly sure the lines will have sensible spacing unless it's mapping cliffs. I looked at the underlying C code for contour a while back with a view to using the algorithms in another package, but I gave up pretty quickly. The generated contour lines and labels are quite beautiful, but the code gave me a headache. Barry Barry, Why use color when you can use black and label the curves where they are most separated? This solves problems with color blindness, xeroxing, and faxing. Frank [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Location of HTML help files
Hi, could be a browser issue. What browser are you using? I see this behavior on Firefox 3.0.1 but not Microsoft IE 7.0(.5730.11). Looking at the source code for the generate search (of 'reshape') you get the relative URL: ../../../library/R.utils/html/wrap.array.html for both browsers. The difference is that the current URL is different for the two: Firefox: file:///C:/PROGRA~1/R/R-2.7.1pat/doc/html/index.html MSIE: C:\Program Files\R\R-2.7.1pat\doc\html\search\SearchEngine.html Applying the relative URL to the two you get incorrect URL for Firefox: Firefox: file:///C:/PROGRA~1/R/R-2.7.1pat/doc/html/../../../library/R.utils/html/wrap.array.html == file:///C:/PROGRA~1/R/R-2.7.1pat/../library/R.utils/html/wrap.array.html == file:///C:/PROGRA~1/R/library/R.utils/html/wrap.array.html MSIE: C:\Program Files\R\R-2.7.1pat\doc\html\search\../../../library/R.utils/html/wrap.array.html == C:\Program Files\R\R-2.7.1pat\doc\/../library/R.utils/html/wrap.array.html == C:\Program Files\R\R-2.7.1pat\library/R.utils/html/wrap.array.html So, it seems that the current URL for the search result is incorrect for Firefox, i.e. a missing search/ directory. My $.02 Henrik On Wed, Jul 16, 2008 at 7:27 PM, Jan Smit [EMAIL PROTECTED] wrote: I am using R 2.7.1 under Windows XP, installed at C:/R/R-2.7.1. The location of the HTML SearchEngine is file:///C:/R/R-2.7.1/doc/html/search/SearchEngine.html. Now, when I type a phrase, say reshape, in the search text field, the Search Results page suggest that the location of the reshape HTML help file is file:///C:/R/library/stats/html/reshape.html, while in reality it is file:///C:/R/R-2.7.1/library/stats/html/reshape.html. Is there an easy way in which I can fix this? -- Jan Smit Statistics Division United Nations Economic and Social Commission for Asia and the Pacific (ESCAP) Rajdamnern Nok Avenue Bangkok 10200, Thailand Tel: +66 (0) 2288 1689 Fax: +66 (0) 2288 1082 http://www.unescap.org/stat/index.asp [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Location of HTML help files
Thanks, Henrik. I was indeed using Firefox 3.0.1, and I now see that the issue doesn't occur with MSIE 7.0. Will use the latter for the time being. Best regards, Jan Henrik Bengtsson [EMAIL PROTECTED] Sent by: [EMAIL PROTECTED] 17/07/2008 10:45 To Jan Smit [EMAIL PROTECTED] cc r-help@r-project.org Subject Re: [R] Location of HTML help files Hi, could be a browser issue. What browser are you using? I see this behavior on Firefox 3.0.1 but not Microsoft IE 7.0(.5730.11). Looking at the source code for the generate search (of 'reshape') you get the relative URL: ../../../library/R.utils/html/wrap.array.html for both browsers. The difference is that the current URL is different for the two: Firefox: file:///C:/PROGRA~1/R/R-2.7.1pat/doc/html/index.html MSIE: C:\Program Files\R\R-2.7.1pat\doc\html\search\SearchEngine.html Applying the relative URL to the two you get incorrect URL for Firefox: Firefox: file:///C:/PROGRA~1/R/R-2.7.1pat/doc/html/../../../library/R.utils/html/wrap.array.html == file:///C:/PROGRA~1/R/R-2.7.1pat/../library/R.utils/html/wrap.array.html == file:///C:/PROGRA~1/R/library/R.utils/html/wrap.array.html MSIE: C:\Program Files\R\R-2.7.1pat\doc\html\search\../../../library/R.utils/html/wrap.array.html == C:\Program Files\R\R-2.7.1pat\doc\/../library/R.utils/html/wrap.array.html == C:\Program Files\R\R-2.7.1pat\library/R.utils/html/wrap.array.html So, it seems that the current URL for the search result is incorrect for Firefox, i.e. a missing search/ directory. My $.02 Henrik On Wed, Jul 16, 2008 at 7:27 PM, Jan Smit [EMAIL PROTECTED] wrote: I am using R 2.7.1 under Windows XP, installed at C:/R/R-2.7.1. The location of the HTML SearchEngine is file:///C:/R/R-2.7.1/doc/html/search/SearchEngine.html. Now, when I type a phrase, say reshape, in the search text field, the Search Results page suggest that the location of the reshape HTML help file is file:///C:/R/library/stats/html/reshape.html, while in reality it is file:///C:/R/R-2.7.1/library/stats/html/reshape.html. Is there an easy way in which I can fix this? -- Jan Smit Statistics Division United Nations Economic and Social Commission for Asia and the Pacific (ESCAP) Rajdamnern Nok Avenue Bangkok 10200, Thailand Tel: +66 (0) 2288 1689 Fax: +66 (0) 2288 1082 http://www.unescap.org/stat/index.asp [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Fw: how i can install Rgraphviz in R2.7.1
--- On Tue, 15/7/08, haani hanni [EMAIL PROTECTED] wrote: From: haani hanni [EMAIL PROTECTED] Subject: how i can install Rgraphviz in R2.7.1 To: Nabble [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Date: Tuesday, 15 July, 2008, 1:39 PM hello i am a new user of R.i have window XP Proffessional in my P.C.i wanted to make the graphs of my data in Rgraphviz.the version of R which i am using is 2.7.1.when i try to install Rgraphviz in R by usinr the commands /source(http://bioconductor.org/biocLite.R) biocLite(Rgraphviz) source(http://bioconductor.org/biocLite.R;) biocLite(Rgraphviz) Running biocinstall version 2.2.9 with R version 2.7.1 Your version of R requires version 2.2 of BioConductor. trying URL 'http://bioconductor.org/packages/2.2/bioc/bin/windows/contrib/2.7/Rgraphviz_1.18.1.zip' Content type 'application/zip' length 1012303 bytes (988 Kb) opened URL downloaded 988 Kb  package 'Rgraphviz' successfully unpacked and MD5 sums checked  The downloaded packages are in        C:\Documents and Settings\XPPRESP3\Local Settings\Temp\RtmpF7Nljk\downloaded_packages updating HTML package descriptions but when i wrote library(Rgraphviz)  then i got the following error Error in inDL(x, as.logical(local), as.logical(now), ...) :  unable to load shared library 'C:/PROGRA~1/R/R-27~1.1/library/Rgraphviz/libs/Rgraphviz.dll':  LoadLibrary failure: The specified module could not be found.  Error : .onLoad failed in 'loadNamespace' for 'Rgraphviz' Error: package/namespace load failed for 'Rgraphviz' save.image(C:\\Documents and Settings\\XPPRESP3\\Desktop\\.RData) save.image(C:\\Documents and Settings\\XPPRESP3\\My Documents\\.RData)  please if any one knows the solution of my problem then tell me how i can solve it. thanks maryam    --- On Mon, 14/7/08, Nabble [EMAIL PROTECTED] wrote:  From: Nabble [EMAIL PROTECTED] Subject: Nabble registration To: [EMAIL PROTECTED] Date: Monday, 14 July, 2008, 8:53 AM Dear Nabble user: Please click on the confirmation link below to finish your registration: http://www.nabble.com/user/Register3.jtp?email=maaryam_khan%40yahoo.comkey=0.6276394866471675 Regards, [EMAIL PROTECTED] Send instant messages to your online friends http://uk.messenger.yahoo.com Send instant messages to your online friends http://uk.messenger.yahoo.com [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.