Re: [R] lwd less than 1
Hi, Thank you for helping, Actually, lwd=.5 in plot() or par() brings neither error nor warning message, but lwd below 1 seems not to be taken into account, as plot(..., lwd=1) and plot(..., lwd=.5) look quite the same. Besides, it is mentioned in the lwd section of the par() help page : (...) some devices do not implement line widths less than one. What I am looking for is how to get readable plots (with not too wide lines) after size reduction... Best regards, Jacques VESLOT Paul Murrell a écrit : Hi Jacques VESLOT wrote: Dear R-users, Someone, who uses R under Mac, wants to insert a couple of small plots (each with several lines) in an article, but he has to reduce plots' size significantly. He did it (in pdf or enc. ps) but, unfortunately, everything is reduced but lines' width. Besides, 'lwd' argument in par() or plot() can't be less than one. IANAMU (I am not a Mac user) either, but you should definitely be able to set lwd to less than 1. What happens when you try par(lwd=.5) or plot(1:10, type=l, lwd=.5)? Paul I am not a Mac user and I don't know whether it is a Mac-related problem or not. Could somebody please give me a way to solve this problem, either to reduce line width under R, or to get reduced lines' width when reducing plot size ? Thanks, Jacques VESLOT Cirad __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Calculation of Durbin-Watson p-value
On 19 May 2005 04:31:54 - Ramesh Kolluru wrote: Sir, I am unable to get the source code for Durbin-Watson test, as I want to calculate the p-value for Durbin Watson statistic using interpolation method. I sent this mail to r-help, but it was rejected, Perhaps you should have tried to figure out why it was rejected instead of sending it directly to BDR... Please *do* read the posting guide at http://www.R-project.org/posting-guide.html on how to ask for help on the R mailing lists. As for your mail (which does not ask any question, and surely no specific one): which source code are you referring to? There are at least two implementations in R (dwtest in package lmtest, durbin.watson in package car), the source code of both is available in the usual ways. But maybe you're referring to some other implementation? Concerning the p values: dwtest() interfaces the pan/gradsol algorithm which computes the null distribution from a linear combination of chi-squared variables and also implements a normal approximation. durbin.watson() computes p values by bootstrapping. So I don't see the need for implementing an interpolation method (although I have to admit that it is not clear to me what exactly this means in this context). Z please suggest me some way. I will be highly greatful to you. Thanks in advance Ramesh [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] lwd less than 1
Jacques VESLOT wrote: Hi, Thank you for helping, Actually, lwd=.5 in plot() or par() brings neither error nor warning message, but lwd below 1 seems not to be taken into account, as plot(..., lwd=1) and plot(..., lwd=.5) look quite the same. Besides, it is mentioned in the lwd section of the par() help page : (...) some devices do not implement line widths less than one. What I am looking for is how to get readable plots (with not too wide lines) after size reduction... What about saving the big plot in a vector format such as PostScript or PDF and later resizing in the document you are going to include the plot in? Uwe Ligges Best regards, Jacques VESLOT Paul Murrell a écrit : Hi Jacques VESLOT wrote: Dear R-users, Someone, who uses R under Mac, wants to insert a couple of small plots (each with several lines) in an article, but he has to reduce plots' size significantly. He did it (in pdf or enc. ps) but, unfortunately, everything is reduced but lines' width. Besides, 'lwd' argument in par() or plot() can't be less than one. IANAMU (I am not a Mac user) either, but you should definitely be able to set lwd to less than 1. What happens when you try par(lwd=.5) or plot(1:10, type=l, lwd=.5)? Paul I am not a Mac user and I don't know whether it is a Mac-related problem or not. Could somebody please give me a way to solve this problem, either to reduce line width under R, or to get reduced lines' width when reducing plot size ? Thanks, Jacques VESLOT Cirad __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] lwd less than 1
On Thu, 19 May 2005, Jacques VESLOT wrote: Thank you for helping, Actually, lwd=.5 in plot() or par() brings neither error nor warning message, but lwd below 1 seems not to be taken into account, as plot(..., lwd=1) and plot(..., lwd=.5) look quite the same. On what device: see below? Besides, it is mentioned in the lwd section of the par() help page : (...) some devices do not implement line widths less than one. (The people who write the documentation do tend to know what it says: you omitted `The interpretation is device-specific' and it seems did not look in the device-specific documentation.) This _is_ documented under both ?postscript and ?pdf as Line widths as controlled by 'par(lwd=)' are in multiples of 1/96inch. Multiples less than 1 are allowed. 'pch=.' with 'cex = 1' corresponds to a square of side 1/72 inch. You haven't mentioned the device (or version of R) you are using, nor the commands used nor how you are viewing the output. I checked the sources: the quartz() device is restricted to lwd = 1, so this might have resulted from plotting on that and then copying the plot. What I am looking for is how to get readable plots (with not too wide lines) after size reduction... Using postscript() or pdf() directly works for me, and the code is the same on all R platforms. Paul Murrell a écrit : Jacques VESLOT wrote: Someone, who uses R under Mac, wants to insert a couple of small plots (each with several lines) in an article, but he has to reduce plots' size significantly. He did it (in pdf or enc. ps) but, unfortunately, everything is reduced but lines' width. Besides, 'lwd' argument in par() or plot() can't be less than one. IANAMU (I am not a Mac user) either, but you should definitely be able to set lwd to less than 1. What happens when you try par(lwd=.5) or plot(1:10, type=l, lwd=.5)? I am not a Mac user and I don't know whether it is a Mac-related problem or not. Could somebody please give me a way to solve this problem, either to reduce line width under R, or to get reduced lines' width when reducing plot size ? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] ARIMA estimation
Good morning, (sorry for my english) i have some problems to put off by extimation ARIMA coefficients the ones not significatives. Exist a method to extimate only that significatives? i use the command: arima(). thanks to all Stefano [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Call R from Fortran
On Thu, 19 May 2005, Mulholland, Tom wrote: I don't know, but I do know that if you search the mailing list the answer is there. One place to start might be http://finzi.psych.upenn.edu/R/Rhelp02a/archive/50776.html That is about calling Fortran from R, not the subject of this question. (There are many other more authoritative sources for that.) I found this by searching for fortran on the mailing list. You might also read the posting guide. The link above refers to a particular operating system which may or may not be be the one you are using. I think you might also need to read Writing R Extensions This can only be done by combining Fortran and C, as R functions need R objects as arguments and return R objects. R objects are defined in C headers and use structures not in Fortran 77. But it can be done, and Writing R Extensions is a good place to start, especially the OS-specific sections on writing new front ends. From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Behalf Of Samiran Sinha Sent: Thursday, 19 May 2005 7:24 AM To: r-help@stat.math.ethz.ch I need to call a R function from Fortran 77 program. How will I do that exactly? I will grately appreciate any help. Sincerely, -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] ARIMA estimation
On Thu, 19 May 2005, Stefano Colucci wrote: Good morning, (sorry for my english) i have some problems to put off by extimation ARIMA coefficients the ones not significatives. Exist a method to extimate only that significatives? i use the command: arima(). See the argument 'fixed', which allows you to choose which coefficients to estimate. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] ARIMA estimation
Le 19.05.2005 09:23, Stefano Colucci a écrit : Good morning, (sorry for my english) i have some problems to put off by extimation ARIMA coefficients the ones not significatives. Exist a method to extimate only that significatives? i use the command: arima(). thanks to all Stefano You can fix coefs to what you want by using the parameter fixed in the arima call. arima(x,fixed=c(NA,0,NA),order=c(3,0,0)) will fit an arima(p=3,i=0,q=0) with \phi_2 fixed to zero. Maybe you'll be interested in graph 29 in the graph gallery : http://addictedtor.free.fr/graphiques/ See http://addictedtor.free.fr/graphiques/RGraphGallery.php?graph=29 Romain -- ~ ~~ Romain FRANCOIS - http://addictedtor.free.fr ~~ Etudiant ISUP - CS3 - Industrie et Services ~~http://www.isup.cicrp.jussieu.fr/ ~~ Stagiaire INRIA Futurs - Equipe SELECT ~~ http://www.inria.fr/recherche/equipes/select.fr.html~~ ~ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] lattice plots question
Sundar == Sundar Dorai-Raj [EMAIL PROTECTED] on Wed, 18 May 2005 14:23:35 -0500 writes: Sundar Laura Holt wrote: Dear R People: Is there any way to have the background of lattice plots be white instead of grey, please? This is not a criticism by any means...the lattice stuff is UNbelievable! indeed, it is! Sundar See ?trellis.par.set or ?trellis.device. Lattice Sundar themes are what you are looking for. Sundar e.g. Sundar library(lattice) Sundar trellis.device(windows, theme = col.whitebg()) Sundar xyplot(0 ~ 0) If, instead of line 2, you use trellis.device(theme = col.whitebg()) i.e., don't specify the device explicitly, you have solution that is portable {across platforms} : The device chosen will depend if you are in interactive or batch mode {which is good!} and in interactive mode will use 'windows', 'x11' , or 'quartz' depending on your platform --- as a matter of fact, it will be what you also get by getOption(device) and you can change by options(device = myfavoriteDevice) Sundar You can also create your own themes, which I find extremely useful: indeed! Sundar sundar.theme - function() { Sundar .. Martin Maechler, ETH Zurich __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R-help,
R-help, I usually call lapply to plot some dat frames structures.Something like this: par(mfrow=c(4,3),mar=c(2, 4, 2, 1) + 0.1) lapply(my.list , function(x) { plot(colnames(x) , apply(x,2,mean), type=o, pch = 16, ylab = Index , xlab = ) } ) But it is difficult for me to put a title on every plot according to the list names. I guess the re other ways to do it but the structure above is so handy to me that I want to stick to it. Any suggestions? I run on Windows XP machine version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor1.0 year 2005 month04 day 18 language R Thanks in advance __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Lattice: how to get default ylim?
Dear r-help, I draw graphics with xyplot and want to add some text to each panel (actually, the slope, error and significance of a regression line). I have defined the function, drawing a single panel and pass it to xyplot in the panel argument. This function calls panel.xyplot, calculates linear regression and formats coefficients. Now I want the text, I mentioned above, to be put in the upper left corner of each plot. I use ltext, and I need to define coordinates x and y. In order to do this I need to know the limits of x and y axes. I do not want to pass arguments xlim and ylim to the xyplot function and want it to calculate them automatically. And I also want to know the result of calculations. :) How to do this? Thank you very much. -- Best regards Wladimir Eremeev mailto:[EMAIL PROTECTED] == Research Scientist, PhD Leninsky Prospect 33, Space Monitoring Ecoinformation Systems Sector, Moscow, Russia, 119071, Institute of Ecology, Phone: (095) 135-9972; Russian Academy of Sciences Fax: (095) 135-9972 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Drawing a circle
Hi. I need to draw a circle whit center (a,b) and radio r. So I use the R code below a-1.975 # valore x del centro b-1.215 # valores y del centro r-1.46 # radio x1-seq(a-r,a+r,by=0.01); #los valores de x yp-sqrt(r^2-(x1-a)^2)+b; # los valores y a partir de la raíz positiva yn-(-1)*sqrt(r^2-(x1-a)^2)+b; # los valores y a partir de la raíz negativa x-c(x1,x1); y-c(yp,yn); plot(x,y,type=l,ylab=,xlab=,xlim=range(x),ylim=range(y)); My circle have two problems. First. I don't want the horizontal line and I don't know how avoid it. Second. It is shaped like ellipse. I need adjust the x and y scales, but I don't know how. Can you help me??? there is another way to draw a circle whit R ? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Arranging Plots
Dear all, I'd appreciate any hints how to arrange some plots. I have three plots. I would like to arrange them in the following order: - Plot 1 and Plot 2 should be in the upper row - Plot 3 should be in the lower row but centered in the middle. I hope the following sketch will help understanding my problem | ====== | || P1| |P2 | | || | | | | | ====== | | | | |P3 | | | || | | | I tried already things split.screen(c(2,1)) split.screen(c(1,2), screen=1) screen(3) ### plotting of Plot 1 screen (4) ### plotting of Plot 2 screen(2) ### plotting of Plot 3 close.screen() but then Plot 3 will be stretched across the whole screen (would be screen(2)) and I would like to have it just the same width as the other plots 1 and 2. Can anyone give me some hints? Thank you very much! Roland + This mail has been sent through the MPI for Demographic Rese...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Drawing a circle
See ?symbols. For example: a - 1.975 # valore x del centro b - 1.215 # valores y del centro r - 1.460 # radio plot(0,0, type = n, ylim=c(b - r, b + r), xlim=c(a - r, a + r)) symbols(x = a, y = b, circles = r) Mario Morales wrote: Hi. I need to draw a circle whit center (a,b) and radio r. So I use the R code below a-1.975 # valore x del centro b-1.215 # valores y del centro r-1.46 # radio x1-seq(a-r,a+r,by=0.01); #los valores de x yp-sqrt(r^2-(x1-a)^2)+b; # los valores y a partir de la raíz positiva yn-(-1)*sqrt(r^2-(x1-a)^2)+b; # los valores y a partir de la raíz negativa x-c(x1,x1); y-c(yp,yn); plot(x,y,type=l,ylab=,xlab=,xlim=range(x),ylim=range(y)); My circle have two problems. First. I don't want the horizontal line and I don't know how avoid it. Second. It is shaped like ellipse. I need adjust the x and y scales, but I don't know how. Can you help me??? there is another way to draw a circle whit R ? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 452-1424 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Arranging Plots
Rau, Roland wrote: Can anyone give me some hints? ?screen tells you: figs: A two-element vector describing the number of rows and the number of columns in a screen matrix _or_ a matrix with 4 columns. If a matrix, then each row describes a screen with values for the left, right, bottom, and top of the screen (in that order) in NDC units, that is 0 at the lower left coner - so by passing a matrix you can put plots anywhere, not just split the whole thing into boxes. Here's an example, which with a bit of tweaking, might work for you: fm=rbind(c(0,.4,.6,.9),c(.6,.9,.6,.9),c(.3,.8,.1,.4)) fm [,1] [,2] [,3] [,4] [1,] 0.0 0.4 0.6 0.9 [2,] 0.6 0.9 0.6 0.9 [3,] 0.3 0.8 0.1 0.4 each row of fm is (left, right, bottom, top) as a fraction of the whole device. split.screen(fm) screen(1) plot(1:10) screen(2) hist(runif(100)) screen(3) plot(1:10) I've left some space around that you might want to get rid of. Its 90% there. Baz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Bias to do with search engines
Patrick Connolly wrote Somehow, southern hemisphere sites aren't taken as seriously as those from that other hemisphere. Is there a word for that type of bias? There is a more simple explanation. If a page isn't linked to or Google isn't explicitly told about it, then Google will never know. As the archives of this list are indexed by Google the SAMM site should appear in a week or two. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R-help,
On May 19, 2005, at 7:01 AM, Jean Eid wrote: I do not fully understand your example but if you need to act on the columns of a dataframe why don't you just call its columns the title you want. something like X-matrix(rnorm(1000), ncol=4) colnames(X)-c(foo, foo1, foo2, foo3) X-as.data.frame(X) par(mfrow=c(2,2)) lapply(colnames(X), function(x) plot(X[,x], ylab=y, xlab=x, main=x)) Taking this back a bit to the original question: par(mfrow=c(4,3),mar=c(2, 4, 2, 1) + 0.1) sapply(names(my.list) , function(x) { plot(colnames(my.list[[x]]) , apply(my.list[[x]],2,mean), type=o, pch = 16, ylab = Index , xlab = ,main=x) } ) HTH Jean On Thu, 19 May 2005, Luis Ridao Cruz wrote: R-help, I usually call lapply to plot some dat frames structures.Something like this: par(mfrow=c(4,3),mar=c(2, 4, 2, 1) + 0.1) lapply(my.list , function(x) { plot(colnames(x) , apply(x,2,mean), type=o, pch = 16, ylab = Index , xlab = ) } ) But it is difficult for me to put a title on every plot according to the list names. I guess the re other ways to do it but the structure above is so handy to me that I want to stick to it. Any suggestions? I run on Windows XP machine version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor1.0 year 2005 month04 day 18 language R Thanks in advance __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] plot question
do you need something like this: par(mfrow=c(2, 2)) plot(0:10, 0:10, axes=FALSE, xlim=c(0, 10)) axis(1, at=seq(0, 10, 5)) axis(2) plot(0:10, 0:10, axes=FALSE, xlim=c(0, 10)) axis(1, at=seq(0, 10, 2)) axis(2) plot(0:10, 0:10, axes=FALSE, xlim=c(0, 10)) axis(1, at=seq(0, 10, 1)) axis(2) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: alexbri [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Thursday, May 19, 2005 1:18 PM Subject: [R] plot question hi all: xlim and ylim are used to define the interval limits of a plot. I'm interested in the scale of values between this limits. suppose xlim=c(0,10) we can have e.g. 0 5 10 0 2 4 6 8 10 0 1 2 3 4 5 6 7 8 9 10 which is the parameter that allows me to modify this? thanks in advance alexandre __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Arranging Plots
Try this: layout(matrix(c(1,0,2,0,3,0),2,3,byrow=TRUE)) plot(runif(10),main=P1) plot(runif(10),main=P2) plot(runif(10),main=P3) Regards, Pierre Lapointe Assistant Market Strategist National Bank Financial *** AVIS DE NON-RESPONSABILITE:\ Ce document transmis par courri...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R from Perl -- RSPerl and lines function.
Dear R-helpers, I am running well Perl and R on my Debian Linux, and I tried RSPerl. Installation is ok and all simple functions run well. But I have a problem to call the lines function. I would like to draw an histogram with the density curve on. Is is OK in R with the command: x-rnorm(1000) hist(x,prob=T) lines(density(x)) for example. Now, I have a Perl script with which pars files, and I obtain data in a list @distance. I draw an hist with RSPerl command (from Perl): -- (---Perl script---) R::initR(--silent); R::library(RSPerl); @Rdata=R::call(as.numeric, [EMAIL PROTECTED]); R::callWithNames(hist, {'', [EMAIL PROTECTED], 'main', '', 'xlab', Distribution of the distances between oligo-5' and sequence 3', 'br', 15, 'col', 'gray', 'prob', 'T'} ); R::call(lines, (density, [EMAIL PROTECTED])) ); sleep(4); R::call(dev.off); exit; - All runs well: I obtained the histogram graph, and it seems that the density call runs well since I have the message Performed the call, result has length 7 and I read the density fuction results in 7 parameters; but just after I have a message like segmentation fault. I cannot understand what happens ? Has someone already encountered this problem or know how to abtain an histogram and the density line with RSPerl ??? Thanks a lot for your help, caus I tried all I could think of ... Florence. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Drawing a circle
Mario Morales wrote: I need to draw a circle I would do it with complex numbers and polar coordinates: Circle = function (t,a) {a*cos(t)+1i*a*sin(t)} interval=c(-8,8) plot(interval,interval,type=n,xlab=,ylab=, asp=1,axes=F) t=seq(0,2*pi,by=0.01) center=2+3i; radius=5 lines(center+Circle(t,radius)) locator(1) dev.off() Josef Eschgfäller -- Josef Eschgfäller Dipartimento Matematico Universita' di Ferrara http://felix.unife.it__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Drawing a circle
Try a-1.975 # valore x del centro b-1.215 # valores y del centro r-1.46 # radio symbols(a,b,circle=r,inches=F) Hope it works PS: Espero que te funcione. Saludos desde Medell{in, Colombia. On Thu, 19 May 2005 05:14:44 -0500, Mario Morales [EMAIL PROTECTED] wrote: Hi. I need to draw a circle whit center (a,b) and radio r. So I use the R code below a-1.975 # valore x del centro b-1.215 # valores y del centro r-1.46 # radio x1-seq(a-r,a+r,by=0.01); #los valores de x yp-sqrt(r^2-(x1-a)^2)+b; # los valores y a partir de la raz positiva yn-(-1)*sqrt(r^2-(x1-a)^2)+b; # los valores y a partir de la raz negativa x-c(x1,x1); y-c(yp,yn); plot(x,y,type=l,ylab=,xlab=,xlim=range(x),ylim=range(y)); My circle have two problems. First. I don't want the horizontal line and I don't know how avoid it. Second. It is shaped like ellipse. I need adjust the x and y scales, but I don't know how. Can you help me??? there is another way to draw a circle whit R ? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Kenneth Roy Cabrera Torres Uninversidad Nacional de Colombia Sede Medellin Tel 430 9351 Cel 315 504 9339 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Drawing a circle
If a solid circle is ok then one can use the symbol pch=19 and blow it up using cex=, e.g. plot(0, pch=19, cex=5, col=blue) See balloonplot in package gplots for an example of this. On 5/19/05, Chuck Cleland [EMAIL PROTECTED] wrote: See ?symbols. For example: a - 1.975 # valore x del centro b - 1.215 # valores y del centro r - 1.460 # radio plot(0,0, type = n, ylim=c(b - r, b + r), xlim=c(a - r, a + r)) symbols(x = a, y = b, circles = r) Mario Morales wrote: Hi. I need to draw a circle whit center (a,b) and radio r. So I use the R code below a-1.975 # valore x del centro b-1.215 # valores y del centro r-1.46 # radio x1-seq(a-r,a+r,by=0.01); #los valores de x yp-sqrt(r^2-(x1-a)^2)+b; # los valores y a partir de la raíz positiva yn-(-1)*sqrt(r^2-(x1-a)^2)+b; # los valores y a partir de la raíz negativa x-c(x1,x1); y-c(yp,yn); plot(x,y,type=l,ylab=,xlab=,xlim=range(x),ylim=range(y)); My circle have two problems. First. I don't want the horizontal line and I don't know how avoid it. Second. It is shaped like ellipse. I need adjust the x and y scales, but I don't know how. Can you help me??? there is another way to draw a circle whit R ? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 452-1424 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] plot with more than 2 variables
Check out the gallery at: http://addictedtor.free.fr/graphiques for lots of examples and source code. On 5/19/05, Amir Safari [EMAIL PROTECTED] wrote: Hi All, I have tried to plot with more than 2 variables in a unique surface. It is not possible in R? Best Regards __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Problem with upgrade to R 2.1 on Mac
I'm not sure what information you might need to help me. When I moved to R 2.1 many of the packages I had installed are not available. Please send copy of reply directly to me. Machine Model: Power Mac G5 CPU Type: PowerPC 970 (2.2) System Version:Mac OS X 10.3.9 (7W98) Kernel Version: Darwin 7.9.0 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Sweave and paths
On Tue, 17 May 2005 14:31:53 -0400, Bill Rising (BR) wrote: Is there some way to encourage \SweaveInput{foo} to find foo in a subdirectory of a file tree? Sure: Write some code doing it ;-) Something along the lines of the behavior of list.files(stuff, recursive=TRUE). This would be very helpful at calling small modular files, such as solution sets and the like. I couldn't see anything in the documentation, and I looked in the source code, but it seems that SweaveReadFiledoc() wants to look only in the directory which contains foo. Well, if you know where it is you can always use the path in the \SweaveInput{} statement, i.e., \SweaveInput{foo/bar} works for me. Best, -- --- Friedrich Leisch Institut für Statistik Tel: (+43 1) 58801 10715 Technische Universität WienFax: (+43 1) 58801 10798 Wiedner Hauptstraße 8-10/1071 A-1040 Wien, Austria http://www.ci.tuwien.ac.at/~leisch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] plot with more than 2 variables
See ?rgl in rgl library. Best regards On Thu, 19 May 2005 14:35:21 +0200 (CEST), Amir Safari [EMAIL PROTECTED] wrote: Hi All, I have tried to plot with more than 2 variables in a unique surface. It is not possible in R? Best Regards - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Kenneth Roy Cabrera Torres Uninversidad Nacional de Colombia Sede Medellin Tel 430 9351 Cel 315 504 9339 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] tune.svm in {e1071}
Dear All , 1- I'm trying to access the values of fitted(model) after model- tune.svm( ) but seemingly it is not poosible. How can I access to values of fitted ? However ,it is possible only after model- svm( ) 2- How can I access to the other values such as the number of Support Vectors , gamma, cost , nu , epsilon , after model- tune.svm( ) ? these are not possible? I receive only Error estimation of 'svm' with model and summary(model) functions. Best Wishes and so many thanks, Amir - Stay connected, organized, and protected. Take the tour [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Lattice: how to get default ylim?
Hi, Within your panel function you can use current.viewport() to recover the active grid viewport and get xlim/ylim (in addition to other very useful information). Then you can use grid.text (plus any other grid.* function), e.g., require(grid) my.panel - function(...) { panel.xyplot(...) ## add Hello World on the top-left of each panel v - current.viewport()## requires R 2.1.0 (I believe) xlim - v$xscale ylim - v$yscale grid.text(x = xlim[1], y = ylim[2], default.units=native, label = Hello World, just= c(left, top)) } Hope this helps. -- David Wladimir Eremeev wrote: Dear r-help, I draw graphics with xyplot and want to add some text to each panel (actually, the slope, error and significance of a regression line). I have defined the function, drawing a single panel and pass it to xyplot in the panel argument. This function calls panel.xyplot, calculates linear regression and formats coefficients. Now I want the text, I mentioned above, to be put in the upper left corner of each plot. I use ltext, and I need to define coordinates x and y. In order to do this I need to know the limits of x and y axes. I do not want to pass arguments xlim and ylim to the xyplot function and want it to calculate them automatically. And I also want to know the result of calculations. :) How to do this? Thank you very much. -- Best regards Wladimir Eremeev mailto:[EMAIL PROTECTED] == Research Scientist, PhD Leninsky Prospect 33, Space Monitoring Ecoinformation Systems Sector, Moscow, Russia, 119071, Institute of Ecology, Phone: (095) 135-9972; Russian Academy of Sciences Fax: (095) 135-9972 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] plot question
thks Dimitris, it helped a lot. alex -Mensagem original- De: Dimitris Rizopoulos [mailto:[EMAIL PROTECTED] Enviada: qui 19-05-2005 12:50 Para: alexbri Cc: r-help@stat.math.ethz.ch Assunto: Re: [R] plot question do you need something like this: par(mfrow=c(2, 2)) plot(0:10, 0:10, axes=FALSE, xlim=c(0, 10)) axis(1, at=seq(0, 10, 5)) axis(2) plot(0:10, 0:10, axes=FALSE, xlim=c(0, 10)) axis(1, at=seq(0, 10, 2)) axis(2) plot(0:10, 0:10, axes=FALSE, xlim=c(0, 10)) axis(1, at=seq(0, 10, 1)) axis(2) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: alexbri [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Thursday, May 19, 2005 1:18 PM Subject: [R] plot question hi all: xlim and ylim are used to define the interval limits of a plot. I'm interested in the scale of values between this limits. suppose xlim=c(0,10) we can have e.g. 0 5 10 0 2 4 6 8 10 0 1 2 3 4 5 6 7 8 9 10 which is the parameter that allows me to modify this? thanks in advance alexandre __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Arranging Plots
Dear all, thank you very much for your help. I would like to thank Sean Davis, Barry Rowlingson, and Pierre Lapointe for their fast help. I actually use now the approach suggested by Barry Rowlingson via the split.screen() function. Thanks, Roland P.S. Three solutions in 30 minutes...and the one which was most convenient for me after 7 minutes. Hard to beat by any other software. :-) + This mail has been sent through the MPI for Demographic Rese...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Log-likelihood calculation in lme
On a real data set, running the lme function, I get parameters estimation and a log-likelihood value. Nevertheless, the variance-covariance matrix in this case had a determinant close to zero. So, I could not calculate the log-likelihood myself with the classical expression. What is the calculus made in lme? Thanks for all suggestions. Tessa P-J (student) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Lattice: how to get default ylim?
On Thursday 19 May 2005 8:00 am, David James wrote: Hi, Within your panel function you can use current.viewport() to recover the active grid viewport and get xlim/ylim (in addition to other very useful information). Then you can use grid.text (plus any other grid.* function), e.g., require(grid) my.panel - function(...) { panel.xyplot(...) ## add Hello World on the top-left of each panel v - current.viewport()## requires R 2.1.0 (I believe) No, I think it's been there for a while. However, AFAIR the fact that viewports have components xscale and yscale that can be accessed like this is undocumented and may change if the implementation changes (which is a real possibility). Ideally, there should be exported interfaces to access this information, either in grid or lattice. One of the reasons there isn't is that you rarely need it, including in this example (see below). xlim - v$xscale ylim - v$yscale grid.text(x = xlim[1], y = ylim[2], default.units=native, label = Hello World, just= c(left, top)) An equivalent version where you don't need xlim and ylim is grid.text(x = 0, y = 1, default.units=npc, label = Hello World, just= c(left, top)) Deepayan } Hope this helps. -- David Wladimir Eremeev wrote: Dear r-help, I draw graphics with xyplot and want to add some text to each panel (actually, the slope, error and significance of a regression line). I have defined the function, drawing a single panel and pass it to xyplot in the panel argument. This function calls panel.xyplot, calculates linear regression and formats coefficients. Now I want the text, I mentioned above, to be put in the upper left corner of each plot. I use ltext, and I need to define coordinates x and y. In order to do this I need to know the limits of x and y axes. I do not want to pass arguments xlim and ylim to the xyplot function and want it to calculate them automatically. And I also want to know the result of calculations. :) How to do this? Thank you very much. -- Best regards Wladimir Eremeev mailto:[EMAIL PROTECTED] = = Research Scientist, PhD Leninsky Prospect 33, Space Monitoring Ecoinformation Systems Sector, Moscow, Russia, 119071, Institute of Ecology, Phone: (095) 135-9972; Russian Academy of Sciences Fax: (095) 135-9972 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] install R packages
Dear All, When I tried to install R packages I found this error: library(survival) Loading required package: splines install.packages(splines) --- Please select a CRAN mirror for use in this session --- Warning message: package splines is in use and will not be installed But I just opened R, and have used anything yet, how come did it say package splines is in use? Thanks Jia __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] install R packages--sorry last letter that I sent I had an error, this one is the right one
Dear All, When I tried to install R packages I found this error: library(survival) Loading required package: splines install.packages(splines) --- Please select a CRAN mirror for use in this session --- Warning message: package splines is in use and will not be installed But I just opened R, and haven't used anything yet, how come did it say package splines is in use? Thanks Jia __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Lattice: how to get default ylim?
Deepayan Sarkar wrote: On Thursday 19 May 2005 8:00 am, David James wrote: Hi, Within your panel function you can use current.viewport() to recover the active grid viewport and get xlim/ylim (in addition to other very useful information). Then you can use grid.text (plus any other grid.* function), e.g., require(grid) my.panel - function(...) { panel.xyplot(...) ## add Hello World on the top-left of each panel v - current.viewport()## requires R 2.1.0 (I believe) No, I think it's been there for a while. However, AFAIR the fact that viewports have components xscale and yscale that can be accessed like this is undocumented and may change if the implementation changes (which is a real possibility). Ideally, there should be exported interfaces to access this information, either in grid or lattice. One of the reasons there isn't is that you rarely Yes, I agree that such an interface is quite desirable. need it, including in this example (see below). xlim - v$xscale ylim - v$yscale grid.text(x = xlim[1], y = ylim[2], default.units=native, label = Hello World, just= c(left, top)) An equivalent version where you don't need xlim and ylim is grid.text(x = 0, y = 1, default.units=npc, label = Hello World, just= c(left, top)) Right, in this silly Hello World example you don't need xlim/ylim, but one can see instances where one would... Deepayan } Hope this helps. -- David Wladimir Eremeev wrote: Dear r-help, I draw graphics with xyplot and want to add some text to each panel (actually, the slope, error and significance of a regression line). I have defined the function, drawing a single panel and pass it to xyplot in the panel argument. This function calls panel.xyplot, calculates linear regression and formats coefficients. Now I want the text, I mentioned above, to be put in the upper left corner of each plot. I use ltext, and I need to define coordinates x and y. In order to do this I need to know the limits of x and y axes. I do not want to pass arguments xlim and ylim to the xyplot function and want it to calculate them automatically. And I also want to know the result of calculations. :) How to do this? Thank you very much. -- Best regards Wladimir Eremeev mailto:[EMAIL PROTECTED] = = Research Scientist, PhD Leninsky Prospect 33, Space Monitoring Ecoinformation Systems Sector, Moscow, Russia, 119071, Institute of Ecology, Phone: (095) 135-9972; Russian Academy of Sciences Fax: (095) 135-9972 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] install R packages--sorry last letter that I sent I had an error, this one is the right one
On Thu, 2005-05-19 at 10:09 -0400, Li, Jia wrote: Dear All, When I tried to install R packages I found this error: library(survival) Loading required package: splines This is for your information. It is not an error message and is not asking you to do anything (i.e. it says loading not please load) install.packages(splines) --- Please select a CRAN mirror for use in this session --- Warning message: package splines is in use and will not be installed But I just opened R, and haven't used anything yet, how come did it say package splines is in use? Because it was loaded automatically when you loaded the splines package. Have a look at the search path with search() You have confused *installing* a package - putting it's files on your disk - with *loading* it - making it's objects and help pages available for use in an R session. Martyn __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Log-likelihood calculation in lme
PIERRE-JOSEPH tessa wrote: On a real data set, running the lme function, I get parameters estimation and a log-likelihood value. Nevertheless, the variance-covariance matrix in this case had a determinant close to zero. So, I could not calculate the log-likelihood myself with the classical expression. What is the calculus made in lme? The evaluation of the log-likelihood used in lme is documented in chapter 2 of Pinheiro and Bates (Springer, 2000). The calculation used in lmer from the lme4 package is somewhat different. If you wish I can send you off-list copies of slides from a presentation that explains that calculation. I'm not sure which variance-covariance matrix you are referring to but it is the case that the ML or REML estimates of the variance-covariance matrix of the random effects can be singular, a fact that is often ignored in the analysis of data with such models. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] install R packages--sorry last letter that I sent I had an error, this one is the right one
Li, Jia wrote: Dear All, When I tried to install R packages I found this error: library(survival) Loading required package: splines install.packages(splines) --- Please select a CRAN mirror for use in this session --- Warning message: package splines is in use and will not be installed But I just opened R, and haven't used anything yet, how come did it say package splines is in use? library(survival) told you that it loaded the required package splines. So it *is* in use. Uwe Ligges Thanks Jia __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Reversing axis in a log plot
Hello, apologies if I'm overlooking the obvious... I would like to revert a logarithmic axis with R 2.1.0 on Linux, e.g. for using pressure as a vertical coordinate. Say we have x = seq(1,3, by = 0.01) y = exp(x) Plotting and reversing linear axis is fine plot(x,y) plot(x,y, ylim = c(30,1)) as is a usual log-plot: plot(x,y, log = y, ylim = c(1,30)) However, plot(x,y, log = y, ylim = c(30,1)) fails with Error in axis(2, ...) : log - axis(), 'at' creation, _SMALL_ range: invalid {xy}axp or par; axp[0]= 10, usr[0:1]=(34.3721,0.872801) In addition: Warning message: CreateAtVector log(from axis()): usr[0] = 34.3721 0.872801 = usr[1] ! What am I doing wrong here? Thanks a lot, Christian. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R annoyances
Dear R Folks, I'm a big fan of R, but there are a couple of things that repeatedly annoy me, and I wondered if anyone has neat ways to deal with them. (a) When using apply row-wise to a matrix, it returns the results column-wise, and to preserve the original orientation, I've to do a transpose. E.g. I've to keep doing a transpose, which I consider to be quite annoying. transformed.mtx - t(apply( mtx, 1, exp)) (b) When extracting 2 or more columns of a matrix, R returns the result as a matrix, BUT when extracting just one column, it returns a vector/array, rather than a matrix, so I've to keep doing as.matrix, which is annoying. sub.mtx - as.matrix(mtx[,1]) Of course I could write a suitable function cols - function(mtx,range) as.matrix(mtx[, range]) but then I lose the syntactic sugar of being able to say [,1]. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Lattice: how to get default ylim?
On Thursday 19 May 2005 9:11 am, David James wrote: Deepayan Sarkar wrote: v - current.viewport()## requires R 2.1.0 (I believe) No, I think it's been there for a while. However, AFAIR the fact that viewports have components xscale and yscale that can be accessed like this is undocumented and may change if the implementation changes (which is a real possibility). Ideally, there should be exported interfaces to access this information, either in grid or lattice. One of the reasons there isn't is that you rarely Yes, I agree that such an interface is quite desirable. OK, I'll put something in the next version of lattice. Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Power w/ unequal sample sizes
Hello, I am hoping someone could shed some light on power calculations for me. I have two small data sets of unequal sample size after NA removal (m = 5, f = 7). m - c(2.0863, 2.1340, 2.1008, 1.9565, 2.0413, NA, NA) f - c(1.8938, 1.9709, 1.8613, 2.0836, 1.9485, 2.0630, 1.9143) In a R help message/reply from Sep 30, 2001, it was noted that the power.t.test function assumes equal group sizes and that the groups have the same theoretical standard deviation. In analyzing this data, I ran a Welch Two Sample t-test and a Wilcoxon Rank Sum test on the data sets and both tests reveal a slight statistical difference for alpha = 0.05 (Welch Two Sample t-test p-value = 0.045 and Wilcoxon Rank Sum test p-value = 0.048). I suspect that the power of these tests will be quite low but I am trying to quantify it. Based on the insight in the R help message from 2001, I am not sure how to go about this with R. Is this feasible with R or is there another approach I should be considering altogether? Any insight would be most appreciated. Thanks a million __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R annoyances
On Thu, 19 May 2005, Chalasani, Prasad wrote: (b) When extracting 2 or more columns of a matrix, R returns the result as a matrix, BUT when extracting just one column, it returns a vector/array, rather than a matrix, so I've to keep doing as.matrix, which is annoying. sub.mtx - as.matrix(mtx[,1]) Of course I could write a suitable function cols - function(mtx,range) as.matrix(mtx[, range]) but then I lose the syntactic sugar of being able to say [,1]. This one is actually a FAQ, mtx[,1,drop=FALSE] -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] R annoyances
(a) If what you're trying to do is just apply exp, or any other element-wise function, you can just say exp(mtx). You avoid both apply and the transpose, and save time in the bargain. If your actual function really does depend on multiple elements, it may be a little more complicated. You could conceivably write a myapply function to do the apply followed by the transpose, but then of course you still need to keep track of which way you're going. (b) You want to look into the drop = FALSE option: Sub.mtx - mtx[,1,drop = FALSE] Hope this helps, Matt Wiener -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chalasani, Prasad Sent: Thursday, May 19, 2005 10:37 AM To: r-help@stat.math.ethz.ch Subject: [R] R annoyances Dear R Folks, I'm a big fan of R, but there are a couple of things that repeatedly annoy me, and I wondered if anyone has neat ways to deal with them. (a) When using apply row-wise to a matrix, it returns the results column-wise, and to preserve the original orientation, I've to do a transpose. E.g. I've to keep doing a transpose, which I consider to be quite annoying. transformed.mtx - t(apply( mtx, 1, exp)) (b) When extracting 2 or more columns of a matrix, R returns the result as a matrix, BUT when extracting just one column, it returns a vector/array, rather than a matrix, so I've to keep doing as.matrix, which is annoying. sub.mtx - as.matrix(mtx[,1]) Of course I could write a suitable function cols - function(mtx,range) as.matrix(mtx[, range]) but then I lose the syntactic sugar of being able to say [,1]. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] R annoyances
Thanks all for pointing out that I can use mtx[,1,drop=F] -Original Message- From: Uwe Ligges [mailto:[EMAIL PROTECTED] Sent: Thursday, May 19, 2005 10:49 AM To: Chalasani, Prasad Cc: r-help@stat.math.ethz.ch Subject: Re: [R] R annoyances Chalasani, Prasad wrote: Dear R Folks, I'm a big fan of R, but there are a couple of things that repeatedly annoy me, and I wondered if anyone has neat ways to deal with them. (a) When using apply row-wise to a matrix, it returns the results column-wise, and to preserve the original orientation, I've to do a transpose. E.g. I've to keep doing a transpose, which I consider to be quite annoying. transformed.mtx - t(apply( mtx, 1, exp)) I'd rather type exp(mtx) (b) When extracting 2 or more columns of a matrix, R returns the result as a matrix, BUT when extracting just one column, it returns a vector/array, rather than a matrix, so I've to keep doing as.matrix, which is annoying. sub.mtx - as.matrix(mtx[,1]) Of course I could write a suitable function cols - function(mtx,range) as.matrix(mtx[, range]) but then I lose the syntactic sugar of being able to say [,1]. The docs suggest: mtx[ , 1, drop = FALSE] Uwe Ligges __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R annoyances
Chalasani, Prasad wrote: Thanks all for pointing out that I can use mtx[,1,drop=F] Which, for example, won't work for F - 10.25 --- drop=FALSE ! ^ Uwe Ligges -Original Message- From: Uwe Ligges [mailto:[EMAIL PROTECTED] Sent: Thursday, May 19, 2005 10:49 AM To: Chalasani, Prasad Cc: r-help@stat.math.ethz.ch Subject: Re: [R] R annoyances Chalasani, Prasad wrote: Dear R Folks, I'm a big fan of R, but there are a couple of things that repeatedly annoy me, and I wondered if anyone has neat ways to deal with them. (a) When using apply row-wise to a matrix, it returns the results column-wise, and to preserve the original orientation, I've to do a transpose. E.g. I've to keep doing a transpose, which I consider to be quite annoying. transformed.mtx - t(apply( mtx, 1, exp)) I'd rather type exp(mtx) (b) When extracting 2 or more columns of a matrix, R returns the result as a matrix, BUT when extracting just one column, it returns a vector/array, rather than a matrix, so I've to keep doing as.matrix, which is annoying. sub.mtx - as.matrix(mtx[,1]) Of course I could write a suitable function cols - function(mtx,range) as.matrix(mtx[, range]) but then I lose the syntactic sugar of being able to say [,1]. The docs suggest: mtx[ , 1, drop = FALSE] Uwe Ligges __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Learning rate with nnet
Hi, can I change the learning rate with nnet? And if yes, how? If no, what is the default one? Thanks __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Fitting Data with errors to non-polynomial Linear Model
Dear R-help, After two days of search on the archive of your web-site, I found partial answers to the problem that I want to solve, but this is not concluent to me and I am thinking that perhaps someone could answer exactly my problem: I have a theoretical Model (for the prediction of some physical quantity) which can be seen as a linear Model with 2 parameters. On the other side the measured data concerning the physical quantity in question, and that I have to my disposition, is a set of 20 points with both errors in x and y, the x error being the same for each point. I would like to fit my model to the data and find the corresponding values of the parameters in order to make predictions for some other physical quantities that depend on the parameters. My theoretical Model which has 2 free parameters a,b and one independant variable X, is of the type: f(X;a,b;M,N,P)=a*f1(X;M)+b*f2(X;M,N)+f3(X;M,N,P) where f1 and f2 are partial fractions and f3 is a complicated non-linear function of X and M, which is bipartite in the range of X on which I want to make my fit. M, N et P are constants with errors (physical quantities that enter into the equation of the model). I do not know R very well and my questions are: 1.Is there a R-package where it is possible to define arbitrary basis functions for a linear Model? 2.The error in y can be taken into acount with the weight option, but what about the error in X? (and in M, N and P) 3.Is it possible, with R, to handle with my bipartite fonction f3 simply? (with the help of the unitstep function or something like that..?) I know that the error in X can be implemented by what is called effective variances technique, but is it available in some package? Many thanks for your help by advance. Samuel [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R annoyances
Thomas Lumley wrote: On Thu, 19 May 2005, Chalasani, Prasad wrote: (b) When extracting 2 or more columns of a matrix, R returns the result as a matrix, BUT when extracting just one column, it returns a vector/array, rather than a matrix, so I've to keep doing as.matrix, which is annoying. sub.mtx - as.matrix(mtx[,1]) Of course I could write a suitable function cols - function(mtx,range) as.matrix(mtx[, range]) but then I lose the syntactic sugar of being able to say [,1]. This one is actually a FAQ, mtx[,1,drop=FALSE] -thomas I wonder whether there is, or should be, a way to set FALSE as the default? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R annoyances
Rod Montgomery wrote: Thomas Lumley wrote: On Thu, 19 May 2005, Chalasani, Prasad wrote: (b) When extracting 2 or more columns of a matrix, R returns the result as a matrix, BUT when extracting just one column, it returns a vector/array, rather than a matrix, so I've to keep doing as.matrix, which is annoying. sub.mtx - as.matrix(mtx[,1]) Of course I could write a suitable function cols - function(mtx,range) as.matrix(mtx[, range]) but then I lose the syntactic sugar of being able to say [,1]. This one is actually a FAQ, mtx[,1,drop=FALSE] -thomas I wonder whether there is, or should be, a way to set FALSE as the default? First question: No. Second question: No, because *many* functions do rely on the fact that x[,1] returns a vector rather than a matrix. Uwe Ligges __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] R annoyances
Dear Uwe, I've often wondered why T and F aren't reserved words in R as TRUE and FALSE are. Perhaps there's some use of T and F as variables, but that seems ill-advised. Regards, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Uwe Ligges Sent: Thursday, May 19, 2005 10:08 AM To: Chalasani, Prasad Cc: r-help@stat.math.ethz.ch Subject: Re: [R] R annoyances Chalasani, Prasad wrote: Thanks all for pointing out that I can use mtx[,1,drop=F] Which, for example, won't work for F - 10.25 --- drop=FALSE ! ^ Uwe Ligges -Original Message- From: Uwe Ligges [mailto:[EMAIL PROTECTED] Sent: Thursday, May 19, 2005 10:49 AM To: Chalasani, Prasad Cc: r-help@stat.math.ethz.ch Subject: Re: [R] R annoyances Chalasani, Prasad wrote: Dear R Folks, I'm a big fan of R, but there are a couple of things that repeatedly annoy me, and I wondered if anyone has neat ways to deal with them. (a) When using apply row-wise to a matrix, it returns the results column-wise, and to preserve the original orientation, I've to do a transpose. E.g. I've to keep doing a transpose, which I consider to be quite annoying. transformed.mtx - t(apply( mtx, 1, exp)) I'd rather type exp(mtx) (b) When extracting 2 or more columns of a matrix, R returns the result as a matrix, BUT when extracting just one column, it returns a vector/array, rather than a matrix, so I've to keep doing as.matrix, which is annoying. sub.mtx - as.matrix(mtx[,1]) Of course I could write a suitable function cols - function(mtx,range) as.matrix(mtx[, range]) but then I lose the syntactic sugar of being able to say [,1]. The docs suggest: mtx[ , 1, drop = FALSE] Uwe Ligges __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Random/systematic selection of rows in a matrix
Hi R people: I am new to R. I am writing a function to (1) produce a sparse stochastic Gaussian 2D field and (2) perform a systematic transect sampling on this field, this carried out many times in a simulation framework. My function does a good job at producing the random field (a matrix of zeros and some manifestations of the stochastic process, depending on a parameter of the function determining how probable it is that the stochastic process will manifest itself). But, when i try to collect some of the rows of the process as in sampling with transects, i noticed in the output files that the rows in the sample were not any of the rows in the original matrix representing the random field. I show below the function. I believe i am making a programming error due to my inexperience with R. I hope some fo you can show me where the error is. Thanks Ruben mcolasim7-function(N.sim,pcell){ # Lattice definition x-seq(1,180,1) y-seq(1,540,1) #Gaussian process param-c(6.63,2.24,1.82,4.36) names(param)-c(beta,sigmasq,tausq,varphi) #Simulations loop - Function GaussRF from package RandomFields for(i in 1:N.sim){ mcola-GaussRF(x=x,y=y,param=param,grid=TRUE,model=gauss) #Process thininng out with 'pcell': probability that the process will manifest itself for(j in 1:540){ for(k in 1:180){ if(runif(1)pcell) mcola[k,j]-mcola[k,j] else mcola[k,j]-0 } } file1.out-paste(mcolasim7,i,txt,sep=.) write(t(mcola),file1.out,ncol=ncol(t(mcola))) #Transect sampling on the thinned process - 20 equidistant transects parallel to x axis #First transect randomly chosen among first 27 rows in process t=0 t-(1+as.integer(27*runif(1))) transis-c(t,t+27,t+54,t+81,t+108,t+135,t+162,t+189,t+216,t+243,t+270,t+297,t+324,t+351,t+378,t+405,t+432,t+459,t+486,t+513) mcolasamsis-mat.or.vec(20,180) for(l in 1:20){ mcolasamsis[l,]-mcola[,transis[l]] } file2.out-paste(mcolasamsis7,i,txt,sep=.) write(mcolasamsis,file2.out,ncol=ncol(mcolasamsis)) } } __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] dse VAR models
There are examples of this in the User's Guide, which gets installed under your R library as dse1/doc/dse-guide.pdf. There is lots of other information in the guide that you will probably find useful too. Paul Gilbert Samuel Kemp wrote: Hi, Can anyone tell me how to construct a simple VAR(1) time series with two variables using the dse package? I would like to end up with two time series y_1t = \phi_11 y_1,t-1 + \phi_12 y_2,t-1 + e_1t y_2t = \phi_21 y_1,t-1 + \phi_22 y_2,t-1 + e_2t Best regards, Sam. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R annoyances
On Thu, 19 May 2005, Rod Montgomery wrote: Thomas Lumley wrote: This one is actually a FAQ, mtx[,1,drop=FALSE] -thomas I wonder whether there is, or should be, a way to set FALSE as the default? There shouldn't be (apart from editing the code), because you really don't want something this basic to be unpredictable. There have been discussions at several times about whether drop=FALSE or drop=TRUE should be the default. The decision has always been that programmers can cope either way, but that users probably don't expect mtx[,1] to be a vector, and that they definitely don't expect mtx[1,1] to be a matrix. -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Arranging Plots
Using layout(matrix(c(1,1,2,2,0,3,3,0),2,3,byrow=TRUE)) may be closer to what the original intent was. Greg Snow, Ph.D. Statistical Data Center, LDS Hospital Intermountain Health Care [EMAIL PROTECTED] (801) 408-8111 Lapointe, Pierre [EMAIL PROTECTED] 05/19/05 05:51AM Try this: layout(matrix(c(1,0,2,0,3,0),2,3,byrow=TRUE)) plot(runif(10),main=P1) plot(runif(10),main=P2) plot(runif(10),main=P3) Regards, Pierre Lapointe Assistant Market Strategist National Bank Financial *** AVIS DE NON-RESPONSABILITE:\ Ce document transmis par courri...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] reason for na.last=TRUE in rank
Dear UseRs, Could someone explain to me why the default behaviour of rank() is to assign the largest rank to missing data rank(c(3, 1, NA)) [1] 2 1 3 as opposed to what I would hazard would be the expected 2, 1, NA? Despite consistency being the hobgoblin of little minds, of two closely related functions one handles NAs in the same way (order()) but another one doesn't (sort()). order() also uses the NA last rule by default, whereas sort() removes NAs. alejandro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] R annoyances
I think the flaw in this reasoning is that programmers are not considered users. IMO, making a better language is beneficial for users. I am now watching how a new colleague of mine, a very good C++ programmer turning into a data miner, is struggling w/ many irregularities of R. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thomas Lumley Sent: Thursday, May 19, 2005 9:39 AM To: Rod Montgomery Cc: r-help@stat.math.ethz.ch Subject: Re: [R] R annoyances On Thu, 19 May 2005, Rod Montgomery wrote: Thomas Lumley wrote: This one is actually a FAQ, mtx[,1,drop=FALSE] -thomas I wonder whether there is, or should be, a way to set FALSE as the default? There shouldn't be (apart from editing the code), because you really don't want something this basic to be unpredictable. There have been discussions at several times about whether drop=FALSE or drop=TRUE should be the default. The decision has always been that programmers can cope either way, but that users probably don't expect mtx[,1] to be a vector, and that they definitely don't expect mtx[1,1] to be a matrix. -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] does column exist?
How do I test if a data.frame has a column named X? exists(o) checks if the object exists or not, I want to test if a data.frame object (df) has a column names(X), something like: exists(df$X) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] R matrix sorting question
Dear there, I am trying to do the following stuff. Could you let me know how to do it efficiently? aaa [,1] [,2] [1,]1 -0.2 [2,]3 0.8 [3,]4 0.3 [4,]5 0.2 [5,]7 0.9 And I would like to sort the matrix by column 2 (and accordingly column 1 sorted as well). The desired matrix will be 1 -0.2 5 0.2 4 0.3 3 0.8 7 0.9 If using Excel or SAS, I can do this easily, but I couldn't figure out how to do it in R. Could you let me know the efficient way to do this ? I appreciate if the solution or reply comes as quickly as possible. Thank you very much. Insu __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] does column exist?
How about is.null(df$X)==FALSE ? Omar Lakkis wrote: How do I test if a data.frame has a column named X? exists(o) checks if the object exists or not, I want to test if a data.frame object (df) has a column names(X), something like: exists(df$X) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Chuck Cleland, Ph.D. NDRI, Inc. 71 West 23rd Street, 8th floor New York, NY 10010 tel: (212) 845-4495 (Tu, Th) tel: (732) 452-1424 (M, W, F) fax: (917) 438-0894 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] does column exist?
There may be a simpler way, but this is.na(match(X, names(df))) should return TRUE if the column name exists and FALSE otherwise. Cheers, Andy __ Andy Jaworski 518-1-01 Process Laboratory 3M Corporate Research Laboratory - E-mail: [EMAIL PROTECTED] Tel: (651) 733-6092 Fax: (651) 736-3122 Omar Lakkis [EMAIL PROTECTED] m To Sent by: r-help@stat.math.ethz.ch [EMAIL PROTECTED] cc at.math.ethz.ch Subject [R] does column exist? 05/19/2005 12:42 PM Please respond to Omar Lakkis [EMAIL PROTECTED] m How do I test if a data.frame has a column named X? exists(o) checks if the object exists or not, I want to test if a data.frame object (df) has a column names(X), something like: exists(df$X) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Loading a dynamic library
Hi, I'm trying to load a .dll library into R 2.1.0 on Windows using the dyn.load function. The library is compiled with gcc 3.3.3 on cygwin 1.5.16. I compile and link: $ gcc -c myfile.cpp -o myfile.o [HRT] $ gcc -shared myfile.o -o myfile.dll [HRT] I then type, in the R console, dynload(myfile.dll)[HRT] And R hangs. Any help appreciated. Thanks. Will _ William Astle. PhD Student, Department of Epidemiology and Public Health, Imperial College London, St Mary's Hospital Campus, Norfolk Place, Paddington. W2 1NY. wja [at] ic [dot] ac [dot] uk __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] R annoyances
Vadim et.al: I do not care to comment one way or the other about R's irregularities.' But I am puzzled by your statement that a good C++ programmer is struggling with R. Why should they not struggle?! R is primarily a language for data analysis, statistics, and graphics. I do not understand why someone who is a C++ programmer would be expected to have the knowledge and experience to be a data miner and would not therefore struggle to deal with the statistical and data analysis issues that are deliberately at the heart of many of R's programming conventions. Is there something here that I am missing, or is this yet another example of Frank Harrell's instant brain surgeon commentary? -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Vadim Ogranovich Sent: Thursday, May 19, 2005 10:40 AM To: Thomas Lumley; Rod Montgomery Cc: r-help@stat.math.ethz.ch Subject: RE: [R] R annoyances I think the flaw in this reasoning is that programmers are not considered users. IMO, making a better language is beneficial for users. I am now watching how a new colleague of mine, a very good C++ programmer turning into a data miner, is struggling w/ many irregularities of R. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thomas Lumley Sent: Thursday, May 19, 2005 9:39 AM To: Rod Montgomery Cc: r-help@stat.math.ethz.ch Subject: Re: [R] R annoyances On Thu, 19 May 2005, Rod Montgomery wrote: Thomas Lumley wrote: This one is actually a FAQ, mtx[,1,drop=FALSE] -thomas I wonder whether there is, or should be, a way to set FALSE as the default? There shouldn't be (apart from editing the code), because you really don't want something this basic to be unpredictable. There have been discussions at several times about whether drop=FALSE or drop=TRUE should be the default. The decision has always been that programmers can cope either way, but that users probably don't expect mtx[,1] to be a vector, and that they definitely don't expect mtx[1,1] to be a matrix. -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Learning rate with nnet
On Thu, 19 May 2005, Elyse Picard wrote: can I change the learning rate with nnet? And if yes, how? If no, what is the default one? I think you need to read the book nnet supports. It does not do on-line learning and does not have a learning rate. PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html (which mentions reading the book). -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] install R packages--sorry last letter that I sent I had an error, this one is the right one
On Thu, 19 May 2005, Li, Jia wrote: Dear All, When I tried to install R packages I found this error: library(survival) Loading required package: splines install.packages(splines) --- Please select a CRAN mirror for use in this session --- Warning message: package splines is in use and will not be installed But I just opened R, and haven't used anything yet, how come did it say package splines is in use? Package survival uses it, and you did use that Note that package splines is a standard package, part of the distribution. install.packages() will not find it. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] does column exist?
It depends on what Omar means by a column named X. Consider the following: tstDF - data.frame(aa=1, bb=2) tstDF$a [1] 1 is.null(tstDF$a) [1] FALSE is.na(match(a, names(tstDF))) [1] TRUE Does tstDF have a column named a? It has a column named aa, which is accessed by tstDF$a; is.null(tstDF$a) correctly identifies its presence, while is.na(match(a, names(tstDF))) correctly says that a is not the official name of any column of tstDF. spencer graves [EMAIL PROTECTED] wrote: There may be a simpler way, but this is.na(match(X, names(df))) should return TRUE if the column name exists and FALSE otherwise. Cheers, Andy __ Andy Jaworski 518-1-01 Process Laboratory 3M Corporate Research Laboratory - E-mail: [EMAIL PROTECTED] Tel: (651) 733-6092 Fax: (651) 736-3122 Omar Lakkis [EMAIL PROTECTED] m To Sent by: r-help@stat.math.ethz.ch [EMAIL PROTECTED] cc at.math.ethz.ch Subject [R] does column exist? 05/19/2005 12:42 PM Please respond to Omar Lakkis [EMAIL PROTECTED] m How do I test if a data.frame has a column named X? exists(o) checks if the object exists or not, I want to test if a data.frame object (df) has a column names(X), something like: exists(df$X) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] R matrix sorting question
You can use order as follows: p - order(aaa[,2]) aa[p,] p is the permutation putting aaa[,2] in ascending order, then aaa[p,] reorders the rows according to p. Reid Huntsinger -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, May 19, 2005 1:43 PM To: R-help@stat.math.ethz.ch Subject: [R] R matrix sorting question Dear there, I am trying to do the following stuff. Could you let me know how to do it efficiently? aaa [,1] [,2] [1,]1 -0.2 [2,]3 0.8 [3,]4 0.3 [4,]5 0.2 [5,]7 0.9 And I would like to sort the matrix by column 2 (and accordingly column 1 sorted as well). The desired matrix will be 1 -0.2 5 0.2 4 0.3 3 0.8 7 0.9 If using Excel or SAS, I can do this easily, but I couldn't figure out how to do it in R. Could you let me know the efficient way to do this ? I appreciate if the solution or reply comes as quickly as possible. Thank you very much. Insu __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] does column exist?
On Thu, 19 May 2005 [EMAIL PROTECTED] wrote: There may be a simpler way, but this is.na(match(X, names(df))) should return TRUE if the column name exists and FALSE otherwise. Mere syntactic sugar, but X %in% names(mydf) is self-documenting. How do I test if a data.frame has a column named X? exists(o) checks if the object exists or not, I want to test if a data.frame object (df) has a column names(X), something like: exists(df$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@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] R matrix sorting question
Try: A=matrix(c(1,3,4,5,7, -0.2, 0.8, 0.3, 0.2, 0.9 ),5,2) A [,1] [,2] [1,]1 -0.2 [2,]3 0.8 [3,]4 0.3 [4,]5 0.2 [5,]7 0.9 A[order(A[,2]), ] [,1] [,2] [1,]1 -0.2 [2,]5 0.2 [3,]4 0.3 [4,]3 0.8 [5,]7 0.9 Jarek \=== Jarek Tuszynski, PhD. o / \ Science Applications International Corporation \__,| (703) 676-4192 \ [EMAIL PROTECTED] `\ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Thursday, May 19, 2005 1:43 PM To: R-help@stat.math.ethz.ch Subject: [R] R matrix sorting question Dear there, I am trying to do the following stuff. Could you let me know how to do it efficiently? aaa [,1] [,2] [1,]1 -0.2 [2,]3 0.8 [3,]4 0.3 [4,]5 0.2 [5,]7 0.9 And I would like to sort the matrix by column 2 (and accordingly column 1 sorted as well). The desired matrix will be 1 -0.2 5 0.2 4 0.3 3 0.8 7 0.9 If using Excel or SAS, I can do this easily, but I couldn't figure out how to do it in R. Could you let me know the efficient way to do this ? I appreciate if the solution or reply comes as quickly as possible. Thank you very much. Insu __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] R annoyances
I guess it depends on what kind of data analysis one does. R is designed and best suited for the analysis that starts with a data frame which fits in 1/10th of your computer RAM. R programming is then mostly limited to writing small convenience functions for better presentation, visualization, etc. Or alternatively one implements a new fitting procedure/algorithm and applies it to the data. Now things begin to look harder when you have 200G of data and 8G of RAM and still need to find structure in the data. You need to pre-process the data, recover from *unexpected* failures, store and retrieve intermediate data sets, etc. This requires qualities of a good general-purpose programming language. Note, we do not use R to program a system, we do data analysis so we should be considered R *users*. In my view, and the experience of the colleague of my confirms it, R has a long way to go to become a wrinkle-free general purpose language. To your specific question, why good (C++) programmers should not struggle with R? Because they have the skills to plan sizeable programs in any wrinkle-free language. Hope this makes my earier comments more clear, Vadim -Original Message- From: Berton Gunter [mailto:[EMAIL PROTECTED] Sent: Thursday, May 19, 2005 10:55 AM To: Vadim Ogranovich; 'Thomas Lumley'; 'Rod Montgomery' Cc: r-help@stat.math.ethz.ch Subject: RE: [R] R annoyances Vadim et.al: I do not care to comment one way or the other about R's irregularities.' But I am puzzled by your statement that a good C++ programmer is struggling with R. Why should they not struggle?! R is primarily a language for data analysis, statistics, and graphics. I do not understand why someone who is a C++ programmer would be expected to have the knowledge and experience to C++ be a data miner and would not therefore struggle to deal with the statistical and data analysis issues that are deliberately at the heart of many of R's programming conventions. Is there something here that I am missing, or is this yet another example of Frank Harrell's instant brain surgeon commentary? -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Vadim Ogranovich Sent: Thursday, May 19, 2005 10:40 AM To: Thomas Lumley; Rod Montgomery Cc: r-help@stat.math.ethz.ch Subject: RE: [R] R annoyances I think the flaw in this reasoning is that programmers are not considered users. IMO, making a better language is beneficial for users. I am now watching how a new colleague of mine, a very good C++ programmer turning into a data miner, is struggling w/ many irregularities of R. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thomas Lumley Sent: Thursday, May 19, 2005 9:39 AM To: Rod Montgomery Cc: r-help@stat.math.ethz.ch Subject: Re: [R] R annoyances On Thu, 19 May 2005, Rod Montgomery wrote: Thomas Lumley wrote: This one is actually a FAQ, mtx[,1,drop=FALSE] -thomas I wonder whether there is, or should be, a way to set FALSE as the default? There shouldn't be (apart from editing the code), because you really don't want something this basic to be unpredictable. There have been discussions at several times about whether drop=FALSE or drop=TRUE should be the default. The decision has always been that programmers can cope either way, but that users probably don't expect mtx[,1] to be a vector, and that they definitely don't expect mtx[1,1] to be a matrix. -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Re: text mining: ttda
Dear Jean-Pierre: I used R, version 2.0.1 and I followed the example from ?ttda.forms.frame and got a dataframe: federalist.frame and run ttda.lemmatisation(federalist.frame$graphical.forms, ispell.path='/usr/bin/ispell') [1] ispell output : wrong size ... Error in ttda.util.lemmatisation(levels(forms), ...) : ispell output : wrong size ... and I got the error message as above. Please be advised! Thanks, weiwei On 5/19/05, Jean-Pierre Muller [EMAIL PROTECTED] wrote: Dear Weiwei, Le 19 mai 05, à 00:17, Weiwei Shi a écrit : Can anyone suggest some good text mining reference or books? thanks, weiwei On 5/18/05, Weiwei Shi [EMAIL PROTECTED] wrote: Hi, I am working on a text mining project and i am interested in ttda package. however, I really cannot find the document for this package in English. I am sorry, but for the moment there is not an english manual... It is in my todo list for a while. R 2.1 as introduced many new functions for text, and i need correct my package first. May be in the nexts weeks? The package try to code what is shown in: Lebart, L., Salem, A. and Berry, L. (1998) Exploring textual data. Dordrecht: Kluwer. HTH. Can anyone give me some help? btw, is there any other package in R doing text mining. I googled MedlineR which might help my project. Anyone can give me some links on how to use it too? thanks, -- Weiwei Shi, Ph.D Did you always know? No, I did not. But I believed... ---Matrix III -- Weiwei Shi, Ph.D Did you always know? No, I did not. But I believed... ---Matrix III __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Jean-Pierre Müller SSP / BFSH2 / UNIL / CH - 1015 Lausanne Voice:+41 21 692 3116 / Fax:+41 21 692 3115 Please avoid sending me Word or PowerPoint attachments. See http://www.gnu.org/philosophy/no-word-attachments.html S'il vous plaît, évitez de m'envoyer des attachements au format Word ou PowerPoint. Voir http://www.gnu.org/philosophy/no-word-attachments.fr.html -- Weiwei Shi, Ph.D Did you always know? No, I did not. But I believed... ---Matrix III __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] R annoyances
Dear Jan, Since you can use variables named c, q, or t in any event, I don't see why the existence of functions with these names is much of an impediment. The problem that I see with T and F is that allowing them to be redefined sets a trap for people. If R wants to discourage use of T and F for TRUE and FALSE, then why provide standard global variables by these names? On the other hand, if providing T and F is considered desirable (e.g., for S-PLUS compatibility), then why not make them reserved names? Regards, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: Jan T. Kim [mailto:[EMAIL PROTECTED] Sent: Thursday, May 19, 2005 12:22 PM To: John Fox Subject: Re: [R] R annoyances On Thu, May 19, 2005 at 11:55:22AM -0400, John Fox wrote: Dear Uwe, I've often wondered why T and F aren't reserved words in R as TRUE and FALSE are. Perhaps there's some use of T and F as variables, but that seems ill-advised. Personally, I'd rather argue the other way around: Reserved words should be words that should be more unique and expressive than just a single letter. In fact, I've found it slightly irritating at times that c, q and t are functions in the base package, as I'm somewhat prone to use all of these as local variable names... Best regards, Jan -- +- Jan T. Kim ---+ |*NEW*email: [EMAIL PROTECTED] | |*NEW*WWW: http://www.cmp.uea.ac.uk/people/jtk | *-= hierarchical systems are for files, not for humans =-* __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] R annoyances
(a) There is 'stable.apply' in S Poetry that looks to me like it should work in R, but I haven't tested it. Patrick Burns Burns Statistics [EMAIL PROTECTED] +44 (0)20 8525 0696 http://www.burns-stat.com (home of S Poetry and A Guide for the Unwilling S User) Chalasani, Prasad wrote: Dear R Folks, I'm a big fan of R, but there are a couple of things that repeatedly annoy me, and I wondered if anyone has neat ways to deal with them. (a) When using apply row-wise to a matrix, it returns the results column-wise, and to preserve the original orientation, I've to do a transpose. E.g. I've to keep doing a transpose, which I consider to be quite annoying. transformed.mtx - t(apply( mtx, 1, exp)) (b) When extracting 2 or more columns of a matrix, R returns the result as a matrix, BUT when extracting just one column, it returns a vector/array, rather than a matrix, so I've to keep doing as.matrix, which is annoying. sub.mtx - as.matrix(mtx[,1]) Of course I could write a suitable function cols - function(mtx,range) as.matrix(mtx[, range]) but then I lose the syntactic sugar of being able to say [,1]. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Larger X11 fonts under R-2.1.0
I view plots on my screen with X11(width=.455*11, height=.455*8.5), which creates a small window with the American standard aspect ratio. Under R-2.0.1 and earlier, the default fonts were a reasonable size, but under R-2.1.0 they are too big and fat. I now have to either set pointsize=10 in X11(), or par(cex=.7) afterwards. The NEWS file has this to say about X11 fonts: The changes to font handling in the X11 module are based on the Japanization patches of Eiji Nakama. I'm not sure if that's relevant to the change I'm seeing. Has anyone else noticed a difference in the X11 fonts? (I assume this is different from Xiang-Jun Lu's problem, since I do not get any error messages that fonts could not be loaded.) -- David Brahm ([EMAIL PROTECTED]) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] logistic regression: differential importance of regressors
Hi, All. I have a logistic regression model that I have run. The question came up: which of these regressors is more important than another? (I'm using Design) Logistic Regression Model lrm(formula = iconicgesture ~ ST + SSP + magnitude + Condition + Expertise, data = d) CoefS.E. Wald Z P Intercept -3.2688 0.2854 -11.45 0. ST 2.0871 0.2730 7.64 0. SSP0.7454 0.3031 2.46 0.0139 magnitude -0.9905 0.6284 -1.58 0.1150 Condition 0.9506 0.2932 3.24 0.0012 Expertise 0.8508 0.2654 3.21 0.0013 The real question is that, since both ST and SSP load significantly into the model, how do I show that ST has a bigger/smaller/similar effect than SSP? thanks in advance! greg __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] reason for na.last=TRUE in rank
Because rank and order are (supposed to be) inverses of each other. For example: a - c(3, 1, NA) a[order(a[rank(a)])] [1] 3 1 NA a[rank(a[order(a)])] [1] 3 1 NA BUT a[order(a[rank(a, na.last = FALSE)])] [1] 1 NA 3 a[rank(a[order(a)], na.last = FALSE)] [1] 1 NA 3 -Original Message- From: Alejandro Munoz del Rio [mailto:[EMAIL PROTECTED] Sent: Thursday, May 19, 2005 1:01 PM To: r-help@stat.math.ethz.ch Subject: [R] reason for na.last=TRUE in rank Dear UseRs, Could someone explain to me why the default behaviour of rank() is to assign the largest rank to missing data rank(c(3, 1, NA)) [1] 2 1 3 as opposed to what I would hazard would be the expected 2, 1, NA? Despite consistency being the hobgoblin of little minds, of two closely related functions one handles NAs in the same way (order()) but another one doesn't (sort()). order() also uses the NA last rule by default, whereas sort() removes NAs. alejandro __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Larger X11 fonts under R-2.1.0
On Thu, 19 May 2005, Brahm, David wrote: I view plots on my screen with X11(width=.455*11, height=.455*8.5), which creates a small window with the American standard aspect ratio. Under R-2.0.1 and earlier, the default fonts were a reasonable size, but under R-2.1.0 they are too big and fat. I now have to either set pointsize=10 in X11(), or par(cex=.7) afterwards. So you should. We have corrected a bug: you now get the size you ask for and 12pt on such a small window will be too large. DId you think to actually measure the sizes? Might be interesting (although you may need to measure the window too). The NEWS file has this to say about X11 fonts: The changes to font handling in the X11 module are based on the Japanization patches of Eiji Nakama. The change is more likely to be o X11() was only scaling its fonts to pointsize if the dpi was within 0.5 of 100dpi. in the BUGS list. I happen to have 99.4 and 120 dpi screens, and I assure you the previous default of 75dpi fonts was way too small for the default 7 window. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Loading a dynamic library
On Thu, 19 May 2005, Astle, William J wrote: Hi, I'm trying to load a .dll library into R 2.1.0 on Windows using the dyn.load function. The library is compiled with gcc 3.3.3 on cygwin 1.5.16. Please use the correct OS's DLLs: Cygwin is another OS hosted on Windows. This might work, but it is not as good an idea as using the recommended compilers, or indeed any other Windows compiler. I compile and link: $ gcc -c myfile.cpp -o myfile.o [HRT] $ gcc -shared myfile.o -o myfile.dll [HRT] I then type, in the R console, dynload(myfile.dll)[HRT] What is `dynload', and what does [HRT] mean? And R hangs. Are you sure? It is more likely that your DLL's initialization code hangs. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Lattice: how to get default ylim?
Hi Deepayan Sarkar wrote: On Thursday 19 May 2005 9:11 am, David James wrote: Deepayan Sarkar wrote: v - current.viewport()## requires R 2.1.0 (I believe) No, I think it's been there for a while. However, AFAIR the fact that viewports have components xscale and yscale that can be accessed like this is undocumented and may change if the implementation changes (which is a real possibility). Ideally, there should be exported interfaces to access this information, either in grid or lattice. One of the reasons there isn't is that you rarely Yes, I agree that such an interface is quite desirable. OK, I'll put something in the next version of lattice. The expression I recommend for this sort of thing is something like ... convertY(unit(0:1, npc), native, valueOnly=TRUE) Paul -- Dr Paul Murrell Department of Statistics The University of Auckland Private Bag 92019 Auckland New Zealand 64 9 3737599 x85392 [EMAIL PROTECTED] http://www.stat.auckland.ac.nz/~paul/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] source-only package, but still: Error: package 'simple' was built for powerpc-apple-darwin7.9.0
Hi Brian, Thanks very much for your two tips concerning my failed attempt, yesterday, to build and install a package: I suspect your package has structure it is not using. I had an empty 'src' directory. Once I removed that, BUILD INSTALL on another OS worked fine. We encourage you to use a repository, as in the article in the current R-news. I've spent a few hours on this, and though I made some pretty good progress, I am not yet completely successful. I read your article, Packages and their Management in R 2.1.0 and the two antecedents, R Help Desk, 12/03 and Writing R Extensions. I also attempted some reverse-engineering by studying directory structure at the CRAN repository. I can now use available.packages (contriburl='http://myhost/R') and see the simple package I installed there, but I cannot load it unless (this is embarrassing...) I have two copies of the tar.gz file, one at the root of the repository, and one in src/contrib within the repository. I am sure that the repository mechanism is sensible, but I am also sure I don't yet understand it. The directory structure, and the roles of the PACKAGES, replisting, and repdatadesc.rda are as yet unclear to me. Can you provide some further help? I'll be grateful. For what it's worth (and assuming it doesn't yet exist) I would be glad, at the conclusion of this exercise, to create a step-by-step tutorial, titled, perhaps: Sharing Code: An Idiot's Guide to packaging an R function, creating a repository, and installing from that repository into a local library. Regards, - Paul Shannon Institute for Systems Biology Seattle __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] R annoyances
From: Vadim Ogranovich I guess it depends on what kind of data analysis one does. R is designed and best suited for the analysis that starts with a data frame which fits in 1/10th of your computer RAM. R programming is then mostly limited to writing small convenience functions for better presentation, visualization, etc. Or alternatively one implements a new fitting procedure/algorithm and applies it to the data. Now things begin to look harder when you have 200G of data and 8G of RAM and still need to find structure in the data. You need to pre-process the data, recover from *unexpected* failures, store and retrieve intermediate data sets, etc. This requires qualities of a good general-purpose programming language. Note, we do not use R to program a system, we do data analysis so we should be considered R *users*. In my view, and the experience of the colleague of my confirms it, R has a long way to go to become a wrinkle-free general purpose language. To your specific question, why good (C++) programmers should not struggle with R? Because they have the skills to plan sizeable programs in any wrinkle-free language. Could you please define wrinkle-free language, or give an (some?) example? Andy Hope this makes my earier comments more clear, Vadim -Original Message- From: Berton Gunter [mailto:[EMAIL PROTECTED] Sent: Thursday, May 19, 2005 10:55 AM To: Vadim Ogranovich; 'Thomas Lumley'; 'Rod Montgomery' Cc: r-help@stat.math.ethz.ch Subject: RE: [R] R annoyances Vadim et.al: I do not care to comment one way or the other about R's irregularities.' But I am puzzled by your statement that a good C++ programmer is struggling with R. Why should they not struggle?! R is primarily a language for data analysis, statistics, and graphics. I do not understand why someone who is a C++ programmer would be expected to have the knowledge and experience to C++ be a data miner and would not therefore struggle to deal with the statistical and data analysis issues that are deliberately at the heart of many of R's programming conventions. Is there something here that I am missing, or is this yet another example of Frank Harrell's instant brain surgeon commentary? -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Vadim Ogranovich Sent: Thursday, May 19, 2005 10:40 AM To: Thomas Lumley; Rod Montgomery Cc: r-help@stat.math.ethz.ch Subject: RE: [R] R annoyances I think the flaw in this reasoning is that programmers are not considered users. IMO, making a better language is beneficial for users. I am now watching how a new colleague of mine, a very good C++ programmer turning into a data miner, is struggling w/ many irregularities of R. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Thomas Lumley Sent: Thursday, May 19, 2005 9:39 AM To: Rod Montgomery Cc: r-help@stat.math.ethz.ch Subject: Re: [R] R annoyances On Thu, 19 May 2005, Rod Montgomery wrote: Thomas Lumley wrote: This one is actually a FAQ, mtx[,1,drop=FALSE] -thomas I wonder whether there is, or should be, a way to set FALSE as the default? There shouldn't be (apart from editing the code), because you really don't want something this basic to be unpredictable. There have been discussions at several times about whether drop=FALSE or drop=TRUE should be the default. The decision has always been that programmers can cope either way, but that users probably don't expect mtx[,1] to be a vector, and that they definitely don't expect mtx[1,1] to be a matrix. -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] laten class analysis
Dear List, just a little question, I am interested in Latent Class Analysis and I guess if there is a package for this pourpose thank for you help, Simone __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] Larger X11 fonts under R-2.1.0
Thanks very much to Prof Brian Ripley [EMAIL PROTECTED] for the quick and illuminating reply: We have corrected a bug: you now get the size you ask for... DId you think to actually measure the sizes? Might be interesting (although you may need to measure the window too). Sticking a ruler up to my screen, I measure the 12pt font at 13.5 pt (where 1 pt = 1/72 inch), and the 10pt at 9.5 pt. My window as a whole is about 1.2x as large as I asked for, though. So the 10pt font is a little small, but the sizes are roughly right (in R-2.1.0). -- David Brahm ([EMAIL PROTECTED]) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Simultaneous estimation of mean and garch eq'n
Is it possible to simultaneously estimate mean and GARCH parameters in R? In other words, I would like to estimate the normal regression equation Y = b X + u and simultaneously do a garch process on the u's to correct the standard errors. I was thinking maybe something with systemfit(), but I can't quite come up with it. Thanks, Tobias -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] logistic regression: differential importance of regressors
Greg Trafton wrote: Hi, All. I have a logistic regression model that I have run. The question came up: which of these regressors is more important than another? (I'm using Design) Logistic Regression Model lrm(formula = iconicgesture ~ ST + SSP + magnitude + Condition + Expertise, data = d) CoefS.E. Wald Z P Intercept -3.2688 0.2854 -11.45 0. ST 2.0871 0.2730 7.64 0. SSP0.7454 0.3031 2.46 0.0139 magnitude -0.9905 0.6284 -1.58 0.1150 Condition 0.9506 0.2932 3.24 0.0012 Expertise 0.8508 0.2654 3.21 0.0013 The real question is that, since both ST and SSP load significantly into the model, how do I show that ST has a bigger/smaller/similar effect than SSP? thanks in advance! greg One thing you can do is to compute what proportion of the total likelihood ratio chi-square statistic is due to each variable by removing one at a time and looking at difference in Model L.R. (assuming both have same observations missing). Note that you are making heavy linearity assumptions. You can also use the bootstrap to get a confidence interval on the rank of the chi-square statistic a variable has among all competing chi-squares. Frank -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Help with R
Hi Gabor, On 05-May-05 Gabor Grothendieck wrote: On 5/5/05, Ted Harding [EMAIL PROTECTED] wrote: [...] However, while representing the raw data in such a form is well supported by R, it seems to me that extracting data in a way adapted to different analyses requires users to create their own methods, using the list-access primitives . For example, to study the changes in the distribution of lengths of specimens in relation to Position and Date (which was one of the important issues in that investigation), I don't think there are any list processing functions available in R which, given the list-based structure described above, would allow a simple query of the form means( Length , ~ Position:Date , data=Cruise ) It's quite feasible to write one's own; but I think Peter's hope (expressed in excerpt above) looks like a first call for thinking about general methods for this sort of thing. The Green Book defines a recursive apply function, rapply, that provides a general means of traversing that sort of structure. [...] R. A. Becker, J. M. Chambers, and A .R. Wilks, The New S Language: A Programming Environment for Data Analysis and Statistics. Pacific Grove, CA: Wadsworth, 1988. Defines S Version 2, which forms the basis of the currently used S Versions 3 and 4, as well as R. (Sometimes called the Blue Book.) Thanks for your suggestions and comments, Gabor. However, I now have the Green Book. There is some mention of 'rapply' (pp. 174-5, 371 where the function is used in the definition of a function, and 430 where it is stated that The S and C computations for rapply follow the style of the example here, the example in question being C code for a simplified version of the S function lapply). However, there is no code anywhere for rapply itself! While the above possibly amount to enough hints for a good R programmer to work out an implementation for rapply, this is at present a level or two above my skills. The S-plus code for rapply can be found by listing rapply. There are two things wrong with doing this. One is that this code involves at least two functions which do not seem to be available in R -- new.frame() and the function which occurs in .Call(2s_tree_apply, ). One would need to infer what these do and implement them in R. The other is that I'm not at all keen on the idea of pinching code from a proprietary product (S-plus). So I'm wondering if there is any R code that implements the equivalent of 'rapply' or could readily be extended to do so. With thanks, and best wishes, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 19-May-05 Time: 22:51:48 -- XFMail -- __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] using src/Makevars file
Hi all, Thanks to all who offered advice on using F95 in R. Now I'm trying to compile a test package using gfortran, Linux 2.4.21 and R 2.1.0. I was able to successfully compile and use a test F95 routine by setting my environment variables as follows in bash: export PATH=~/bin/:$PATH export F77=gfortran export LD_LIBRARY_PATH=~/bin/irun/lib export GFORTRAN_STDIN_UNIT=-1 Now I'm trying to write a Makevars file for my test package and not quite sure how to do it. I've tried FF=gfortran GFORTRAN_STDIN_UNIT=-1 FLIBS=/home/jbremson/bin/irun/lib/libgfortran.a but when running an R CMD check on the package I see that it's still using g77 to compile: -output ... ** libs g77 -fPIC -g -O2 -c estimate.f -o estimate.o estimate.f: In subroutine `estimate': estimate.f:20: forall (i = 1:nxrows) beta(i) = i * 2 ^ Invalid declaration of or reference to symbol `forall' at (^) [initially seen at (^)] ... end output The code compiles using: gfortran -c estimate.f I can run my code if I build the .so by hand and then dyn.load it. Here is my F95 test code: subroutine estimate(beta, yij, nij, nxrows, nxcols,xmat, irequest, ierror) integer nxrows, nxcols, yij, nij, irequest, ierror double precision beta(nxrows), xmat(nxrows,nxcols) integer i i = 0 c fortran 95 version forall (i = 1:nxrows) beta(i) = i * 2 ierror = 0 end Regards, Joel Bremson UC Davis [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
RE: [R] install R packages
From: Li, Jia Dear All, When I tried to install R packages I found this error: library(survival) Loading required package: splines install.packages(splines) --- Please select a CRAN mirror for use in this session --- Warning message: package splines is in use and will not be installed But I just opened R, and have used anything yet, how come did it say package splines is in use? You didn't just open R. You loaded the survival package, which depends on the splines package, so that's loaded as well. Why would you want to install that package if you already have it? The error you get tells you that you can't install over a package that's in use. You can see what's loaded by typing search(). Andy Thanks Jia __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Help with R
On 5/19/05, Ted Harding [EMAIL PROTECTED] wrote: Hi Gabor, On 05-May-05 Gabor Grothendieck wrote: On 5/5/05, Ted Harding [EMAIL PROTECTED] wrote: [...] However, while representing the raw data in such a form is well supported by R, it seems to me that extracting data in a way adapted to different analyses requires users to create their own methods, using the list-access primitives . For example, to study the changes in the distribution of lengths of specimens in relation to Position and Date (which was one of the important issues in that investigation), I don't think there are any list processing functions available in R which, given the list-based structure described above, would allow a simple query of the form means( Length , ~ Position:Date , data=Cruise ) It's quite feasible to write one's own; but I think Peter's hope (expressed in excerpt above) looks like a first call for thinking about general methods for this sort of thing. The Green Book defines a recursive apply function, rapply, that provides a general means of traversing that sort of structure. [...] R. A. Becker, J. M. Chambers, and A .R. Wilks, The New S Language: A Programming Environment for Data Analysis and Statistics. Pacific Grove, CA: Wadsworth, 1988. Defines S Version 2, which forms the basis of the currently used S Versions 3 and 4, as well as R. (Sometimes called the Blue Book.) Thanks for your suggestions and comments, Gabor. However, I now have the Green Book. There is some mention of 'rapply' (pp. 174-5, 371 where the function is used in the definition of a function, and 430 where it is stated that The S and C computations for rapply follow the style of the example here, the example in question being C code for a simplified version of the S function lapply). However, there is no code anywhere for rapply itself! While the above possibly amount to enough hints for a good R programmer to work out an implementation for rapply, this is at present a level or two above my skills. The S-plus code for rapply can be found by listing rapply. There are two things wrong with doing this. One is that this code involves at least two functions which do not seem to be available in R -- new.frame() and the function which occurs in .Call(2s_tree_apply, ). One would need to infer what these do and implement them in R. The other is that I'm not at all keen on the idea of pinching code from a proprietary product (S-plus). So I'm wondering if there is any R code that implements the equivalent of 'rapply' or could readily be extended to do so. Search r-help for treeapply. Also r-devel for a link to the codetools package which has some recursive code in it. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] fast matrix update
Thank you Duncan for the answer. I was thinking on the same kind of tricks. I'll probably subscribe nextly to R-devel. Thanks Vincent __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html