[R] How to find the zero (only the real solution) with the package polynom ?
Hello, I have 3 columns : a, b and a*b I would like to find the pair (a,b) so that a*b is the minimum but not from the points I measured but from the fit of the curve (I have more points that the ones given below but I fit only on this part because I know that the minimum a*b is in this interval). I thought doing it this way : - to fit a*b=f(a) abfit-lm(ab ~ poly(a,8,raw=T)) - to use the package polynom to make the polynom library(polynom) polynomial(abfit$coefficients) 0.03537506 - 0.8506516*x + 8.302545*x^2 - 44.80418*x^3 + 144.2161*x^4 - 283.2458*x^5 + 331.1776*x^6 - 210.5144*x^7 + 55.86646*x^8 - to derive the polynom deriv(polynomial(pfit$coefficients)) -0.8506516 + 16.60509*x - 134.4125*x^2 + 576.8643*x^3 - 1416.229*x^4 + 1987.066*x^5 - 1473.601*x^6 + 446.9317*x^7 - to find the zero solve(deriv(polynomial(pfit$coefficients))) [1] 0.1749897+0.0568886i 0.1749897-0.0568886i 0.3742571-0.1235393i 0.3742571+0.1235393i 0.4778418+0.000i 0.8604070+0.1306799i 0.8604070-0.1306799i And here is my little problem : I don't want the complex solutions, only the real one (0.4778418). I also tried uniroot but I got an error message : uniroot(deriv(polynomial(pfit$coefficients)), c(0.8,0.2)) Error in uniroot(deriv(polynomial(abfit$coefficients)), c(0.8, 0.2)) : Impossible to find the function f Is there a way to extract this real solution ? I thank you in advance for your help, Have a nice day, Ptit Bleu. - Set of points aba*b 0.8 0.033320357 0.026656286 0.760.023930636 0.018187283 0.720.0153903 0.011081016 0.680.007844914 0.005334542 0.640.001598132 0.001022804 0.6 -0.00315939 -0.001895634 0.56-0.006402796-0.003585566 0.52-0.008379886-0.004357541 0.48-0.009528793-0.004573821 0.44-0.010198446-0.004487316 0.4 -0.010638282-0.004255313 0.36-0.010937536-0.003937513 0.32-0.011169004-0.003574081 0.28-0.011343229-0.003176104 0.24-0.0114878 -0.002757072 0.2 -0.011630636-0.002326127 0.16-0.011724586-0.001875934 -- View this message in context: http://www.nabble.com/How-to-find-the-zero-%28only-the-real-solution%29-with-the-package-polynom---tf4756646.html#a13602364 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] How to know created time of object in R?
Prof Brian Ripley wrote: I would like to know the created time and date of specific object. Is there any function for it? There isn't even the concept. Most objects in R are a collection of SEXPRECs created at different times. Suppose you create a data frame out of existing columns, and then later change the names? What does 'created' mean for the data frame? In any case, none of the possibly relevant date-times is stored. I imagine that it could be possible to create a class that would store the creation time of its objects... but I have no idea how to do it (I think I could do it in C++, but I am illiterate in R++ oops S4 classes). Alberto Monteiro __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] virus warning from escan to mail-sender!
The attachment(s) that you sent with the following mail had Viruses in it! = The Mail came from: [EMAIL PROTECTED] The Mail recipient: [EMAIL PROTECTED] Subject of the Mail : Delivery reports about your e-mail Message-ID: [EMAIL PROTECTED] Received : from stat.math.ethz.ch (p4FD2C3B8.dip0.t-ipconnect.de [79.210.195.184]) by zamnet.zm Sender IP : 79.210.195.184 Attachment-Name Virus-Name Action-Taken instruction.zip Email-Worm.Win32.Mydoom.m Deleted = Use MailScan on your EMail Servers and eScan on your Windows-based PCs and Servers for maximum protection from Internet-borne viruses.__ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 know created time of object in R?
On Tue, 6 Nov 2007, Alberto Monteiro wrote: Prof Brian Ripley wrote: I would like to know the created time and date of specific object. Is there any function for it? There isn't even the concept. Most objects in R are a collection of SEXPRECs created at different times. Suppose you create a data frame out of existing columns, and then later change the names? What does 'created' mean for the data frame? In any case, none of the possibly relevant date-times is stored. I imagine that it could be possible to create a class that would store the creation time of its objects... but I have no idea how to do it (I think I could do it in C++, but I am illiterate in R++ oops S4 classes). You could record the time at which you recorded the time by e.g. attr(x, creation time) - Sys.time() but this would be subject to all the ambiguities I mentioned. For an S4 class you could have a slot for time and assign it in the constructor, but it is commonplace to use new() to create a skeleton object and then fill it in. You would then need to arrange for all the subset and subassignment methods to either preserve or update the time. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Running R2WinBUGS on Linux using Wine
Hello all (1) My departmental IT guru has installed the latest Wine (0.9.48) on a well maintained Fedora 7 server, so that I can run WinBUGS from R via R2WinBUGS (this seems like the only real option for running BUGS from R on a Linux platform?) (2) WinBUGS seems to run okay, except for the following output errors: === === === fixme:keyboard:RegisterHotKey (0x10024,13,0x0002,3): stub fixme:ole:GetHGlobalFromILockBytes cbSize is 13824 err:ole:CoGetClassObject class {0003000a---c000-0046} not registered err:ole:CoGetClassObject class {0003000a---c000-0046} not registered err:ole:CoGetClassObject no class object {0003000a---c000-0046} could be created for context 0x3 === === === (3) I found a previous posting suggesting that this is a Wine related issue, which doesn't seem too major, and is likely to be fixed (pasted below). As I'm not too technical, I am naturally concerned that this problem might be doing horrible things with my analysis, which I haven't spotted yet. This mailing is just a sanity check with any of you gurus out there - for words of wisdom, advice, and perhaps what to watch out for. Thanks, Quin === === === From: Uwe Ligges ligges_at_statistik.uni-dortmund.de mailto:ligges_at_statistik.uni-dortmund.de?Subject=Re:%20%5BR%5D%20error%20in%20using%20R2WinBUGS%20on%20Ubuntu%206.10%20Linux Date: Thu, 26 Jul 2007 18:54:54 +0200 meyerjp_at_jmu.edu wrote: I am trying to run WinBUGS 1.4 from the Ubuntu 6.10 Linux distribution. I am using the R2WinBUGS packages with the source file listed below. WinBUGS appears to run properly, but I get the following message after WinBUGS starts in WINE. Does anyone know what may be causing this error and what the correction may be? http://tolstoy.newcastle.edu.au/R/e2/help/07/07/22080.html#22084qlink1 / / / Thanks / / / */ ERROR MESSAGE: / */ / / fixme:ole:GetHGlobalFromILockBytes cbSize is 13824 / / err:ole:CoGetClassObject class {0003000a---c000-0046} not registered / / err:ole:CoGetClassObject class {0003000a---c000-0046} not registered / / err:ole:CoGetClassObject no class object {0003000a---c000-0046} could be created for context 0x3 / / fixme:keyboard:RegisterHotKey (0x10032,13,0x0002,3): stub / / fixme:ntdll:RtlNtStatusToDosErrorNoTeb no mapping for 800a / / err:ole:local_server_thread Failure during ConnectNamedPipe 317 / This is wine, not R2WinBUGS nor WinBUGS nor R, I fear, and the fixme: sounds promising that things go away in a more recent version of wine... 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.
[R] library(tcltk) fails
Dear list, I cannot load the tcltk library: library(tcltk) Loading Tcl/Tk interface ... Error in fun(...) : Can't find a usable tk.tcl in the following directories: /usr/share/tcltk/tcl8.4/tk8.4 ./lib/tk8.4 /usr/local/lib/tcltk/tk8.4 /usr/local/share/tcltk/tk8.4 /usr/lib/tcltk/tk8.4 /usr/share/tcltk/tk8.4 ./library ./tk8.4.16/library This probably means that tk wasn't installed properly. Error : .onLoad failed in 'loadNamespace' for 'tcltk' Error: package/namespace load failed for 'tcltk' Cannot remember that I uninstalled anything related to Tcl/Tk, and I can start Tcl/TK application I wrote. Some system information: Sys.info() sysnamerelease Linux 2.6.22 version nodename #2 Mon Oct 22 09:58:25 CEST 2007 meta machine login i686 unknown user sfg on Debian testing, Tcl/Tk: $ ldconfig -p | grep libtk libtk8.5.so.0 (libc6) = /usr/lib/libtk8.5.so.0 libtk8.4.so.0 (libc6) = /usr/lib/libtk8.4.so.0 libtk8.4.so (libc6) = /usr/lib/libtk8.4.so $ ldconfig -p | grep libtcl libtcl8.5.so.0 (libc6) = /usr/lib/libtcl8.5.so.0 libtcl8.4.so.0 (libc6) = /usr/lib/libtcl8.4.so.0 libtcl8.4.so (libc6) = /usr/lib/libtcl8.4.so Anything wrong with my Tcl/Tk installation? Thanks, Sven __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Is it possible to modify the position of the graphic window ?
Dear R users, is there a way to tell R where to draw the windows where the plots are drawn ? I always get that window on the right of my screen, where it interferes with my Xemacs + ESS window where I'm writing lines. Of course I can move it manually, but I would like to have it permanently on the right, rather than on the left. Thanks for any advice Ottorino Ubuntu 7.10 Xemacs 21.4 patch 20 ESS version 5.3.4 R version 2.5.1 (2007-06-27) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 translating S-Plus command
Thank you very much. Worked perfectly !! El dl 05 de 11 del 2007 a les 22:17 +, en/na Prof Brian Ripley va escriure: It would help if we knew what that command was supposed to do. My guess is that you want the Tr$size with the smallest value of Tr$dev, in which case Tr$size[which.min(Tr$dev)] would seem to do it. However, there are details like what is to happen if there are ties for the smallest value. (There are simpler ways in S-PLUS to sort one variable by the values of another, for example Tr$size[sort.list(Tr$dev)] which works the same way as in R.) On Mon, 5 Nov 2007, [EMAIL PROTECTED] wrote: Dear all I have a small routine in S-Plus that I would like to use in R. There are some small changes I've been able to adapt, but I don't know how to translate the line starting with g1-sort.col and the one Size- c(Size...) (I also add some lines before) (...) Size-NULL g-cbind(Tr$dev,Tr$size) (...) g-data.frame(g) # these next two lines are the ones I need help for g1 - sort.col(target=g, columns.to.sort=@ALL, columns.to sort.by=list(g.1), ascending=T) Size-c(Size,g1[1,2]) Thanks in advance Bernat [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Produce graph that looks nice on screen and on paper
Hi all, I made a dotplot() with lattice, which comes out nice on the graphics device. I can save this as a eps using postscript() and include this in a word document. This prints nice, but does not look good on screen. If I produce a pdf, it is nice on screen, but not on paper. How can I save a graph that looks nice on paper and on screen? Bjorn Bjorn Van Campenhout Institute of Development Policy and Management (IDPM) University of Antwerp Lange Sint Annastraat 7 (S119) 2000 Antwerp - Belgium ++32 3 275 59 35 www.ua.ac.be/bjorn.vancampenhout __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Produce graph that looks nice on screen and on paper
On 11/6/07, Van Campenhout Bjorn [EMAIL PROTECTED] wrote: Hi all, I made a dotplot() with lattice, which comes out nice on the graphics device. I can save this as a eps using postscript() and include this in a word document. This prints nice, but does not look good on screen. If I produce a pdf, it is nice on screen, but not on paper. How can I save a graph that looks nice on paper and on screen? Although you haven't said so, I presume your 'paper' output is produced by a black and white printer? You have to define a theme (a collection of graphical parameters) that is nice for both screen and paper. Once you come up with such a collection of parameters, ?trellis.par.set should tell you how to set them globally. If you want someone else to come up with such a list, you are probably out of luck (but see ?col.whitebg for a not-very-good approach). -Deepayan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Solution: ploting a comparison of two scores, including the labels in the plot
Thanks to Greg Snow and John Kane I now have a working function that does what I wanted, that is compares two scores in a plot. Here is the function: ## compare.ratings: plots two lists corresponding to two different ## ratings. For each element, a line connects the position of that ## element in the two lists. compare.ratings - function(data.frame=df, vector1=rating1, vector2=rating2, vector3=labels) { treshold - 0.1 data.frame - data.frame[sort.list(data.frame[[vector2]]),] for(i in 2:length(data.frame[,vector2])) { data.frame[i,vector2] - data.frame[i,vector2] + (treshold * (i-1)) } data.frame - data.frame[sort.list(data.frame[[vector1]]),] for(i in 1:length(data.frame[,vector1])) { data.frame[i,vector1] - data.frame[i,vector1] + (treshold * (i-1)) } tmp - c(rbind( data.frame[[vector1]], data.frame[[vector2]], NA )) tmp2 - rep( c(1,2,NA), nrow(data.frame) ) plot(tmp2, tmp, type='b', xlim=c(0,3), xlab='', ylab='', lwd=0.5) text(0.9, data.frame[[vector1]], data.frame[[vector3]], adj=1, cex=0.75) text(2.1, data.frame[[vector2]], data.frame[[vector3]], adj=0, cex=0.75) } -- Hans Ekbrand (http://sociologi.cjb.net) [EMAIL PROTECTED] A. Because it breaks the logical sequence of discussion Q. Why is top posting bad? signature.asc Description: Digital signature __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Combining Density plots
Hi, you may want to look at Macdonald P (2006) Mixdist package for R www.math.mcmaster.ca/peter/mix/mix.html It also has an anova test for your model so you would know if your possible sub-populations are statistically significant of not. I don't know why actually this package is not posted on CRAN, though! I hope this helps, Monica - Message: 50Date: Tue, 6 Nov 2007 11:40:07 +1300From: Gareth Campbell [EMAIL PROTECTED]Subject: [R] Combining Density plotsTo: R Help r-help@r-project.orgMessage-ID:[EMAIL PROTECTED]Content-Type: text/plain Hello, What I am trying to do is: Generate a density plot of a population of data. This data has a bimodaldistribution so I've isolated a couple of possible sub-populations and Iwant to overlay these two density plots over the first to see whether theyare contributing to the bimodal population. I can do this fine with plot(density(...)) and lines(density(...)) . Butthe resulting plots seem to NOT share the same scale or something. I've hada read up on bandwidth and fiddled with this but I can't quite get them howthey should look. Needless to say that the sub-populations are smaller (n)than the overall population. Does anyone know how to scale the populations so they all plot on the samescale with the density function? Tha! nks very much -- Gareth CampbellPhD CandidateThe University of Auckland P +649 815 3670M +6421 256 3511E [EMAIL PROTECTED]@gmail.com _ Get it now. 6971033 [[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] Integrating a function
Hello everybody! I have problems with integrating my function. My primary function is a survival function of the following type: surviv - exp(-k*x)/(1+exp(alpha*(x-tau))) I would like to integrate this function over a defined range and obtain a vector with all the values from integrate(surviv, 0, x) for x - 1:N. I unfortunately obtain just a scalar value corresponding to the last integrated x. How do I have to proceed if I want to obtain a vector with all the results? I have tried to solve this problem by adding a while loop. It works but the expression becomes to complex if I want to perform further optimization. Have any one a solution for this problem? Thanks a lot in advance. Example # General equation beta1 - 0.001 beta2 - 0 Hct0 - 0.27 tau - 70 k - 0.001 alpha - 0.3 T2 -40 step - function(x){ if(x=0) step - 1 else step - 0 } Nmax - 250 n - 1 while(nNmax){ surviv - function(n){ surviv - exp(-k*n)/(1+exp(alpha*(n-tau))) } geq - function(n){ geq - Hct0+beta1*as.integer(integrate(surviv,0,n)[1])+step(n-T2)*(beta2-beta1)*as. integer(integrate(surviv,0,n-T2)[1]) } plot(n, geq(n), type=p, pch=19, xlim=c(0,250), ylim=c(0.25,0.35), xlab=time in days, ylab=Hct) par(new=T) print(c(n, surviv(n), geq(n), as.integer(integrate(surviv,0,n)[1])) n - n + 1 } Robert M. Kalicki, MD Department of Nephrology and Hypertension University of Bern Abteilung für Nephrologie und Hypertonie (KiKl G5) Freiburgstrasse 15 CH-3010 Inselspital Tel: +41316329663 Fax:+41316329734 [[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] library(tcltk) fails
On Tue, Nov 06, 2007 at 01:08:40PM +0100, Sven Garbade wrote: Dear list, I cannot load the tcltk library: library(tcltk) Loading Tcl/Tk interface ... Error in fun(...) : Can't find a usable tk.tcl in the following directories: /usr/share/tcltk/tcl8.4/tk8.4 ./lib/tk8.4 /usr/local/lib/tcltk/tk8.4 /usr/local/share/tcltk/tk8.4 /usr/lib/tcltk/tk8.4 /usr/share/tcltk/tk8.4 ./library ./tk8.4.16/library This probably means that tk wasn't installed properly. Error : .onLoad failed in 'loadNamespace' for 'tcltk' Error: package/namespace load failed for 'tcltk' Cannot remember that I uninstalled anything related to Tcl/Tk, and I can start Tcl/TK application I wrote. Some system information: Sys.info() sysnamerelease Linux 2.6.22 version nodename #2 Mon Oct 22 09:58:25 CEST 2007 meta machine login i686 unknown user sfg on Debian testing, Tcl/Tk: $ ldconfig -p | grep libtk libtk8.5.so.0 (libc6) = /usr/lib/libtk8.5.so.0 libtk8.4.so.0 (libc6) = /usr/lib/libtk8.4.so.0 libtk8.4.so (libc6) = /usr/lib/libtk8.4.so $ ldconfig -p | grep libtcl libtcl8.5.so.0 (libc6) = /usr/lib/libtcl8.5.so.0 libtcl8.4.so.0 (libc6) = /usr/lib/libtcl8.4.so.0 libtcl8.4.so (libc6) = /usr/lib/libtcl8.4.so Anything wrong with my Tcl/Tk installation? You didn't tell us your operating system -- but a few days ago on the r-sig-debian list we looked at the same issue and found that the tk8.4 package from Debian unstable fixes this. Hth, Dirk Thanks, Sven __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Three out of two people have difficulties with fractions. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] wilcox test on two data frames
Hi all, Basically I have 2 data frames with equal dimension and I want to apply the wilcox.test to compare columns in the same position (i.e. 1st of df.A with 1st of df.B, 2nd of df.A with 2nd of df.B,...). Anyone give me an hint on this, as I think it is nicer to avoid loops, specially for huge dataframes (3 x 200) Thanks in advance, Diogo André Alagador Portugal [[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] Is it possible to modify the position of the graphic window ?
There's a Renviron file under /etc/R, but there are no lines with position (x, y). Henrique Dallazuanna ha scritto: In the Windows the file Rconsole contains the position(x,y) of the graphics. I don't know if file have the same name in Ubuntu. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] wilcox test on two data frames
On Tue, 6 Nov 2007, Diogo Alagador wrote: Hi all, Basically I have 2 data frames with equal dimension and I want to apply the wilcox.test to compare columns in the same position (i.e. 1st of df.A with 1st of df.B, 2nd of df.A with 2nd of df.B,...). Anyone give me an hint on this, as I think it is nicer to avoid loops, specially for huge dataframes (3 x 200) Avoiding loops is unlikely to help with speed. It is more likely to be useful to avoid large dataframes (using lists or matrices) but you may need the dataframe structure for something else. If you really want to avoid loops because it is nicer you could use mapply(): mapply(wilcox.test, df.A, df.B) but this might be slower than a loop. -thomas __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] library(tcltk) fails
On Tue, 2007-11-06 at 08:03 -0600, Dirk Eddelbuettel wrote: On Tue, Nov 06, 2007 at 01:08:40PM +0100, Sven Garbade wrote: Dear list, I cannot load the tcltk library: library(tcltk) Loading Tcl/Tk interface ... Error in fun(...) : Can't find a usable tk.tcl in the following directories: /usr/share/tcltk/tcl8.4/tk8.4 ./lib/tk8.4 /usr/local/lib/tcltk/tk8.4 /usr/local/share/tcltk/tk8.4 /usr/lib/tcltk/tk8.4 /usr/share/tcltk/tk8.4 ./library ./tk8.4.16/library This probably means that tk wasn't installed properly. Error : .onLoad failed in 'loadNamespace' for 'tcltk' Error: package/namespace load failed for 'tcltk' Cannot remember that I uninstalled anything related to Tcl/Tk, and I can start Tcl/TK application I wrote. Some system information: Sys.info() sysnamerelease Linux 2.6.22 version nodename #2 Mon Oct 22 09:58:25 CEST 2007 meta machine login i686 unknown user sfg on Debian testing, Tcl/Tk: $ ldconfig -p | grep libtk libtk8.5.so.0 (libc6) = /usr/lib/libtk8.5.so.0 libtk8.4.so.0 (libc6) = /usr/lib/libtk8.4.so.0 libtk8.4.so (libc6) = /usr/lib/libtk8.4.so $ ldconfig -p | grep libtcl libtcl8.5.so.0 (libc6) = /usr/lib/libtcl8.5.so.0 libtcl8.4.so.0 (libc6) = /usr/lib/libtcl8.4.so.0 libtcl8.4.so (libc6) = /usr/lib/libtcl8.4.so Anything wrong with my Tcl/Tk installation? You didn't tell us your operating system -- but a few days ago on the r-sig-debian list we looked at the same issue and found that the tk8.4 package from Debian unstable fixes this. Operating system is Debian lenny/sid: $ uname -a Linux meta 2.6.22 #2 Mon Oct 22 09:58:25 CEST 2007 i686 GNU/Linux I now fixed this with a symbolic link from /usr/local/lib/tcltk/ (were R (?) looks for the Tcl/TK libs) to /usr/lib/ were the Tcl/Tk libs are. I wait until tk8.4 package from Debian unstable is in testing, because sometimes unstable is really unstable... Thanks, Sven __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] wilcox test on two data frames
I don't think that the loop-part puts a great penalty in this case; however, it'd be better to convert the data.frames to matrices, since matrix indexing is faster, e.g., # I presume that you only want to keep the p-values mat.A - data.matrix(df.A) mat.B - data.matrix(df.B) pvalues - numeric(200) for (i in 1:200) { pvalues[i] - wilcox.test(x = mat.A[, i], y = mat.B[, i])$p.value } I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm - Original Message - From: Diogo Alagador [EMAIL PROTECTED] To: r-help@r-project.org Sent: Tuesday, November 06, 2007 12:30 PM Subject: [R] wilcox test on two data frames Hi all, Basically I have 2 data frames with equal dimension and I want to apply the wilcox.test to compare columns in the same position (i.e. 1st of df.A with 1st of df.B, 2nd of df.A with 2nd of df.B,...). Anyone give me an hint on this, as I think it is nicer to avoid loops, specially for huge dataframes (3 x 200) Thanks in advance, Diogo André Alagador Portugal [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Is it possible to modify the position of the graphic window ?
The lines are: ## Initial position of the graphics window ## (pixels, 0 values from opposite edge) xgraphics = 200 ygraphics = 10 On 06/11/2007, 8rino-Luca Pantani [EMAIL PROTECTED] wrote: There's a Renviron file under /etc/R, but there are no lines with position (x, y). Henrique Dallazuanna ha scritto: In the Windows the file Rconsole contains the position(x,y) of the graphics. I don't know if file have the same name in Ubuntu. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[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] pipe scan timeout
Hi all, Usually when I do a command in shell and have the output read from R, I like to do this: pp - pipe(cmd) sol - scan(pp, what=character, sep=\n) I prefer this one over read.table since read.table somewhere has a gc call and it's slow. However, sometimes the cmd takes a while to run and somehow scan/pipe waits for like 5 seconds and return 0 results (even though the shell command returns something if i were to put it in shell after 2 min). So i THINK there's some timeout kicking around somewhere. Do you guys know what the options would be or if this is a timeout issue at all or if there's a better way to do this? I tried options('timeout') and I have it set to 60 seconds.. so i don't think it's that options.. Thanks! -yo -- View this message in context: http://www.nabble.com/pipe-scan-timeout-tf4758597.html#a13608432 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] Non-parametric tolerance limits
Does anyone know if there exists a package for non-parametric tolerance limits in R? Or any other way to do it? -- View this message in context: http://www.nabble.com/Non-parametric-tolerance-limits-tf4750263.html#a13583088 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] Produce a multiple formats graphic
Cuvelier Etienne wrote: Is it possible to produce the same graphic in different formats in one shot? Now if I want to produce the same graphic in pdf, ps and jpeg I run the producing code, but I change the graphic device, and I choose successively : pdf(...) ps(...) jpeg(...) So in this case I run the same code 3 times, Yes, or write a small piece of code that does it for you. Uwe Ligges or I have to choose a format and use converters... Is it possible to produce the 3 graphics in once ? Thank you very much __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] C++ and R interface
Hi All, I am trying to do an ML estimation in R. My likelihood function has several nested loops and so it takes a lot of time (days when I use the genetic algorithm for optimization) for the optimization to finish. Unable to avoid loops, I am thinking of writing the likelihood function in C++ and calling it from within R when using *optim()*. I found that one can call C functions (once they have been compiled) from within R with dyn.load(file.so) and .C(function, ...) Can the same be done for C++ code? Deepankar __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Kolmogorov-Smirnoff test
I am trying to determine whether two samples are identical or not. I'm aware that somebody can use the Kolmogorov-Smirnoff test to compare empirical distributions, but since my samples have ties I'm not sure if I'm getting the right p-values for the comparison. Can the Kolmogorov-Smirnoff test be adjusted for the case when ties exists and are there any functions that already exists in R ( Kolmogorov-Smirnoff test )performing that can be used in the case of the existance of ties? Thank you in advance for your help. Oarabile __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Fwd: Produce a multiple formats graphic
-- Forwarded message -- From: Mark Wardle [EMAIL PROTECTED] Date: 6 Nov 2007 16:01 Subject: Re: [R] Produce a multiple formats graphic To: Cuvelier Etienne [EMAIL PROTECTED] You have several options: 1. Write a function that creates your plot, and call that function repeatedly manually. 2. Write a wrapper function that takes the name of a function, and an output filename, and calls that function repeatedly after creating different graphics devices. 3. Create as PDF, and use something else (like ImageMagick) to convert to different formats. I tend to do option 3 as it is the most flexible. Best wishes, Mark On 06/11/2007, Cuvelier Etienne [EMAIL PROTECTED] wrote: Is it possible to produce the same graphic in different formats in one shot? Now if I want to produce the same graphic in pdf, ps and jpeg I run the producing code, but I change the graphic device, and I choose successively : pdf(...) ps(...) jpeg(...) So in this case I run the same code 3 times, or I have to choose a format and use converters... Is it possible to produce the 3 graphics in once ? Thank you very much -- === Cuvelier Etienne Assistant FUNDP - Institut d'Informatique rue Grandgagnage, 21 B-5000 Namur (Belgique) tel: 32.81.72.49.93fax: 32.81.72.49.67 === Top 10 reasons to become a Statistician 1. Deviation is considered normal 2. We feel complete and sufficient 3. We are 'mean' lovers 4. Statisticians do it discretely and continuously 5. We are right 95% of the time 6. We can legally comment on someone's posterior distribution 7. We may not be normal, but we are transformable 8. We never have to say we are certain 9. We are honestly significantly different 10. No one wants our jobs __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email __ -- Dr. Mark Wardle Specialist registrar, Neurology Cardiff, UK -- Dr. Mark Wardle Specialist registrar, Neurology Cardiff, 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] Is it possible to modify the position of the graphic window ?
On Linux the default graphics device is X11(), and not so on Windows. ?X11 tells you no less than *two* ways to do this: I do wonder why you don't just read the help file? ?options (see 'device') tells you how to set up a default device which you could use to change default arguments, but using the X11 geometry resources is the canonical way to do this. On Tue, 6 Nov 2007, 8rino-Luca Pantani wrote: There's a Renviron file under /etc/R, but there are no lines with position (x, y). Henrique Dallazuanna ha scritto: In the Windows the file Rconsole contains the position(x,y) of the graphics. I don't know if file have the same name in Ubuntu. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] translating R code to C code
I would like to try to implement a big series of nested loops in a C code and then call it from R; however I'm not familiar with C programming. Does anyone know about some sort of reference I can use that help me to translate my code to C? (I'm thinking on something like to Octave to R reference posted in CRAN) thanks PM __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Kolmogorov-Smirnoff test
On 06-Nov-07 15:53:53, Oarabile Molaodi wrote: I am trying to determine whether two samples are identical or not. I'm aware that somebody can use the Kolmogorov-Smirnoff test to compare empirical distributions, but since my samples have ties I'm not sure if I'm getting the right p-values for the comparison. Can the Kolmogorov-Smirnoff test be adjusted for the case when ties exists and are there any functions that already exists in R (Kolmogorov-Smirnoff test )performing that can be used in the case of the existance of ties? Thank you in advance for your help. Oarabile Tests like the Kolmogorov-Smirnov whose theoretical null distribution assume continuous random variables (hence wothout ties) do not have definite null distributions when ties are possible. Whatever null distribution the test may have when ties are present (e.g. due to data being recorded to a relatively coarse precision) will depend on the pattern of ties. However, it is possible to investigate the effect of ties on the P-value by randomly breaking ties. For instance, suppose your data are recorded to a precision of 0.1, and you have two such samples X and Y, then let X.rand - X + 0.0001*runif(length(X) Y.rand - Y + 0.0001*runif(length(Y) and then do a K-S test on X.rand vs Y.rand. You will get a P-value. Repeat this many time. You will get a distribution of P-values. You can extract any relevant property of this distrobution of P-values, for instance its mean, it's 95th percentile (so you can be 96% confident that the tie-broken P-value is less than this value). and so on. Hoping this helps, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 06-Nov-07 Time: 16:23:34 -- XFMail -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] C++ and R interface
Yes, this can be done and the call is the same, however the C++ needs to be indicated as external c, see details in the writing R extensions manual. hth, Ingmar On 6 Nov 2007, at 17:05, Deepankar Basu wrote: Hi All, I am trying to do an ML estimation in R. My likelihood function has several nested loops and so it takes a lot of time (days when I use the genetic algorithm for optimization) for the optimization to finish. Unable to avoid loops, I am thinking of writing the likelihood function in C++ and calling it from within R when using *optim()*. I found that one can call C functions (once they have been compiled) from within R with dyn.load(file.so) and .C(function, ...) Can the same be done for C++ code? Deepankar __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. Ingmar Visser Department of Psychology, University of Amsterdam Roetersstraat 15 1018 WB Amsterdam The Netherlands t: +31-20-5256723 [[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] C++ and R interface
Deepankar Basu wrote: I am trying to do an ML estimation in R. My likelihood function has several nested loops and so it takes a lot of time (days when I use the genetic algorithm for optimization) for the optimization to finish. Unable to avoid loops, I am thinking of writing the likelihood function in C++ and calling it from within R when using *optim()*. I found that one can call C functions (once they have been compiled) from within R with dyn.load(file.so) and .C(function, ...) Can the same be done for C++ code? If it can be done in C, it probably (P 99%) can be done in C++, because C++ can call C functions. Just write the C++ code as: extern C int myfunction(int x1, int x2) { // write C++ code here return rval; } Alberto Monteiro __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Problem with a non-factor, non-numeric variable in a data.frame
Dear R list, I would like to perform an ANOVA in a set of measurements, but I have problems formatting the data. The data is a two dimensional array containing two columns: - Stim : the type of stimulation (string) - Ratio : a ratio of two numeric values Now, because some values are missing in the data (defaulting to zero), part of this array will be populated with NA ratios. Maybe this is important later. In order to make the ANOVA analysis, I need to turn my vector into a data.frame. I tried vector.table=as.data.frame(vector) But I realized that is.numeric(Ratio) gives FALSE is.factor(Ratio) gives TRUE After reading the documentation, I tried vector.table=as.data.frame(vector, stringsAsFactors = FALSE) This time is.numeric(Ratio) gives FALSE is.factor(Ratio) gives FALSE So I don't even know what is Ratio, but it's not yet numeric (is this due to the NA values?). How can I get R to understand that Ratio is numeric? Checking the documentation it seems you can do it with I(x), but the details are not explained. I also tried as.numeric(Ratio), and everything was turned into zeros. Any suggestions? Cheers, Alexandre Santos Neuro-MPI, Martinsread, Germany __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] C++ and R interface
Thanks for the help. On Tue, 2007-11-06 at 14:48 -0200, Alberto Monteiro wrote: Deepankar Basu wrote: I am trying to do an ML estimation in R. My likelihood function has several nested loops and so it takes a lot of time (days when I use the genetic algorithm for optimization) for the optimization to finish. Unable to avoid loops, I am thinking of writing the likelihood function in C++ and calling it from within R when using *optim()*. I found that one can call C functions (once they have been compiled) from within R with dyn.load(file.so) and .C(function, ...) Can the same be done for C++ code? If it can be done in C, it probably (P 99%) can be done in C++, because C++ can call C functions. Just write the C++ code as: extern C int myfunction(int x1, int x2) { // write C++ code here return rval; } Alberto Monteiro __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Is it possible to modify the position of the graphic window ?
I see. Thanks for your highly appreciated help, Prof. Ripley. I've been reading the x11 help file, only after people from this list told me that it is the default in Linux Please consider that I recently (and definitely) moved to linux from Windows, and I still need to re-learn a lot of things. I did'nt know that with options was possible to change the x11 windows. I typed the following, and it worked options(device= x11(xpos =500)) moving the window on the left Now, if I'm allowed to push your patience a little further, how can I make this change permanent ? Thanks again Ottorino Pantani Prof Brian Ripley ha scritto: On Linux the default graphics device is X11(), and not so on Windows. ?X11 tells you no less than *two* ways to do this: I do wonder why you don't just read the help file? ?options (see 'device') tells you how to set up a default device which you could use to change default arguments, but using the X11 geometry resources is the canonical way to do this. On Tue, 6 Nov 2007, 8rino-Luca Pantani wrote: There's a Renviron file under /etc/R, but there are no lines with position (x, y). Henrique Dallazuanna ha scritto: In the Windows the file Rconsole contains the position(x,y) of the graphics. I don't know if file have the same name in Ubuntu. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Ottorino-Luca Pantani, Università di Firenze Dip. Scienza del Suolo e Nutrizione della Pianta P.zle Cascine 28 50144 Firenze Italia Tel 39 055 3288 202 (348 lab) Fax 39 055 333 273 [EMAIL PROTECTED] http://www4.unifi.it/dssnp/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] translating R code to C code
Pedro Mardones mardones.p at gmail.com writes: I would like to try to implement a big series of nested loops in a C code and then call it from R; however I'm not familiar with C programming. Does anyone know about some sort of reference I can use that help me to translate my code to C? (I'm thinking on something like to Octave to R reference posted in CRAN) thanks No. R and C are not comparable, so there is not reference. R, Octave and Matlab have more similarities. Best is to ask someone who knows C, and explain him/her what has to be done; you have little chance to get a C program to work without some experience. 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] R validation
For the survival package, you might want to reference appendix E of Therneau and Grambsh, Modeling Survival Data, Springer-Verlag, 2000. This contains a set of small example data sets for which results have been worked out in closed form. S-plus and R pass all the tests: they are a portion of the test suite of the package. (SAS does not pass, BTW. It doesn't compute dfbeta residuals for a Cox model quite right under the Efron approximation. The error is small and almost certainly unimportant in practical data, but I like to keep it in hand as a counterexample to believers of SAS infallability). Terry Therneau __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Why can repeated measures anova with within between subjects design not be done if group sizes are unbalanced?
Charles C. Berry cberry at tajo.ucsd.edu writes: As the posting guide suggests, you could perform a search using RSiteSearch(repeated measures, restric=functions) say. That generates an inventory of functions that pertain to repeated measures designs. The problem I noted in practice with researcher is that nlme is not among those associated with repeated measurements, with the exception of the citation of Davidian, M. and Giltinan, D.M. (1995) Nonlinear Mixed Effects Models for Repeated Measurement Data, Chapman and Hall. somewhere in the nlme documentation. And as far as I remember, the word repeated measurements cannot be found in text of Pinheiro Bates; which otherwise is the most worn-out book on my shelf. I may be slightly off with both statements, but the association (mixed model) = (repeated measurements) is not at all obvious. For the record: forget repeated measurements. It definitively pays to be fluent in mixed models. Once you have your data in the long form, most work is done. And if lme tells you it cannot solve your problem, it has damned good reasons for it. 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] Is it possible to modify the position of the graphic window ?
On Tue, 6 Nov 2007, 8rino-Luca Pantani wrote: I see. Thanks for your highly appreciated help, Prof. Ripley. I've been reading the x11 help file, only after people from this list told me that it is the default in Linux Please consider that I recently (and definitely) moved to linux from Windows, and I still need to re-learn a lot of things. I did'nt know that with options was possible to change the x11 windows. I typed the following, and it worked options(device= x11(xpos =500)) moving the window on the left Now, if I'm allowed to push your patience a little further, how can I make this change permanent ? Better to use resources. But you can use (in .Rprofile) options(device=function() x11(xpos=-1)) The resources version would be to put in ~/.Xresources something like R_x11*geometry: 700x700-0+0 Thanks again Ottorino Pantani Prof Brian Ripley ha scritto: On Linux the default graphics device is X11(), and not so on Windows. ?X11 tells you no less than *two* ways to do this: I do wonder why you don't just read the help file? ?options (see 'device') tells you how to set up a default device which you could use to change default arguments, but using the X11 geometry resources is the canonical way to do this. On Tue, 6 Nov 2007, 8rino-Luca Pantani wrote: There's a Renviron file under /etc/R, but there are no lines with position (x, y). Henrique Dallazuanna ha scritto: In the Windows the file Rconsole contains the position(x,y) of the graphics. I don't know if file have the same name in Ubuntu. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Is it possible to modify the position of the graphic window ?
8rino-Luca Pantani wrote: I see. Thanks for your highly appreciated help, Prof. Ripley. I've been reading the x11 help file, only after people from this list told me that it is the default in Linux Please consider that I recently (and definitely) moved to linux from Windows, and I still need to re-learn a lot of things. I did'nt know that with options was possible to change the x11 windows. I typed the following, and it worked options(device= x11(xpos =500)) moving the window on the left Now, if I'm allowed to push your patience a little further, how can I make this change permanent ? Umm, I think that one only seemingly works. It does the same as plain x11(xpos=500) followed by options(device=NULL) (try removing the window and then plot(0)). More likely, you want options(device = function() x11(xpos=500) ) which you can handle using the techniques described under ?Startup (i.e. stick it in a .Rprofile file, for instance). (xpos=-1 might be better if you switch between different-sized screens, though) Thanks again Ottorino Pantani Prof Brian Ripley ha scritto: On Linux the default graphics device is X11(), and not so on Windows. ?X11 tells you no less than *two* ways to do this: I do wonder why you don't just read the help file? ?options (see 'device') tells you how to set up a default device which you could use to change default arguments, but using the X11 geometry resources is the canonical way to do this. On Tue, 6 Nov 2007, 8rino-Luca Pantani wrote: There's a Renviron file under /etc/R, but there are no lines with position (x, y). Henrique Dallazuanna ha scritto: In the Windows the file Rconsole contains the position(x,y) of the graphics. I don't know if file have the same name in Ubuntu. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] question about running out of memory on R -- memory.limit change in R 2.6.0?
jim holtman [EMAIL PROTECTED] wrote in message news:[EMAIL PROTECTED] --max-mem-size=N (Windows only) Specify a limit for the amount of memory to be used both for R objects and working areas. This is set by default to the smaller of 1.5Gb24 and the amount of physical RAM in the machine, and must be between 32Mb and 3Gb. Something seems to have changed in R 2.6.0 -- the limit is no longer 3 GB. On a PC with 3.5 GB with R 2.5.1 using default command line: Default memory.limit() [1] 1610612736 With --max-mem-size=3000M on the command line: memory.limit() [1] 3145728000 Let's see what happens with R 2.6.0 on the same 3.5 GB PC (Windows XP): Default command line: memory.limit() [1] 1535.875 Note: The format of the return value is now in MB instead of bytes. With --max-mem-size=3000M on the command line: Error message: WARNING: --max-mem-size=3000M: too large and taken as 2047M memory.limit() [1] 2047.875 This value is less than the value shown in R 2.5.1 (after converting both to the same basis). But was this change a fix to report that a Windows process only has a 2 GB address space? That is, the value returned by R 2.5.1 of 3145728000 wasn't strictly correct? efg Earl F. Glynn Scientific Programmer Stowers Institute __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 needed: taking a function out of a package and it can not find some funtions
I tried to modify the R function bw.SJ (from the stats package) for my own use. But if I just get the source code and run directly (without any modification), it can no longer find some key functions called within it. I understand this has something to do with searching path which I do not understand well. Can anyone tell me how to modify the source code of an R function and still make it part of an existing package? Thanks. Jason Liao, http://www.geocities.com/jg_liao Associate Professor of Biostatistics Drexel University School of Public Health 245 N. 15th Street, Mail Stop 660 Philadelphia, PA 19102-1192 phone 215-762-3934 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 know created time of object in R?
On Tue, 06-Nov-2007 at 08:17AM -0200, Alberto Monteiro wrote: | | Prof Brian Ripley wrote: | | I would like to know the created time and date of specific object. | Is there any function for it? | | There isn't even the concept. Most objects in R are a collection of | SEXPRECs created at different times. Suppose you create a data | frame out of existing columns, and then later change the names? What | does 'created' mean for the data frame? | | In any case, none of the possibly relevant date-times is stored. | | I imagine that it could be possible to create a class that | would store the creation time of its objects... but I have | no idea how to do it (I think I could do it in C++, but I am | illiterate in R++ oops S4 classes). I never use the comment for anything else, so it's simple enough to store that information there. In my case, I'm only interested in the date which is interesting information when revisiting a project months or years later. As Brian indicated, it's not entirely predictable, but it's good enough for my purposes. I'm mostly interested in various versions of functions or lists that they create. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] color2D.matplot
I am a true R novice aonly using it for this function ;) I am trying to use color2D.matplot to form a image of my data using the following conditions color2D.matplot(fi1, c(dr), c(dg), c(db), nslices=7, ylab='Species', xlab=gene, show.legend=TRUE) where fi1 is my matrix. I have a matrix with 36 columns and 130 rows. most entries are 1 or 0 and I am trying to get this function to plot these as either 0 = white or 1 = black. This is fine but one column contains entries between 0 and 7. I would entries between 2 and 7 to be different colors (as this is what I am trying to show although I also need to see the black and white areas) using the following: dr = c(1,0,1,0,0) dg = c(1,0,0,1,0) db = c(1,0,0,0,1) I can get some color to work but I cannot get them all as if I but in a c() range equalling 0-7 (i.e. one color for each number I get the following. I cannot figure out from the documentation why it will not let me do what I want :( Error in rescale(x[segindex], redrange[c(seg, seg + 1)]) : rescale: can't rescale a constant vector! help please someone... -- View this message in context: http://www.nabble.com/color2D.matplot-tf4760527.html#a13614400 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] Is it possible to modify the position of the graphic window ?
On 7/11/2007, at 6:39 AM, Prof Brian Ripley wrote: Better to use resources. But you can use (in .Rprofile) options(device=function() x11(xpos=-1)) The resources version would be to put in ~/.Xresources something like R_x11*geometry: 700x700-0+0 Neither of these options appears to have any effect under Mac OSX. I run R from the command line from a terminal window (not from the GUI) and I have X11 installed so that in R x11() does indeed put up a graphics window. But it always puts it (the initial window) in exactly the same place, irrespective of my having put the specified line in ~/.Xresources before starting R, or having issued the specified options() command immediately after having started R (before issuing the x11() command). It's no big deal --- I'm reasonably happy with the default position of the window. I just hate it when a computer refuses to follow instructions, with no explanation. :-( cheers, Rolf Turner P. S.: sessionInfo() R version 2.6.0 (2007-10-03) i386-apple-darwin8.10.1 locale: C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] misc_0.0-2 loaded via a namespace (and not attached): [1] rcompgen_0.1-15 ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] translating R code to C code
On 7/11/2007, at 6:24 AM, Dieter Menne wrote: you have little chance to get a C program to work without some experience. A fortune??? cheers, Rolf Turner ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with a non-factor, non-numeric variable in a data.frame
Have a look at the R-FAQ issue 7.10. It's a standard problem For more information about your variable try str(variable). --- Alexandre Santos [EMAIL PROTECTED] wrote: Dear R list, I would like to perform an ANOVA in a set of measurements, but I have problems formatting the data. The data is a two dimensional array containing two columns: - Stim : the type of stimulation (string) - Ratio : a ratio of two numeric values Now, because some values are missing in the data (defaulting to zero), part of this array will be populated with NA ratios. Maybe this is important later. In order to make the ANOVA analysis, I need to turn my vector into a data.frame. I tried vector.table=as.data.frame(vector) But I realized that is.numeric(Ratio) gives FALSE is.factor(Ratio) gives TRUE After reading the documentation, I tried vector.table=as.data.frame(vector, stringsAsFactors = FALSE) This time is.numeric(Ratio) gives FALSE is.factor(Ratio) gives FALSE So I don't even know what is Ratio, but it's not yet numeric (is this due to the NA values?). How can I get R to understand that Ratio is numeric? Checking the documentation it seems you can do it with I(x), but the details are not explained. I also tried as.numeric(Ratio), and everything was turned into zeros. Any suggestions? Cheers, Alexandre Santos Neuro-MPI, Martinsread, Germany __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Is it possible to modify the position of the graphic window ?
1) Did you merge the resources or restart X? You need to in order to get new resources to be recognized. xrdb -merge ~/.Xresources would be needed to merge resources into the current X session. I don't know if MacOS X11 is standard enough to support this, but it is a very long-standing basic part of X11. 2) options(device=function() x11(xpos=-1)) plot(1:10) should work (does for me): it does not affect x11() in any way, just the auto-start graphics device. On Wed, 7 Nov 2007, Rolf Turner wrote: On 7/11/2007, at 6:39 AM, Prof Brian Ripley wrote: Better to use resources. But you can use (in .Rprofile) options(device=function() x11(xpos=-1)) The resources version would be to put in ~/.Xresources something like R_x11*geometry: 700x700-0+0 Neither of these options appears to have any effect under Mac OSX. I run R from the command line from a terminal window (not from the GUI) and I have X11 installed so that in R x11() does indeed put up a graphics window. But it always puts it (the initial window) in exactly the same place, irrespective of my having put the specified line in ~/.Xresources before starting R, or having issued the specified options() command immediately after having started R (before issuing the x11() command). It's no big deal --- I'm reasonably happy with the default position of the window. I just hate it when a computer refuses to follow instructions, with no explanation. :-( cheers, Rolf Turner P. S.: sessionInfo() R version 2.6.0 (2007-10-03) i386-apple-darwin8.10.1 locale: C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] misc_0.0-2 loaded via a namespace (and not attached): [1] rcompgen_0.1-15 ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 needed: taking a function out of a package and it can not find some funtions
bw.SJ calls C code from the file /usr/local/bin/R-2.6.0/src/library/stats/src/bandwidths.c You have to make this code available. You can do the following: 1. copy bandwidths.c and the definition of bw.SJ (the latter renamed) to a directory 2. compile bandwidths.c into a shared library with the command R CMD SHLIB bandwidths.c (see the manual writing R extensions for details) 3. in your definition of bw.SJ, in the 3 places .C is called, remove R_ from the first argument and quote it; e.g., C(R_band_phi4_bin, ... becomes C(band_phi4_bin, 4. in R, load the shared library you built with the dyn.load function; now your definition of the (renamed) function bw.SJ can be modified as you like. On Tue, 6 Nov 2007, Jason Liao wrote: I tried to modify the R function bw.SJ (from the stats package) for my own use. But if I just get the source code and run directly (without any modification), it can no longer find some key functions called within it. I understand this has something to do with searching path which I do not understand well. Can anyone tell me how to modify the source code of an R function and still make it part of an existing package? Thanks. Jason Liao, http://www.geocities.com/jg_liao Associate Professor of Biostatistics Drexel University School of Public Health 245 N. 15th Street, Mail Stop 660 Philadelphia, PA 19102-1192 phone 215-762-3934 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] R validation
In regard to validation of R, there are test directories with test code. See for example: https://svn.r-project.org/R/trunk/tests/ and https://svn.r-project.org/R/trunk/src/library/stats/tests/ David Scott _ David Scott Department of Statistics, Tamaki Campus The University of Auckland, PB 92019 Auckland 1142,NEW ZEALAND Phone: +64 9 373 7599 ext 86830 Fax: +64 9 373 7000 Email: [EMAIL PROTECTED] Graduate Officer, Department of Statistics Director of Consulting, Department of Statistics __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with a non-factor, non-numeric variable in a data.frame
I tested as.numeric(as.character(Ratio)) and it works perfectly! I still don't get why as.numeric(Ratio) was not enough, but at least now I know how to deal with it. Thanks for the tip, and sorry for missing the R-FAQ issue 7.10. Cheers, Alexandre Santos 2007/11/6, John Kane [EMAIL PROTECTED]: Have a look at the R-FAQ issue 7.10. It's a standard problem For more information about your variable try str(variable). --- Alexandre Santos [EMAIL PROTECTED] wrote: Dear R list, I would like to perform an ANOVA in a set of measurements, but I have problems formatting the data. The data is a two dimensional array containing two columns: - Stim : the type of stimulation (string) - Ratio : a ratio of two numeric values Now, because some values are missing in the data (defaulting to zero), part of this array will be populated with NA ratios. Maybe this is important later. In order to make the ANOVA analysis, I need to turn my vector into a data.frame. I tried vector.table=as.data.frame(vector) But I realized that is.numeric(Ratio) gives FALSE is.factor(Ratio) gives TRUE After reading the documentation, I tried vector.table=as.data.frame(vector, stringsAsFactors = FALSE) This time is.numeric(Ratio) gives FALSE is.factor(Ratio) gives FALSE So I don't even know what is Ratio, but it's not yet numeric (is this due to the NA values?). How can I get R to understand that Ratio is numeric? Checking the documentation it seems you can do it with I(x), but the details are not explained. I also tried as.numeric(Ratio), and everything was turned into zeros. Any suggestions? Cheers, Alexandre Santos Neuro-MPI, Martinsread, Germany __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now at http://ca.toolbar.yahoo.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] R validation
On Wed, 2007-11-07 at 09:28 +1300, David Scott wrote: In regard to validation of R, there are test directories with test code. See for example: https://svn.r-project.org/R/trunk/tests/ and https://svn.r-project.org/R/trunk/src/library/stats/tests/ David Scott Those are a part of the tests that are run when using 'make check all' after building R from source. As Tony noted, they can be used (and I do) for the IQ (Installation Qualification) part of the validation process. In my case, I have a shell script that runs the full process (svn checkout, configure, make and make check all). The script, using 'mutt', e-mails me the output of make check all, which has been re-directed to a file, as an attachment, along with the SVN-REVISION file. I keep that as part of my internal documentation. Again as Tony noted, the specifications for the remainder of the OQ/PQ (Operational Qualification and Performance Qualification) and other components as required, need to be defined by the organization that intends to use R in this domain. As indicated in the R-FDA document, these are areas where the FDA has provided generally non-prescriptive guidance. As a result, it is up to each organization to assess its own requirements and implement solutions that it feels reasonably satisfies those requirements. A starting point might be to review the process currently in place for similar applications within the organization and assess how they either do or do not translate for R. You then have the basis for a 'gap' analysis and can move forward from there. 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] xtable.by
Thanks to all who helped out with this question. I have a version that's working reasonably well for me right now, and will post code if I manage a more generalizable version. Best, Ari __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem with a non-factor, non-numeric variable in a data.frame
Alexandre, Try rereading FAX 7.10, it explains why as.numeric() won't do it: In any case, do not call as.numeric() or their likes directly for the task at hand as as.numeric() or unclass() give the internal codes I.e., the INTERNAL CODE of the factor is what as.numeric() is working on rather than the numeric representation that you see. On 11/6/07, Alexandre Santos [EMAIL PROTECTED] wrote: I tested as.numeric(as.character(Ratio)) and it works perfectly! I still don't get why as.numeric(Ratio) was not enough, but at least now I know how to deal with it. Thanks for the tip, and sorry for missing the R-FAQ issue 7.10. Cheers, Alexandre Santos 2007/11/6, John Kane [EMAIL PROTECTED]: Have a look at the R-FAQ issue 7.10. It's a standard problem For more information about your variable try str(variable). --- Alexandre Santos [EMAIL PROTECTED] wrote: Dear R list, I would like to perform an ANOVA in a set of measurements, but I have problems formatting the data. The data is a two dimensional array containing two columns: - Stim : the type of stimulation (string) - Ratio : a ratio of two numeric values Now, because some values are missing in the data (defaulting to zero), part of this array will be populated with NA ratios. Maybe this is important later. In order to make the ANOVA analysis, I need to turn my vector into a data.frame. I tried vector.table=as.data.frame(vector) But I realized that is.numeric(Ratio) gives FALSE is.factor(Ratio) gives TRUE After reading the documentation, I tried vector.table=as.data.frame(vector, stringsAsFactors = FALSE) This time is.numeric(Ratio) gives FALSE is.factor(Ratio) gives FALSE So I don't even know what is Ratio, but it's not yet numeric (is this due to the NA values?). How can I get R to understand that Ratio is numeric? Checking the documentation it seems you can do it with I(x), but the details are not explained. I also tried as.numeric(Ratio), and everything was turned into zeros. Any suggestions? Cheers, Alexandre Santos Neuro-MPI, Martinsread, Germany __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Yahoo! Canada Toolbar: Search from anywhere on the web, and bookmark your favourite sites. Download it now at http://ca.toolbar.yahoo.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. -- Matthew C Keller Asst. Professor of Psychology University of Colorado at Boulder www.matthewckeller.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] Is it possible to modify the position of the graphic window ?
On 7/11/2007, at 9:12 AM, Prof Brian Ripley wrote: 1) Did you merge the resources or restart X? You need to in order to get new resources to be recognized. xrdb -merge ~/.Xresources would be needed to merge resources into the current X session. No I didn't. Didn't know or didn't remember about the merge business. Dang! That works. But only for the auto-start device, not for x11(). I don't know if MacOS X11 is standard enough to support this, but it is a very long-standing basic part of X11. 2) options(device=function() x11(xpos=-1)) plot(1:10) should work (does for me): it does not affect x11() in any way, just the auto-start graphics device. Right. That works too. Missed the distinction between x11() and the auto-start device. Thanks very much. cheers, Rolf ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help needed: taking a function out of a package and it can not find some funtions
OK, well, the way I suggested will allow you to modify the C code too -- but reading your question I realize you probably don't want to do this. If you want to use the definitions of the C functions from stats, you can skip 2. below and add another modification to the calls to .C in your def. of bw.SJ; add the argument PACKAGE=stats. On Tue, 6 Nov 2007, Katharine Mullen wrote: bw.SJ calls C code from the file /usr/local/bin/R-2.6.0/src/library/stats/src/bandwidths.c You have to make this code available. You can do the following: 1. copy bandwidths.c and the definition of bw.SJ (the latter renamed) to a directory 2. compile bandwidths.c into a shared library with the command R CMD SHLIB bandwidths.c (see the manual writing R extensions for details) 3. in your definition of bw.SJ, in the 3 places .C is called, remove R_ from the first argument and quote it; e.g., C(R_band_phi4_bin, ... becomes C(band_phi4_bin, 4. in R, load the shared library you built with the dyn.load function; now your definition of the (renamed) function bw.SJ can be modified as you like. On Tue, 6 Nov 2007, Jason Liao wrote: I tried to modify the R function bw.SJ (from the stats package) for my own use. But if I just get the source code and run directly (without any modification), it can no longer find some key functions called within it. I understand this has something to do with searching path which I do not understand well. Can anyone tell me how to modify the source code of an R function and still make it part of an existing package? Thanks. Jason Liao, http://www.geocities.com/jg_liao Associate Professor of Biostatistics Drexel University School of Public Health 245 N. 15th Street, Mail Stop 660 Philadelphia, PA 19102-1192 phone 215-762-3934 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Algorithms for coincidences
A paper that may help you: Methods for Studying Coincidences, Persi Diaconis; Frederick Mosteller. Journal of the American Statistical Association, vol 84, no. 408 (Dec., 1989), 853-861. And remember that the birthday problem assumes independence, but if you have 2 students that studied together (legitimately) then we would not expect their scores to be independent. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare [EMAIL PROTECTED] (801) 408-8111 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Doran, Harold Sent: Tuesday, November 06, 2007 12:10 PM To: r-help Subject: [R] Algorithms for coincidences I'm looking at algorithms for determining coincidences. In educational testing, it is interesting to look at cheating via the birthday problem where I can assess the probability of n students having the same test score in a class of size k. I was writing my own code for the b-day problem until I ran into the qbirthday() function, which has solutions for the overflow problems I kept running into. There is no see also part of this man page which would reference me to other functions which may prove useful for such problems. But, that doesn't mean they don't exist. I am just not familiar enough with this branch of mathematics to know exactly what else I might look for. Does anyone know of any other R functions that may be useful for me to look at in thinking about this kind of problem? Harold [[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] Pass Array input to web service
-BEGIN PGP SIGNED MESSAGE- Hash: SHA1 Rohan7 wrote: Hello everybody, I'm using SSOAP and RCurl to call webservice. I got success in calling webservice with string as an input. Now i want to pass array as an input(can be single or multidimensional). When i do that i get error. unable to find an inherited method for function toSOAP, for signature data.frame, textConnection, NULL When i remove argument part then it doesn't give any error. here is the code inputarray - read.table(path/to/file) Server - SOAPServer(http://192.168.100.1/abc.php;) result - .SOAP(Server, FunctionName, .soapArgs=list('tempInput' = inputarray),action=/abc.php) Any suggestions.:working: Hi. I imagine that you are experimenting with both sides of the client/server interface and so you control all things. Typically the server is fixed and expects a particular data type for a parameter in the SOAP call. Once we know this type (typically from the WSDL for the server), then we can figure out how to serialize the R object appropriately. Without that, the two sides have no way to agree on how to send and how to interpret the information. But since you are in charge of both sides, then you can make up any convention and write the method for toSOAP that generates the XML representation of the R object. There are tools in the XML package to aid generating XML from within R. You could use StatDataML and the work is already done. You could also serialize the R object using dump/dput/save etc. in any format (ASCII or XDR) and then put that as the content of the XML for that parameter. It depends what you are going to do with the result on the server side. R's XDR format would not be good for a PHP server, but great for an R server. So there are lots of ways to go about this and you have to think through both sides or have one already defined. There are terminology ambiguities here also. R's concept of an array and SOAP's are quite different. Thanks and regards, Rohan7 -BEGIN PGP SIGNATURE- Version: GnuPG v1.4.7 (Darwin) Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org iD8DBQFHMP5w9p/Jzwa2QP4RAheFAJ9V+ZMwzcA8RbTYcuHMTRE/T6MQKQCfWUlE dJQyK2byAWPA901TzZyYAT0= =czhX -END PGP SIGNATURE- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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 of sort()
Hi, In the documentarion of sort() it reads (Arguments section): ...: arguments to be passed to or from methods or (for the default methods and objects without a class) to 'sim.int'. should it be 'sort.int' instead of 'sim.int'? Thank's -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[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] R GUI for Linux
Maura, The workaround from https://bugzilla.novell.com/show_bug.cgi?id=330991 seems to fix this for most people (but not me): just add export LIBXCB_ALLOW_SLOPPY_LOCK=1 to your ~/.profile file (or to /etc/profile to make it available for all users). Ted. Maura E Monville wrote on 11/03/2007 04:35 AM: Thank you . I followed all the path on my installation. I got the following: [EMAIL PROTECTED]:/usr/lib/jvm/java-1.6.0.u3-sun-1.6.0.u3/jre/lib/i386 ll total 636 -rwxr-xr-x 1 root root 80594 2007-09-25 01:10 libjavaplugin_jni.so -rwxr-xr-x 1 root root 297535 2007-09-25 01:10 libjavaplugin_nscp_gcc29.so -rwxr-xr-x 1 root root 257071 2007-09-25 01:10 libjavaplugin_nscp.so I do not have xawt/libmawt.so as you can see from the above. I do not know what that is. I run Linux/SuSE 10.3 On 10/31/07, ecatchpole [EMAIL PROTECTED] wrote: This is a known problem with Suse10.3 --- lots of things that use Java (e.g., Matlab) produce the same error message. I'm currently trying to fix this upon my machine, but haven't succeeded yet. Josh Triplett (http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=6532373) suggested the following: ---begin--- I worked with jcristau and christoph4 via IRC on #debian-x, and we managed to track down the problem with broken locking in Sun Java 1.5 and 1.6. It only occurs if Java finds the Xinerama extension, at which point it does something broken with locking and triggers the assertion. If Java never finds the Xinerama extension, it doesn't trigger the assertion for broken locking. The following workarounds address this problem: For sun-java5-bin: sed -i 's/XINERAMA/FAKEEXTN/g' /usr/lib/jvm/java-1.5.0-sun-1.5.0.11/jre/lib/i386/xawt/libmawt.so ---end--- You need to modify the path for your jre. This seems to have helped several people. But it didn't work for me. A sure fix is going back to Suse10.2! :( Ted. -- Dr E.A. Catchpole Visiting Fellow Univ of New South Wales at ADFA, Canberra, Australia _ and University of Kent, Canterbury, England 'v'- www.pems.adfa.edu.au/~ecatchpolehttp://www.pems.adfa.edu.au/%7Eecatchpole / \ - fax: +61 2 6268 8786 m m- ph: +61 2 6268 8895 Maura E Monville wrote on 11/01/2007 09:43 AM: I have downloaded and tried to install JGR - Java GUI for R - Version 1.5. I followed all the instructions (at least in my best resolution) and installed Java latest version. R installation complete fine. Has anyone succeded in installing JGR on SuSE 10.3 ? In the following I hade detailed the failed installation, As root /i did the following: linux-Mimin:/usr/local/bin # ./R R version 2.6.0 (2007-10-03) Copyright (C) 2007 The R Foundation for Statistical Computing ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. install.packages (JGR,dep=TRUE) --- Please select a CRAN mirror for use in this session --- CRAN mirror 1: Argentina 2: Australia (QLD) 3: Australia (VIC) 4: Austria 5: Belgium 6: Brazil (PR) 7: Brazil (MG) 8: Brazil (RJ) 9: Brazil (SP 1) 10: Brazil (SP 2) 11: Canada (BC)12: Canada (ON) 13: Chile (Santiago) 14: Croatia 15: Czech Republic 16: Denmark 17: France (Toulouse) 18: France (Lyon) 19: France (Paris) 20: Germany (Bamberg) 21: Germany (Mainz)22: Germany (Muenchen) 23: India (Kolkata)24: India 25: Ireland26: Italy (Ferrara) 27: Italy (Milano) 28: Italy (Padua) 29: Italy (Palermo)30: Japan (Aizu) 31: Japan (Tokyo) 32: Japan (Tsukuba) 33: Korea 34: Netherlands (Amsterdam 2) 35: Netherlands (Amsterdam)36: Netherlands (Utrecht) 37: Norway 38: Poland (Lublin) 39: Poland (Wroclaw) 40: Portugal 41: Slovenia (Ljubljana) 42: South Africa 43: Spain (Madrid) 44: Sweden 45: Switzerland (Zuerich) 46: Switzerland (Bern) 47: Taiwan (Taichung) 48: Taiwan (Taipeh) 49: UK (Bristol) 50: UK (London) 51: USA (CA 1) 52: USA (CA 3) 53: USA (CA 2) 54: USA (IA) 55: USA (IL) 56: USA (MI) 57: USA (MO) 58: USA (NC) 59: USA (PA 2) 60: USA (PA) 61: USA (TX) 62: USA (WA)
Re: [R] Integrating a function
Does this do any better, or perhaps offer other ideas? I could not understand what the Hct and step()'s were doing from the description of your desired result, so they were omitted from geq(). I also could not understand why you were rounding off the integrals or why there wee two integral terms. I think the problem may be (in part) that integrate() returns a list unless you specify the value column. When I tested your function or my earliest efforts at fixing it I continued to get a single value despite passing it a sequence or a matrix. surviv-function(x){k=.001;alpha=0.3;tau=70; exp(-k*x)/(1+exp(alpha*(x-tau)))} geq-function(n){ integrate(surviv, 0,n)$value } Nmax=250 gxt-matrix(nrow=Nmax) gxt-as.matrix(1:250) # there may be better methods o making this matrix geq.results-geq.results-apply(gxt,1,geq) geq.results plot(gxt, geq.results) I suspect that I have not understood what you wanted from geq(.) since the plot looks rather boring. I am guessing that Hct0 is a hematocrit value. And geq basically returns a value very close to its input up until tau and then stays at approximately tau for the rest of time. -- David Winsemius, MD Robert Kalicki wrote: Hello everybody! I have problems with integrating my function. My primary function is a “survival function” of the following type: surviv - exp(-k*x)/(1+exp(alpha*(x-tau))) I would like to integrate this function over a defined range and obtain a vector with all the values from integrate(surviv, 0, x) for x - 1:N. I unfortunately obtain just a scalar value corresponding to the last integrated x. How do I have to proceed if I want to obtain a vector with all the results? I have tried to solve this problem by adding a “while loop”. It works but the expression becomes to complex if I want to perform further optimization. Have any one a solution for this problem? Thanks a lot in advance. Example # General equation beta1 - 0.001 beta2 - 0 Hct0 - 0.27 tau - 70 k - 0.001 alpha - 0.3 T2 -40 step - function(x){ if(x=0) step - 1 else step - 0 } Nmax - 250 n - 1 while(nNmax){ surviv - function(n){ surviv - exp(-k*n)/(1+exp(alpha*(n-tau))) } geq - function(n){ geq - Hct0+beta1*as.integer(integrate(surviv,0,n)[1])+step(n-T2)*(beta2-beta1)*as. integer(integrate(surviv,0,n-T2)[1]) } plot(n, geq(n), type=p, pch=19, xlim=c(0,250), ylim=c(0.25,0.35), xlab=time in days, ylab=Hct) par(new=T) print(c(n, surviv(n), geq(n), as.integer(integrate(surviv,0,n)[1])) n - n + 1 } Robert M. Kalicki, MD Department of Nephrology and Hypertension __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Indexing, and using an empty string as a name
Hello all, I ran into the following, to me unexpected, behavior. I have (for reasons that don't necessarily pertain to the question at hand, hence I won't go into them) the need/desire to use an empty string for the name of a vector entry. Perhaps I did not read ?[ very carefully, but it seems to me that he following lines should return 1 at the end: x-1:4 names(x) - c(,a,b,c) x[] Instead, they return NA. Could anyone provide an explanation for this behavior? Thanks, Haris Skiadas Department of Mathematics and Computer Science Hanover College __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/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] Indexing, and using an empty string as a name
On Tue, 6 Nov 2007, Charilaos Skiadas wrote: Hello all, I ran into the following, to me unexpected, behavior. I have (for reasons that don't necessarily pertain to the question at hand, hence I won't go into them) the need/desire to use an empty string for the name of a vector entry. The 'R Languge Definition' says The string is treated specially: it indicates `no name' and matches no element (not even those without a name). and from ?names The name \code{} is special: it is used to indicate that there is no name associated with an element of a (atomic or generic) vector. Subscripting by \code{} will match nothing (not even elements which have no name). so it should perhaps have been expected. Perhaps I did not read ?[ very carefully, but it seems to me that he following lines should return 1 at the end: x-1:4 names(x) - c(,a,b,c) x[] Instead, they return NA. Could anyone provide an explanation for this behavior? You can do x[[]] [1] 1 (which is arguably a bug given the quotes above) or x[match(, names(x))] -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.