[R] png() or jpeg() in a php script
Hello, I've got a problem with a PHP script, in which I call the system function (to call another processes). The call is : system("R --slave --vanilla < path/to/source/source.R"); if in this R file, I've got the lines: pdf(file="/path/to/file/file.pdf") commands dev.off() the pdf file is perfectly created but if I change the lines to: png(file="/path/to/file/file.png"); commands dev.off() (or with the jpeg() function) the files are not created. any help? Thanks [[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] information
Hi. My name is Angel, I am Mexican, and I write by the following thing: I am in search of commands or options in R that can be used in regional economics. Specially I am interested in commands who can be interacted with geographic information systems, to get a regionalization, using a lot of many indicators. -- Atentamente Ángel Toledo Tolentino [[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] Reconstructing Datasets
Hi Laura, You might want to have a look at function decevf in package pastecs. It uses eigenvector filtering to reconstruct a signal using only the most representative eigenvectors. It is applied for time series but you could easily modify the code to use it for spatial data also. Bests, Angel Laura Quinn wrote: Hi, Is it possible to recreate "smoothed" data sets in R, by performing a PCA and then reconstructing a data set from say the first 2/3 EOFs? I've had a look in the help pages and don't seem to find anything relevant. Thanks in advance, Laura Laura Quinn Institute of Atmospheric Science School of Earth and Environment University of Leeds Leeds LS2 9JT tel: +44 113 343 1596 fax: +44 113 343 6716 mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html . __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: AW: [R] How to improve the quality of curve/line plots?
I posted a similar question while ago: http://tolstoy.newcastle.edu.au/R/help/04/03/0590.html with not much success. The only replies I recieved were in private, the one i keep in my inbox is: "Is this just a "rasterization" effect? i.e., a conceptually smooth line looks jagged because the screen can only turn on the pixels closest to where the line goes. The example looks smooth when printed right(?)" The reply is that it looks better (although not perfect) when printed or when I use a postscript device. Angel Wolf, Michael wrote: Thanks for the tip using a smoothing technique before plotiing in order to get a curve instead of a line connecting the observations. But that's not the solution for my main problem with the "unclean" line plot. In order to show my problem let's take this simple example: xval <- c(1, 2, 3, 4, 5, 6, 7, 8) yval <- c(10, 30, 40, 50, 70, 90, 100, 110) plot (xval, yval, type="l") If you look to the result in the graphic window you will see that the line seems to exist of many points between the observations; e. g. between xval=1 and xval=2 the line contains 8 or more sublines. Perhaps, you can also observe a break of the line at xval=4. That's what I call an "unclean line". Even if you try to export the plot with the png command you can observe the same phenomenon. The line has not an exact appearance like Excel diagram plots. If there are no other techniques to get better line plots it seems to be a problem of the graphic output!? Michael Wolf -Ursprüngliche Nachricht- Von: Uwe Ligges [mailto:[EMAIL PROTECTED] Gesendet: Freitag, 24. September 2004 09:00 An: Wolf, Michael Cc: [EMAIL PROTECTED] Betreff: Re: [R] How to improve the quality of curve/line plots? Wolf, Michael wrote: Dear list, I'm using the windows version of R. When plotting a curve or a line for time series with annual data , e. g. GDP growth 1991-2003, the line seems to exist of a lot of smaller lines. Printing the results the curves and lines seems to be "unclean" (because of using small resolution bitmaps?). Comparing the result of R with the same results of Excel the lines in excel seems to havve a higher qualitiy. In Excel you also can produce curves instead of lines. Are there any possibilities how to improve the quality of the plots in R? How can R be influenced to plot "clean" lines with a higher resolution on the screen (I think it's not a question of the pdf- or png command.). Perhaps, it's a problem of the graphical possibilites of R because the most line plots which can be seen on the web have these problems. Can you specify an example please? I cannot remember any "unclean" plot. In particular, no bitmaps are used to render graphics in R. What I guess is that you have a line plot and each observation is connected with the subsequent one by a line. If you want to smooth it (and you think smoothing is appropriate here), you have to apply a smoothing technique before plotting. Uwe Ligges Thanks, Dr. Michael Wolf Bezirksregierung Münster Dezernat 61 Domplatz 1-348161 Münster Tel.: ++ 49 (02 51) / 4 11 - 17 95 Fax.: ++ 49 (02 51) / 4 11 - 8 17 95 E-Mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html . __ [EMAIL PROTECTED] 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] image recognition in R
I have some images of bugs (insects) with many bugs in each image. I want to count the number of bugs and to have an estimate of the area of each one. I've tried searching for an R package to do so with no success. Is this a task that I should pursue doing in R or should I restrict myself to specific image analysis software (e.g. ImageJ)?. The reason I consider R would be a good choice is because then It would probably be possible to use R statistical power to do pattern recognition on each bug's image to try to identify each bug (Family, genus or species). Is anybody working in this direction? Thanks, Angel __ [EMAIL PROTECTED] 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] about lme
Hi R-users: I've got a problem with lme. In Rail data,I try to model the next one lme(travel ~ Rail, data = Rail, random = ~ Rail | Rail) I want travel = Rail(i) + Rail(j) + epsilon(i,j) say, an effect fixed for every Rail and other for Rail(j) random, R says fewer observations or false convergence. Why can't I model an effect fixed and other random? Thanks in advance. My e-mail is [EMAIL PROTECTED] Descárgalo y pruébalo 2 meses gratis. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] pca with missing values
Thanks for the pointers. I've read them with care but I don't seem capable of making it work. For example, if I do: data(USArrests) USArrests2<-USArrests USArrests2[1,1]<-NA princomp(USArrests2, cor = TRUE, na.action = "na.omit") I get the error message: Error in cov.wt(z) : x must contain finite values only I've tried changing the 'options' na.action and using other values than na.omit with no success. The only way that I can make it work in some way was if I did: USArrestsNA<-na.omit(USArrests) princomp(USArrestsNA, cor = TRUE) I've also obtained the same by giving the correlation matrix instead of the data frame: princomp(covmat=cor(USArrestsNA)) Both solutions do the job by not using the row with the NA. After more reading I thought I would get the same result by doing: princomp(covmat=cor(USArrests2,use="complete.obs")) but the result is slightly different. I can not manage to understand the difference. Can someone give me some more light to keep going? P.S:Using the solution above with na.omit would not be very good in my real world problem because it is relatively common to have an NA in a row. Maybe using princomp(covmat=cor(USArrests2,use="pairwise.complete.obs")) would be a solution but I would like to understand the above before doing this next step. Thanks, Ange Prof Brian Ripley wrote: On Wed, 30 Jun 2004, Angel Lopez wrote: I need to perform a principal components analysis on a matrix with missing values. I've searched the R web site but didn't manage to find anything. ?princomp has a description of an na.action argument, and help.search("missing values") comes up with several relevant entries. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] camberra distance?
From Legendre & Legendre Numerical Ecology I read: "The Australians Lance & Williams (1967a) give several variants of the Manhattan metric including their Canberra metric (Lance & Williams 1966c)" Lance &Williams (1967a) Mixed-data classificatory programs I.Agglomerative systems. Aust. Comput.J.1:15-20 Lance & Williams 1966c Computer programs for classification. Proc. ANCCAC Conference, Canberra, May 1966, Paper 12/3 HTH, Angel Wolski wrote: Hi! Its not an R specific question but had no idea where to ask elsewhere. Does anyone know the orginal reference to the CAMBERA DISTANCE? Eryk. Ps.: I knew that its an out of topic question (sorry). Can anyone reccomend a mailing list where such questions are in topic? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html . __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] pca with missing values
I need to perform a principal components analysis on a matrix with missing values. I've searched the R web site but didn't manage to find anything. Any pointers/guidelines are much appreciatted. Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] chronological clustering
Does anybody know of any R functions to perform chronological clustering as explained in: Legendre, P., S. Dallot & L. Legendre. 1985. Succession of species within a community: chronological clustering, with applications to marine and freshwater zooplankton. American Naturalist 125: 257-288. http://www.fas.umontreal.ca/BIOL/legendre/reprints/succession_of_species.pdf Thanks, Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] sunrise, sunset calculation
Martin Maechler wrote: >>>>>> "Mike" == Mike Sumner <[EMAIL PROTECTED]> >>>>>>on Mon, 21 Jun 2004 19:04:00 +1000 writes: > > > > Mike> At 06:26 PM 6/21/2004, Angel Lopez wrote: > >> Are there any functions available to calculate sunrise and sunset times >> for given latitude,longitude and dates? > >> If not, I'll appreciatte any pointers to C code I could use/port. > >> Thanks, > >> Angel > > > Mike> Hello, I have R code for determining solar elevation > Mike> for given lat,lon,time - they were translated from the > Mike> Javascript on these pages. > > Mike> http://www.srrb.noaa.gov/highlights/sunrise/sunrise.html > Mike> http://www.srrb.noaa.gov/highlights/sunrise/azel.html > > Mike> I use them in a fairly specialized way, but I can dig > Mike> it out and probably help you get started. > > that might be nice to have in an R package. > sunrise/sunset would then be the zeros [ "uniroot()" ] of the > sun elevations? > Well, not always ;-) , it depends on how you define sunrise/sunset, there are various definitions (astrological, nautical, civil). The most complete code I know of (also pointed to me by another user in private) is sunriset.c. It would be quite easy to use this C code and write a wrapper functions in R. Because it was me who asked first I'll try to do it. However using noaa algorithms might be better, the sunriset.c gives slight differences to noaa (and to emacs sunrise-sunset), I don't know which one is better but it might be better to say that R code 'uses noaa algorithms'. Any other pointers welcomed. Angel > Note that ESS (and other Emacs) users have it at least at their > finger tips: M-x sunrise-sunset > (and there's lunar phases, holidays, dairy etc; only partly also available from [Tools] -> [Display Calendar] -> {{new menu entries when inside calendar}} > > So, you can also find the emacs-lisp code (in > /lisp/calendar/solar.el but only when you've got a "source" > installation of emacs). > > Martin Maechler > > . > __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] sunrise, sunset calculation
Are there any functions available to calculate sunrise and sunset times for given latitude,longitude and dates? If not, I'll appreciatte any pointers to C code I could use/port. Thanks, Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Regression model type II
Hi Benjamin, Maybe this link is useful to you: http://eeb37.biosci.arizona.edu/~brian/splus.html It has a function 'slope' that calculates different type II regressions and a link to a paper comparing them. Although it was written for S-plus it works in R too. If you get any better solutions, let me know. Best regards, Angel Benjamin PLANQUE wrote: I am trying to fit regression models type II with R, but it seems to me that most (all) of the linear model functions are for type I regressions. Does anyone knows whether type II regressions functions exist in R. Benjamin __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Bivariate interpolation
library(fields) ?interp.surface Best, Angel Miha STAUT wrote: Hello, Is there any other bivariate pointwise interpolation command besides akima's interpp? I tried to search through the J. Baron's page without luck. The problem is that I have got regularly spaced data (in x and y) what is not acceptable for interpp. I am not very much interested in the method of interpolation as the data are dense and the error would not be to high. Thanks in advance, Miha __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html . __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] axis labels disappear
When I do a plot, e.g. plot(1:10) and resize the window so that the x-axis becomes too small to hold all the x-axis labels, R automatically makes some of the labels disappear so that the remaining fit in the available space. I would like to be able to tell R which labels should not be removed. I've tried plotting the axis with axis() but this behaviour is still there. plot(1:10,xaxt="n") axis(side=1,at=1:10,labels=c("1","","","","5","","","","","10")) In my case when I resize the window first the "10" disappears and the the "5". Also if I start the graph with a 'small' window (e.g. X11(width=3,height=3) I do not get the "10". Is there a way to force that these labels are not removed automatically? I've searched the documentation but couldn't find any reference, Could anyone point me to the right documentation for this feature? Thanks Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Lyapunov exponent?
Philippe, I think, it was discussed last month on the list: http://tolstoy.newcastle.edu.au/R/help/04/03/0318.html In summary: From: Stephen Ellner ([EMAIL PROTECTED]) Date: Sat 06 Mar 2004 - 01:57:09 EST The lyapunov exponent part of Funfits is semi-available, but only for Windows. Doug Nychka and I, who wrote that part of Funfits, started trying to make it a CRANworthy package but never got it done. I've just linked it to my web page (www.eeb.cornell.edu/Ellner); follow the Software link on that page and get LENNS.zip. Steve Angel Lopez wrote: >"Frozen" package Funfits was able to. Although its succesor package is >Fields, it has not lyapunov exponent calculations. >You can get funfits from : >http://www.cgd.ucar.edu/stats/Software/Funfits/index.shtml >I haven't got the statistical or programming knowledge to revise that >code, if you are able to I would be keen to know of any updates. >Cheers, > Best, Angel Philippe Grosjean wrote: Hello, Does anybody know if there is somewhere in R a function to calculate the Lyapunov exponent in a time series? Thanks, Philippe Grosjean ...<°}))>< ) ) ) ) ) ( ( ( ( ( Prof. Philippe Grosjean \ ___ ) \/ECO\ ( Numerical Ecology of Aquatic Systems /\___/ ) Mons-Hainaut University, Pentagone / ___ /( 8, Av. du Champ de Mars, 7000 Mons, Belgium /NUM\/ ) \___/\ ( phone: + 32.65.37.34.97, fax: + 32.65.37.33.12 \ ) email: [EMAIL PROTECTED] ) ) ) ) ) SciViews project coordinator (http://www.sciviews.org) ( ( ( ( ( ... __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html . __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] experimental design
Hi R users: Anyone knows like to obtain software for experimental design? I need to get Aliasing structure like SAS does. Anything for windows. Thanks in advance. My e-mail is [EMAIL PROTECTED] _ ¿Vas a comprar algo a través de Internet? Ordénalo por el mejor precio en MSN Compras. http://www.msn.es/compras/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] about lme
Dear R users: I've a problem with lme function, when I want to model an unbalanced two-way anova, with 2 random factors say t and b. My two models are: model1- y(ijk) = beta+b(i)+t(j)+epsilon(ijk) model2- y(ijk)= beta+b(i)+t(j)+b:t(ij)+epsilon(ijk) beta overall mean effect The data.frame is X t b med celda 1 110 1 1 112 1 1 111 1 1 213 2 1 215 2 1 321 3 1 319 3 2 116 4 2 118 4 2 213 5 2 219 5 2 214 5 2 311 6 2 313 6 I try with lme to obtain the variance estimates like with varcomp, for model1 model-2, sum and interaction effects. varcomp gives me: variance estimates: t 0 b0 t:b 7.407 residuals3.8429 I try with lme: x <- lme(med~ 1, data = X;random = ~ 1 | t+b or random = ~t+b | celda random = ~t*b | celda random = ~ 1 | t*b , method = "ML") I get "bad groupping" or "singular convergence". Please, Can anyone tell me how to model, model-1 and model-2 in lme. Do you know any library for S-PLUS, R in order to get like in SPSS expected mean squares if no library, how obtain in S-PLUS, R? My e-mail is [EMAIL PROTECTED] _ Protege tu correo del spam y los virus con MSN 8. Prueba gratis dos meses MSN 8. http://join.msn.com/?pgmarket=es-es&XAPID=199&DI=1055 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Update R Import/Export Manual? was: [R] A package to read and write NetCDF?
Maybe this package and the one I mentioned (ncdf) should be in the manual "R Data Import/Export" that now says: --- Binary data formats Packages hdf5 and netCDF on CRAN provide experimental interfaces to NASA's HDF5 (Hierarchical Data Format, see http://hdf.ncsa.uiuc.edu/HDF5/) and to UCAR's netCDF data files (network Common Data Form, see http://www.unidata.ucar.edu/packages/netcdf/), respectively. Both of these are systems to store scientific data in array-oriented ways, including descriptions, labels, formats, units, HDF5 also allows groups of arrays, and the R interface maps lists to HDF5 groups, and can write numeric and character vectors and matrices. The R interface can only read netCDF, not write it (yet). --- Well, the yet seems no longer valid, package ncdf (and apparently clim.pact also) are able to write netCDF. cheers, Angel Stephan Matthiesen wrote: Hi, Am Dienstag, 6. April 2004 02:35 schrieb Shin, Daehyok: I am looking for a package to read and write NetCDF files. NetCDF package says it can only read, not write. Another package for the standard binary file format? The package clim.pact has the functions r2cdf and retrieve.nc I haven't tried them, but the documentation says they are for NetCDF writing and reading. Hope that helps... Stephan __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html . __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] k nearest neighbours
I want to 1) Select for each of the n points in a matrix A, those of the m points in B that lay within a given radius. 2) Of those points within the radius, select the k nearest ones. What I now do is 1) Create an n*m matrix C were I put the distances from all the points in B to the points in A and make NA those cells were the distance is larger than the radius. (The points are geographical locations so I use function rdist.earth in package fields) e.g.: library(fields) data(ozone) A<-cbind(ozone$lon.lat[1:10,]) B<-cbind(ozone$lon.lat+2) C<-rdist.earth(A,B) radius<-180 # The search radius C[which(C>radius)]<-NA 2) Then I make NA everything but the k nearest ones k<-5 # The nearest neighbours rank<-function(rank){rank<-sort.list(sort.list(rank,))}; C[which(apply(C,2,rank)>k)]<-NA; My problem is that the code is quite slow and due to the need to create a n*m matrix I run out of memory many times. I would also prefer to get a C matrix that is n*k instead of n*m were each of the values in C indicated the row in B were the corresponding knearest point would be. But I can not find a way to solve my main problem which is the need to create a n*m matrix. Thanks for any clues, Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] A package to read and write NetCDF?
ncdf: Interface to Unidata netCDF data files This package provides a high-level R interface to Unidata's netCDF data files, which are portable across platforms and include metadata information in addition to the data sets. Using this package netCDF files can be opened and data sets read in easily. It is also easy to create new netCDF dimensions, variables, and files, or manipulate existing netCDF files. This interface provides considerably more functionality than the "netCDF" package. It is not compatible with the "netCDF" package. Shin, Daehyok wrote: I am looking for a package to read and write NetCDF files. NetCDF package says it can only read, not write. Another package for the standard binary file format? Daehyok Shin __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html . __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] multiple plots problem
Depends on what you understand by _explicitly_ specify screen number: par(bg = "white") # default is likely to be transparent screenlist<-split.screen(c(3,1))# split display into three i<-screenlist[1] # Create a function to simulate the "tabbing" nextplot<-function(i) { i<-i+1 if (i>screenlist[length(screenlist)]) i<-screenlist[1] screen(i) erase.screen(i) return(i) } plot(1:10) i<-nextplot(i) plot(2:20) i<-nextplot(i) plot(3:30) i<-nextplot(i) plot(sin(40:400)) i<-nextplot(i) plot(sin(4:40)) ## Continue your plots close.screen(all = TRUE) Oleg Bartunov wrote: interesting, it works, but still need to explicitly specify screen number. It'b be nice to have tabbed canvas, but I suspect it's wrong list. Oleg On Thu, 1 Apr 2004, Angel Lopez wrote: Have you considered using ?split.screen and ?erase.screen with a non-transparent background instead of layout. Example: par(bg = "white") # default is likely to be transparent split.screen(c(3,1))# split display into three screens screen(1) plot(1:10) screen(2) plot(2:20) screen(3) plot(3:30) screen(1) erase.screen() plot(sin(40:400)) Angel Oleg Bartunov wrote: On Thu, 1 Apr 2004, Duncan Murdoch wrote: On Thu, 1 Apr 2004 15:38:54 +0400 (MSD), Oleg Bartunov <[EMAIL PROTECTED]> wrote : Hello, for testing & learning purposes I create X11 device and specify layout like layout(c(1,2,3), 3, 1), so I could play with parameters and see several plots at the same time. That works fine until I try to create 4-th plot - all other plots erased. Such behaviour isn't desirable for testing purposes and I'm asking where to look to disable erasing other plots. In Windows you can record all plots by using the record=TRUE option when you open the graphics display, or from the menu on the display window. You cycle back through the history by hitting the PgUp key. You're using X11, so you might need to save your plots explicitly using recordPlot() and then use replayPlot() to see it again (but your front-end might provide access to them more easily, the way Windows does). Thanks, looks like too much work :( I just don't understand a logic why I can't recycle canvas. Duncan Murdoch Regards, Oleg _ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html . Regards, Oleg _ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html . __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] multiple plots problem
Have you considered using ?split.screen and ?erase.screen with a non-transparent background instead of layout. Example: par(bg = "white") # default is likely to be transparent split.screen(c(3,1))# split display into three screens screen(1) plot(1:10) screen(2) plot(2:20) screen(3) plot(3:30) screen(1) erase.screen() plot(sin(40:400)) Angel Oleg Bartunov wrote: On Thu, 1 Apr 2004, Duncan Murdoch wrote: On Thu, 1 Apr 2004 15:38:54 +0400 (MSD), Oleg Bartunov <[EMAIL PROTECTED]> wrote : Hello, for testing & learning purposes I create X11 device and specify layout like layout(c(1,2,3), 3, 1), so I could play with parameters and see several plots at the same time. That works fine until I try to create 4-th plot - all other plots erased. Such behaviour isn't desirable for testing purposes and I'm asking where to look to disable erasing other plots. In Windows you can record all plots by using the record=TRUE option when you open the graphics display, or from the menu on the display window. You cycle back through the history by hitting the PgUp key. You're using X11, so you might need to save your plots explicitly using recordPlot() and then use replayPlot() to see it again (but your front-end might provide access to them more easily, the way Windows does). Thanks, looks like too much work :( I just don't understand a logic why I can't recycle canvas. Duncan Murdoch Regards, Oleg _ Oleg Bartunov, sci.researcher, hostmaster of AstroNet, Sternberg Astronomical Institute, Moscow University (Russia) Internet: [EMAIL PROTECTED], http://www.sai.msu.su/~megera/ phone: +007(095)939-16-83, +007(095)939-23-83 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html . __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] about fact.design
Hi R-users: Can I get the S-function fact.desig for experimentl design for like S-PLUS In general , Is there software for R in windows about experimental design , say, experimental design , ssType3 , combinatory, orthogonal design...and for sampling in finite population, Horwitz-Thompson sampling pps. Thanks in advance. _ ¿Todavía no conoces el nuevo MSN Messenger? Descárgatelo gratis aquí. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] about fact.design
Hi R users: In R for windows. is there any package to work, in experimental design? With functions like in S-PLUS , fact.design and the other ones. How to implement in R, all theory about experimental design, I'm talking about ssType3, fact.design and the theory of orthogonal design, combinatory.. Thanks in advance and please excuse me, my "european english". My e-mail is [EMAIL PROTECTED] _ Encuentra a tu media naranja entre los perfiles que más te gusten. Toda la magia del romance en MSN Amor & Amistad. http://match.msn.es/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] date conversions in pastecs
In function daystoyears in package pastecs, I get this (wrong?) result with 1995: > daystoyears(1,datemin="1/1/1997",dateformat="m/d/Y") 1997.001 > daystoyears(1,datemin="1/1/1995",dateformat="m/d/Y") 1994.999 Any insights? Thanks Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] reading short int and float from binary connection
Thanks for the advise. I think I've found the solution, the problem was that the file had been written from a C program using a structure containing floats and int, if I rewrite the C code not using a structure but independent floats and ints the data then is read smoothly into R. I still can't figure out why a structure is different or how should I have read it into R but it is probably more a C than an R question . Thanks, Angel Uwe Ligges wrote: Angel Lopez wrote: Hi, I have a binary file with mixture of short integers (2 bytes) and floats (4 bytes). To get the data into R I use readBin reading each value one at a time (n=1) but it is giving me headaches, two questions: -In the "what" option is there any difference between "integer" and "int"? -To read the short int I use what="int" and size=2 and to read the floats I use what="double" and size=4, the strange thing is that sometimes it works but other times it reads wrong values. Any clues where my mistake might be? Thanks Angel Are the inetgers signed or not? You might want to set signed = FALSE for unsigned integers. Are you sure you are reading each time from the beginning of the connection? Are you really sure about the file format specifications? Difficult to track down without your code, the file format's specification, and an example file.. Uwe Ligges . __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] reading short int and float from binary connection
Hi, I have a binary file with mixture of short integers (2 bytes) and floats (4 bytes). To get the data into R I use readBin reading each value one at a time (n=1) but it is giving me headaches, two questions: -In the "what" option is there any difference between "integer" and "int"? -To read the short int I use what="int" and size=2 and to read the floats I use what="double" and size=4, the strange thing is that sometimes it works but other times it reads wrong values. Any clues where my mistake might be? Thanks Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] reading binary file with different modes
I have a binary file representing a matrix with columns of different variable type/mode (i.e. the file was saved from C using double and int variables) I want to import it into R, I've been reading the R Import/Export and I am able to use readBin for a file that contains only one variable type (either all doubles or all ints) but I can not find the way to use it when you have a file with mixture of the two. Could somebody point me to a solution or appropiatte reference? Thanks, Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] avoid step appearance in plot lines
How can I improve the aspect of the lines in a line plot? I want to avoid that between two points the line joining them is breaked into "steps". For example: plot(1:100,sin(1:100)) lines(1:100,sin(1:100),type='l',lwd=2) I get that the line joining two points is made up of vertical segments, what I basically want is that there are more segments between two points so I get the aspect of a true line. Thanks, Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] asking for information
Hola, Yes you can call R from C and viceversa, you should read the manual "Writing R extensions": available in the section "manuals" from the r-project website http://cran.r-project.org/doc/manuals/R-exts.pdf Suerte, Angel Miguel Ángel Gómez-Nieto wrote: Dear Sir: I am interesting in to use some R functions in some of our developments. But I have a problem which I have not found information in R documentation, for that I ask for help. Can I to call R functions from a C (or another language) program ?. ANd if the answer if yes, could you help me informe me where I can found information to respect? I will be very thanks to you, if you could help me Thanks a lot Best Regards - Miguel Ángel Gómez-Nieto University of Córdoba Dept. Computing and Numerical Analysis Software and Knowledge Engineering and Database Researh Group Campus Universitario de Rabanales Building C2, Plant 3. E-14071 Córdoba (Spain) Phone: +34-957-212082 Fax: +34-957-218630 [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html . __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Lyapunov exponent code for time series
"Frozen" package Funfits was able to. Although its succesor package is Fields, it has not lyapunov exponent calculations. You can get funfits from : http://www.cgd.ucar.edu/stats/Software/Funfits/index.shtml I haven't got the statistical or programming knowledge to revise that code, if you are able to I would be keen to know of any updates. Cheers, Angel Uwe Ligges wrote: Xiaozhe (Catherine) Wang wrote: Dear all, Has anyone worked on coding for calculating Lyapunov Exponent for a time series data? or any package is available for computing Lyapunov? Please advice and many thanks in advance. Catherine X Wang I don't think there is code available. You might want to "google" for "TISEAN" and/or contribute the desired code yourself ... Uwe Ligges __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www..R-project.org/posting-guide.html . __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] k nearest neighbours between two matrix
I have two dataframes A and B consisting of latitude longitude coordinates of points. For each point in A I want to find the k-nearest neighbours in B. Currently, I calculate the distance from each point in A to all the points in B (using rdist.earth() in fields package), sort the points of B by distance and select the k nearest ones. Is there a more efficient way to do this? Function knearneigh {spdep} (using knn() of VR) does something similar but for a matrix with itself and not with another matrix. Is there a function that already does what I want and I could not find? Thanks Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Debugging R Code
If you plan using Mark Bravingtons's debug package within emacs via ess you should read this: https://www.stat.math.ethz.ch/pipermail/ess-help/2004-February/001708.html were Mark suggested that in emacs you should set options( debug.command.recall=FALSE)' before running the debugger. Cheers, Angel - Original Message - From: "Tobias Sing" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 12, 2004 12:08 PM Subject: [R] Debugging R Code > Hi all, > > is there a more convenient way to debug R code than the built in debug() > function? (so that one can set breakpoints, step in and out of function > calls,...). I read the section on debugging compiled code in the manual > "Writing R Extensions" (I only want to debug ordinary code but thought that > maybe the advice there could help), but didn't find out how I can start > debugging my code after typing "R -d gdb", which brought me to the gdb prompt > (I'm using R 1.6.2 in xemacs via ESS). > > Thanks, > Tobias > > > __ > Tobias Sing > > Computational Biology Group > Max-Planck-Institut für Informatik > Stuhlsatzenhausweg 85 > 66123 Saarbrücken, Germany > > Phone: +49 681 9325 314 > Fax: +49 681 9325 399 > E-mail: [EMAIL PROTECTED] > WWW: http://www.mpi-sb.mpg.de/units/ag3/ > > __ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html > __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] png support on R debian sid 1.8.1 binary
I have updated my R to the current R version (1.8.1) using apt-get of the R binaries for debian sid in cran. Now, when I do: png(file="myplot.png") I get: Error in X11(paste("png::", filename, sep = ""), width, height, pointsize, : unable to start device PNG In addition: Warning message: No png support in this version of R what do I have to do to get the png support? Thanks, Angel _ Express yourself with cool new emoticons http://www.msn.co.uk/specials/myemo __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] symbolic and algebraic computation
I needed a symbolic and algebraic computation software. The best solution I've found so far is maxima computer algebra system. I was wondering if there is any R package that has similar features as maxima's or somebody could point me to reference manuals on how to use R for this purpose. Thanks, Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] (no subject)
Hola, he visto que no has tenido mucho exito con tu consulta. Esta ayuda es principalmente en ingles, esta puede ser una de las razones. Otras es que has sido muy poco conciso/a con tu pregunta. De que tienes dudas exactamente, has leido la documentacion del paquete y de R. Si lo has hecho, pon un ejemplo con tu problema o duda. Y, repito, preferentemente en ingles. Angel - Original Message - From: "ruddi rodriguez" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, December 11, 2003 7:14 PM Subject: [R] (no subject) Hola Hace poco comence a utilizar R y tengo dudas como utilizar el paquete de tree saludos ruddi - Yahoo! Sorteos ¡Ya puedes comprar Lotería de Navidad! [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Error with spdep
spdep depends on package 'maptools', install it. - Original Message - From: "Perez Martin, Agustin" <[EMAIL PROTECTED]> To: "lista R help (E-mail)" <[EMAIL PROTECTED]> Sent: Monday, December 15, 2003 1:17 PM Subject: [R] Error with spdep > Dear useRs: > > First of all I would like to thank all the responses. > I've an error with package "spdep". > > I am working with a Windows XP machine (AMD-2000-XP RAM-256DDR) and 1.8.0. > R-version and when I try to load spdep appear the following error: > > > library(spdep) > Error in loadNamespace(i, c(lib.loc, .libPaths()), keep.source) : > There is no package called 'maptools' > Error in library(spdep) : package/namespace load failed > > I don't know what is this. > Can you help me? > > Best wishes, > Agustin > > __ > [EMAIL PROTECTED] mailing list > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] best editor for .R files
Which is the best editor for .R files? I currently use kate on my linux as it has R highlighting and allows me to split the window into two: in one I edit the .R file and in the other I have a shell so I run R and can easily copy and paste the code. There are some features that I don't like and I am having a look on some alternatives. I've heard wonders of emacs with ess but I am a little bit frightened of the steep learning curve. What do the R experts use or would recommend using? Both linux and/or windows alternatives are welcomed. I guess it would much depend on the particular needs/preferences of each user but I would like to know which are the most commonly used editors. Thanks, Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] ?for
Windows 98 with R 1.7.1: ? paste("help") opens help for help in my machine. In my linux debian with R 1.8.1 beta it opens the help for paste. I am even more puzzled now!, is this system dependent or R-version dependent? - Original Message - From: "Ray Brownrigg" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, November 21, 2003 3:42 AM Subject: Re: [R] ?for > > I thought I was getting to grips with it, until last reply from Prof Brian > > Ripley's. At least in my Windows and Linux boxes > > Actually it was my reply that suggested ?paste("help") > > > ? paste("help") > > opens the help for help (!?) > > Not on my systems! [Solaris, NetBSD, Windows 98]. I believe it should > open the help for paste(). > > The point is that it requires a syntactically correct statement after > the ? so that the command parses correctly (with ? as a unary > operator), but the result is to provide the help for the first > syntactic element of the parsed expression, *without* evaluating the expression. > > Ray Brownrigg > __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] ?for
I thought I was getting to grips with it, until last reply from Prof Brian Ripley's. At least in my Windows and Linux boxes ? paste("help") opens the help for help (!?) (But Marc is right, when you use emacs (in my Debian) instead of the shell it gives the error he says, anybody knows why?) For what I think I've learned, when you call ? it first evaluates the topic and then asks for help on the result, i.e. if you put a function after ? it will call help on the return value of that function, if it is a for or other type of flow control it will ask for help for each of the loop results. Is this the explicit reply to my original answer?? Thanks, Angel - Original Message - From: "Marc Schwartz" <[EMAIL PROTECTED]> To: "Prof Brian Ripley" <[EMAIL PROTECTED]> Cc: "Ray Brownrigg" <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]>; <[EMAIL PROTECTED]> Sent: Monday, November 17, 2003 9:58 PM Subject: Re: [R] ?for > On Mon, 2003-11-17 at 14:27, Prof Brian Ripley wrote: > > Well ^C or ESC (on Windows GUI) is the answer I would give. > > > > On Tue, 18 Nov 2003, Ray Brownrigg wrote: > > > > > Peter Dalgaard <[EMAIL PROTECTED]> writes: > > > > > > > > Prof Brian Ripley <[EMAIL PROTECTED]> writes: > > > > > > > > > You have typed a syntactically incomplete statement: this is explained in > > > > > ?help. > > > > > > > > > > Hint: ?"for" and help("for") work. > > > > > > > > [Original question added back in: > > > > On Sun, 16 Nov 2003, Angel wrote: > > > > > > > > > I have always been intrigued by why ?for (or ?if,?while,etc) leave R > > > > > wanting for more: > > > > > > ?for > > > > > + > > > > > I know the help for these is in ?Control, but I sometimes make the > > > > > mistake of typing ?for instead. What is R expecting me to say to finish > > > > > the statement? > > > > ] > > > > Further hint: ? is an operator, syntactically similar to + and -. You > > > > can apply operators to the result of a for loop. Consider for example > > > > > > > > x <- 1; - for (i in 1:10) x <- x * i > > > > > > > > (? has special semantics, but that is not noticed at parse time). > > > > > > > Unfortunately the original question still hasn't been answered > > > explicitly, not even in ?help. > > > Try: > > > > ?for > > > + (i in 0) 0 > > > or: > > > > ?if > > > + (T) T > > > or: > > > > ?+ > > > + 0 > > > > > > So you have to provide the rest of a syntactically complete statement. > > > > > > Just to see if you now understand exactly how ? works, what do you > > > think: > > > ? paste("help") > > > will do? > > > > > > Ray Brownrigg > > > R 1.8.1 Beta using gnome-terminal on Fedora Core 1 gives: > > > ? paste("help") > help() for paste is shown in browser /usr/bin/mozilla ... > Use help( paste , htmlhelp=FALSE) > or options(htmlhelp = FALSE) > to revert. > > > However, using ESS with emacs on the same platform gives: > > > ? paste("help") > > Error in help("paste(", htmlhelp = FALSE) : > No documentation for 'paste(' in specified packages and libraries: > you could try 'help.search("paste(")' > > > :-) > > Marc > > > > __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] ?for
I have always been intrigued by why ?for (or ?if,?while,etc) leave R wanting for more: > ?for + I know the help for these is in ?Control, but I sometimes make the mistake of typing ?for instead. What is R expecting me to say to finish the statement? Thanks, Angel [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] setting xlim and ylim with asp=1
Thanks for the advise. Sorry, I should have explained better. As you say xlim and ylim have an effect. But when they do not match the width and height of the plot region , one of them is modified in order to make the plot fill the whole plot region with the aspect ratio given. I would have expected that because I give asp, xlim and ylim, then the plot region would be automatically modified. After reading An Introduction to R, I would have expected R to automatically do something like: xlim<-c(-1,1) ylim<-c(-1,2) xyratio=abs((xlim[1]-xlim[2])/(ylim[1]-ylim[2])) width<-par("pin")[1] height<-par("pin")[2] if (height>width/xyratio) height=width/xyratio else if(height To: "Angel" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Monday, August 25, 2003 1:31 PM Subject: Re: [R] setting xlim and ylim with asp=1 > On Mon, 25 Aug 2003, Angel wrote: > > > In plot(), when using option asp=1 the xlim and ylim have no effect because > > they are changed > > changed in order to fill the whole plot region. > > Not true: try xlim=c(-2,2) in your example. > > > Is there a way to > > automatically set > > xlim and ylim when asp has been set to 1? > > For example: > > #This is a box of the plot ranges I want: > > boxxy=rbind(c(-1,2),c(-1,-1),c(1,-1),c(1,2),c(-1,2)) > > #Without asp=1 I get what I want (i.e. I can't see the box because it > > #overlays with the axis > > plot(boxxy,type="l",xaxs="i",yaxs="i",xlim=c(-1,1), ylim=c(-1,2)) > > # When I add asp=1 I can see the box > > plot(boxxy,type="l",xaxs="i",yaxs="i",xlim=c(-1,1), ylim=c(-1,2),asp=1) > > And you must be able to, since the plot region is not in ratio 2:3 on any > standard graphics device. > > R is doing sensible things, and you have not told us what you want, just > made a false assertion. Perhaps you could try to explain what it is you > actually want to do? > > You cannot set the aspect ratio, the plot region and xlim and ylim > simultaneously: once you have three the fourth is (partially) determined. > I suspect you intended to set the plot region ... see An Introduction to > R. > > -- > 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 > > __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] setting xlim and ylim with asp=1
In plot(), when using option asp=1 the xlim and ylim have no effect because they are changed changed in order to fill the whole plot region. Is there a way to automatically set xlim and ylim when asp has been set to 1? For example: #This is a box of the plot ranges I want: boxxy=rbind(c(-1,2),c(-1,-1),c(1,-1),c(1,2),c(-1,2)) #Without asp=1 I get what I want (i.e. I can't see the box because it #overlays with the axis plot(boxxy,type="l",xaxs="i",yaxs="i",xlim=c(-1,1), ylim=c(-1,2)) # When I add asp=1 I can see the box plot(boxxy,type="l",xaxs="i",yaxs="i",xlim=c(-1,1), ylim=c(-1,2),asp=1) Thanks for any help, Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] apply and sort vs vectorized order
Dear all, Trying to solve a problem I had (see thread "putting NAs at the end" ) I've noticed a difference in system time requirements between using apply and sort (or order) to order each row or column of a matrix compared to a vectorized function I wrote. Using apply is much faster when the number of loops (number of rows or columns to order) is low BUT much slower when number of loops are high and the other dimension short. Here is my function: order.rc<-function(A,row.column=1,na.last = TRUE, decreasing = FALSE,return.sort=TRUE) { # removes negative values scaling A so min(A)=0 A.order<-A+abs(min(A,na.rm=TRUE)) # rescales A so max(A)=0.1 A.order<-A.order/(max(A.order,na.rm=TRUE)*10) # makes NAs=0 (na.last=FALSE) or NAs=0.9 (na.last=TRUE) # NOTE: if decreasing is TRUE NAs are the inverse of above if ((na.last & !decreasing) | (!na.last & decreasing)) A.order[which(is.na(A.order))]<-0.9 else A.order[which(is.na(A.order))]<-0 # if ordering each row the integer part of A is the column index (row.column=1) # else, we are ordering each column so the integer part of A is the column index if (row.column==1) A.order<-A.order+rep(1:nrow(A),ncol(A)) else A.order<-A.order+rep(1:ncol(A),each=nrow(A)) # returns either a matrix with sorted values or the ordering indexes if (return.sort) { A.order<-A[order(A.order,decreasing=decreasing)] if (row.column==1) { dim(A.order)<-dim(t(A)) A.order<-t(A.order) } else dim(A.order)<-dim(A) return(A.order) } else return(order(A.order,decreasing=decreasing)) } # Some system time comparisons # CHANGE Nrandom ACORDING TO YOUR SYSTEM Nrandom=1000 A<-matrix(rnorm(Nrandom*Nrandom),nrow=Nrandom,ncol=Nrandom) A[rbind(c(100,3),c(90,9),c(40,6))]<-NA system.time({A.r<-order.rc(A)}) system.time(A.s1<-apply(A,1,sort)) system.time({A.c<-order.rc(A,row.column=2)}) system.time(A.s2<-apply(A,2,sort)) A<-matrix(rnorm(Nrandom*Nrandom),nrow=Nrandom*Nrandom/10,ncol=10) A[rbind(c(100,3),c(90,9),c(40,6))]<-NA system.time({A.r<-order.rc(A)}) system.time(A.s1<-apply(A,1,order)) system.time({A.c<-order.rc(A,row.column=2)}) system.time(A.s2<-apply(A,2,order)) I think only the third apply is slower than the function because number of "loops" is too high and my function is faster despite the long vector to order. Thanks for any clarifications on how all this works, Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] putting NAs at the end
Thanks to Gabor and others I've found the solution to my problem, but there are some issues with order, sort and apply that I post in another thread. Here are two solutions to my problem: # Example matrix: A<-matrix(rnorm(1*12),nrow=1,ncol=12) A[rbind(c(100,3),c(90,9),c(40,6))]<-NA # Solution given by GaborGrothendieck system.time({A.a<-t(apply(A,1,function(x){x<-matrix(x,nr=3);x[,order(colSums (is.na(x))>0)]}))}) # A function I wrote with various suggestions (Petr Pikal, Duncan Murdoch, Ted Harding) Put.NaN.last<-function(A) { # First creates a matrix where the points with NA z have also NA # x and y A.o<-A A.o[,1:3]<-A.o[,1:3]*A[,3]/A[,3] A.o[,4:6]<-A.o[,4:6]*A[,6]/A[,6] A.o[,7:9]<-A.o[,7:9]*A[,9]/A[,9] A.o[,10:12]<-A.o[,10:12]*A[,12]/A[,12] # Transposes both matrix as I want to order each row (by column) and R is # by default "column-major order" A<-t(A) A.o<-t(A.o) # Now makes another matrix Ind with same dim as A but # where the integer part of each element indicates the row (original A columns) # and the second decimal indicates the column (original A row, i.e A is now transposed) serie<-rep(1:4,each=3)/10 serie<-rep(serie,ncol(A)) Ind<-rep(1:ncol(A),each=nrow(A)) Ind<-Ind+serie # Adds 0.5 to the elements where A.o is NA so they will be larger # than any in the row Ind[which(is.na(A.o))]<-Ind[which(is.na(A.o))]+0.5 # Finally order A according to the Ind # this avoids having to use apply A.o[,]<-A[order(Ind)] A.o<-t(A.o) A<-t(A) return(A.o) } system.time({A.put<-Put.NaN.last(A)}) # As you see calling with my function is much faster than the apply # I've decided to post another thread to try to understand what is going on here # Thanks to all that helped # Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] understanding time series objects
### First, is there a way to access a univariate time series as a matrix instead of a vector? # For example: data(UKLungDeaths) # If I do apply(mdeaths,1,cumsum) # Gives an error as mdeaths is not a matrix but a vector, although when I look at it : mdeaths # the ts object has a matrix like "appearance" # The only way of doing it I've found is: mdeaths2<-as.matrix(mdeaths) dim(mdeaths2)<-c(12,6) mdeaths2<-apply(mdeaths2,2,cumsum) mdeaths[]<-mdeaths2 # It is not very efficient to solve the problem of applying a cummulative sum to each year ### Second, for a multivariate ts: data(UKLungDeaths) Multits<-ts.union(mdeaths, fdeaths) # Why does Multits$mdeaths # not work and I have to use: Multits[,"mdeaths"] # Is it the way it works or am I missing something? # Thanks as always, # Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] putting NAs at the end
I'm afraid that's not what I wanted. Let's see if taking your example data I can explain better. Starting from: > [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] > [1,] 11.1 11.2 11.3 12.1 12.2 12.3 13.1 13.2 13.3 14.1 14.2 14.3 > [2,] 21.1 21.2 NA 22.1 22.2 22.3 23.1 23.2 NA 24.1 24.2 24.3 > [3,] 31.1 31.2 31.3 32.1 32.2 32.3 33.1 33.2 33.3 34.1 34.2 34.3 > [4,] 41.1 41.2 41.3 42.1 42.2 42.3 43.1 43.2 43.3 44.1 44.2 44.3 > [5,] 51.1 51.2 51.3 52.1 52.2 NA 53.1 53.2 53.3 54.1 54.2NA > [6,] 61.1 61.2 61.3 62.1 62.2 62.3 63.1 63.2 63.3 64.1 64.2 64.3 I want to arrive to: > [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] > [1,] 11.1 11.2 11.3 12.1 12.2 12.3 13.1 13.2 13.3 14.1 14.2 14.3 > [2,] 22.1 22.2 22.3 24.1 24.2 24.3 21.1 21.2 NA 23.1 23.2 NA > [3,] 31.1 31.2 31.3 32.1 32.2 32.3 33.1 33.2 33.3 34.1 34.2 34.3 > [4,] 41.1 41.2 41.3 42.1 42.2 42.3 43.1 43.2 43.3 44.1 44.2 44.3 > [5,] 51.1 51.2 51.3 53.1 53.2 53.3 52.1 52.2 NA 54.1 54.2NA > [6,] 61.1 61.2 61.3 62.1 62.2 62.3 63.1 63.2 63.3 64.1 64.2 64.3 That is, for the second row the elements in columns 1:3 and 7:9 have moved to the columns 7:9 and 10:12 and the rest of elements that were in 4:6 and 10:12 have moved to columns 1:3 and 4:6 respectively. For row 5 the elements in columns 4:6 have moved to 7:9 and elements in 10:12 have "moved" to 10:12 and the elements in columns 7:9 take the columsn 4:6 For the rest of rows all the elements remain in the same position. This is what my (slow) function does in a very rudimentary form: [original post added]: I have a matrix for which each row has 12 elements that represent the xyz coordinates of 4 points. So each row of M is (x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4). Some points have NA as z values. I want another matrix to be the same as M but with the coordinates of those points with z=NA placed last. For ezample if z1=NA then the new matrix row should be (x2,y2,z2,x3,y3,z3,x4,y4,z4,x1,y1,z1) I've tried writing a function that does the job for each row and then apply to the matrix Put.NaN.last<-function(p) { Index<-c(which(!is.na(p[c(3,6,9,12)]))*3,which(is.na(p[c(3,6,9,12)]))*3) p<-c(p[Index[1]-2],p[Index[1]-1],p[Index[1]], p[Index[2]-2],p[Index[2]-1],p[Index[2]], p[Index[3]-2],p[Index[3]-1],p[Index[3]], p[Index[4]-2],p[Index[4]-1],p[Index[4]]) return(p) } A<-matrix(1:36,ncol=12) A[c(7,9,17,36)]<-NA A<-t(apply(A,1,Put.NaN.last)) but it is awfully slow. Any suggestions on how to do this faster? Thanks Angel Hope it is clearer now. Thanks, Angel - Original Message - From: "Ted Harding" <[EMAIL PROTECTED]> To: "Angel" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Thursday, August 14, 2003 11:20 AM Subject: Re: [R] putting NAs at the end > Hi Angel, > On 14-Aug-03 Angel wrote: > > Yes, I have. I am sorry if I am missing some very basic stuff, but both > > order and sort will not only put the NAs at the end (with na.last=TRUE) > > BUT also sort in ascending or descending order the rest of the > > elements and that is not what I want. And with order I would only get > > the z NAs at the end and not also the associated x and y coordinates. > > This may not be the best way to do it, but it works and, I think, does > what you want (and, in particular, preserves the original row order > within the NA and non-NA blocks): > > Setup: First, a matrix x: > > x > [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] > [1,] 11.1 11.2 11.3 12.1 12.2 12.3 13.1 13.2 13.3 14.1 14.2 14.3 > [2,] 21.1 21.2 21.3 22.1 22.2 22.3 23.1 23.2 23.3 24.1 24.2 24.3 > [3,] 31.1 31.2 31.3 32.1 32.2 32.3 33.1 33.2 33.3 34.1 34.2 34.3 > [4,] 41.1 41.2 41.3 42.1 42.2 42.3 43.1 43.2 43.3 44.1 44.2 44.3 > [5,] 51.1 51.2 51.3 52.1 52.2 52.3 53.1 53.2 53.3 54.1 54.2 54.3 > [6,] 61.1 61.2 61.3 62.1 62.2 62.3 63.1 63.2 63.3 64.1 64.2 64.3 > > Setup: Next, set some NAs: > > x1<-x;x1[2,3]<-NA;x1[2,9]<-NA;x1[5,6]<-NA;x1[5,12]<-NA;x1 > [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [,11] [,12] > [1,] 11.1 11.2 11.3 12.1 12.2 12.3 13.1 13.2 13.3 14.1 14.2 14.3 > [2,] 21.1 21.2 NA 22.1 22.2 22.3 23.1 23.2 NA 24.1 24.2 24.3 > [3,] 31.1 31.2 31.3 32.1 32.2 32.3 33.1 33.2 33.3 34.1 34.2 34.3 > [4,] 41.1 41.2 41.3 42.1 42.2 42.3 43.1 43.2 43.3 44.1 44.2 44.3 > [5,] 51.1 51.2 51.3 52.1 52.2 NA 53.1 53.2 53.3 54.1 54.2NA > [6,] 61.1 61.2 61.3 62.1 62.2 62.3 63.1 63.2 63.3 64.1 64.2 64.3 > > The work: Now you want rows 2 and 5 at the end (if I understand): > > icol<-c(3,6,9,12) > > iNA<-is.na(rowSums(x1[,icol])) > > x2<-x1[!iNA,] > > x3<-x1[iNA,] > > x4<-rbind(x2,x3);x4 >
Re: [R] putting NAs at the end
Yes, I have. I am sorry if I am missing some very basic stuff, but both order and sort will not only put the NAs at the end (with na.last=TRUE) BUT also sort in ascending or descending order the rest of the elements and that is not what I want. And with order I would only get the z NAs at the end and not also the associated x and y coordinates. Thanks for any further help. Angel - Original Message - From: "Spencer Graves" <[EMAIL PROTECTED]> To: "Angel" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Wednesday, August 13, 2003 3:41 PM Subject: Re: [R] putting NAs at the end > Have you considered "?order"? > > Spencer Graves > > Angel wrote: > > I have a matrix for which each row has 12 elements that represent the xyz coordinates of 4 points. > > So each row of M is (x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4). Some points have NA as z values. > > I want another matrix to be the same as M but with the coordinates of those points with z=NA placed last. > > For ezample if z1=NA then the new matrix row should be (x2,y2,z2,x3,y3,z3,x4,y4,z4,x1,y1,z1) > > I've tried writing a function that does the job for each row and then apply to the matrix > > > > Put.NaN.last<-function(p) { > > Index<-c(which(!is.na(p[c(3,6,9,12)]))*3,which(is.na(p[c(3,6,9,12)]))*3) > > p<-c(p[Index[1]-2],p[Index[1]-1],p[Index[1]], > > p[Index[2]-2],p[Index[2]-1],p[Index[2]], > > p[Index[3]-2],p[Index[3]-1],p[Index[3]], > > p[Index[4]-2],p[Index[4]-1],p[Index[4]]) > > return(p) > > } > > A<-matrix(1:36,ncol=12) > > A[c(7,9,17,36)]<-NA > > A<-t(apply(A,1,Put.NaN.last)) > > > > but it is awfully slow. > > Any suggestions on how to do this faster? > > Thanks > > Angel > > > > [[alternative HTML version deleted]] > > > > __ > > [EMAIL PROTECTED] mailing list > > https://www.stat.math.ethz.ch/mailman/listinfo/r-help > > > __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] putting NAs at the end
I have a matrix for which each row has 12 elements that represent the xyz coordinates of 4 points. So each row of M is (x1,y1,z1,x2,y2,z2,x3,y3,z3,x4,y4,z4). Some points have NA as z values. I want another matrix to be the same as M but with the coordinates of those points with z=NA placed last. For ezample if z1=NA then the new matrix row should be (x2,y2,z2,x3,y3,z3,x4,y4,z4,x1,y1,z1) I've tried writing a function that does the job for each row and then apply to the matrix Put.NaN.last<-function(p) { Index<-c(which(!is.na(p[c(3,6,9,12)]))*3,which(is.na(p[c(3,6,9,12)]))*3) p<-c(p[Index[1]-2],p[Index[1]-1],p[Index[1]], p[Index[2]-2],p[Index[2]-1],p[Index[2]], p[Index[3]-2],p[Index[3]-1],p[Index[3]], p[Index[4]-2],p[Index[4]-1],p[Index[4]]) return(p) } A<-matrix(1:36,ncol=12) A[c(7,9,17,36)]<-NA A<-t(apply(A,1,Put.NaN.last)) but it is awfully slow. Any suggestions on how to do this faster? Thanks Angel [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] shading in image()
The rgl package offers 3-D rendering (and Gouraud shading) capabilities through an OpenGL. I don't know why it is not in cran, I found it at: http://wsopuppenkiste.wiso.uni-goettingen.de/~dadler/rgl/ In any case that's not what I wanted (although I still have to explore in more depth this package). My question was (naive me!) more simple! I was just thinking of an interpolation function in R, maybe not very efficient but it'd do the job for me. Although the idea of linking blender is nice, it might be "too sophisticated" for simple things in 2-D. Thanks, Angel - Original Message - From: "Ross Ihaka" <[EMAIL PROTECTED]> To: "Barry Rowlingson" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]>; "Angel" <[EMAIL PROTECTED]> Sent: Monday, August 04, 2003 9:52 PM Subject: Re: [R] shading in image() > Barry Rowlingson wrote: > > Ross Ihaka wrote: > > > >> If anyone knows how to Gouraud, Phong or other smooth shading method > >> portably in a vector system I'd be keen to hear about it. > >> > > > > Why bloat R with something like that? All we need is a way of linking R > > with Blender and we have a fully-GPL statistics and 3-d rendering > > facility. Blender is scriptable in python, so you could read data files > > from Blender, or possibly one could write an R graphics device that > > produced Blender-compatible data files. Blender > > > > Eventually you'll be able to walk through your data in 3-d > > Its actually not that big, and it's useful for things other than 3d. > Interpolation could be used for things like gradient colour fills for > plot backgrunds or bars in barplots, drawing light spectra, etc. > > I've much about with some of this using existing primitives, and its > quite hard work to get the effects I want. > > -- > Ross Ihaka Email: [EMAIL PROTECTED] > The R Project and R Foundation > > __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] ginv vs. solve
Why do x<-b%*%ginv(A) and x<-solve(A,b) give different results?. It seems that I am missing some basic feature of matrix indexing. e.g.: A<-matrix(c(0,-4,4,0),nrow=2,ncol=2) b<-c(-16,0) x<-b%*%ginv(A);x x<-solve(A,b);x Thanks in advance, Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] shading in image()
Is there a way to make a shading interpolation on an image plot? Something similar to matlab 'shading interp', I think it is called Gouraud shading. What I want is to make a image plot look nicer. with image() it looks very facetted, and I would like to make it look smoother. I've tried with interp.surface() in fields package but it (obviously) makes nan values at the borders and around nan. Maybe an example would make me explain better: data(volcano) par(mfrow=c(1,2)) x <- 10*(1:nrow(volcano)) y <- 10*(1:ncol(volcano)) volcano[seq(1,87,by=10),seq(1,61,by=10)]<-NA; image(x, y, volcano, col = terrain.colors(100)) ## This is what I've tried with interp.surface() library(fields) newx<-seq(10,870,by=2); newy<-seq(10,610,by=2); volcano2<-interp.surface(list(x=x,y=y,z=volcano),make.surface.grid(list(newx ,newy))); dim(volcano2)<-c(length(newx),length(newy)); image(newx,newy,volcano2, col = terrain.colors(100)) As you see NANs are lareger in the interpolated image, I've modified the interp.surface function to take the nearest neightbour when any of the 4 bounding points is NA but the result is still not perfect, thats why I'm looking for a function that does Gouraud shading. Thanks for all the help, Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] rank with ties
Hi, Is there a function like rank but that solves the ties by randomly assigning a value (doesn't average ranks of ties). This is what I actually need: I want to make NA all elements of each column in an array that are ranked in a position larger that rankmax for each column. # Say I've got an array b: b<-cbind(c(1:5,5:1),c(1,12,14,2,5,4:8)) #> b # [,1] [,2] #[1,]11 #[2,]2 12 #[3,]3 14 #[4,]42 #[5,]55 #[6,]54 #[7,]45 #[8,]36 #[9,]27 #[10,]18 rankmax<-5 # The maximum rank position # I make the values ranked in a position larger than 5 NAs b[which(apply(b,2,rank)>rankmax)]<-NA # > b # [,1] [,2] # [1,]11 # [2,]2 NA # [3,] NA NA # [4,] NA2 # [5,] NA5 # [6,] NA4 # [7,] NA5 # [8,] NA NA # [9,]2 NA #[10,]1 NA ### What I want is one of the "3" in the first column not to be made NA. (similar to the algorithm used in sort) Thanks in advance for any help, Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] remove and put back elements in vector
Hi, How can I remove elements from a vector and them put them back in place?? An example (very simple, my vector/operations are much larger/complicated): Got a vector, lets say: a<-c(1,2,40,10,3,20,6); # I remove values larger than 10 a<-a[a<10] # Do some operations on the new a "1 2 3 6" b<-a^2 # Now b is "[1] 1 4 9 36" # Now I want to insert the elements I removed in a back into a and b # so I get: # a "1 2 40 10 3 20 6" #and b "1 4 40 10 9 20 36" The only thing I've found on the archives is explanations on how to insert: http://maths.newcastle.edu.au/~rking/R/help/03a/1794.html Thanks, Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] maps library for R?
Hi there, Does it already exist a library in R to draw maps (something like a Generic Mapping Toolbox, http://gmt.soest.hawaii.edu/ port). I've seen in an old R-help that Ross Ihaka once tried to port the S-plus map library (http://maths.newcastle.edu.au/~rking/R/help/99b/0832.html ). Anybody know if this package is available somewhere or if there is somebody developing a Mapping package for R. I'll might then try to help. Cheers, Angel __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Fortran linking problems
Thanks to all, Once I installed readline-dev (and reinstalled Blas/lapack) it worked! I don't know it why this wasn't shown as a dependency when I installed the R rpm! Thanks, Gelu Original Message Follows From: [EMAIL PROTECTED] To: Angel Lopez-Urrutia <[EMAIL PROTECTED]> CC: [EMAIL PROTECTED] Subject: Re: [R] Fortran linking problems Date: Mon, 20 Jan 2003 07:56:20 + (GMT) Did you build R yourself, or install an rpm? It looks like your installation is missing libreadline, and it was there when R was built. I'm surprised then that R would run, but maybe it is somewhere that the standard LD_LIBRARY_PATH does not find. You need readline and perhaps readline-devel (if it exists) installed, and they should have been dependencies of the R rpm (if that is what you used). I believe that -lreadline is not needed (and this is solved in R-devel), so you could just edit R_HOME/etc/Makeconf and remove -lreadline (and -lnurses) from FLIBS. On Mon, 20 Jan 2003, Angel Lopez-Urrutia wrote: > In a box running Mandrake 9 with R 1.6.2 I get problems when trying to > install packages Matrix and Akima. > It seems my gcc compiler and fortran do not talk to each other. > The errors are: > > * Installing *source* package 'Matrix' ... > checking for gcc... gcc > checking for C compiler default output... a.out > checking whether the C compiler works... yes > checking whether we are cross compiling... no > checking for suffix of executables... > checking for suffix of object files... o > checking whether we are using the GNU C compiler... yes > checking whether gcc accepts -g... yes > checking for gcc option to accept ANSI C... none needed > checking whether we are using the GNU Fortran 77 compiler... yes > checking whether g77 accepts -g... yes > checking how to get verbose linking output from g77... -v > checking for Fortran 77 libraries... -L/usr/local/lib > -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2 > -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2/../../.. -lreadline -ldl > -lncurses -lfrtbegin -lg2c -lm -lgcc_s > checking for dummy main to link with Fortran 77 libraries... unknown > configure: error: linking to Fortran libraries from C fails > ERROR: configuration failed for package 'Matrix' In cases like that, look in config.log. The error message is terse, because it is repeating a test done when R was installed. [...] > gcc -shared -L/usr/local/lib -o akima.so akima.new.o idbvip.o idcldp.o > idgrid.o idlctn.o idpdrv.o idptip.o idptli.o idsfft.o idtang.o idxchg.o > tripack.o ttidbs.o -L/usr/local/lib > -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2 > -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2/../../.. -lreadline -ldl > -lncurses -lfrtbegin -lg2c -lm -lgcc_s -L/usr/lib/R/bin -lR > /usr/bin/ld: cannot find -lreadline > collect2: ld returned 1 exit status > make: *** [akima.so] Error 1 > ERROR: compilation failed for package 'akima' -- 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 __ [EMAIL PROTECTED] mailing list http://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Fortran linking problems
In a box running Mandrake 9 with R 1.6.2 I get problems when trying to install packages Matrix and Akima. It seems my gcc compiler and fortran do not talk to each other. Thanks in advance for any help, Gelu The errors are: * Installing *source* package 'Matrix' ... checking for gcc... gcc checking for C compiler default output... a.out checking whether the C compiler works... yes checking whether we are cross compiling... no checking for suffix of executables... checking for suffix of object files... o checking whether we are using the GNU C compiler... yes checking whether gcc accepts -g... yes checking for gcc option to accept ANSI C... none needed checking whether we are using the GNU Fortran 77 compiler... yes checking whether g77 accepts -g... yes checking how to get verbose linking output from g77... -v checking for Fortran 77 libraries... -L/usr/local/lib -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2 -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2/../../.. -lreadline -ldl -lncurses -lfrtbegin -lg2c -lm -lgcc_s checking for dummy main to link with Fortran 77 libraries... unknown configure: error: linking to Fortran libraries from C fails ERROR: configuration failed for package 'Matrix' # R CMD INSTALL akima_0.3-4.tar.gz * Installing *source* package 'akima' ... ** libs g77 -mieee-fp -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -c akima.new.f -o akima.new.o g77 -mieee-fp -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -c idbvip.f -o idbvip.o g77 -mieee-fp -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -c idcldp.f -o idcldp.o g77 -mieee-fp -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -c idgrid.f -o idgrid.o g77 -mieee-fp -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -c idlctn.f -o idlctn.o g77 -mieee-fp -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -c idpdrv.f -o idpdrv.o g77 -mieee-fp -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -c idptip.f -o idptip.o g77 -mieee-fp -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -c idptli.f -o idptli.o g77 -mieee-fp -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -c idsfft.f -o idsfft.o g77 -mieee-fp -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -c idtang.f -o idtang.o g77 -mieee-fp -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -c idxchg.f -o idxchg.o g77 -mieee-fp -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -c tripack.f -o tripack.o g77 -mieee-fp -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -O3 -fomit-frame-pointer -pipe -mcpu=pentiumpro -march=i586 -fno-fast-math -fno-strength-reduce -c ttidbs.f -o ttidbs.o gcc -shared -L/usr/local/lib -o akima.so akima.new.o idbvip.o idcldp.o idgrid.o idlctn.o idpdrv.o idptip.o idptli.o idsfft.o idtang.o idxchg.o tripack.o ttidbs.o -L/usr/local/lib -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2 -L/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.2/../../.. -lreadline -ldl -lncurses -lfrtbegin -lg2c -lm -lgcc_s -L/usr/lib/R/bin -lR /usr/bin/ld: cannot find -lreadline collect2: ld returned 1 exit status make: *** [akima.so] Error 1 ERROR: compilation failed for package 'akima' _ MSN 8 with e-mail virus protection service: 2 month