Re: [R] Modifying a built-in R function
japal wrote: Hello, Something incredible (at least for me) has happen. Yesterday night I downloaded biplot.R to edit this function and add new features I wished. Namely I wanted to plot points belonging to different groups using different colors and symbols. I identified which part of the original code I had to modify. Then, I rename biplot by biplotes and executing biplotes(x), being x a princomp class object, the function did what I wanted. The problem is that today I type exactly the same (after sourcing my script file incluiding biplotes) but biplotes(x) execute the original biplot function. Also, if I invoke any of the new arguments I wrote in the code then multiple warnings messages are displayed. I don't understand what is the problem. Yesterday it works perfectly. Why R does not execute my code and call the original biplot function? Thanks in advance, Javier. Can you send us your modified version and the way you called it (as the posting guide asks you to do)? Otherwise we cannot know. Uwe Ligges __ 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] nls does not accept start values
Petr PIKAL wrote: Hi to all OK as I did not get any response and I really need some insight I try again with different subject line I have troubles with correct evaluating/structure of nls input Here is an example # data x -1:10 y -1/(.5-x)+rnorm(10)/100 # formula list form - structure(list(a = list(quote(y ~ 1/(a - x)), list(a=mean(y, .Names = a) # This gives me an error due to not suitable default starting value fit - nls(form [[1]] [[1]], data.frame(x=x, y=y)) # This works and gives me a result fit - nls(form [[1]] [[1]], data.frame(x=x, y=y), start=list(a=mean(y))) *** How to organise list form and call to nls to enable to use other then default starting values***. I thought about something like fit - nls(form [[1]] [[1]], data.frame(x=x, y=y), start=get(form [[1]] [[2]])) ^^^ but this gives me an error so it is not correct syntax. (BTW I tried eval, assign, sustitute, evalq and maybe some other options but did not get it right. I know I can put starting values interactively but what if I want them computed by some easy way which is specified by second part of a list, like in above example. If you really want to orgnize it that way, why not simpler as in: form - list(y ~ 1/(a - x), a = mean(y)) fit - nls(form[[1]], data.frame(x=x, y=y), start = form[2]) Uwe Ligges If it matters WXP, R2.9.0 devel. Regards Petr petr.pi...@precheza.cz __ 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] Loop over several Garch-models
Dear all, I'm using R 2.8.1 on Windows XP. I want to loop over several garch-models to evaluate the best model-fit. After loading the package fGarch I execute the following loop: For(i in 1:5){ for(j in 1:5){ garchFit(~ arma(0,0) + garch(i,j), stetige_renditen[,7], cond.dist=sged, trace=F) } } Where stetige_renditen[,7] are the continously compounded returns of the FX â¬/$ 2007 - 2008. Unfortunately I get the following error: [1] data ij [1] data Fehler in .garchArgsParser(formula = formula, data = data, trace = FALSE) : Formula and data units do not match. On top the time series is not stationary. So any advice to choose another model? I think IGARCH is not so good... Any help about the code and the non-statioarity-thing would be very appreciated. Kind regards, Thomas [[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] nls does not accept start values
It is not very clear what you are trying to do here, and form - structure(list(a = list(quote(y ~ 1/(a - x)), list(a=mean(y, .Names = a) is using a historic anomaly (see the help page). I am gussing you want to give nls an object containing a formula and an expression for the starting value. It seems you are re-inventing self-starting nls models: see ?selfStart and MASS$ ca p. 216. One way to use them in your example is mod - selfStart(~ 1/(a - x), function(mCall, data, LHS) { structure(mean(eval(LHS, data)), names=a) }, a) nls(y ~ mod(x, a)) But if you want to follow ypur route, youer starting values would be better to be a list that you evaluate in an appropriate context (which y is this supposed to be?). nls() knows where it will find variables, but it is not so easy for you to replicate its logic without access to its evaluation frames. On Mon, 2 Mar 2009, Petr PIKAL wrote: Hi to all OK as I did not get any response and I really need some insight I try again with different subject line I have troubles with correct evaluating/structure of nls input Here is an example # data x -1:10 y -1/(.5-x)+rnorm(10)/100 # formula list form - structure(list(a = list(quote(y ~ 1/(a - x)), list(a=mean(y, .Names = a) # This gives me an error due to not suitable default starting value fit - nls(form [[1]] [[1]], data.frame(x=x, y=y)) # This works and gives me a result fit - nls(form [[1]] [[1]], data.frame(x=x, y=y), start=list(a=mean(y))) *** How to organise list form and call to nls to enable to use other then default starting values***. I thought about something like fit - nls(form [[1]] [[1]], data.frame(x=x, y=y), start=get(form [[1]] [[2]])) ^^^ but this gives me an error so it is not correct syntax. (BTW I tried eval, assign, sustitute, evalq and maybe some other options but did not get it right. I know I can put starting values interactively but what if I want them computed by some easy way which is specified by second part of a list, like in above example. If it matters WXP, R2.9.0 devel. Regards Petr petr.pi...@precheza.cz -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@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] ave and grouping
Dear list, # I have a DF like this: sleep$b - c(rep(8,10), rep(9,10)) sleep$me - with(sleep, ave(extra, group, FUN = mean)) sleep # I would like to create a new variable # holding the b-th value of group 1 and 2. # This is not what I want, it takes always the '8' from group '1' # and not the '9' sleep$gr - with(sleep, ave(extra, group, FUN = function(x) x[ b[1] ])) sleep Thanks for any help! Patrick __ 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] Does The Randvar package contain a virus(Malware) ?
On Mon, 2009-03-02 at 08:41 +0100, Matthias Kohl wrote: there were only minor changes in the latest version of RandVar (from 0.6.6 to 0.6.7). Might this be a mirror problem? Best Matthias Timthy Chang wrote: Today,I update the packages in R. but AntiVir Guard dectects the Randvar package as affected file. What happen ?? Thank you for your answer. http://www.nabble.com/file/p22281513/qq.gif Or this find a False Positive Second http://www.avira.com/en/threats/section/fulldetails/id_vir/4142/heur_html.malware.html HEUR/HTML.Malware Not a virus but a code this anti virus suspected may be a virus -- Bernardo Rangel Tura, M.D,MPH,Ph.D National Institute of Cardiology Brazil __ 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] rounding problem
On Sun, 2009-03-01 at 17:51 -0800, tedzzx wrote: Yes, round(1.5)=2. but round(2.5)=2. I want round(2.5)=3 just like the what the excel do. Can we change the setting or do some trick so that the computer will work like what we usually do with respect to rounding. My system is R 2.8.1, winXP, Intel core 2 dual . Thanks. On Sun, 2009-03-01 at 17:51 -0800, tedzzx wrote: Yes, round(1.5)=2. but round(2.5)=2. I want round(2.5)=3 just like the what the excel do. Can we change the setting or do some trick so that the computer will work like what we usually do with respect to rounding. If I understand your problem you need using a bias round like excell. Do you understand this is a wrong way and this is a bug of excell, but you need this. Well to help you i create a function for this round.excell-function(x){ aux-round(x,1) aux-ifelse( all.equal(aux-trunc(aux),.5)==TRUE, ceiling(aux), round(aux,0)) return(aux) } round.excell(1.5) round.excell(2.5) round.excell(2.1) round.excell(1.1) round.excell(2.6) round.excell(1.6) But I need talk to you: 1- The use of routine put a bias in your analysis 2- Is not a standard (check IEC 60559 about this) 3- Do you migrating a excell bug to R -- Bernardo Rangel Tura, M.D,MPH,Ph.D National Institute of Cardiology Brazil __ 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] handle graph size in eps
Hi all, I've got a density graph made with the following commands: win.graph(width=13,height=6) par ( fin=c(13,3) ,mai=c(1,1,0.5,0.5) ,mfrow=c(1,2) ,cex.axis=1.5 ,cex.lab=1.5) dens-density(DATA1.y[2,]-mean(DATA1.y[2,]),kernel=gaussian) xlimit-range(dens$x) ylimit-range(dens$y) hist( DATA1.y[2,]-mean(DATA1.y[2,]) ,xlim=1.1*xlimit ,xlab=expression(q[e]) ,ylim=1.1*ylimit ,probability=T ,main=Random distribution around y) lines(dens,col=2,) rm(dens,xlimit,ylimit) qqnorm(DATA1.x[1,]) that's what I've on the screen and I'm OK with that. http://www.4shared.com/file/90283562/9f27d83b/screen.html When I save the graph in eps format I've got that http://www.4shared.com/file/90283115/490b7383/density_v_1.html what am I doing wrong? Regards Benoit __ 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] probleme with savePlot (to eps)
I am using windows XP pack3 and R 2.8.1 so I guess this is savePlot for Windows. As Gabor say, savePlot offer to export graph also in eps. If you want to copy a screen device to postscript portably, use dev.copy2eps(). I am exporting graph in a package, so I don't want to copy screen device to postscript, I want to copy screen device to postscript OR to any other type that the user may want... It is why I can not use a specific function (postscrip(), dev.copy2eps() ) but I need a generic one. Christophe On Sun, 1 Mar 2009, David Winsemius wrote: Unfortunately your burning desire to use savePlot for this purpose is not going to reconfigure the capabilities of that function. Just read the help page of savePlot: savePlot {grDevices} R Documentation Save Cairo X11 Plot to FileDescription Save the current page of a cairo X11() device to a file. Usage savePlot(filename = paste(Rplot, type, sep=.), type = c(png, jpeg, tiff, bmp), device = dev.cur()) Do you see ps or eps in the supported types? I do not. Why would you expect be a warning not to use a type of device that was not documented as possible. Have you looked at dev.copy or dev.print as a method of getting the user choice of screen displayed graphics to an output file? -- David Winsemius On Mar 1, 2009, at 6:02 PM, Christophe Genolini wrote: Thanks for your answer. Use the postscript device to save .ps or .eps files. Unfortunatly, I can't. I am using savePlot in a package. Several graphs (up to 100) are exported at the same time and I would like the user to chose the extension. It is why I need savePlot. Beside, I did not find any warning again postscript in the help page for savePlot. Where did you get this information ? I am using R 2.8.1 Christophe The help page for savePlot does not suggest that it would be of any value in saving plots as postscript files. ?postscript ?Devices __ 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] nls does not accept start values
Thank you It was simplified version of my problem. I want to elaborate a function which can take predefined list of formulas, some data and evaluate which formulas can fit the data. I was inspired by some article in Chemical engineering in which some guy used excel solver for such task. I was curious if I can do it in R too. I am not sure if nls is appropriate tool for such task but I had to start somewhere. Here is a function which takes list of formulas and data and gives a result for each formula. modely - function(formula, data, ...){ ll - length(formula) #no of items in formula list result2 - vector(list, ll) #prepare results result1 - rep(NA, ll) for(i in 1:ll) { fit-try(nls(formula[[i]], data)) if( class(fit)==try-error) result1[i] - NA else result1[i] - sum(resid(fit)^2) if( class(fit)==try-error) result2[[i]] - NA else result2[[i]] - coef(fit) } ooo-order(result1) #order results according to residual sum #combine results into one list together with functions used result - mapply(c, sq.resid = result1, result2) names(result) - as.character(formula) # output result[ooo] } # data x -1:10 y -1/(.5-x)+rnorm(10)/100 # list of formulas fol - structure(list(a = y ~ 1/(a - x), b = y ~ a * x^2 + b * log(x), c = y ~ x^a), .Names = c(a, b, c)) modely(fol, data.frame(x=x, y=y) does not use correct model because when using default start values it results in nls(fol[[1]], data.frame(x=x, y=y)) Error in numericDeriv(form[[3]], names(ind), env) : Missing value or an infinity produced when evaluating the model however nls(fol[[1]], data.frame(x=x, y=y), start=list(a=mean(y))) gives correct result. Therefore I started think about how to add a better starting value for some fits as a second part of my formula list to define structure like list(a= formula1, start.formula1, b=formula2, start.formula2, ) I wonder If you can push me to better direction. Thanks again Best regards Petr Uwe Ligges lig...@statistik.tu-dortmund.de napsal dne 02.03.2009 09:41:45: Petr PIKAL wrote: Hi to all OK as I did not get any response and I really need some insight I try again with different subject line I have troubles with correct evaluating/structure of nls input Here is an example # data x -1:10 y -1/(.5-x)+rnorm(10)/100 # formula list form - structure(list(a = list(quote(y ~ 1/(a - x)), list(a=mean(y, .Names = a) # This gives me an error due to not suitable default starting value fit - nls(form [[1]] [[1]], data.frame(x=x, y=y)) # This works and gives me a result fit - nls(form [[1]] [[1]], data.frame(x=x, y=y), start=list(a=mean(y))) *** How to organise list form and call to nls to enable to use other then default starting values***. I thought about something like fit - nls(form [[1]] [[1]], data.frame(x=x, y=y), start=get(form [[1]] [[2]])) ^^^ but this gives me an error so it is not correct syntax. (BTW I tried eval, assign, sustitute, evalq and maybe some other options but did not get it right. I know I can put starting values interactively but what if I want them computed by some easy way which is specified by second part of a list, like in above example. If you really want to orgnize it that way, why not simpler as in: form - list(y ~ 1/(a - x), a = mean(y)) fit - nls(form[[1]], data.frame(x=x, y=y), start = form[2]) Uwe Ligges If it matters WXP, R2.9.0 devel. Regards Petr petr.pi...@precheza.cz __ 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] Need help extracting info from XML file using XML package
Don MacQueen wrote: I have an XML file that has within it the coordinates of some polygons that I would like to extract and use in R. The polygons are nested rather deeply. For example, I found by trial and error that I can extract the coordinates of one of them using functions from the XML package: doc - xmlInternalTreeParse('doc.kml') docroot - xmlRoot(doc) pgon - try lapply( xpathSApply(doc, '//Polygon', xpathSApply, '//coordinates', function(node) strsplit(xmlValue(node), split=',|\\s+')), as.numeric) which should find all polygon nodes, extract the coordinates node for each polygon separately, split the coordinates string by comma and convert to a numeric vector, and then report a list of such vectors, one vector per polygon. i've tried it on some dummy data made up from your example below. the xpath patterns may need to be adjusted, depending on the actual structure of your xml file, as may the strsplit pattern. vQ but this is hardly general! I'm hoping there is some relatively straightforward way to use functions from the XML package to recursively descend the structure and return the text strings representing the polygons into, say, a list with as many elements as there are polygons. I've been looking at several XML documentation files downloaded from http://www.omegahat.org/RSXML/ , but since my understanding of XML is weak at best, I'm having trouble. I can deal with converting the text strings to an R object suitable for plotting etc. Here's a look at the structure of this file graphics[5]% grep Polygon doc.kml Polygon id=15342 /Polygon Polygon id=1073 /Polygon Polygon id=16508 /Polygon Polygon id=18665 /Polygon Polygon id=32903 /Polygon Polygon id=5232 /Polygon And each of the Polygon /Polygon pairs has coordinates as per this example: Polygon id=15342 outerBoundaryIs LinearRing id=11467 coordinates -23.679835352296,30.263840290388,5.001 -23.68138782285701,30.264740875186,5.001 [snip] -23.679835352296,30.263840290388,5.001 -23.679835352296,30.263840290388,5.001 /coordinates /LinearRing /outerBoundaryIs /Polygon Thanks! -Don p.s. There is a lot of other stuff in this file, i.e, some points, and attributes of the points such as color, as well as a legend describing what the polygons mean, but I can get by without all that stuff, at least for now. Note also that readOGR() would in principle work, but the underlying OGR libraries have some limitations that this file exceeds. Per info at http://www.gdal.org/ogr/drv_kml.html. __ 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] nls does not accept start values
Petr PIKAL wrote: Thank you It was simplified version of my problem. I want to elaborate a function which can take predefined list of formulas, some data and evaluate which formulas can fit the data. I was inspired by some article in Chemical engineering in which some guy used excel solver for such task. I was curious if I can do it in R too. I am not sure if nls is appropriate tool for such task but I had to start somewhere. Here is a function which takes list of formulas and data and gives a result for each formula. modely - function(formula, data, ...){ ll - length(formula) #no of items in formula list result2 - vector(list, ll) #prepare results result1 - rep(NA, ll) for(i in 1:ll) { fit-try(nls(formula[[i]], data)) if( class(fit)==try-error) result1[i] - NA else result1[i] - sum(resid(fit)^2) if( class(fit)==try-error) result2[[i]] - NA else result2[[i]] - coef(fit) } ooo-order(result1) #order results according to residual sum #combine results into one list together with functions used result - mapply(c, sq.resid = result1, result2) names(result) - as.character(formula) # output result[ooo] } # data x -1:10 y -1/(.5-x)+rnorm(10)/100 # list of formulas fol - structure(list(a = y ~ 1/(a - x), b = y ~ a * x^2 + b * log(x), c = y ~ x^a), .Names = c(a, b, c)) modely(fol, data.frame(x=x, y=y) does not use correct model because when using default start values it results in nls(fol[[1]], data.frame(x=x, y=y)) Error in numericDeriv(form[[3]], names(ind), env) : Missing value or an infinity produced when evaluating the model however nls(fol[[1]], data.frame(x=x, y=y), start=list(a=mean(y))) gives correct result. Therefore I started think about how to add a better starting value for some fits as a second part of my formula list to define structure like list(a= formula1, start.formula1, b=formula2, start.formula2, ) I wonder If you can push me to better direction. You can make up a list of lists (each containing one formula and its starting values) or specify formulas in one list and starting values in a corresponding second list. You need just the corresponding subsetting in your call to nls such as in the simple case I suggested already. Best, Uwe Thanks again Best regards Petr Uwe Ligges lig...@statistik.tu-dortmund.de napsal dne 02.03.2009 09:41:45: Petr PIKAL wrote: Hi to all OK as I did not get any response and I really need some insight I try again with different subject line I have troubles with correct evaluating/structure of nls input Here is an example # data x -1:10 y -1/(.5-x)+rnorm(10)/100 # formula list form - structure(list(a = list(quote(y ~ 1/(a - x)), list(a=mean(y, .Names = a) # This gives me an error due to not suitable default starting value fit - nls(form [[1]] [[1]], data.frame(x=x, y=y)) # This works and gives me a result fit - nls(form [[1]] [[1]], data.frame(x=x, y=y), start=list(a=mean(y))) *** How to organise list form and call to nls to enable to use other then default starting values***. I thought about something like fit - nls(form [[1]] [[1]], data.frame(x=x, y=y), start=get(form [[1]] [[2]])) ^^^ but this gives me an error so it is not correct syntax. (BTW I tried eval, assign, sustitute, evalq and maybe some other options but did not get it right. I know I can put starting values interactively but what if I want them computed by some easy way which is specified by second part of a list, like in above example. If you really want to orgnize it that way, why not simpler as in: form - list(y ~ 1/(a - x), a = mean(y)) fit - nls(form[[1]], data.frame(x=x, y=y), start = form[2]) Uwe Ligges If it matters WXP, R2.9.0 devel. Regards Petr petr.pi...@precheza.cz __ 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] Large data set in R
Hello, I'm trying to use R statistical packages to do ANOVA analysis using aov() and lm(). I'm having a problem when I have a large data set for input data from Full Factorial Design Experiment with replications. R seems to store everything in the memory and it fails when memory is not enough to hold the massive computation. Have anyone successfully used R to do such analysis before? Are there any work around on this problem? Thanks, Hardi __ 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] issue with varSel.svm.rfe in package MCRestimate
Unfortunately no one ever answered my question and I was never able to implement the varSel.svm.rfe function in R. I found a 2005 book that mentions the RFE package: Analyzing Microarray Gene Expression Data, Chapter 6.13.4http://books.google.com/books?id=gt8JNQfpnMICpg=PA206lpg=PA206dq= but the link does not work so I searched the name Ambroise and came up with this site: Christophe Ambroisehttp://stat.genopole.cnrs.fr/dw/~cambroise/doku.php?id=softwares:softwares . Towards the bottom of the page you'll find links to packages that are supposed to carry out RFE - you might try RMagpiehttp://www.maths.uq.edu.au/bioinformatics/rmagpie.html . I have not yet attempted to use this package. Elizabeth On Fri, Sep 26, 2008 at 10:38 AM, Elizabeth McClellan elizabethmcclel...@gmail.com wrote: Hello all, I would like to perform SVM-RFE (Guyon et al. 2002) in R and have only found one implementation of this algorithm. The function belongs to the MCRestimate package but when I try to use it I encounter a problem - the function appears to be missing a required package or other function that I simply cannot find available anywhere. Here is my session info followed by a simple example with the error message I receive when using the function varSel.svm.rfe: sessionInfo() R version 2.7.1 (2008-06-23) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] tools splines stats graphics grDevices utils datasets [8] methods base other attached packages: [1] MCRestimate_1.4.0 Biobase_2.0.1 randomForest_4.5-25 [4] pamr_1.38.0 survival_2.34-1 cluster_1.11.11 [7] e1071_1.5-18class_7.2-42RColorBrewer_1.0-2 m-matrix(c(1:16),4,4) classes-c(1,1,0,0) varSel.svm.rfe(m,classes) Loading required package: rfe Error in varSel.svm.rfe(m, classes) : could not find function rfe.cv In addition: Warning message: In library(package, lib.loc = lib.loc, character.only = TRUE, logical.return = TRUE, : there is no package called 'rfe' Thanks in advance for any help/suggestions, Elizabeth McClellan elizabethmcclel...@gmail.com -- Ms. Elizabeth McClellan Research Assistant Department of Statistical Science Southern Methodist University -- Ms. Elizabeth McClellan Research Assistant Department of Statistical Science Southern Methodist University [[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] Modifying a built-in R function
japal wrote: Hello, Something incredible (at least for me) has happen. Yesterday night I downloaded biplot.R to edit this function and add new features I wished. Namely I wanted to plot points belonging to different groups using different colors and symbols. I identified which part of the original code I had to modify. Then, I rename biplot by biplotes and executing biplotes(x), being x a princomp class object, the function did what I wanted. The problem is that today I type exactly the same (after sourcing my script file incluiding biplotes) but biplotes(x) execute the original biplot function. Also, if I invoke any of the new arguments I wrote in the code then multiple warnings messages are displayed. I don't understand what is the problem. Yesterday it works perfectly. Why R does not execute my code and call the original biplot function? Thanks in advance, Javier. Sorry, I did not show the code: (I have highlighted in bold the changes) *** biplotes - function(x, ...) UseMethod(biplot) biplot.default - function(x, y, color=blue, char=1, var.axes = TRUE, col, cex = rep(par(cex), 2), xlabs = NULL, ylabs = NULL, expand=1, xlim = NULL, ylim = NULL, arrow.len = 0.1, main = NULL, sub = NULL, xlab = NULL, ylab = NULL, ...) { n - nrow(x) p - nrow(y) if(missing(xlabs)) { xlabs - dimnames(x)[[1L]] if(is.null(xlabs)) xlabs - 1L:n } xlabs - as.character(xlabs) dimnames(x) - list(xlabs, dimnames(x)[[2L]]) if(missing(ylabs)) { ylabs - dimnames(y)[[1L]] if(is.null(ylabs)) ylabs - paste(Var, 1L:p) } ylabs - as.character(ylabs) dimnames(y) - list(ylabs, dimnames(y)[[2L]]) if(length(cex) == 1L) cex - c(cex, cex) if(missing(col)) { col - par(col) if (!is.numeric(col)) col - match(col, palette(), nomatch=1L) col - c(col, col + 1L) } else if(length(col) == 1L) col - c(col, col) biplot.princomp - function(x, choices = 1L:2, scale = 1, pc.biplot=FALSE, ...) { if(length(choices) != 2) stop(length of choices must be 2) if(!length(scores - x$scores)) stop(gettextf(object '%s' has no scores, deparse(substitute(x))), domain = NA) lam - x$sdev[choices] if(is.null(n - x$n.obs)) n - 1 lam - lam * sqrt(n) if(scale 0 || scale 1) warning('scale' is outside [0, 1]) if(scale != 0) lam - lam^scale else lam - 1 if(pc.biplot) lam - lam / sqrt(n) biplot.default(t(t(scores[, choices]) / lam), t(t(x$loadings[, choices]) * lam), ...) invisible() } unsigned.range - function(x) c(-abs(min(x, na.rm=TRUE)), abs(max(x, na.rm=TRUE))) rangx1 - unsigned.range(x[, 1L]) rangx2 - unsigned.range(x[, 2L]) rangy1 - unsigned.range(y[, 1L]) rangy2 - unsigned.range(y[, 2L]) if(missing(xlim) missing(ylim)) xlim - ylim - rangx1 - rangx2 - range(rangx1, rangx2) else if(missing(xlim)) xlim - rangx1 else if(missing(ylim)) ylim - rangx2 ratio - max(rangy1/rangx1, rangy2/rangx2)/expand on.exit(par(op)) op - par(pty = s) if(!is.null(main)) op - c(op, par(mar = par(mar)+c(0,0,1,0))) plot(x, type = p, xlim = xlim, ylim = ylim, col = color,pch=char,cex=0.75, #color, símbolo y tamaños de los puntos xlab = xlab, ylab = ylab, sub = sub, main = main, ...) par(new = TRUE) plot(y, axes = FALSE, type = n, xlim = xlim*ratio, ylim = ylim*ratio, xlab = , ylab = , col = col[1L], ...) #axis(3, col = col[2L], ...) #axis(4, col = col[2L], ...) #box(col = col[1L]) text(y, labels=ylabs, cex = 0.9, col = grey32, ...) if(var.axes) arrows(0, 0, y[,1L] * 0.8, y[,2L] * 0.8, col = grey32, #Arrow color length=0.07) invisible() } * Note that the problem is solved if (after sourcing the R script incluiding biplotes function to the current R session) I only copy-paste the biplot.princomp function into the R console. After this, biplotes apply my changes correctly, without invoke the original biplot function. But I think this is only a trick and not the suitable way. Thanks again. -- View this message in context: http://www.nabble.com/Modifying-a-built-in-R-function-tp22278950p22284264.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] xlsReadWrite package repository for Ubuntu
Hi, I'm trying to install R on Ubuntu. I succeeded at installing the r-recommended package that is present in the synaptics, but i can't find the xlsReadWrite package in the repositories included in my synaptics manager. Does anybody know a liable repository in which this package is present. Thanks in advance -- View this message in context: http://www.nabble.com/xlsReadWrite-package-repository-for-Ubuntu-tp22283704p22283704.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] nls does not accept start values
Hi Prof Brian Ripley rip...@stats.ox.ac.uk napsal dne 02.03.2009 10:24:52: It is not very clear what you are trying to do here, and form - structure(list(a = list(quote(y ~ 1/(a - x)), list(a=mean(y, .Names = a) is using a historic anomaly (see the help page). I am gussing you want to give nls an object containing a formula and an expression for the starting value. It seems you are re-inventing You are correct as usually. self-starting nls models: see ?selfStart and MASS$ ca p. 216. One way to use them in your example is mod - selfStart(~ 1/(a - x), function(mCall, data, LHS) { structure(mean(eval(LHS, data)), names=a) }, a) nls(y ~ mod(x, a)) But if you want to follow ypur route, youer starting values would be better to be a list that you evaluate in an appropriate context (which y is this supposed to be?). nls() knows where it will find variables, but it is not so easy for you to replicate its logic without access to its evaluation frames. It was simplified version of my problem. I want to elaborate a function which can take predefined list of formulas, some data and evaluate which formulas can fit the data. I was inspired by some article in Chemical engineering in which some guy used excel solver for such task. I was curious if I can do it in R too. I am not sure if nls is appropriate tool for such task but I had to start somewhere. Here is a function which takes list of formulas and data and gives a result for each formula. modely - function(formula, data, ...){ ll - length(formula) #no of items in formula list result2 - vector(list, ll) #prepare results result1 - rep(NA, ll) for(i in 1:ll) { fit-try(nls(formula[[i]], data)) if( class(fit)==try-error) result1[i] - NA else result1[i] - sum(resid(fit)^2) if( class(fit)==try-error) result2[[i]] - NA else result2[[i]] - coef(fit) } ooo-order(result1) #order results according to residual sum #combine results into one list together with functions used result - mapply(c, sq.resid = result1, result2) names(result) - as.character(formula) # output result[ooo] } # data x -1:10 y -1/(.5-x)+rnorm(10)/100 # list of formulas fol - structure(list(a = y ~ 1/(a - x), b = y ~ a * x^2 + b * log(x), c = y ~ x^a), .Names = c(a, b, c)) modely(fol, data.frame(x=x, y=y) does not use correct model because when using default start values it results in nls(fol[[1]], data.frame(x=x, y=y)) Error in numericDeriv(form[[3]], names(ind), env) : Missing value or an infinity produced when evaluating the model I tried to establish such structure to get more appropriate starting values list(a= list(formula1, start.formula1), b=list(formula2, start.formula2), ) But did not manage yet to get correct syntax for let say mean of response values. I try to look more closely what I can achieve with selfStart Thank you again Best regards Petr On Mon, 2 Mar 2009, Petr PIKAL wrote: Hi to all OK as I did not get any response and I really need some insight I try again with different subject line I have troubles with correct evaluating/structure of nls input Here is an example # data x -1:10 y -1/(.5-x)+rnorm(10)/100 # formula list form - structure(list(a = list(quote(y ~ 1/(a - x)), list(a=mean(y, .Names = a) # This gives me an error due to not suitable default starting value fit - nls(form [[1]] [[1]], data.frame(x=x, y=y)) # This works and gives me a result fit - nls(form [[1]] [[1]], data.frame(x=x, y=y), start=list(a=mean(y))) *** How to organise list form and call to nls to enable to use other then default starting values***. I thought about something like fit - nls(form [[1]] [[1]], data.frame(x=x, y=y), start=get(form [[1]] [[2]])) ^^^ but this gives me an error so it is not correct syntax. (BTW I tried eval, assign, sustitute, evalq and maybe some other options but did not get it right. I know I can put starting values interactively but what if I want them computed by some easy way which is specified by second part of a list, like in above example. If it matters WXP, R2.9.0 devel. Regards Petr petr.pi...@precheza.cz -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@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] Inefficiency of SAS Programming
Yes Greg, but if you're buying SAS they'll throw in IML pretty cheaply - SAS think it's only for a few nerds out there who wan to do funny stuff. G Greg Snow greg.s...@imail. org To Sent by: Gerard M. Keogh r-help-boun...@r- gmke...@justice.ie, Frank E project.org Harrell Jr f.harr...@vanderbilt.edu cc 27/02/2009 19:05 r-help-boun...@r-project.org r-help-boun...@r-project.org, R list r-h...@stat.math.ethz.ch Subject Re: [R] Inefficiency of SAS Programming But SAS/IML is not part of base SAS, it costs extra, so there is a good chance that a user that has SAS will not be able to run code that uses SAS/IML. I have known of SAS programmers who know IML well that still write matrix/vector tools using macros or proc transpose so that a user without IML can still use the code (the fact that the code that started this thread was found on a website, suggests that it was meant for general use rather than something only used internally where you know what add-ons will be available). Just another way that R makes life easier for both programmer and user. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- project.org] On Behalf Of Gerard M. Keogh Sent: Friday, February 27, 2009 7:19 AM To: Frank E Harrell Jr Cc: r-help-boun...@r-project.org; R list Subject: Re: [R] Inefficiency of SAS Programming Yes Frank, I accept your point but nevertheless IML is the proper place for matrix work in SAS - mixing macro-level logic and computation is another question - R is certainly more seemless in this respect. Gerard Frank E Harrell Jr f.harr...@vander To bilt.edu Gerard M. Keogh gmke...@justice.ie 27/02/2009 13:55 cc R list r- h...@stat.math.ethz.ch, r-help-boun...@r-project.org Subject Re: [R] Inefficiency of SAS Programming Gerard M. Keogh wrote: Frank, I can't see the code you mention - Web marshall at work - but I don't think you should be too quick to run down SAS - it's a powerful and flexible language but unfortunately very expensive. Your example mentions doing a vector product in the macro language - this only suggest to me that those people writing the code need a crash course in SAS/IML (the matrix language). SAS is designed to work on records and so is inapproprorriate for matrices - macros are only an efficient code copying device. Doing matrix computations in this way is pretty mad and the code would be impossible never mind the memory problems. SAS recognise that but a lot of SAS users remain familiar with IML. In IML by contrast there are inner, cross and outer products and a raft of other useful methods for matrix work that R users would be familiar with. OLS for example is one line: b = solve(X`X, X`y) ; rss = sqrt(ssq(y - Xb)) ; And to give you a flavour of IML's capabilities I implemented a SAS version of the MARS program in it about 6 or 7 years ago. BTW SPSS also has a matrix language. Gerard But try this: PROC IML; ... some custom user code ... ... loop over j=1 to 10 ... ... PROC GENMOD, output results back to IML ... IML is only a partial solution since it is not integrated with the PROC step. Frank Frank E Harrell Jr f.harr...@vander To
Re: [R] handle graph size in eps
On Mon, 2 Mar 2009, Benoit Boulinguiez wrote: Hi all, I've got a density graph made with the following commands: win.graph(width=13,height=6) The preferred name is windows(). par ( fin=c(13,3) ,mai=c(1,1,0.5,0.5) ,mfrow=c(1,2) ,cex.axis=1.5 ,cex.lab=1.5) dens-density(DATA1.y[2,]-mean(DATA1.y[2,]),kernel=gaussian) xlimit-range(dens$x) ylimit-range(dens$y) hist( DATA1.y[2,]-mean(DATA1.y[2,]) ,xlim=1.1*xlimit ,xlab=expression(q[e]) ,ylim=1.1*ylimit ,probability=T ,main=Random distribution around y) lines(dens,col=2,) rm(dens,xlimit,ylimit) qqnorm(DATA1.x[1,]) that's what I've on the screen and I'm OK with that. http://www.4shared.com/file/90283562/9f27d83b/screen.html When I save the graph in eps format How exactly? I know at least three ways to do that. I am guessing that as you didn't tell us you were on Windows, you also didn't tell us that you used the menu on the windows() device, but these details do matter. I've got that http://www.4shared.com/file/90283115/490b7383/density_v_1.html what am I doing wrong? Not telling us what you don't like about this plot. I think you should consider using dev.copy2eps(), which will give you more control. Or even better, calling postscript() directly. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@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] Adjusting confidence intervals for paired t-tests of multiple endpoints
Thanks, this comes close to what I need, but the problem is that I have repeated measures in each comparison and SimComp does not seem to handle this. In my experiments, each subject received both placebo and the drug in a randomized order. So, I want to do multiple paired t-test corrected for multiple comparisons. I'm primarily interested in the corrected confidence intervals because I want to plot the mean differences with it. Regards, Erich -Ursprüngliche Nachricht- Von: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Im Auftrag von Mark Difford Gesendet: Montag, 2. März 2009 08:34 An: r-help@r-project.org Betreff: Re: [R] Adjusting confidence intervals for pairedt-tests of multiple endpoints Hi Erich, Look at the SimComp package, which handles multiple endpoints, i.e. columns of response variables. Ratio-comparisons are also handled. Good ready-made range of comparisons; you can also set up your own. Regards, Mark. Erich Studerus wrote: Johannes Huesing johan...@huesing.name wrote: Couldn't you re-phrase your model by including timepoint as a continuous regressor and scale as a factor? Well, the measuring time points are 70 170, 300 and 1440 minutes after drug intake. Since the influence of time is cerainly not linear, I think it's better to treat it as categorical factor. In fact, I already calculated mixed effects models with the four-level factor time and the two-level factor treatment and random effects factors subjects (nested in studies) and studies for each scale. I used mixed effects models, because I'm doing a meta-analysis on the raw data of 8 studies. Thus my dataset has not only a grouping structure, but is also unbalanced (not all studies did 4 measurements). I'm not sure, if I could extend my model by including another factor for scale, since these scales measure quite different things. I guess, It would be also very difficult the set up appropriate contrasts to compare each scale on each measuring time point. __ 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/Adjusting-confidence-intervals-for-paired-t-tests-of-m ultiple-endpoints-tp22247598p22283385.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-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-code help for filtering with for loop
Dear Sir / Madam, I am new for R coding. Kindly help me out in sorting out the following problem. There are 50 rows with six coloumns(you could see in the attached .txt file). I wish to go for filtering this 50 rows for any one of the six coloumns satisfying the value = 64. I need to have a final table with rows having = 64 value in any one of the six coloumns and the rest could be =64. For this purpose I use the following R code; --- datax-read.table(filter_test.txt,row.names=1,sep=\t,header=TRUE,dec = .,as.is =TRUE,na.strings = NA, colClasses = NA,check.names = FALSE,strip.white = FALSE, blank.lines.skip = TRUE, allowEscapes = FALSE, flush = FALSE,encoding = unknown) filter-datax[,1:6] filtered-vector() for(i in 1:(dim(filter)[1])) { for(j in 1:(dim(filter)[2])) { x=(filter[i,j])=64 filtered[i]-x } } # summing the result of the above sum(filtered) which(filtered) z-which(filtered) filereddata-filter[z,] write.table(filtereddata,file =filterdgenes.txt,quote = TRUE, sep = \t , dec = .,row.names=T,col.names = NA, qmethod = c (escape, double)) --- There is something is missing in my coding therefore the filteration is done according to the value of the last column that is the sixth coloumn value not takiing into consideration the rest of the coloumns. For example with the table in .txt file I have attached, the first coloumn has 29 rows having values = 64 but the last coloumn has only 25 rows. The filtered list should have around 29 rows but only 25 since the coding has considered only the last coloumn. How to sort out this problem. Kindly help me out. Thanking in advance, With Regards, antony -- Thony University of Cologne 50931 Cologne/Germany Tel: 004922125918042 Handy: 004917683142627 __ 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] xlsReadWrite package repository for Ubuntu
On Mon, 2 Mar 2009, reverend33 wrote: Hi, I'm trying to install R on Ubuntu. I succeeded at installing the r-recommended package that is present in the synaptics, but i can't find the xlsReadWrite package in the repositories included in my synaptics manager. Does anybody know a liable repository in which this package is present. The CRAN Windows ones. It is a windows-only package, see http://cran.r-project.org/web/packages/xlsReadWrite/index.html (incidentally to you: it seems no longer maintained and does not build under R-devel on Windows, see http://cran.r-project.org/bin/windows/contrib/2.9/check/xlsReadWrite-check.log The maintainer has not responded to requests for a fix.) -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@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] Can no longer use resize graphics X windows
Hi, I use the ubuntu deb packages for R. In previous versions of R I could resize the graphics windows by dragging the bottom corner, but now I can't. Anyone got any idea why this has happened and whether it is possible to change it back? Dan -- ** Daniel Brewer, Ph.D. Institute of Cancer Research Molecular Carcinogenesis Email: daniel.bre...@icr.ac.uk ** The Institute of Cancer Research: Royal Cancer Hospital, a charitable Company Limited by Guarantee, Registered in England under Company No. 534147 with its Registered Office at 123 Old Brompton Road, London SW7 3RP. This e-mail message is confidential and for use by the a...{{dropped:2}} __ 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] Distance between clusters
Dear friends I reformulate the question. I think I did not formulate it properly. I have some data on some sites. I can define a dissimilarity between each pair of sites. Using this dissimilarity, I have clustered the sites using the hclust algorithm, with method ward. I then obtain 48 clusters, by cutting the tree using cutree with k=48. I would now like to estimate the distance between each pair of the 48 resulting clusters. I have read the documentation, but I cannot find a solution. Any clue on how I can do that? This is a snippet of the code: distPredTurn-as.dist(dissimilarityMatrix) hctr-hclust(distPredTurn,ward) cutree(hctr,k=48) Regards -- Corrado Topi Global Climate Change Biodiversity Indicators Area 18,Department of Biology University of York, York, YO10 5YW, UK Phone: + 44 (0) 1904 328645, E-mail: ct...@york.ac.uk __ 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] Modifying a built-in R function
I am not sure what you intended by biplotes - function(x, ...) UseMethod(biplot) That does nothing different from biplot(). You need to call your modified functions 'biplotes.default' and 'biplotes.princomp' and call those via biplotes - function(x, ...) UseMethod(biplotes) Anything else depends on the scoping rules for S3 methods, and those are too complex to rely on with multiple objects of the same name -- but if your biplot.default is visible from where biplotes is called, I would expect it to be used. There are good reasons why the posting guide and message footers asks for reproducible examples -- otherwise, as here, we are left to guess. On Mon, 2 Mar 2009, japal wrote: japal wrote: Hello, Something incredible (at least for me) has happen. Yesterday night I downloaded biplot.R to edit this function and add new features I wished. Namely I wanted to plot points belonging to different groups using different colors and symbols. I identified which part of the original code I had to modify. Then, I rename biplot by biplotes and executing biplotes(x), being x a princomp class object, the function did what I wanted. The problem is that today I type exactly the same (after sourcing my script file incluiding biplotes) but biplotes(x) execute the original biplot function. Also, if I invoke any of the new arguments I wrote in the code then multiple warnings messages are displayed. I don't understand what is the problem. Yesterday it works perfectly. Why R does not execute my code and call the original biplot function? Thanks in advance, Javier. Sorry, I did not show the code: (I have highlighted in bold the changes) Highlighting does not work in plain text, all you were asked to send. *** biplotes - function(x, ...) UseMethod(biplot) biplot.default - function(x, y, color=blue, char=1, var.axes = TRUE, col, cex = rep(par(cex), 2), xlabs = NULL, ylabs = NULL, expand=1, xlim = NULL, ylim = NULL, arrow.len = 0.1, main = NULL, sub = NULL, xlab = NULL, ylab = NULL, ...) { n - nrow(x) p - nrow(y) if(missing(xlabs)) { xlabs - dimnames(x)[[1L]] if(is.null(xlabs)) xlabs - 1L:n } xlabs - as.character(xlabs) dimnames(x) - list(xlabs, dimnames(x)[[2L]]) if(missing(ylabs)) { ylabs - dimnames(y)[[1L]] if(is.null(ylabs)) ylabs - paste(Var, 1L:p) } ylabs - as.character(ylabs) dimnames(y) - list(ylabs, dimnames(y)[[2L]]) if(length(cex) == 1L) cex - c(cex, cex) if(missing(col)) { col - par(col) if (!is.numeric(col)) col - match(col, palette(), nomatch=1L) col - c(col, col + 1L) } else if(length(col) == 1L) col - c(col, col) biplot.princomp - function(x, choices = 1L:2, scale = 1, pc.biplot=FALSE, ...) { if(length(choices) != 2) stop(length of choices must be 2) if(!length(scores - x$scores)) stop(gettextf(object '%s' has no scores, deparse(substitute(x))), domain = NA) lam - x$sdev[choices] if(is.null(n - x$n.obs)) n - 1 lam - lam * sqrt(n) if(scale 0 || scale 1) warning('scale' is outside [0, 1]) if(scale != 0) lam - lam^scale else lam - 1 if(pc.biplot) lam - lam / sqrt(n) biplot.default(t(t(scores[, choices]) / lam), t(t(x$loadings[, choices]) * lam), ...) invisible() } unsigned.range - function(x) c(-abs(min(x, na.rm=TRUE)), abs(max(x, na.rm=TRUE))) rangx1 - unsigned.range(x[, 1L]) rangx2 - unsigned.range(x[, 2L]) rangy1 - unsigned.range(y[, 1L]) rangy2 - unsigned.range(y[, 2L]) if(missing(xlim) missing(ylim)) xlim - ylim - rangx1 - rangx2 - range(rangx1, rangx2) else if(missing(xlim)) xlim - rangx1 else if(missing(ylim)) ylim - rangx2 ratio - max(rangy1/rangx1, rangy2/rangx2)/expand on.exit(par(op)) op - par(pty = s) if(!is.null(main)) op - c(op, par(mar = par(mar)+c(0,0,1,0))) plot(x, type = p, xlim = xlim, ylim = ylim, col = color,pch=char,cex=0.75, #color, símbolo y tamaños de los puntos xlab = xlab, ylab = ylab, sub = sub, main = main, ...) par(new = TRUE) plot(y, axes = FALSE, type = n, xlim = xlim*ratio, ylim = ylim*ratio, xlab = , ylab = , col = col[1L], ...) #axis(3, col = col[2L], ...) #axis(4, col = col[2L], ...) #box(col = col[1L]) text(y, labels=ylabs, cex = 0.9, col = grey32, ...) if(var.axes) arrows(0, 0, y[,1L] * 0.8, y[,2L] * 0.8, col = grey32, #Arrow color length=0.07) invisible() } * Note that the problem is solved if (after sourcing the R script incluiding biplotes function to the current R session) I only copy-paste the biplot.princomp function into the R console. After this, biplotes apply my changes correctly, without invoke the original biplot function. But I think this is only a trick and not the suitable way. Thanks again. -- View this message in context: http://www.nabble.com/Modifying-a-built-in-R-function-tp22278950p22284264.html
Re: [R] xlsReadWrite package repository for Ubuntu
reverend33 wrote: Hi, I'm trying to install R on Ubuntu. I succeeded at installing the r-recommended package that is present in the synaptics, but i can't find the xlsReadWrite package in the repositories included in my synaptics manager. Does anybody know a liable repository in which this package is present. If you consider the CRAN master to be liable, it tells you for xlsReadWrite: OS_type:windows Moreover it tells you that the package's status for R-devel is ERROR. Uwe Ligges Thanks in advance __ 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] Using very large matrix
Thanks a lot! Unfortunately, the R package I have to sue for my research was only released on 32 bit R on 32 bit MS Windows and only closed source I normally use 64 bit R on 64 bit Linux :) I tried to use the bigmemory in cran with 32 bit windows, but I had some serious problems. Best, On Thursday 26 February 2009 15:43:11 Jay Emerson wrote: Corrado, Package bigmemory has undergone a major re-engineering and will be available soon (available now in Beta version upon request). The version currently on CRAN is probably of limited use unless you're in Linux. bigmemory may be useful to you for data management, at the very least, where x - filebacked.big.matrix(8, 8, init=n, type=double) would accomplish what you want using filebacking (disk space) to hold the object. But even this requires 64-bit R (Linux or Mac, or perhaps a Beta version of Windows 64-bit R that REvolution Computing is working on). Subsequent operations (e.g. extraction of a small portion for analysis) are then easy enough: y - x[1,] would give you the first row of x as an object y in R. Note that x is not itself an R matrix, and most existing R analytics can't work on x directly (and would max out the RAM if they tried, anyway). Feel free to email me for more information (and this invitation applies to anyone who is interested in this). Cheers, Jay #Dear friends, # #I have to use a very large matrix. Something of the sort of #matrix(8,8,n) where n is something numeric of the sort 0.xx # #I have not found a way of doing it. I keep getting the error # #Error in matrix(nrow = 8, ncol = 8, 0.2) : too many elements specified # #Any suggestions? I have searched the mailing list, but to no avail. # #Best, #-- #Corrado Topi # #Global Climate Change Biodiversity Indicators #Area 18,Department of Biology #University of York, York, YO10 5YW, UK #Phone: + 44 (0) 1904 328645, E-mail: ct...@york.ac.uk -- Corrado Topi Global Climate Change Biodiversity Indicators Area 18,Department of Biology University of York, York, YO10 5YW, UK Phone: + 44 (0) 1904 328645, E-mail: ct...@york.ac.uk __ 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-code help for filtering with for loop
Dear John, It looks like you are stuck in both the second and the third circle of the R inferno (http://www.burns-stat.com/pages/Tutor/R_inferno.pdf) You problem is easy to vectorise. #could the number of columns = 64 in each row NumCols - rowSums(datax = 64) #select rows with at least one column = 64 datax[NumCols = 1, ] HTH, Thierry ir. Thierry Onkelinx Instituut voor natuur- en bosonderzoek / Research Institute for Nature and Forest Cel biometrie, methodologie en kwaliteitszorg / Section biometrics, methodology and quality assurance Gaverstraat 4 9500 Geraardsbergen Belgium tel. + 32 54/436 185 thierry.onkel...@inbo.be www.inbo.be To call in the statistician after the experiment is done may be no more than asking him to perform a post-mortem examination: he may be able to say what the experiment died of. ~ Sir Ronald Aylmer Fisher The plural of anecdote is not data. ~ Roger Brinner The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. ~ John Tukey -Oorspronkelijk bericht- Van: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Namens John Antonydas Gaspar Verzonden: maandag 2 maart 2009 11:31 Aan: r-help@r-project.org Onderwerp: [R] R-code help for filtering with for loop Dear Sir / Madam, I am new for R coding. Kindly help me out in sorting out the following problem. There are 50 rows with six coloumns(you could see in the attached .txt file). I wish to go for filtering this 50 rows for any one of the six coloumns satisfying the value = 64. I need to have a final table with rows having = 64 value in any one of the six coloumns and the rest could be =64. For this purpose I use the following R code; --- datax-read.table(filter_test.txt,row.names=1,sep=\t,header=TRUE,dec = .,as.is =TRUE,na.strings = NA, colClasses = NA,check.names = FALSE,strip.white = FALSE, blank.lines.skip = TRUE, allowEscapes = FALSE, flush = FALSE,encoding = unknown) filter-datax[,1:6] filtered-vector() for(i in 1:(dim(filter)[1])) { for(j in 1:(dim(filter)[2])) { x=(filter[i,j])=64 filtered[i]-x } } # summing the result of the above sum(filtered) which(filtered) z-which(filtered) filereddata-filter[z,] write.table(filtereddata,file =filterdgenes.txt,quote = TRUE, sep = \t , dec = .,row.names=T,col.names = NA, qmethod = c (escape, double)) --- There is something is missing in my coding therefore the filteration is done according to the value of the last column that is the sixth coloumn value not takiing into consideration the rest of the coloumns. For example with the table in .txt file I have attached, the first coloumn has 29 rows having values = 64 but the last coloumn has only 25 rows. The filtered list should have around 29 rows but only 25 since the coding has considered only the last coloumn. How to sort out this problem. Kindly help me out. Thanking in advance, With Regards, antony -- Thony University of Cologne 50931 Cologne/Germany Tel: 004922125918042 Handy: 004917683142627 Dit bericht en eventuele bijlagen geven enkel de visie van de schrijver weer en binden het INBO onder geen enkel beding, zolang dit bericht niet bevestigd is door een geldig ondertekend document. The views expressed in this message and any annex are purely those of the writer and may not be regarded as stating an official position of INBO, as long as the message is not confirmed by a duly signed document. __ 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] Inefficiency of SAS Programming
R depends on all of those things to run, but you only have to use those programs through R. The software depends on these other tools, but the human doesn't have to switch interfaces. Tom! On Fri, Feb 27, 2009 at 9:22 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Fri, Feb 27, 2009 at 8:53 AM, Frank E Harrell Jr f.harr...@vanderbilt.edu wrote: Ajay ohri wrote: Sometimes for the sake of simplicity, SAS coding is created like that. One can use the concatenate function and drag and drop in an simple excel sheet for creating elaborate SAS code like the one mentioned and without any time at all. A system that requires Excel for its success is not a complete system. To be fair R depends on perl (although this dependence seems to be decreasing lately and possibly will be eliminated), latex and a bunch of unix tools. Developing GUIs depends on tcl/tk or other external system and developing fast code can require that some of it be written in C. __ 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. [[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] Need help extracting info from XML file using XML package
Hi, You also might want to check R4X: # install.packages(R4X, repos=http://R-Forge.R-project.org;) require( R4X ) x - xml(http://code.google.com/apis/kml/documentation/KML_Samples.kml;) coords - x[Polygon///coordinates/# ] data - sapply( strsplit( coords, (,|\\s+) ), as.numeric ) Romain -- Romain Francois Independent R Consultant +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr Wacek Kusnierczyk wrote: Don MacQueen wrote: I have an XML file that has within it the coordinates of some polygons that I would like to extract and use in R. The polygons are nested rather deeply. For example, I found by trial and error that I can extract the coordinates of one of them using functions from the XML package: doc - xmlInternalTreeParse('doc.kml') docroot - xmlRoot(doc) pgon - try lapply( xpathSApply(doc, '//Polygon', xpathSApply, '//coordinates', function(node) strsplit(xmlValue(node), split=',|\\s+')), as.numeric) which should find all polygon nodes, extract the coordinates node for each polygon separately, split the coordinates string by comma and convert to a numeric vector, and then report a list of such vectors, one vector per polygon. i've tried it on some dummy data made up from your example below. the xpath patterns may need to be adjusted, depending on the actual structure of your xml file, as may the strsplit pattern. vQ but this is hardly general! I'm hoping there is some relatively straightforward way to use functions from the XML package to recursively descend the structure and return the text strings representing the polygons into, say, a list with as many elements as there are polygons. I've been looking at several XML documentation files downloaded from http://www.omegahat.org/RSXML/ , but since my understanding of XML is weak at best, I'm having trouble. I can deal with converting the text strings to an R object suitable for plotting etc. Here's a look at the structure of this file graphics[5]% grep Polygon doc.kml Polygon id=15342 /Polygon Polygon id=1073 /Polygon Polygon id=16508 /Polygon Polygon id=18665 /Polygon Polygon id=32903 /Polygon Polygon id=5232 /Polygon And each of the Polygon /Polygon pairs has coordinates as per this example: Polygon id=15342 outerBoundaryIs LinearRing id=11467 coordinates -23.679835352296,30.263840290388,5.001 -23.68138782285701,30.264740875186,5.001 [snip] -23.679835352296,30.263840290388,5.001 -23.679835352296,30.263840290388,5.001 /coordinates /LinearRing /outerBoundaryIs /Polygon Thanks! -Don p.s. There is a lot of other stuff in this file, i.e, some points, and attributes of the points such as color, as well as a legend describing what the polygons mean, but I can get by without all that stuff, at least for now. Note also that readOGR() would in principle work, but the underlying OGR libraries have some limitations that this file exceeds. Per info at http://www.gdal.org/ogr/drv_kml.html. __ 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] RES: object .trPaths not found
Did you do the configuration of Tinn-R after the installation? Atenciosamente, Leandro Lins Marino Centro de Avaliação Fundação CESGRANRIO Rua Santa Alexandrina, 1011 - 2º andar Rio de Janeiro, RJ - CEP: 20261-903 R (21) 2103-9600 R.:236 ( (21) 8777-7907 ( lean...@cesgranrio.org.br Aquele que suporta o peso da sociedade é precisamente aquele que obtém as menores vantagens. (SMITH, Adam) Antes de imprimir pense em sua responsabilidade e compromisso com o MEIO AMBIENTE -Mensagem original- De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em nome de Uwe Ligges Enviada em: sábado, 28 de fevereiro de 2009 16:34 Para: rkevinbur...@charter.net Cc: R help Assunto: Re: [R] object .trPaths not found rkevinbur...@charter.net wrote: I am running an R script with Tinn-R (2.2.0.1) and I get the error message Error in source(.trPaths[4], echo = TRUE, max.deparse.length = 150) : object .trPaths not found Any solutions? Maybe, but the may depend on your script, your OS, your R version, used packages and so on. Hence please read and follow the posting guide and provide commented, minimal, self-contained, reproducible code. Uwe Ligges Thank you. Kevin __ 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.
[R] density 1?
Dear R-Gurus, I wonder why 'density' values as shown in hist or plot(density(x)) are sometimes over 1. How can that be? Example hist(rnorm(1000,sd=.5),freq=FALSE) The resulting plot shows density values below 1 on the y-axis. However, hist(rnorm(1000,sd=.1),freq=FALSE) shows density values over 1. How to interpret density values over 1? Greetings, Johannes __ 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] Need help extracting info from XML file using XML package
Romain Francois wrote: Hi, You also might want to check R4X: # install.packages(R4X, repos=http://R-Forge.R-project.org;) require( R4X ) x - xml(http://code.google.com/apis/kml/documentation/KML_Samples.kml;) coords - x[Polygon///coordinates/# ] data - sapply( strsplit( coords, (,|\\s+) ), as.numeric ) Romain With a bit more formatting : # install.packages(R4X, repos=http://R-Forge.R-project.org;) require( R4X ) x - xml(http://code.google.com/apis/kml/documentation/KML_Samples.kml;) coords - x[Polygon///coordinates/# ] data - lapply( strsplit( coords, (,|\\s+) ), function(.){ out - matrix( as.numeric(.), ncol = 3, byrow = TRUE ) colnames( out ) - c(longitude, lattitude, altitude ) out }) names( data ) - x[//Placemark/name/# ] Romain -- Romain Francois Independent R Consultant +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr __ 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] density 1?
Because densities are not probabilities. It is the area under the density curve that represents probability. Example: the chi-squared density with 1 degree of freedom has a singularity at the zero and is unbounded. The area under the curve, however, is still 1. (This is a distressingly common misconception. It is really not an R issue but a distribution theory issue.) Bill Venables From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Johannes Elias [jel...@hygiene.uni-wuerzburg.de] Sent: 02 March 2009 22:27 To: r-help@r-project.org Subject: [R] density 1? Dear R-Gurus, I wonder why 'density' values as shown in hist or plot(density(x)) are sometimes over 1. How can that be? Example hist(rnorm(1000,sd=.5),freq=FALSE) The resulting plot shows density values below 1 on the y-axis. However, hist(rnorm(1000,sd=.1),freq=FALSE) shows density values over 1. How to interpret density values over 1? Greetings, Johannes __ 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] density 1?
Hi Johannes, ist more a statistical issue. In short: densities are not probabilities! With a continuous random variable probability statements are typically over intervals not over points. A density is bound to have an integral of 1 (and to be non-negative), nothing else. Consider the uniform (0,0.5) distribution there the density is f(x)=2 for all 0=x=0.5. This is a perfect probability density having all non-zero values 1. hth. Johannes Elias schrieb: Dear R-Gurus, I wonder why 'density' values as shown in hist or plot(density(x)) are sometimes over 1. How can that be? Example hist(rnorm(1000,sd=.5),freq=FALSE) The resulting plot shows density values below 1 on the y-axis. However, hist(rnorm(1000,sd=.1),freq=FALSE) shows density values over 1. How to interpret density values over 1? Greetings, Johannes __ 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. -- Eik Vettorazzi Institut für Medizinische Biometrie und Epidemiologie Universitätsklinikum Hamburg-Eppendorf Martinistr. 52 20246 Hamburg T ++49/40/42803-8243 F ++49/40/42803-7790 __ 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] density 1?
Johannes Elias wrote: Dear R-Gurus, I wonder why 'density' values as shown in hist or plot(density(x)) are sometimes over 1. How can that be? Example hist(rnorm(1000,sd=.5),freq=FALSE) The resulting plot shows density values below 1 on the y-axis. However, hist(rnorm(1000,sd=.1),freq=FALSE) shows density values over 1. How to interpret density values over 1? This comes up every now and again. The real question is: Why do people believe that densities should be probabilities? They're not, they denote (differential) probability per unit on the x axis, and the denominator can be small. The density _integrates_ to 1, so if e.g. it is concentrated on (0, 0.5) if has to be at least 2 somewhere. Greetings, Johannes __ 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. -- 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 ~~ - (p.dalga...@biostat.ku.dk) 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.
Re: [R] ave and grouping
Try performing ave over the indexes rather than over extra itself: sleep$newcol - with(sleep, ave(1:nrow(sleep), group, FUN = function(ix) extra[b[ix][1]])) On Mon, Mar 2, 2009 at 4:28 AM, Patrick Hausmann patrick.hausm...@uni-bremen.de wrote: Dear list, # I have a DF like this: sleep$b - c(rep(8,10), rep(9,10)) sleep$me - with(sleep, ave(extra, group, FUN = mean)) sleep # I would like to create a new variable # holding the b-th value of group 1 and 2. # This is not what I want, it takes always the '8' from group '1' # and not the '9' sleep$gr - with(sleep, ave(extra, group, FUN = function(x) x[ b[1] ])) sleep Thanks for any help! Patrick __ 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] ave and grouping
Patrick Hausmann Patrick.Hausmann at uni-bremen.de writes: # I have a DF like this: sleep$b - c(rep(8,10), rep(9,10)) sleep$me - with(sleep, ave(extra, group, FUN = mean)) sleep # I would like to create a new variable # holding the b-th value of group 1 and 2. # This is not what I want, it takes always the '8' from group '1' # and not the '9' sleep$gr - with(sleep, ave(extra, group, FUN = function(x) x[ b[1] ])) sleep Nice example, but I don't fully understand what you want. sleep$b[1] 8 Or could it be that you got into the factor-trap? Try R-FAQ How-do-I-convert-factors-to-numeric_003f Dieter __ 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 normalize to a set of internal references
Waverley wrote: Thanks for the advice. My question is more on how to do this? Let me use a biology gene analysis example to illustrate: In biology, there are always some house keeping genes which differ little even at pathological conditions. We know that at different batches, there are external factors affect the measurements. For example, overall signal intensity might be different due to lab reagents. A simplified picture: Day 1: Using control samples, I have measured #1 to #110 genes and get data. Day 2: Using disease samples, I have measured again #1 to #110 genes and get data. For those two data sets, I noticed the overall signal intensity in Day 1, for each gene, is more than Day 2. I know, from biological literature, gene 101 to 110, are house keeping genes, should not change much between disease and control. My questions arise, technically, how do I use gene 101 to 110 values to adjust the signals of gene 1 to 100 such that the batch effect can be corrected. The differences revealing from the comparative analysis of 1 ~ 100 genes between disease and control are due to biology rather than lab artifacts. So the question is how to do that mathematically? If I have only one house keeping gene, then I can divide every gene to that to normalize, then compare. But now I have 10 genes which can be utilized for normalization. I assume, the more reference genes to be used, the better, under this context. Can you help again? Thanks much in advance. That is an inappropriate experimental design that has caused major problems in the biomedical research literature (look up the famous Petricoin fiasco - google for petricoin baggerly; Baggerly discovered the error). You have day and disease completely confounded and no model can correct for that (day and disease are completely collinear). Once you randomize the order of samples to be run and analyzed, you can include day as a blocking factor to adjust for any day effect. If analyzing log intensity, the regression adjustment for day will involve a ratio correction on the original scale. If you are completely correct that the housekeeping genes cannot be disease-related, there is hope for some kind of internal control if you make a strong assumption about the time effect being the same for housekeeping genes as for other genes. But why not just do the proper design? Frank Waverley wrote: Hi, I have a question of the method as how to normalize the data sets according to a set of the internal measurements. For example, I have performed two batches of experiments contrasting two different conditions (positive versus negative conditions): one at a time. 1. each experiment, I measure signals of variable v1 to v100. I want to understand v1 to v100 change under these two contrasting conditions 2. Also I know different variables v101 to v1110, total of 10 of them, although they are different from each other, but they would of the same or similar values under these two contrasting conditions 3. How do I do the internal normalization? How can I use the the variable v101 to v110 values to normalize the measures of v1 to v100 at either positive or negative condition to minimize batch effect? I hope the comparisons of values (v1 to v100) between two different conditions can be more accurate and robust to external noises. In general, I have a couple of matrices of the same dimensions and a reference matrix of values to be used as reference values to be normalize to. How should I do that? I don't understand your problem well, but in general internal normalization is by and large an attempt to avoid appropriate modeling (e.g., incorporating block effects or certain covariates in a regression model), and results in overstated confidence of the final estimates by not taking into account the imprecision in the normalizing factors. Frank -- 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] ave and grouping
There was an error in the line below. It should have been the following (i.e. the ix in extra[ix] was missing): sleep$newcol - with(sleep, ave(1:nrow(sleep), group, FUN = function(ix) extra[ix][b[ix][1]])) On Mon, Mar 2, 2009 at 8:01 AM, Gabor Grothendieck ggrothendi...@gmail.com wrote: Try performing ave over the indexes rather than over extra itself: sleep$newcol - with(sleep, ave(1:nrow(sleep), group, FUN = function(ix) extra[b[ix][1]])) On Mon, Mar 2, 2009 at 4:28 AM, Patrick Hausmann patrick.hausm...@uni-bremen.de wrote: Dear list, # I have a DF like this: sleep$b - c(rep(8,10), rep(9,10)) sleep$me - with(sleep, ave(extra, group, FUN = mean)) sleep # I would like to create a new variable # holding the b-th value of group 1 and 2. # This is not what I want, it takes always the '8' from group '1' # and not the '9' sleep$gr - with(sleep, ave(extra, group, FUN = function(x) x[ b[1] ])) sleep Thanks for any help! Patrick __ 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] Need help extracting info from XML file using XML package
Wacek Kusnierczyk wrote: Don MacQueen wrote: I have an XML file that has within it the coordinates of some polygons that I would like to extract and use in R. The polygons are nested rather deeply. For example, I found by trial and error that I can extract the coordinates of one of them using functions from the XML package: doc - xmlInternalTreeParse('doc.kml') docroot - xmlRoot(doc) pgon - try lapply( xpathSApply(doc, '//Polygon', xpathSApply, '//coordinates', function(node) strsplit(xmlValue(node), split=',|\\s+')), as.numeric) Just for the record, I the xpath expression in the second xpathSApply would need to be .//coordinates to start searching from the previously matched Polygon node. Otherwise, the search starts from the top of the document again. However, it would seem that xpathSApply(doc, //Polygon//coordinates, function(node) strsplit(.)) would be more direct, i.e. fetch the coordinates nodes in single XPath expression. D. which should find all polygon nodes, extract the coordinates node for each polygon separately, split the coordinates string by comma and convert to a numeric vector, and then report a list of such vectors, one vector per polygon. i've tried it on some dummy data made up from your example below. the xpath patterns may need to be adjusted, depending on the actual structure of your xml file, as may the strsplit pattern. vQ but this is hardly general! I'm hoping there is some relatively straightforward way to use functions from the XML package to recursively descend the structure and return the text strings representing the polygons into, say, a list with as many elements as there are polygons. I've been looking at several XML documentation files downloaded from http://www.omegahat.org/RSXML/ , but since my understanding of XML is weak at best, I'm having trouble. I can deal with converting the text strings to an R object suitable for plotting etc. Here's a look at the structure of this file graphics[5]% grep Polygon doc.kml Polygon id=15342 /Polygon Polygon id=1073 /Polygon Polygon id=16508 /Polygon Polygon id=18665 /Polygon Polygon id=32903 /Polygon Polygon id=5232 /Polygon And each of the Polygon /Polygon pairs has coordinates as per this example: Polygon id=15342 outerBoundaryIs LinearRing id=11467 coordinates -23.679835352296,30.263840290388,5.001 -23.68138782285701,30.264740875186,5.001 [snip] -23.679835352296,30.263840290388,5.001 -23.679835352296,30.263840290388,5.001 /coordinates /LinearRing /outerBoundaryIs /Polygon Thanks! -Don p.s. There is a lot of other stuff in this file, i.e, some points, and attributes of the points such as color, as well as a legend describing what the polygons mean, but I can get by without all that stuff, at least for now. Note also that readOGR() would in principle work, but the underlying OGR libraries have some limitations that this file exceeds. Per info at http://www.gdal.org/ogr/drv_kml.html. __ 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] Inefficiency of SAS Programming
On 3/2/2009 6:57 AM, Thomas Levine wrote: R depends on all of those things to run, but you only have to use those programs through R. The software depends on these other tools, but the human doesn't have to switch interfaces. In fact, it doesn't even depend on them to run. Most Windows users don't have perl, latex, any of the unix tools, an external tcl/tk system (R includes one), or a C compiler. (Most *nix users have them, but don't need them for running R, with the exception of tcl/tk, which is used by a number of packages.) You only need them to build packages, or to build R. Duncan Murdoch Tom! On Fri, Feb 27, 2009 at 9:22 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Fri, Feb 27, 2009 at 8:53 AM, Frank E Harrell Jr f.harr...@vanderbilt.edu wrote: Ajay ohri wrote: Sometimes for the sake of simplicity, SAS coding is created like that. One can use the concatenate function and drag and drop in an simple excel sheet for creating elaborate SAS code like the one mentioned and without any time at all. A system that requires Excel for its success is not a complete system. To be fair R depends on perl (although this dependence seems to be decreasing lately and possibly will be eliminated), latex and a bunch of unix tools. Developing GUIs depends on tcl/tk or other external system and developing fast code can require that some of it be written in C. __ 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. [[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] Inefficiency of SAS Programming
If you want to write Sweave reports you have to learn latex and R does not hide that from you. This situation is somewhat better for tcltk, especially if you use one of the higher level wrapper packages that use it, but for serious work directly with it you need tcl/tk materials. On Mon, Mar 2, 2009 at 6:57 AM, Thomas Levine thomas.lev...@gmail.com wrote: R depends on all of those things to run, but you only have to use those programs through R. The software depends on these other tools, but the human doesn't have to switch interfaces. Tom! On Fri, Feb 27, 2009 at 9:22 PM, Gabor Grothendieck ggrothendi...@gmail.com wrote: On Fri, Feb 27, 2009 at 8:53 AM, Frank E Harrell Jr f.harr...@vanderbilt.edu wrote: Ajay ohri wrote: Sometimes for the sake of simplicity, SAS coding is created like that. One can use the concatenate function and drag and drop in an simple excel sheet for creating elaborate SAS code like the one mentioned and without any time at all. A system that requires Excel for its success is not a complete system. To be fair R depends on perl (although this dependence seems to be decreasing lately and possibly will be eliminated), latex and a bunch of unix tools. Developing GUIs depends on tcl/tk or other external system and developing fast code can require that some of it be written in C. __ 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] Need help extracting info from XML file using XML package
Duncan Temple Lang wrote: Wacek Kusnierczyk wrote: Don MacQueen wrote: I have an XML file that has within it the coordinates of some polygons that I would like to extract and use in R. The polygons are nested rather deeply. For example, I found by trial and error that I can extract the coordinates of one of them using functions from the XML package: doc - xmlInternalTreeParse('doc.kml') docroot - xmlRoot(doc) pgon - try lapply( xpathSApply(doc, '//Polygon', xpathSApply, '//coordinates', function(node) strsplit(xmlValue(node), split=',|\\s+')), as.numeric) Just for the record, I the xpath expression in the second xpathSApply would need to be .//coordinates to start searching from the previously matched Polygon node. Otherwise, the search starts from the top of the document again. not really: the xpath pattern '//coordinates' does say 'find all coordinates nodes searching from the root', but the root here is not the original root of the whole document, but each polygon node in turn. try: root = xmlInternalTreeParse(' root foo bar1/bar /foo foo bar2/bar /foo /root') xpathApply(root, '//foo', xpathSApply, '//bar', xmlValue) # equals list(1, 2), not list(c(1, 2), c(1, 2)) this is not equivalent to xpathApply(root, '//foo', function(foo) xpathSApply(root, '//bar', xmlValue)) but to xpathApply(root, '//foo', function(foo) xpathSApply(foo, '//bar', xmlValue)) as the author of the XML package, you should know ;) However, it would seem that xpathSApply(doc, //Polygon//coordinates, function(node) strsplit(.)) would be more direct, i.e. fetch the coordinates nodes in single XPath expression. yes, in this case it would; i was not sure about the concrete schema. i copied the code from my solution to some other problem, where polygon would have multiple coordinates nodes which would have to be merged in some way for each polygon separately -- your solution would return the content of each coordinates nodes separately irrespectively of whether it is unique within the polygon (which might well be in this particular case, and thus your solution is undeniably more elegant). vQ __ 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] Newton-Raphson method and Quasi Newton
Hello, I need to apply the Newton-Raphson method and Quasi Newton method to a maximum log-likelihood function with three parameters. Which are the functions to use in R? And how to use it? Thanks, GB. __ 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] Large data set in R
install.packages(biglm, dep=TRUE) library(help=biglm) kjetil On Mon, Mar 2, 2009 at 7:06 AM, Hardi sky_dr...@yahoo.com wrote: Hello, I'm trying to use R statistical packages to do ANOVA analysis using aov() and lm(). I'm having a problem when I have a large data set for input data from Full Factorial Design Experiment with replications. R seems to store everything in the memory and it fails when memory is not enough to hold the massive computation. Have anyone successfully used R to do such analysis before? Are there any work around on this problem? Thanks, Hardi __ 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. [[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] Bold Face in Plot
Dear all, I am trying to plot some text in bold face which works fine: plot(0:1,0:1,type=n) text(x=0.5, y=0.5, labels=expression(bold(the-actual-string))) Now when I try to do the following, the displayed text reads thestring: thestring - the-actual-string plot(0:1,0:1,type=n) text(x=0.5, y=0.5, labels=expression(bold(thestring))) Can someone tell me what I am doing wrong? I assume it is rather simple but I am stuck somehow. Thanks in advance, Roland P.S. I tried it using (ancient) R 2.7.0 on Windows32 and version 2.8.1 on GNU/Linux (Ubuntu 8.10). -- This mail has been sent through the MPI for Demographic Research. Should you receive a mail that is apparently from a MPI user without this text displayed, then the address has most likely been faked. If you are uncertain about the validity of this message, please check the mail header or ask your system administrator for assistance. __ 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] Using very large matrix
I'm very interested in the bigmemory package for windows 32-bit environments. Who do I need to contact to request the Beta version? Thanks Steve Steve Friedman Ph. D. Spatial Statistical Analyst Everglades and Dry Tortugas National Park 950 N Krome Ave (3rd Floor) Homestead, Florida 33034 steve_fried...@nps.gov Office (305) 224 - 4282 Fax (305) 224 - 4147 Corrado ct...@york.ac.uk To Sent by: john.emer...@yale.edu, Tony Breyal r-help-boun...@r- tony.bre...@googlemail.com project.orgcc r-help@r-project.org Subject 03/02/2009 10:46 Re: [R] Using very large matrix AM GMT Thanks a lot! Unfortunately, the R package I have to sue for my research was only released on 32 bit R on 32 bit MS Windows and only closed source I normally use 64 bit R on 64 bit Linux :) I tried to use the bigmemory in cran with 32 bit windows, but I had some serious problems. Best, On Thursday 26 February 2009 15:43:11 Jay Emerson wrote: Corrado, Package bigmemory has undergone a major re-engineering and will be available soon (available now in Beta version upon request). The version currently on CRAN is probably of limited use unless you're in Linux. bigmemory may be useful to you for data management, at the very least, where x - filebacked.big.matrix(8, 8, init=n, type=double) would accomplish what you want using filebacking (disk space) to hold the object. But even this requires 64-bit R (Linux or Mac, or perhaps a Beta version of Windows 64-bit R that REvolution Computing is working on). Subsequent operations (e.g. extraction of a small portion for analysis) are then easy enough: y - x[1,] would give you the first row of x as an object y in R. Note that x is not itself an R matrix, and most existing R analytics can't work on x directly (and would max out the RAM if they tried, anyway). Feel free to email me for more information (and this invitation applies to anyone who is interested in this). Cheers, Jay #Dear friends, # #I have to use a very large matrix. Something of the sort of #matrix(8,8,n) where n is something numeric of the sort 0.xx # #I have not found a way of doing it. I keep getting the error # #Error in matrix(nrow = 8, ncol = 8, 0.2) : too many elements specified # #Any suggestions? I have searched the mailing list, but to no avail. # #Best, #-- #Corrado Topi # #Global Climate Change Biodiversity Indicators #Area 18,Department of Biology #University of York, York, YO10 5YW, UK #Phone: + 44 (0) 1904 328645, E-mail: ct...@york.ac.uk -- Corrado Topi Global Climate Change Biodiversity Indicators Area 18,Department of Biology University of York, York, YO10 5YW, UK Phone: + 44 (0) 1904 328645, E-mail: ct...@york.ac.uk __ 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] gamm (mgvc) and time-varying coefficient model
Looks correct to me. You get a smooth of time for each level of x, so the smooths describe the way in which each coefficient of x varies in time. Note that the time varying coefficient for some level of a factor is actually given by the sum of the smooth for that factor level, and the estimate of the coefficient for that factor level from the parametric part of the model. For this reason it might actually be slightly better to use model formula: y ~ factor(x) + s(time, by=factor(x)) - 1 which will ensure that the coefficients for factor(x) are directly interpretable as the `average' values of the coefficents for each factor level. best, Simon On Sunday 01 March 2009 23:52, Marie-Pierre Sylvestre wrote: Dear R users, I have repeated measurements on individuals. I want to estimate the time-varying effect of a factor variable X (taking three levels), e.g. a model in the spirit of Hastie and Tibshirani (1993). I am considering using the package mgvc which implements generalized additive models, especially the function gamm, which estimates generalized additive mixed models, and thus, can deal with the correlated repeated measures within individuals. However, I am confused as to how to specify the time-varying coefficient part of the formula. According to the mgvc documentation (p. 35): by variables are the means for constructing 'varying-coefficient models' (geographic regression models) and for letting smooths 'interact' with factors or parametric terms. Suppose that y is the response variable, id identifies individuals, x is the three-level factor variable and time indexes the chronology of responses. Is this model estimating the time-varying coefficient of x? If it is not, how should I specify the model? mod - gamm( y ~, data=mydata, random=list(patient=~ 1), correlation = corAR1()) Best, MP [[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. -- Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK +44 1225 386603 www.maths.bath.ac.uk/~sw283 __ 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] smoothing a matrix (interpolate in plane)
the thin plate spline, or tensor product smooths built into `mgcv' might be useful here (by default mgcv does automatic bandwidth selection for these). On Sunday 01 March 2009 09:51, Žroutík wrote: Hi R-users, I'd like to smooth a matrix to dismiss spikes and to interpolate in plane example of a matrix: Map[1:3,1:3] [,1] [,2] [,3]... [1,] 34.4 34.2 35.1 [2,] 33.4 34.2 35.4 [3,] 34.1 33.2 32.1 dim(Map)[1] =/= dim(Map)[2] What functions can I use? Thanks a lot for any response, M [[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. -- Simon Wood, Mathematical Sciences, University of Bath, Bath, BA2 7AY UK +44 1225 386603 www.maths.bath.ac.uk/~sw283 __ 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] Using very large matrix
Steve et.al., The old version is still on CRAN, but I strongly encourage anyone interested to email me directly and I'll make the new version available. In fact, I wouldn't mind just pulling the old version off of CRAN, but of course that's not a great idea. !-) Jay On Mon, Mar 2, 2009 at 8:47 AM, steve_fried...@nps.gov wrote: I'm very interested in the bigmemory package for windows 32-bit environments. Who do I need to contact to request the Beta version? Thanks Steve Steve Friedman Ph. D. Spatial Statistical Analyst Everglades and Dry Tortugas National Park 950 N Krome Ave (3rd Floor) Homestead, Florida 33034 steve_fried...@nps.gov Office (305) 224 - 4282 Fax (305) 224 - 4147 Corrado ct...@york.ac.uk To Sent by: john.emer...@yale.edu, Tony Breyal r-help-boun...@r- tony.bre...@googlemail.com project.org cc r-help@r-project.org Subject 03/02/2009 10:46 Re: [R] Using very large matrix AM GMT Thanks a lot! Unfortunately, the R package I have to sue for my research was only released on 32 bit R on 32 bit MS Windows and only closed source I normally use 64 bit R on 64 bit Linux :) I tried to use the bigmemory in cran with 32 bit windows, but I had some serious problems. Best, On Thursday 26 February 2009 15:43:11 Jay Emerson wrote: Corrado, Package bigmemory has undergone a major re-engineering and will be available soon (available now in Beta version upon request). The version currently on CRAN is probably of limited use unless you're in Linux. bigmemory may be useful to you for data management, at the very least, where x - filebacked.big.matrix(8, 8, init=n, type=double) would accomplish what you want using filebacking (disk space) to hold the object. But even this requires 64-bit R (Linux or Mac, or perhaps a Beta version of Windows 64-bit R that REvolution Computing is working on). Subsequent operations (e.g. extraction of a small portion for analysis) are then easy enough: y - x[1,] would give you the first row of x as an object y in R. Note that x is not itself an R matrix, and most existing R analytics can't work on x directly (and would max out the RAM if they tried, anyway). Feel free to email me for more information (and this invitation applies to anyone who is interested in this). Cheers, Jay #Dear friends, # #I have to use a very large matrix. Something of the sort of #matrix(8,8,n) where n is something numeric of the sort 0.xx # #I have not found a way of doing it. I keep getting the error # #Error in matrix(nrow = 8, ncol = 8, 0.2) : too many elements specified # #Any suggestions? I have searched the mailing list, but to no avail. # #Best, #-- #Corrado Topi # #Global Climate Change Biodiversity Indicators #Area 18,Department of Biology #University of York, York, YO10 5YW, UK #Phone: + 44 (0) 1904 328645, E-mail: ct...@york.ac.uk -- Corrado Topi Global Climate Change Biodiversity Indicators Area 18,Department of Biology University of York, York, YO10 5YW, UK Phone: + 44 (0) 1904 328645, E-mail: ct...@york.ac.uk __ 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. -- John W. Emerson (Jay) Assistant Professor of Statistics Department of Statistics Yale University http://www.stat.yale.edu/~jay __ 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-code help for filtering with for loop
The apply function which can work on either a row-wise of column-wise basis can be used with max and can return a logical vector that will let you separate the rows into those with and without a maximum greater than 60. datax - matrix(rnorm(300)*30,nrow=50) datax - as.data.frame(datax) datax[ apply(datax, 1 ,max) = 64, ] # the rows from datax with any value greater than 64 datax[ apply(datax, 1 ,max) 64, ] # the other rows I am not sure what you mean by a table, since in R table generally means a contingency table. If you wanted a vector of row numbers, this might help: which(apply(datax,1,max) 60) # [1] 7 17 22 25 29 46 49 -- David Winsemius On Mar 2, 2009, at 5:30 AM, John Antonydas Gaspar wrote: Dear Sir / Madam, I am new for R coding. Kindly help me out in sorting out the following problem. There are 50 rows with six coloumns(you could see in the attached .txt file). I wish to go for filtering this 50 rows for any one of the six coloumns satisfying the value = 64. I need to have a final table with rows having = 64 value in any one of the six coloumns and the rest could be =64. For this purpose I use the following R code; --- datax- read.table(filter_test.txt,row.names=1,sep=\t,header=TRUE,dec = .,as.is =TRUE,na.strings = NA, colClasses = NA,check.names = FALSE,strip.white = FALSE, blank.lines.skip = TRUE, allowEscapes = FALSE, flush = FALSE,encoding = unknown) filter-datax[,1:6] filtered-vector() for(i in 1:(dim(filter)[1])) { for(j in 1:(dim(filter)[2])) { x=(filter[i,j])=64 filtered[i]-x } } # summing the result of the above sum(filtered) which(filtered) z-which(filtered) filereddata-filter[z,] write.table(filtereddata,file =filterdgenes.txt,quote = TRUE, sep = \t , dec = .,row.names=T,col.names = NA, qmethod = c (escape, double)) --- There is something is missing in my coding therefore the filteration is done according to the value of the last column that is the sixth coloumn value not takiing into consideration the rest of the coloumns. For example with the table in .txt file I have attached, the first coloumn has 29 rows having values = 64 but the last coloumn has only 25 rows. The filtered list should have around 29 rows but only 25 since the coding has considered only the last coloumn. How to sort out this problem. Kindly help me out. Thanking in advance, With Regards, antony -- Thony University of Cologne 50931 Cologne/Germany Tel: 004922125918042 Handy: 004917683142627 __ 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] Bold Face in Plot
On Mon, 2 Mar 2009, Rau, Roland wrote: Dear all, I am trying to plot some text in bold face which works fine: plot(0:1,0:1,type=n) text(x=0.5, y=0.5, labels=expression(bold(the-actual-string))) Now when I try to do the following, the displayed text reads thestring: thestring - the-actual-string plot(0:1,0:1,type=n) text(x=0.5, y=0.5, labels=expression(bold(thestring))) See ?substitute (or its wrapper bquote) E.g. lab - substitute(bold(thestring), list(thestring=thestring)) text(x=0.5, y=0.5, labels=lab) But, why are you setting plain text as an expression? The better way to do this is thestring - the-actual-string plot(0:1,0:1,type=n) text(x=0.5, y=0.5, labels=thestring, font=2) See ?par (and ?text). There are subtle differences (e.g. how the baslines are aligned), and using plotmath when you do not need it will get you encountering those differences. Can someone tell me what I am doing wrong? I assume it is rather simple but I am stuck somehow. Thanks in advance, Roland P.S. I tried it using (ancient) R 2.7.0 on Windows32 and version 2.8.1 on GNU/Linux (Ubuntu 8.10). -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@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] rounding problem
Prof Brian Ripley wrote: I think your subject line should read 'Excel bug'. From the R help for round() Note that for rounding off a 5, the IEC 60559 standard is expected to be used, '_go to the even digit_'. In case you did not recognize it, IEC 60559 is an international standard: Excel is not. R is Open Source and so you can modify it to emulate the bugs in other software: that is not one of the aims of its developers so please don't expect us to do so for you. It is rare for round() to be called explicitly in R code: rounding is usually going on inside print routines. But a version of round that comes close to always rounding away from zero is excel_round - function(x, digits) round(x*(1+1e-15), digits) did you say 'bug'? one could expect that people who turn bright red when they see the word 'bug' included in the subject or body of a message sent to r-*, are more careful about using the word themselves. is this really a bug in excel? can you point us to where in the excel documentation they say which of the more than one existing schemes for rounding numbers is adopted in excel, and which would make it clear that excel indeed has a *bug* -- behaviour that does not conform to the documentation? or maybe you mean that not adopting the standard you mention is a bug? at best, i think, it would be a design flaw, but it may actually be a matter of opinion. there is a long list of both commercial and open source softwares that expose this 'bug' -- including openoffice calc (dumb emulation of excel, perhaps?), sage (presumably a bug in python? scipy and numpy round 2.5 to 2), gnu octave (and matlab too), maple (but not mathematica), etc. the following simple code shows that there is a bug in the c math library, too: #include math.h #include stdio.h int main() { printf(round(1.5) = %d\n, round(1.5)); printf(round(2.5) = %d\n, round(2.5)); return 0; } maybe you should report this 'bug' to all those innocent folks who happen to have it in their products. it's a true revelation. vQ On Sun, 1 Mar 2009, tedzzx wrote: Yes, round(1.5)=2. but round(2.5)=2. I want round(2.5)=3 just like the what the excel do. Can we change the setting or do some trick so that the computer will work like what we usually do with respect to rounding. My system is R 2.8.1, winXP, Intel core 2 dual . Thanks. Daniel Nordlund-2 wrote: -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of tedzzx Sent: Saturday, February 28, 2009 4:58 AM To: r-help@r-project.org Subject: [R] rounding problem Hi all, According to the help page on round(), round(1.5) could be either 1 or 2. But I want to the answere to be 2 for sure just what we usually do. How can I do that? Thanks advance. Cheers Ted -- Ted, Actually, the documentation (at least for R-2.8.1) doesn't say that. The number 1.5 can be represented exactly on most systems that I know, and therefore it will round to the even digit, i.e. round(1.5) = 2.0 . The documentation says that 0.15 cannot be represented exactly, and therefore whether it rounds to 0.1 or 0.2 depends on the OS and the machine architecture. So on my WinXP Pentium IV system, 1.5 rounds to 2.0 and it also happens that round(0.15, 1) equals 0.2 . You say you want 1.5 to round to 2.0. What would you like the result of round(2.5) to equal? Dan Daniel Nordlund Bothell, WA USA __ 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/rounding-problem-tp22261852p22280785.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-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] Bold Face in Plot
Dear Prof. Ripley, -Original Message- From: Prof Brian Ripley [mailto:rip...@stats.ox.ac.uk] Sent: Monday, March 02, 2009 3:05 PM To: Rau, Roland Cc: r-help@r-project.org Subject: Re: [R] Bold Face in Plot thestring - the-actual-string plot(0:1,0:1,type=n) text(x=0.5, y=0.5, labels=thestring, font=2) thank you very much. Using the font argument, I accomplished what I wanted to do. Thanks again, Roland -- This mail has been sent through the MPI for Demographic Research. Should you receive a mail that is apparently from a MPI user without this text displayed, then the address has most likely been faked. If you are uncertain about the validity of this message, please check the mail header or ask your system administrator for assistance. __ 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] Finding Lambda in Poisson distribution
Hi, I have a dataset. First of all, I know that my dataset shall follow the Poission distribution. Now I have two questions: 1) How can I check that my data follow the Poisson distribution? 2) How can I calculate Lambda of my data? Regards Saeed -- View this message in context: http://www.nabble.com/Finding-Lambda-in-Poisson-distribution-tp2225p2225.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] Bold Face in Plot
Rau, Roland Rau at demogr.mpg.de writes: I am trying to plot some text in bold face which works fine: plot(0:1,0:1,type=n) text(x=0.5, y=0.5, labels=expression(bold(the-actual-string))) Now when I try to do the following, the displayed text reads thestring: thestring - the-actual-string plot(0:1,0:1,type=n) text(x=0.5, y=0.5, labels=expression(bold(thestring))) expression can be mind twisting. For a probably more realistic example, see the following: plot(0:1,0:1,type=n) ss1 = paste(there was ,expression(Delta)) ss = substitute(paste(there was ,expression(Delta))) text(x=0.3, y=0.3, labels=ss1) text(x=0.4, y=0.4, labels=ss) Dieter __ 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] Bash script that uses an R command
I have wriiten (with the help of the internet) a bash scirpt for my debian ppc 5.0 laptop to display battery remaining in a panel on the xfce desktop environment. echo `hal-device | grep battery.remaining_time | awk '{print $3/3600}' `-battery and this nicely spits out 4.95 hours in the panel. This is fine except it is a snow day and I have some extra time on my hands. I was wondering if I could write a little program that would take 4.95 and convert it into 4: (.95*6) in other words 4:57 in R and then use that in a shell script to tweak the battery remaining script. I am sure there is a better way, but I am a noob to linux and have a couple of years with R. thanks -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis __ 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] Fwd: Converting R to Sweave (Rnw)
Rainer M Krug-6 wrote: Hi I am thinking about using Sweave more frequently, especially for documenting code. But the syntax is slightly awkward for me (name= ... @), and I was thinking if there would be a way of importing the type of code extracted from an Rnw file back into an Rnw file? The advantage would be that the code could run in R without tangling. Obviously, sweave options could not be imported, but that would be fine for me. Below an example of the code generated by Rtangle, which I would like to import into a sweave file. Cheers Rainer ### ### chunk number 1: a ### x - 10 ### ### chunk number 2: ### asequence- seq(from=0,to=5,by=0.1) expnegx2 - exp(-asequence^2) plot(asequence,expnegx2,type=l,ylab=expression(exp(-z^2)),xlab=z) ### ### chunk number 3: Normal1 ### mu - 3 sigma - 5 This seems like trying to put the cart before the horse to my mind. A .Rnw is a hybrid of LaTeX and R code the later is delineated from the former by being encapsulated by the (name= ... @) tags which also define whether the results and/or images should be included in the LaTeX output. If you always want to use Sweave to document your code thats you're prerogative, but its really designed for writing a report with the R-code embedded, some of that code (reading in files etc.) is not relevant to the code so is suppressed, whilst others the output of the commands is required (and you duly write the tags around the R code to show the relevant output). If all you want to do is comment you're code, then I see nothing wrong or hard about using the '#' delimiter which comments out all text that follows its insertion in your .R file. Personally when I write Sweave documents I include comments in the R section of the files using this delimiter. Neil -- View this message in context: http://www.nabble.com/Fwd%3A-Converting-R-to-Sweave-%28Rnw%29-tp22288734p22289546.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] Bash script that uses an R command
Make suitable changes for Linux (this was done in Windows Vista) but you should be able to do without R. In particular the double echo 4.95 | gawk {print int($1) : 60*($1-int($1))} On Mon, Mar 2, 2009 at 9:48 AM, stephen sefick ssef...@gmail.com wrote: I have wriiten (with the help of the internet) a bash scirpt for my debian ppc 5.0 laptop to display battery remaining in a panel on the xfce desktop environment. echo `hal-device | grep battery.remaining_time | awk '{print $3/3600}' `-battery and this nicely spits out 4.95 hours in the panel. This is fine except it is a snow day and I have some extra time on my hands. I was wondering if I could write a little program that would take 4.95 and convert it into 4: (.95*6) in other words 4:57 in R and then use that in a shell script to tweak the battery remaining script. I am sure there is a better way, but I am a noob to linux and have a couple of years with R. thanks -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis __ 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] Fwd: Converting R to Sweave (Rnw)
On 3/2/2009 9:06 AM, Rainer M Krug wrote: Hi I am thinking about using Sweave more frequently, especially for documenting code. But the syntax is slightly awkward for me (name= ... @), and I was thinking if there would be a way of importing the type of code extracted from an Rnw file back into an Rnw file? The advantage would be that the code could run in R without tangling. Obviously, sweave options could not be imported, but that would be fine for me. Below an example of the code generated by Rtangle, which I would like to import into a sweave file. I don't think so, but writing a new driver is only a medium difficulty job. Start with an existing one in https://svn.r-project.org/R/trunk/src/library/utils/R/Sweave.R and modify until you have what you want. The harder part of this is the design: exactly what input and output is not going to be awkward? A different approach to the same problem is to use specially formatted comments in the R source to generate documentation; I think the R.oo package includes such a thing, and there may be others. I haven't used these with R, but have in other languages, and they were nice there. Duncan Murdoch Cheers Rainer ### ### chunk number 1: a ### x - 10 ### ### chunk number 2: ### asequence- seq(from=0,to=5,by=0.1) expnegx2 - exp(-asequence^2) plot(asequence,expnegx2,type=l,ylab=expression(exp(-z^2)),xlab=z) ### ### chunk number 3: Normal1 ### mu - 3 sigma - 5 -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Faculty of Science Natural Sciences Building Private Bag X1 University of Stellenbosch Matieland 7602 South Africa __ 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] RES: object .trPaths not found
Yes. But I found out I the files permissions were set so that the configuration had a null effect and the configuration silently ignored the fact that the file could not be written to. Thank you. Kevin Leandro Marino lean...@cesgranrio.org.br wrote: Did you do the configuration of Tinn-R after the installation? Atenciosamente, Leandro Lins Marino Centro de Avaliação Fundação CESGRANRIO Rua Santa Alexandrina, 1011 - 2º andar Rio de Janeiro, RJ - CEP: 20261-903 R (21) 2103-9600 R.:236 ( (21) 8777-7907 ( lean...@cesgranrio.org.br Aquele que suporta o peso da sociedade é precisamente aquele que obtém as menores vantagens. (SMITH, Adam) Antes de imprimir pense em sua responsabilidade e compromisso com o MEIO AMBIENTE -Mensagem original- De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em nome de Uwe Ligges Enviada em: sábado, 28 de fevereiro de 2009 16:34 Para: rkevinbur...@charter.net Cc: R help Assunto: Re: [R] object .trPaths not found rkevinbur...@charter.net wrote: I am running an R script with Tinn-R (2.2.0.1) and I get the error message Error in source(.trPaths[4], echo = TRUE, max.deparse.length = 150) : object .trPaths not found Any solutions? Maybe, but the may depend on your script, your OS, your R version, used packages and so on. Hence please read and follow the posting guide and provide commented, minimal, self-contained, reproducible code. Uwe Ligges Thank you. Kevin __ 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] RES: object .trPaths not found
Yes. But I found out I the files permissions were set so that the configuration had a null effect and the configuration silently ignored the fact that the file could not be written to. Thank you. Kevin Leandro Marino lean...@cesgranrio.org.br wrote: Did you do the configuration of Tinn-R after the installation? Atenciosamente, Leandro Lins Marino Centro de Avaliação Fundação CESGRANRIO Rua Santa Alexandrina, 1011 - 2º andar Rio de Janeiro, RJ - CEP: 20261-903 R (21) 2103-9600 R.:236 ( (21) 8777-7907 ( lean...@cesgranrio.org.br Aquele que suporta o peso da sociedade é precisamente aquele que obtém as menores vantagens. (SMITH, Adam) Antes de imprimir pense em sua responsabilidade e compromisso com o MEIO AMBIENTE -Mensagem original- De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em nome de Uwe Ligges Enviada em: sábado, 28 de fevereiro de 2009 16:34 Para: rkevinbur...@charter.net Cc: R help Assunto: Re: [R] object .trPaths not found rkevinbur...@charter.net wrote: I am running an R script with Tinn-R (2.2.0.1) and I get the error message Error in source(.trPaths[4], echo = TRUE, max.deparse.length = 150) : object .trPaths not found Any solutions? Maybe, but the may depend on your script, your OS, your R version, used packages and so on. Hence please read and follow the posting guide and provide commented, minimal, self-contained, reproducible code. Uwe Ligges Thank you. Kevin __ 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] Gradient function for optim.
Thank you. I saw the source. But I am not sure how to get from .Internal(optim(...)) to fmingr. Kevin Katharine Mullen k...@few.vu.nl wrote: see the fmingr function in src/main/optim.c (https://svn.r-project.org/R/trunk/src/main/optim.c) On Wed, 25 Feb 2009 rkevinbur...@charter.net wrote: I have read that when the gradient function is not supplied (is null) then first order differencing is used to find the differential. I was trying to track down this for my own information but I run into .Internal(optim.). I was not sure where to look next to see the function that is automatically supplied for the gradient. Thank you. Kevin __ 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] Bash script that uses an R command
stephen sefick wrote: I have wriiten (with the help of the internet) a bash scirpt for my debian ppc 5.0 laptop to display battery remaining in a panel on the xfce desktop environment. echo `hal-device | grep battery.remaining_time | awk '{print $3/3600}' `-battery and this nicely spits out 4.95 hours in the panel. This is fine except it is a snow day and I have some extra time on my hands. I was wondering if I could write a little program that would take 4.95 and convert it into 4: (.95*6) in other words 4:57 in R and then use that in a shell script to tweak the battery remaining script. I am sure there is a better way, but I am a noob to linux and have a couple of years with R. thanks This is one for little r (http://dirk.eddelbuettel.com/code/littler.html) $ echo 4.95 | r -e x - as.numeric(readLines()); cat( floor(x),':', round( ( x - floor( x ) ) * 60 ),'\n',sep='') 4:57 Romain -- Romain Francois Independent R Consultant +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr __ 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] Optim parscale?
I am not clear on what is happening with parscale in optim It seems that scaling the parameters will produce unpredictable results in a non-linear function (which is the purpose of optim right?) The documentation states: parscale A vector of scaling values for the parameters. Optimization is performed on par/parscale and these should be comparable in the sense that a unit change in any element produces about a unit change in the scaled value. I am not sure how it can be guaranteed that this will be case. I first saw a non-unity parscale in the ARIMA code where I see code like: ses - summary(fit)$coefficients[, 2] parscale - c(parscale, 10 * ses) Comments? Thank you. Kevin __ 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] Need help extracting info from XML file using XML package
Wacek Kusnierczyk wrote: Duncan Temple Lang wrote: Wacek Kusnierczyk wrote: Don MacQueen wrote: I have an XML file that has within it the coordinates of some polygons that I would like to extract and use in R. The polygons are nested rather deeply. For example, I found by trial and error that I can extract the coordinates of one of them using functions from the XML package: doc - xmlInternalTreeParse('doc.kml') docroot - xmlRoot(doc) pgon - try lapply( xpathSApply(doc, '//Polygon', xpathSApply, '//coordinates', function(node) strsplit(xmlValue(node), split=',|\\s+')), as.numeric) Just for the record, I the xpath expression in the second xpathSApply would need to be .//coordinates to start searching from the previously matched Polygon node. Otherwise, the search starts from the top of the document again. not really: the xpath pattern '//coordinates' does say 'find all coordinates nodes searching from the root', but the root here is not the original root of the whole document, but each polygon node in turn. try: root = xmlInternalTreeParse(' root foo bar1/bar /foo foo bar2/bar /foo /root') xpathApply(root, '//foo', xpathSApply, '//bar', xmlValue) # equals list(1, 2), not list(c(1, 2), c(1, 2)) Just for the record and to avoid confusion for anyone reading the archives in the future, the behaviour displayed above is from an old version of the XML package (mid 2008). Subsequent versions yield the second result as the //bar works from the root of the document. But using .//bar would search from the foo down the sub-tree. The reason for this is that, having used XPath to get a node, e.g. foo, we often want to go back up the XML tree from that current node, e.g. ../ ./ancestor::foo and so on. D. this is not equivalent to xpathApply(root, '//foo', function(foo) xpathSApply(root, '//bar', xmlValue)) but to xpathApply(root, '//foo', function(foo) xpathSApply(foo, '//bar', xmlValue)) as the author of the XML package, you should know ;) However, it would seem that xpathSApply(doc, //Polygon//coordinates, function(node) strsplit(.)) would be more direct, i.e. fetch the coordinates nodes in single XPath expression. yes, in this case it would; i was not sure about the concrete schema. i copied the code from my solution to some other problem, where polygon would have multiple coordinates nodes which would have to be merged in some way for each polygon separately -- your solution would return the content of each coordinates nodes separately irrespectively of whether it is unique within the polygon (which might well be in this particular case, and thus your solution is undeniably more elegant). vQ __ 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 Wilcoxon Test
Hi I have 2 sets of data that I want to do a Wilcoxon test on. They are of the same dimension. One has 4 zero values and the other has 5. dim(SampA) [1] 1 10 dim(SampV) [1] 1 10 I get the folowing error Error in wilcox.test.default(SampA, SampV, na.rm = TRUE, paired = FALSE, : 'x' must be numeric I am using the function wilcox.test(SampA, SampV, na.rm=TRUE, paired=FALSE, conf.level=0.95) __ 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] Bash script that uses an R command
echo 'hal-device | grep battery.remaining_time | awk '{print$3/3600}' | awk '{print int($1)}:int(60*($1-int($1)))'` here is the final shell script is anyone is interested - this is written and working in debian linux Stephen Sefick On Mon, Mar 2, 2009 at 10:13 AM, Romain Francois romain.franc...@dbmail.com wrote: stephen sefick wrote: I have wriiten (with the help of the internet) a bash scirpt for my debian ppc 5.0 laptop to display battery remaining in a panel on the xfce desktop environment. echo `hal-device | grep battery.remaining_time | awk '{print $3/3600}' `-battery and this nicely spits out 4.95 hours in the panel. This is fine except it is a snow day and I have some extra time on my hands. I was wondering if I could write a little program that would take 4.95 and convert it into 4: (.95*6) in other words 4:57 in R and then use that in a shell script to tweak the battery remaining script. I am sure there is a better way, but I am a noob to linux and have a couple of years with R. thanks This is one for little r (http://dirk.eddelbuettel.com/code/littler.html) $ echo 4.95 | r -e x - as.numeric(readLines()); cat( floor(x),':', round( ( x - floor( x ) ) * 60 ),'\n',sep='') 4:57 Romain -- Romain Francois Independent R Consultant +33(0) 6 28 91 30 30 http://romainfrancois.blog.free.fr -- Stephen Sefick Let's not spend our time and resources thinking about things that are so little or so large that all they really do for us is puff us up and make us feel like gods. We are mammals, and have not exhausted the annoying little problems of being mammals. -K. Mullis __ 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] portable R editor
Hi, I have been dreaming about a complete R environment on my USB stick for a long time. Now I finally want to realize it but what I am missing is a good, portable editor for R which has tabs and syntax highlighting, can execute code, has bookmarks and a little project file management facility pretty much like Tinn-R has those. I like Tinn-R but it seems like there is only a very old version of Tinn-R which works standalone. Can anyone recommend an adequate editor? Many thanks and all the best, Werner __ 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] handle graph size in eps
Sorry for the lack of information. I'm indeed under Windows. I indeed used the menu save as in the graph window. The matter with the eps obtained was the width of the graph which is lower than what I had on the screen or what I got when I saved it as a JPEG file. I tried the postscript command postscript(test.eps,width=14,height=6) print.it=TRUE { #windows(width=6,height=6) par ( fin=c(6,6) ,mai=c(1,1,0.5,0.5) ,mfrow=c(1,2) ,cex.axis=1.5 ,cex.lab=1.5) dens-density(DATA1.y[2,]-mean(DATA1.y[2,]),kernel=gaussian) xlimit-range(dens$x) ylimit-range(dens$y) hist( DATA1.y[2,]-mean(DATA1.y[2,]) ,xlim=1.1*xlimit ,xlab=expression(q[e]) ,ylim=1.1*ylimit ,probability=T ,main=Random distribution around y) lines(dens,col=2,lwd=2) qqnorm(DATA1.x[1,]) } dev.off() rm(dens,xlimit,ylimit) I barely managed to get the ratio I want for the graph http://www.4shared.com/file/90339223/5a3239fc/test.html But still when I change the width in the poscript command from 12 to 20 for instance, it doesn't change anything... why? BTW how do I stop the pipe between a poscript file and R without closing R? Regards/Cordialement Benoit Boulinguiez -Message d'origine- De : Prof Brian Ripley [mailto:rip...@stats.ox.ac.uk] Envoyé : lundi 2 mars 2009 11:25 À : Benoit Boulinguiez Cc : r-help@r-project.org Objet : Re: [R] handle graph size in eps On Mon, 2 Mar 2009, Benoit Boulinguiez wrote: Hi all, I've got a density graph made with the following commands: win.graph(width=13,height=6) The preferred name is windows(). par ( fin=c(13,3) ,mai=c(1,1,0.5,0.5) ,mfrow=c(1,2) ,cex.axis=1.5 ,cex.lab=1.5) dens-density(DATA1.y[2,]-mean(DATA1.y[2,]),kernel=gaussian) xlimit-range(dens$x) ylimit-range(dens$y) hist( DATA1.y[2,]-mean(DATA1.y[2,]) ,xlim=1.1*xlimit ,xlab=expression(q[e]) ,ylim=1.1*ylimit ,probability=T ,main=Random distribution around y) lines(dens,col=2,) rm(dens,xlimit,ylimit) qqnorm(DATA1.x[1,]) that's what I've on the screen and I'm OK with that. http://www.4shared.com/file/90283562/9f27d83b/screen.html When I save the graph in eps format How exactly? I know at least three ways to do that. I am guessing that as you didn't tell us you were on Windows, you also didn't tell us that you used the menu on the windows() device, but these details do matter. I've got that http://www.4shared.com/file/90283115/490b7383/density_v_1.html what am I doing wrong? Not telling us what you don't like about this plot. I think you should consider using dev.copy2eps(), which will give you more control. Or even better, calling postscript() directly. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@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] handle graph size in eps
Try adding paper = special to your postscript arguments. Clint BowmanINTERNET: cl...@ecy.wa.gov Air Dispersion Modeler INTERNET: cl...@math.utah.edu Air Quality Program VOICE: (360) 407-6815 Department of Ecology FAX:(360) 407-7534 USPS: PO Box 47600, Olympia, WA 98504-7600 Parcels:300 Desmond Drive, Lacey, WA 98503-1274 On Mon, 2 Mar 2009, Benoit Boulinguiez wrote: Sorry for the lack of information. I'm indeed under Windows. I indeed used the menu save as in the graph window. The matter with the eps obtained was the width of the graph which is lower than what I had on the screen or what I got when I saved it as a JPEG file. I tried the postscript command postscript(test.eps,width=14,height=6) print.it=TRUE { #windows(width=6,height=6) par ( fin=c(6,6) ,mai=c(1,1,0.5,0.5) ,mfrow=c(1,2) ,cex.axis=1.5 ,cex.lab=1.5) dens-density(DATA1.y[2,]-mean(DATA1.y[2,]),kernel=gaussian) xlimit-range(dens$x) ylimit-range(dens$y) hist( DATA1.y[2,]-mean(DATA1.y[2,]) ,xlim=1.1*xlimit ,xlab=expression(q[e]) ,ylim=1.1*ylimit ,probability=T ,main=Random distribution around y) lines(dens,col=2,lwd=2) qqnorm(DATA1.x[1,]) } dev.off() rm(dens,xlimit,ylimit) I barely managed to get the ratio I want for the graph http://www.4shared.com/file/90339223/5a3239fc/test.html But still when I change the width in the poscript command from 12 to 20 for instance, it doesn't change anything... why? BTW how do I stop the pipe between a poscript file and R without closing R? Regards/Cordialement Benoit Boulinguiez -Message d'origine- De : Prof Brian Ripley [mailto:rip...@stats.ox.ac.uk] Envoyé : lundi 2 mars 2009 11:25 À : Benoit Boulinguiez Cc : r-help@r-project.org Objet : Re: [R] handle graph size in eps On Mon, 2 Mar 2009, Benoit Boulinguiez wrote: Hi all, I've got a density graph made with the following commands: win.graph(width=13,height=6) The preferred name is windows(). par ( fin=c(13,3) ,mai=c(1,1,0.5,0.5) ,mfrow=c(1,2) ,cex.axis=1.5 ,cex.lab=1.5) dens-density(DATA1.y[2,]-mean(DATA1.y[2,]),kernel=gaussian) xlimit-range(dens$x) ylimit-range(dens$y) hist( DATA1.y[2,]-mean(DATA1.y[2,]) ,xlim=1.1*xlimit ,xlab=expression(q[e]) ,ylim=1.1*ylimit ,probability=T ,main=Random distribution around y) lines(dens,col=2,) rm(dens,xlimit,ylimit) qqnorm(DATA1.x[1,]) that's what I've on the screen and I'm OK with that. http://www.4shared.com/file/90283562/9f27d83b/screen.html When I save the graph in eps format How exactly? I know at least three ways to do that. I am guessing that as you didn't tell us you were on Windows, you also didn't tell us that you used the menu on the windows() device, but these details do matter. I've got that http://www.4shared.com/file/90283115/490b7383/density_v_1.html what am I doing wrong? Not telling us what you don't like about this plot. I think you should consider using dev.copy2eps(), which will give you more control. Or even better, calling postscript() directly. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@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] combining identify() and locator()
I am new to R and programming in general, so although your framework wasn't exactly what I needed, it was a tremendous help in getting what I needed. Here is what I ended up doing: idloc - function(xy,tol=0.10,hitcol=red,mispch=19,miscol=red){ if (type==flag) {col=red}else if (type==unflag){col=green} tol2 =tol^2 incoords = cbind(grconvertX(xy[,1],to=inches),grconvertY(xy[, 2],to=inches)) hit=c() hits=c() multhit=c() while(names(dev.cur())==quartz) { ptU = try(locator(1)) if (class(ptU)!=try-error) { pt=c(grconvertX(ptU$x,to='inches'),grconvertY(ptU$y,to=inches)) d2= (incoords[,1]-pt[1])^2 + (incoords[,2]-pt[2])^2 if(any(d2 tol2)){ print(clicked) hit=c(hit,(1:dim(xy)[1])[d2 = min(d2)]) points(xy[hit,1],xy[hit,2],pch=x,col=col) }else{ print(missed) missed=c(ptU$x,ptU$y) points(ptU,pch=mispch,col=red,type=p) ptU2 = try(locator(1)) if (class(ptU)!=try-error) { pt2=c(grconvertX(ptU2$x,to='inches'),grconvertY(ptU2$y,to=inches)) multhit - c(hit,(1:dim(xy)[1])[incoords[,1]=min(pt[1],pt2[1]) incoords[,1]=max(pt[1],pt2[1]) incoords[,2]=min(pt[2],pt2[2]) incoords[,2]=(max(pt[2],pt2[2]))]) points(xy[multhit,1],xy[multhit,2],pch=x,col=col) points(ptU2,pch=19,col=white) points(ptU,pch=19,col=white) } } } hits - unique(c(hits,multhit,hit)) } return(list(hit=hits)) } type=flag xy = cbind(1:10,runif(10)) plot(xy) test - idloc(xy) On Feb 27, 2009, at 9:43 AM, Barry Rowlingson wrote: 2009/2/27 Brian Bolt bb...@kalypsys.com: awesome. Thank you very much for the quick response. I think this is exactly what I was looking for. Here's a basic framework: `idloc` - function(xy,n=1, tol=0.25){ tol2=tol^2 icoords = cbind(grconvertX(xy[,1],to=inches),grconvertY(xy[, 2],to=inches)) hit = c() missed = matrix(ncol=2,nrow=0) for(i in 1:n){ ptU = locator(1) pt = c(grconvertX(ptU$x,to='inches'),grconvertY(ptU $y,to=inches)) d2 = (icoords[,1]-pt[1])^2 + (icoords[,2]-pt[2])^2 if (any(d2 tol2)){ print(clicked) hit = c(hit, (1:dim(xy)[1])[d2 tol2]) }else{ print(missed) missed=rbind(missed,c(ptU$x,ptU$y)) } } return(list(hit=hit,missed=missed)) } Test: xy = cbind(1:10,runif(10)) plot(xy) idloc(xy,10) now click ten times, on points or off points. You get back: $hit [1] 4 6 7 10 $missed [,1] [,2] [1,] 5.698940 0.6835392 [2,] 6.216171 0.6144229 [3,] 5.877982 0.5752569 [4,] 6.773190 0.2895761 [5,] 7.210847 0.3126149 [6,] 9.239985 0.5614337 - $hit is the indices of the points you hit (in order, including duplicates) and $missed are the coordinates of the misses. It crashes out if you hit the middle button for the locator, but that should be easy enough to fixup. It doesn't label hit points, but that's also easy enough to do. 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] comment on this book A Handbook of Statistical Analyses Using R by Brian S. Everitt (Author), Torsten Hothorn (Author)
Is this book a good reference to learn R for statistical analysis ? A Handbook of Statistical Analyses Using R by Brian S. Everitthttp://www.amazon.com/exec/obidos/search-handle-url/ref=ntt_athr_dp_sr_1?%5Fencoding=UTF8search-type=ssindex=booksfield-author=Brian%20S.%20Everitt(Author), Torsten Hothornhttp://www.amazon.com/exec/obidos/search-handle-url/ref=ntt_athr_dp_sr_2?%5Fencoding=UTF8search-type=ssindex=booksfield-author=Torsten%20Hothorn(Author) [[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] handle graph size in eps
See the help for argument 'paper' in ?postscript On Mon, 2 Mar 2009, Benoit Boulinguiez wrote: Sorry for the lack of information. I'm indeed under Windows. I indeed used the menu save as in the graph window. The matter with the eps obtained was the width of the graph which is lower than what I had on the screen or what I got when I saved it as a JPEG file. I tried the postscript command postscript(test.eps,width=14,height=6) print.it=TRUE { #windows(width=6,height=6) par ( fin=c(6,6) ,mai=c(1,1,0.5,0.5) ,mfrow=c(1,2) ,cex.axis=1.5 ,cex.lab=1.5) dens-density(DATA1.y[2,]-mean(DATA1.y[2,]),kernel=gaussian) xlimit-range(dens$x) ylimit-range(dens$y) hist( DATA1.y[2,]-mean(DATA1.y[2,]) ,xlim=1.1*xlimit ,xlab=expression(q[e]) ,ylim=1.1*ylimit ,probability=T ,main=Random distribution around y) lines(dens,col=2,lwd=2) qqnorm(DATA1.x[1,]) } dev.off() rm(dens,xlimit,ylimit) I barely managed to get the ratio I want for the graph http://www.4shared.com/file/90339223/5a3239fc/test.html But still when I change the width in the poscript command from 12 to 20 for instance, it doesn't change anything... why? BTW how do I stop the pipe between a poscript file and R without closing R? Regards/Cordialement Benoit Boulinguiez -Message d'origine- De : Prof Brian Ripley [mailto:rip...@stats.ox.ac.uk] Envoyé : lundi 2 mars 2009 11:25 À : Benoit Boulinguiez Cc : r-help@r-project.org Objet : Re: [R] handle graph size in eps On Mon, 2 Mar 2009, Benoit Boulinguiez wrote: Hi all, I've got a density graph made with the following commands: win.graph(width=13,height=6) The preferred name is windows(). par ( fin=c(13,3) ,mai=c(1,1,0.5,0.5) ,mfrow=c(1,2) ,cex.axis=1.5 ,cex.lab=1.5) dens-density(DATA1.y[2,]-mean(DATA1.y[2,]),kernel=gaussian) xlimit-range(dens$x) ylimit-range(dens$y) hist( DATA1.y[2,]-mean(DATA1.y[2,]) ,xlim=1.1*xlimit ,xlab=expression(q[e]) ,ylim=1.1*ylimit ,probability=T ,main=Random distribution around y) lines(dens,col=2,) rm(dens,xlimit,ylimit) qqnorm(DATA1.x[1,]) that's what I've on the screen and I'm OK with that. http://www.4shared.com/file/90283562/9f27d83b/screen.html When I save the graph in eps format How exactly? I know at least three ways to do that. I am guessing that as you didn't tell us you were on Windows, you also didn't tell us that you used the menu on the windows() device, but these details do matter. I've got that http://www.4shared.com/file/90283115/490b7383/density_v_1.html what am I doing wrong? Not telling us what you don't like about this plot. I think you should consider using dev.copy2eps(), which will give you more control. Or even better, calling postscript() directly. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@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. -- Brian D. Ripley, rip...@stats.ox.ac.uk Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595__ R-help@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] portable R editor
I feel emacs is portable enough for me. On 3/2/09, Werner Wernersen pensterfuz...@yahoo.de wrote: Hi, I have been dreaming about a complete R environment on my USB stick for a long time. Now I finally want to realize it but what I am missing is a good, portable editor for R which has tabs and syntax highlighting, can execute code, has bookmarks and a little project file management facility pretty much like Tinn-R has those. I like Tinn-R but it seems like there is only a very old version of Tinn-R which works standalone. Can anyone recommend an adequate editor? Many thanks and all the best, Werner __ 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. -- === WenSui Liu Acquisition Risk, Chase Blog : statcompute.spaces.live.com I can calculate the motion of heavenly bodies, but not the madness of people.” -- Isaac Newton === __ 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] comment on this book A Handbook of Statistical Analyses Using R by Brian S. Everitt (Author), Torsten Hothorn (Author)
Yes I think it is. I used it. On Mon, Mar 2, 2009 at 11:46 AM, choonhong ang angie.bear...@gmail.com wrote: Is this book a good reference to learn R for statistical analysis ? A Handbook of Statistical Analyses Using R by Brian S. Everitthttp://www.amazon.com/exec/obidos/search-handle-url/ref=ntt_athr_dp_sr_1?%5Fencoding=UTF8search-type=ssindex=booksfield-author=Brian%20S.%20Everitt(Author), Torsten Hothornhttp://www.amazon.com/exec/obidos/search-handle-url/ref=ntt_athr_dp_sr_2?%5Fencoding=UTF8search-type=ssindex=booksfield-author=Torsten%20Hothorn(Author) [[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. -- Due to the recession, requests for instant gratification will be deferred until arrears in scheduled gratification have been satisfied. __ 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 with Wilcoxon Test
What do you get with: str(SampA) str(SampV) The error message suggests you are not giving it numeric vectors. -- David Winsemius On Mar 2, 2009, at 10:59 AM, Amit Patel wrote: Hi I have 2 sets of data that I want to do a Wilcoxon test on. They are of the same dimension. One has 4 zero values and the other has 5. dim(SampA) [1] 1 10 dim(SampV) [1] 1 10 I get the folowing error Error in wilcox.test.default(SampA, SampV, na.rm = TRUE, paired = FALSE, : 'x' must be numeric I am using the function wilcox.test(SampA, SampV, na.rm=TRUE, paired=FALSE, conf.level=0.95) __ 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] Trouble - Installing R on RedHat el5
I am lucky and am now working with a new Redhat Linux 64-bit OS But I am getting the following error can anyone provide some graciously needed assistance: [r...@bluebird system-files]# rpm -i R-2.8.1-1.rh5.x86_64.rpm warning: R-2.8.1-1.rh5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 99b62126 error: Failed dependencies: xdg-utils is needed by R-2.8.1-1.rh5.x86_64 Thanks Steve Steve Friedman Ph. D. Spatial Statistical Analyst Everglades and Dry Tortugas National Park 950 N Krome Ave (3rd Floor) Homestead, Florida 33034 steve_fried...@nps.gov Office (305) 224 - 4282 Fax (305) 224 - 4147 __ 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] Need help extracting info from XML file using XML package
Duncan Temple Lang wrote: not really: the xpath pattern '//coordinates' does say 'find all coordinates nodes searching from the root', but the root here is not the original root of the whole document, but each polygon node in turn. try: root = xmlInternalTreeParse(' root foo bar1/bar /foo foo bar2/bar /foo /root') xpathApply(root, '//foo', xpathSApply, '//bar', xmlValue) # equals list(1, 2), not list(c(1, 2), c(1, 2)) Just for the record and to avoid confusion for anyone reading the archives in the future, the behaviour displayed above is from an old version of the XML package (mid 2008). Subsequent versions yield the second result as the //bar works from the root of the document. But using .//bar would search from the foo down the sub-tree. The reason for this is that, having used XPath to get a node, e.g. foo, we often want to go back up the XML tree from that current node, e.g. ../ ./ancestor::foo and so on. just for the record: this is an excellent example of where the behaviour (implementation + interface) of a package changes to make it better, despite the trillions of lines of old code that get broken by the change. thanks, duncan. vQ __ 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] Trouble - Installing R on RedHat el5
on 03/02/2009 11:07 AM steve_fried...@nps.gov wrote: I am lucky and am now working with a new Redhat Linux 64-bit OS But I am getting the following error can anyone provide some graciously needed assistance: [r...@bluebird system-files]# rpm -i R-2.8.1-1.rh5.x86_64.rpm warning: R-2.8.1-1.rh5.x86_64.rpm: Header V3 DSA signature: NOKEY, key ID 99b62126 error: Failed dependencies: xdg-utils is needed by R-2.8.1-1.rh5.x86_64 Steve, The xdg-utils RPM is available via the EPEL from: http://download.fedora.redhat.com/pub/epel/5/x86_64/ BTW, R itself is also available via the EPEL. For additional information, see: http://fedoraproject.org/wiki/EPEL/FAQ#What_is_EPEL.3F http://fedoraproject.org/wiki/EPEL/FAQ#How_can_I_install_the_packages_from_the_EPEL_software_repository.3F http://fedoraproject.org/wiki/EPEL/FAQ#How_do_I_know_that_a_package_is_a_EPEL_package HTH, Marc Schwartz __ 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] Bash script that uses an R command
stephen sefick wrote: echo 'hal-device | grep battery.remaining_time | awk '{print$3/3600}' | awk '{print int($1)}:int(60*($1-int($1)))'` here is the final shell script is anyone is interested - this is written and working in debian linux it can't work -- you have unmatched quotes here. you can also use a variable in awk to spare one call to awk. vQ __ 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] Goldbach partitions code
Folks, I put up a brief note describing my naive attempts to compute Goldbach partitions, starting with a brute-force approach and refining progressively. http://jostamon.blogspot.com/2009/02/goldbachs-comet.html I'd welcome your suggestions on improvements, alternatives, other optimisations, esp. to do with space vs time tradeoffs. Is this an example interesting enough for pedagogical purposes, do you think? Please advise. Cheers, MM [[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] Newton-Raphson method and Quasi Newton
Check out: ?optim ?nlminb Ravi. Ravi Varadhan, Ph.D. Assistant Professor, Division of Geriatric Medicine and Gerontology School of Medicine Johns Hopkins University Ph. (410) 502-2619 email: rvarad...@jhmi.edu - Original Message - From: lelebecks gabriele.becca...@gmail.com Date: Monday, March 2, 2009 8:42 am Subject: [R] Newton-Raphson method and Quasi Newton To: r-help@r-project.org Hello, I need to apply the Newton-Raphson method and Quasi Newton method to a maximum log-likelihood function with three parameters. Which are the functions to use in R? And how to use it? Thanks, GB. __ R-help@r-project.org mailing list PLEASE do read the posting guide 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] TinnR Philips Webcam
Hi All, I have a Philips Webcam, model SPC110NC. I had to download a diver in order for the webcam to work with Skype from the philips support page (www.philips.com/support). Now when I start up TinnR to use with R, it opens the webcam. If I manually start up R, Tinn R will no longer synch with it. Also, when I install the webcam driver there doesn't appear to be anyway to modify the install (when I choose custom installation there aren't any options to change). I can get Tinn R working by uninstalling the webcam driver. However, I was hoping i'd be able to keep both installed. Does anyone have a possible solution or any hints? __ 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] QQplot
Hi All, this might be an easy question but I do not know how to find R-squared for a QQplot when doing linear regression? -- View this message in context: http://www.nabble.com/QQplot-tp22288218p22288218.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] xyplot color question
Hi, I am plotting scatterplots of horsepower by torque, conditional on brand (I'm just making up the variables for this example), and the goal is to see both the scatterplot points as well as the smoothed line. When I do the following code, I get the same color for the points and line, and would like the colors to be different, such as black points and a red smoothed line. How do I do that? I can't find any examples or figure out how to manipulate color. Thanks. xyplot(horsepower ~ torque | brand, MyData, type=c(p,smooth)) -- View this message in context: http://www.nabble.com/xyplot-color-question-tp22288842p22288842.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] FW: partial residual plots
I was advised someone might be able to help me with this. Very truly yours, Dwayne E. Culp, P.E., CFM Effective February 8, 2009, my contact information becomes: Dwayne E. Culp, P.E., CFM | JACOBS ENGINEERING GROUP : North American Infrastructure | Manager: Hydrology Hydraulics Section | 5995 Rogerdale Road- B2047B | Houston, TX 77072 | 281-776-2109 | 832.351.7766 Fax | 713.898.1977 Mobile | dwayne.c...@jacobs.com mailto:dwayne.c...@jacobs.com | From: Culp, Dwayne Sent: Friday, February 27, 2009 3:04 PM To: Ted Cleveland; r-c...@r-project.org Subject: partial residual plots Is it possible to produce partial residual plots in R? I am trying to plot the partial residual vs the adjusted explanatory variable in a multiple linear regression to determine if a transformation should be done in the explanatory variable. Very truly yours, Dwayne E. Culp, P.E., CFM | Jacobs North American Infrastructure | Senior Project Manager- Land Development | 5995 Rogerdale Road | Houston, TX 77072| 281.776.2109 | 713.898.1977 Mobile | dwayne.c...@jacobs.com NOTICE - This communication may contain confidential and privileged information that is for the sole use of the intended recipient. Any viewing, copying or distribution of, or reliance on this message by unintended recipients is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. [[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] barplot with specific order of x axis labels
Hi all, I'd appreciate your help with this problem. I need to plot a barplot with the categories in a specific order. My data might be: hours Freq AN 10 MO 14 LU 30 I need the categories to be in the order: MO LU AN Is there some way to pass sort the dataset into this order so that it plots correctly when passed to barplot()? Thanks very much, Richie [[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] logistic regression model validation through bootstrapping
Hi, I was wondering whether this query was addressed on how to perform validation through boostrapping. I am currently trying to implement a boostrapping approach to validation but don't know where to start. Help please. Thank you and Regards, Vivienne Ozohili Risk Model Validation Manager Group Risk Independent Control Unit A5, Bank of Ireland Head Office Lower Baggot Street Dublin 2 Tel: +353-01-6044833 Email: vivienne_o.ozoh...@boimail.com The Governor and Company of the Bank of Ireland is regulated by the Financial Regulator in Ireland and authorised by the Financial Services Authority in the UK. Bank of Ireland incorporated in Ireland with Limited Liability. Registered Office: Head Office, Lower Baggot Street, Dublin 2. Registered Number - C-1 PRE ** /PRE This email and any files transmitted with it are confide...{{dropped:15}} __ 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] (no subject)
Greetings, I am using fGarch package to estimate and simulate GARCH models. What I would like to do is to perform Monte Carlo simulation. Unfortunately I cannot figure how to modify the code to achieve this. I use the following code to run a single simulation: spec=garchSpec(model=list(ar= 0.440270860, omega=0.000374365,alpha=0.475446583 , mu=0, beta=0)) sim-garchSim(spec, length(dp)-1,extended=T) Can someone suggest a modification to the code which would allow to obtain multiple simulations? Many thanks, Jurica Brajkovic __ 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] RWeka dataset running
Hi to all list members, I'm a newbie to R and will work on it from now. I'm preparing my thesis based on rpart and RWeka. I've managed to run already existing test data but couldn't import a data set from out of R. (By the way I'm an ubuntu user.) Thanks for your help Ahmet KOCYIGIT _ [[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] initial gradient and vmmin not finite
Dear Rhelpers I have the problem with initial values, could you please tell me how to solve it? Thank you June p = summary(maxLik(fr,start=c(0,0,0,1,0,-25,-0.2))) Error in maxRoutine(fn = logLik, grad = grad, hess = hess, start = start, : NA in the initial gradient p = summary(maxLik(fr,start=c(0,0,0,1,0,-25,-0.2),method=BFGS)) Error in optim(start, func, gr = gradient, control = control, method = BFGS, : initial value in 'vmmin' is not finite The codes are as follows yogurt = read.table(yogurtnp.csv, header=F,sep=,) attach(yogurt) dim(yogurt) choice = yogurt[,2:5] price=yogurt[,14:17] feature=yogurt[,6:9] n = nrow(yogurt) constant = rep(1,n) yop=cbind(constant,feature[,1],price[,1]) dan=cbind(constant,feature[,2],price[,2]) hil=cbind(constant,feature[,3],price[,3]) wt=cbind(feature[,4],price[,4]) library(maxLik) fr - function(x) { con1 = rbind(x[1],x[5],x[6]) con2 = rbind(x[2],x[5],x[6]) con3 = rbind(x[3],x[5],x[6]) con4 = rbind(x[5],x[6]) rho = exp(x[7])/(1+exp(x[7])) ey = exp((yop%*%con1)/rho) ed = exp((dan%*%con2)/rho) eh = exp((hil%*%con3)/rho) ew = exp((wt%*%con4)/rho) ev = ey+ed+eh+ew den=(ey+ed+eh+ew) iv = rho*log(den) pp=exp(x[4]+iv)/(1+exp(x[4]+iv)) pr1 =pp*(ey/den) pr2 =pp*(ed/den) pr3 =pp*(eh/den) pr4 =pp*(ew/den) pnp=1/(1+exp(x[4]+iv)) likelihood = (pnp*yogurt[,1])+(pr1*yogurt[,2])+(pr2*yogurt[,3])+(pr3*yogurt[,4])+(pr4*yogurt[,4]) lsum = log(likelihood) return(colSums(lsum)) } p = summary(maxLik(fr,start=c(0,0,0,1,0,-25,-0.2))) p _ cns!503D1D86EBB2B53C!2285.entry?ocid=TXT_TAGLM_WL_UGC_Contacts_032009 [[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] TinnR Philips Webcam
On Mon, 2 Mar 2009 12:48:16 -0500 (EST) waterho...@vims.edu wrote: WE Now when I start up TinnR to use with R, it opens the webcam. If I WE manually start up R, Tinn R will no longer synch with it. More detail would help to answer those questions properly. Which Tinn-R are you using, and how are you starting an R session? The current Tinn-R (2.2.0.2) has 2 different possibilities to do that. Older Tinn-R programs (below 2) had the problem to start R it searched something that is named console. Which caused very different programs to start (it was my wireless console). But this problem was solved with 2.x since I dont know your version: use latest TinnR. hth Stefan __ 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] Fwd: Converting R to Sweave (Rnw)
On 3/2/2009 10:12 AM, Duncan Murdoch wrote: On 3/2/2009 9:06 AM, Rainer M Krug wrote: Hi I am thinking about using Sweave more frequently, especially for documenting code. But the syntax is slightly awkward for me (name= ... @), and I was thinking if there would be a way of importing the type of code extracted from an Rnw file back into an Rnw file? The advantage would be that the code could run in R without tangling. Obviously, sweave options could not be imported, but that would be fine for me. Below an example of the code generated by Rtangle, which I would like to import into a sweave file. I don't think so, but writing a new driver is only a medium difficulty job. Start with an existing one in https://svn.r-project.org/R/trunk/src/library/utils/R/Sweave.R and modify until you have what you want. The harder part of this is the design: exactly what input and output is not going to be awkward? A different approach to the same problem is to use specially formatted comments in the R source to generate documentation; I think the R.oo package includes such a thing, and there may be others. I haven't used these with R, but have in other languages, and they were nice there. Actually, the package I was thinking of was roxygen (on CRAN), but I couldn't remember the name and a search came up with the R.oo reference. So there appear to be at least two such systems. Duncan Murdoch Duncan Murdoch Cheers Rainer ### ### chunk number 1: a ### x - 10 ### ### chunk number 2: ### asequence- seq(from=0,to=5,by=0.1) expnegx2 - exp(-asequence^2) plot(asequence,expnegx2,type=l,ylab=expression(exp(-z^2)),xlab=z) ### ### chunk number 3: Normal1 ### mu - 3 sigma - 5 -- Rainer M. Krug, PhD (Conservation Ecology, SUN), MSc (Conservation Biology, UCT), Dipl. Phys. (Germany) Centre of Excellence for Invasion Biology Faculty of Science Natural Sciences Building Private Bag X1 University of Stellenbosch Matieland 7602 South Africa __ 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.
[R] using par funtions in bargraph.CI()
I'm trying to create a bargraph of means with standard error bars using the function bargraph.CI (in the sciplot package). Like this: bargraph.CI(x.factor, response,data,xlab, ylab, par(family=serif),font=11) However, an error message comes up when I try to use the par funtion. Does the character font/style need to be changed in a different way for this kind of plot? Or am I misusing the par function? Thanks! Melissa __ 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] ways to put multiple graphs on single page (using ggplot2)
Hi, Here are three plots: library(ggplot2) data(diamonds) randind - sample(nrow(diamonds),1000,replace=FALSE) dsmall - diamonds[randind,] qplot(carat, data=dsmall, geom=histogram,binwidth=1) qplot(carat, data=dsmall, geom=histogram,binwidth=.1) qplot(carat, data=dsmall, geom=histogram,binwidth=.01) What are ways to put these three plots on a single page and label them A, B, and C. In general, do you use R directly for these tasks, or do you use an image editor? If you use an editor, which one do you use? I'm working on Windows. Thanks for your time. Regards, Juliet __ 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] Finding Lambda in Poisson distribution
Hi, -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Saeed Ahmadi Sent: Monday, March 02, 2009 3:16 PM To: r-help@r-project.org Subject: [R] Finding Lambda in Poisson distribution Hi, I have a dataset. First of all, I know that my dataset shall follow the Poission distribution. Now I have two questions: 1) How can I check that my data follow the Poisson distribution? 2) How can I calculate Lambda of my data? is this maybe some homework? For 2): I simulated data and did some simple MLE. I don't know if this is the recommended way, but it worked fine for me. Best, Roland -- This mail has been sent through the MPI for Demographic Research. Should you receive a mail that is apparently from a MPI user without this text displayed, then the address has most likely been faked. If you are uncertain about the validity of this message, please check the mail header or ask your system administrator for assistance. __ 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] FW: partial residual plots
Dwayne Culp wrote: Is it possible to produce partial residual plots in R? See ?cr.plots in package car. This does Component+Residual (Partial Residual) Plots. Regards, Mark. Culp, Dwayne wrote: I was advised someone might be able to help me with this. Very truly yours, Dwayne E. Culp, P.E., CFM Effective February 8, 2009, my contact information becomes: Dwayne E. Culp, P.E., CFM | JACOBS ENGINEERING GROUP : North American Infrastructure | Manager: Hydrology Hydraulics Section | 5995 Rogerdale Road- B2047B | Houston, TX 77072 | 281-776-2109 | 832.351.7766 Fax | 713.898.1977 Mobile | dwayne.c...@jacobs.com mailto:dwayne.c...@jacobs.com | From: Culp, Dwayne Sent: Friday, February 27, 2009 3:04 PM To: Ted Cleveland; r-c...@r-project.org Subject: partial residual plots Is it possible to produce partial residual plots in R? I am trying to plot the partial residual vs the adjusted explanatory variable in a multiple linear regression to determine if a transformation should be done in the explanatory variable. Very truly yours, Dwayne E. Culp, P.E., CFM | Jacobs North American Infrastructure | Senior Project Manager- Land Development | 5995 Rogerdale Road | Houston, TX 77072| 281.776.2109 | 713.898.1977 Mobile | dwayne.c...@jacobs.com NOTICE - This communication may contain confidential and privileged information that is for the sole use of the intended recipient. Any viewing, copying or distribution of, or reliance on this message by unintended recipients is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. [[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/FW%3A-partial-residual-plots-tp22293416p22293563.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] FW: partial residual plots
Dwayne, Sorry, I forgot about this: also look at ?ceres.plots, also in package car. From Prof. Fox's documentation: Ceres plots are a generalization of component+residual (partial residual) plots that are less prone to leakage of nonlinearity among the predictors. Regards, Mark. Culp, Dwayne wrote: I was advised someone might be able to help me with this. Very truly yours, Dwayne E. Culp, P.E., CFM Effective February 8, 2009, my contact information becomes: Dwayne E. Culp, P.E., CFM | JACOBS ENGINEERING GROUP : North American Infrastructure | Manager: Hydrology Hydraulics Section | 5995 Rogerdale Road- B2047B | Houston, TX 77072 | 281-776-2109 | 832.351.7766 Fax | 713.898.1977 Mobile | dwayne.c...@jacobs.com mailto:dwayne.c...@jacobs.com | From: Culp, Dwayne Sent: Friday, February 27, 2009 3:04 PM To: Ted Cleveland; r-c...@r-project.org Subject: partial residual plots Is it possible to produce partial residual plots in R? I am trying to plot the partial residual vs the adjusted explanatory variable in a multiple linear regression to determine if a transformation should be done in the explanatory variable. Very truly yours, Dwayne E. Culp, P.E., CFM | Jacobs North American Infrastructure | Senior Project Manager- Land Development | 5995 Rogerdale Road | Houston, TX 77072| 281.776.2109 | 713.898.1977 Mobile | dwayne.c...@jacobs.com NOTICE - This communication may contain confidential and privileged information that is for the sole use of the intended recipient. Any viewing, copying or distribution of, or reliance on this message by unintended recipients is strictly prohibited. If you have received this message in error, please notify us immediately by replying to the message and deleting it from your computer. [[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/FW%3A-partial-residual-plots-tp22293416p22293662.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.