[R] Blank windows in Rcmdr
I started to learn R and like to use Rcmdr. I have the latest R (R-2.6.2) and R commander (1.3-14). When I go to Tools menu (for example) pull down load packages in Rcmdr, a blank window is up and there is nothing in it. I can not select and move to next step. This also happens with the other functions like in Graphs menu. I know that Rcmdr uses Tcl/Tk interface. I do not have this experience with other programs like amsn. is this related to Rcmdr or my system configuration?. I could not find similar problems in Ubuntu forums. My Ubuntu 7.10 is up to date Thanks for your help library(Rcmdr) Loading required package: tcltk Loading Tcl/Tk interface ... done Loading required package: car Rcmdr Version 1.3-14 Error in get(paste(on, toupper(letter), sep = )) : variable onÝ was not found Dr. Fehmi YAZICI Ondokuz Mayis University TURKEY - [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Blank windows in Rcmdr
I started to learn R and like to use Rcmdr. I have the latest R (R-2.6.2) and R commander (1.3-14). When I go to Tools menu (for example) pull down load packages in Rcmdr, a blank window is up and there is nothing in it. I can not select and move to next step. This also happens with the other functions like in Graphs menu. I know that Rcmdr uses Tcl/Tk interface. I do not have this experience with other programs like amsn. is this related to Rcmdr or my system configuration?. I could not find similar problems in Ubuntu forums. My Ubuntu 7.10 is up to date Thanks for your help library(Rcmdr) Loading required package: tcltk Loading Tcl/Tk interface ... done Loading required package: car Rcmdr Version 1.3-14 Error in get(paste(on, toupper(letter), sep = )) : variable oni was not found Dr. Fehmi YAZICI Ondokuz Mayis University TURKEY e-mail: [EMAIL PROTECTED] - [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Including Java files in R Package
Duncan Murdoch wrote: On 15/04/2008 7:20 PM, Hongshu Chen wrote: Hi, I am building a package which contains some Java class files. I am planning to create a subdirectory inst/Java/ in the source directory and put Java files in it, therefore after installing the package, those files will be in the Java/ subdirectory in where the package is installed. My question is, how can I make references to those Java files in the R source files in my package? Or is there a better way to do this? I assume you just want to know how to find them, you already know how to use them once you've found them. The path to the Java/ subdir is given by system.file(Java, package=yourPackage) and so the file my.class is in file.path(system.file(Java, package=yourPackage), my.class) I made a dummy example package on how to interface to Java code inside a package - the steps are explained in the vignette inside the package. http://www.openanalytics.be/doc/helloJavaWorld_0.0-3.tar.gz It is planned to contribute this to CRAN or the rJava website (if it is deemed useful and when it will be a bit more mature) - feedback welcome. HTH, Tobias __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Displaying Grahics to the X Window when calling R from command line
The issue is that the X11() device is the default device only in interactive use, and further than the event loop is only run in interactive use. You need to 1) make use of R 2.7.0 RC 2) call R with R --vanilla --interactive 3) arrange for your script to wait for something so the plot remains up. This has come up before, so please search the archives for more details. On Tue, 15 Apr 2008, Pologruto, Thomas wrote: Hi, I am running an R script from the command line by calling: R --vanilla test.R My terminal is part of the Xwin (Xterm) and there is a plot(1:10) command in the test.R script. This will not produce a grahic though. I think it does, on a PostScript or PDF file. When I start R by calling R then plotting from the R command in the same xterm, I do get a graphic display. How do I create a xwin plot by calling R from the command line? Any help is most appreciated. I have preprocessed the data in perl and then feed it into my R script and want to see a plot on the screen. Thanks, Tom == Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html == [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] a question of alphabetical order
Hi, as already mentioned, sorting could be a pain. My solution to that is to write my own order routine for a given language. The idea is to transform the UTF-8 string into ASCII in such a way that the built-in order routine outputs the desired result. But this could be a very stony way. Example for Spanish (please correct me if I'm wrong): -accents are ignored -ll is one single entity and comes after l (ludar comes before llave) -ch is one single entity and comes after c The only thing I do not know if it could happen that a 'll' is not one entity but two (maybe the result of the combination of two nouns). If so then the entire story will be much more complicated. Now the big question is how to delete all these accents in åàÿñü etc. to get aaynu. (technically spoken canonical decomposition of a Unicode string NFKD) One possible way is to use a scripting language which can handle it. The only language I know which can do it as default is python. For ruby, perl one has to install an additional library. On a Mac system python is installed as default; on Windows not. If this ordering is also an issue for Windows users then one has to install it in beforehand. The code comes here: orderES - function(x) { #decomposes all accented characters str - NKFD(x) #all combining diacritics nonChars - c(768:879) pattern - paste([, intToUtf8(as.integer(nonChars)), ], sep=) #delete all combining diacritics str - gsub(pattern, , str) #transform ll an ch to l{ and c{ ({ comes after z) str - gsub(ll, l{, gsub(ch, c{, str)) order(str) } NKFD - function(x) { system(paste(echo -en '# coding=utf-8\nimport unicodedata\nfor i,v in enumerate([\ , paste(x, collapse=\, \), \]):print unicodedata.normalize(\NFKD\,unicode(v, \UTF-8\)).encode(\UTF-8\)'|python -, sep=), intern=T) } Notes to NFKD rountine: - only works if R's environment is set to UTF-8! - for instance a Danish ø won't be decompose to o / (these cases has to be solved manually) - this routine is not very fast Cheers, --Hans __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] X 11
Hi, I would like to have at least 2 x11 windows open and make many graphs into them. I wonder how to draw the graph in a certain device so that the new graph will be in the place of the old one. For example I have open x11 with device numbers 1 and 2. I want to make plot to the device 1 without doing anythin to the 2 and not making a new x11. Something like ?: x11()device 2; plot() dev.off() t. Tommi __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Matched pairs with two data frames
Hi, sorry for jumping in here, but to me your description of why you want to have only the needed data rows remains ambiguous. If you just want to select the data you indicate then you do: selected.data=data[ , needed==yes] where data is the name of your long dataset (13 obs). As I see it, you are just selecting data rows from the whole data set; you are not merging or unstacking data in any way. If that is true, it would be more helpful to know why it is lines 1, 6, and 9 that you need and not the others. That is, is there a systematic reason for yes and no in the needed variable - a reason that could be coded? Or is it just your (arbitrary) selection? This is the part of your questions that I completely do not understand. If the answer to the aforementioned question is yes, there is a reason, then we would need to know the criteria on which to base the coding for this variable. What makes a yes a yes and a no a no? Cheers, Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von Udo Gesendet: Wednesday, April 16, 2008 5:59 AM An: r-help@r-project.org Betreff: Re: [R] Matched pairs with two data frames Patrick, my intention was, to perform a one-to-one exact match, which pairs each treated unit with ONE control unit (without replacement), using my two confounders (age, school) for matching. Patrick Connolly schrieb: On Mon, 14-Apr-2008 at 08:37AM +0200, Udo wrote: | Zitat von Peter Alspach [EMAIL PROTECTED]: | | Udo | | Seems you might want merge() | | HTH ... | | Peter Alspach | | Thank you Peter and Jorge, | | but as I had written in my last sentence, Merge doesn´t do the job, | because it makes all possible matches, but maybe there is a | sophisticated solution with merge, I could not bring light to. Maybe it would help if we knew what you mean by 'all' in this context. To get the NAs in your example, it is NECESSARY to use the all = TRUE argument. Without the all = TRUE, the NA rows are omitted. With 'all' I mean, that in the merged data frame (13 Obs) there are 8 cases (2*4) with age=1 and school=10 (all possible combinations). What is it that you don't want in this: I only need line 1, 6 and 9. To show this, I added needed by hand. age school out1 out2 needed 11 10 9.5 1.1 yes 21 10 9.5 2.0 no 31 10 9.5 3.5 no 41 10 9.5 4.9 no 51 10 2.3 1.1 no 61 10 2.3 2.0 yes 71 10 2.3 3.5 no 81 10 2.3 4.9 no 92 20 3.3 6.5 yes 10 2 20 4.1 6.5 no 11 2 20 5.9 6.5 no 12 3 33 NA 5.2 no 13 4 11 4.6 NA no Whatever it is, can't you subset them out? Yes, that´s the problem. To describe what I mean, I added the variable needed by hand. I don´t know how to compute such a variable to subset. My final data frame should look like this: age school out1 out2nedded 11 10 9.5 1.1 yes 61 10 2.3 2.0 yes 92 20 3.3 6.5 yes I hope, I could make clear, what the problem ist and waht I mean. An alternative would be using packages like Matching or MatchIt, which need a long data structure with one data frame and not a wide one with two data frames. Many thanks! Udo __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Matched pairs with two data frames
Patrick, my intention was, to perform a one-to-one exact match, which pairs each treated unit with ONE control unit (without replacement), using my two confounders (age, school) for matching. Patrick Connolly schrieb: On Mon, 14-Apr-2008 at 08:37AM +0200, Udo wrote: | Zitat von Peter Alspach [EMAIL PROTECTED]: | | Udo | | Seems you might want merge() | | HTH ... | | Peter Alspach | | Thank you Peter and Jorge, | | but as I had written in my last sentence, | Merge doesn´t do the job, because it makes | all possible matches, but maybe there is a sophisticated | solution with merge, I could not bring light to. Maybe it would help if we knew what you mean by 'all' in this context. To get the NAs in your example, it is NECESSARY to use the all = TRUE argument. Without the all = TRUE, the NA rows are omitted. With 'all' I mean, that in the merged data frame (13 Obs) there are 8 cases (2*4) with age=1 and school=10 (all possible combinations). What is it that you don't want in this: I only need line 1, 6 and 9. To show this, I added needed by hand. age school out1 out2 needed 11 10 9.5 1.1 yes 21 10 9.5 2.0 no 31 10 9.5 3.5 no 41 10 9.5 4.9 no 51 10 2.3 1.1 no 61 10 2.3 2.0 yes 71 10 2.3 3.5 no 81 10 2.3 4.9 no 92 20 3.3 6.5 yes 10 2 20 4.1 6.5 no 11 2 20 5.9 6.5 no 12 3 33 NA 5.2 no 13 4 11 4.6 NA no Whatever it is, can't you subset them out? Yes, that´s the problem. To describe what I mean, I added the variable needed by hand. I don´t know how to compute such a variable to subset. My final data frame should look like this: age school out1 out2nedded 11 10 9.5 1.1 yes 61 10 2.3 2.0 yes 92 20 3.3 6.5 yes I hope, I could make clear, what the problem ist and waht I mean. An alternative would be using packages like Matching or MatchIt, which need a long data structure with one data frame and not a wide one with two data frames. Many thanks! Udo __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] transposition problem
Hi use Rs, I have a csv file: 1989-90,1990-91 Barley,23,34 Oats,15,16 Which I want to turn into: year, Barley, Oats 1 1989-90, 23, 15 2 1990-91,34,16 Transpose doesn't quite do it, is there a standard way? Cheers, Geoff Russell __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] X 11
On 16-Apr-08 10:21:00, Tommi Viitanen wrote: Hi, I would like to have at least 2 x11 windows open and make many graphs into them. I wonder how to draw the graph in a certain device so that the new graph will be in the place of the old one. For example I have open x11 with device numbers 1 and 2. I want to make plot to the device 1 without doing anything to the 2 and not making a new x11. Something like ?: x11()device 2; plot() dev.off() t. Tommi Device 1 is the null device. Ignore this. The first X11 window opened (either automatically by, say, a plot() command) is device 2. Unless you explicitly open further X11 windows, all plots will go to this one, over-writing what was there before. If you close this X11 window (e.g. by using the close button in its frame) then you are back to device 1, with no X11 windows available. To open an additional X11 window, use X11() (and see ?X11 for options to this command). The new X11 window will have device number 1 greater than the highest device number already in existence. You can repeat this command to open several X11 windows at once. Thus you will have X11 windows with device numbers 2, 3, ... To select which X11 window is to receive the next plot, use the command dev.set(). For example, with X11 windows open on devices 2, 3, 4, dev.set(3) will select device number 3 (the 2nd X11 window). You should see the word ACTIVE in the title bar of the selected window, and the word inactive in the title bars of the others. All graphics output goes to the selected device, until you change the selection with dev.set(). See ?dev.set for more things you can do with devices. NB (re device 1) -- if you have say 2 X11s on devices 2, 3, and you do dev.set(1), then you will in fact open a new X11 on device 4, which will be the ACTIVE device! Hoping this helps, Ted E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 16-Apr-08 Time: 11:49:16 -- XFMail -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] X 11
?dev.set (on the same page as dev.off). On Wed, 16 Apr 2008, Tommi Viitanen wrote: Hi, I would like to have at least 2 x11 windows open and make many graphs into them. I wonder how to draw the graph in a certain device so that the new graph will be in the place of the old one. For example I have open x11 with device numbers 1 and 2. I want to make plot to the device 1 without doing anythin to the 2 and not making a new x11. Something like ?: x11()device 2; plot() dev.off() t. Tommi __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Load the shared object/DLL
On Wed, 16 Apr 2008, Guohui Ding wrote: Dear All, I have written a function in c (in a file named 'a.c') as follows, *PLEASE* don't claim credit for the work of others (in this case it is me that you owe the apology and retraction to). That is from 'S Programming' p. 126, and 'Writing R Extensions'. void convolve(double *a, int *na, double *b, int *nb, double *ab) { int i, j, nab = *na + *nb - 1; for(i = 0; i nab; i++) ab[i] = 0.0; for(i = 0; i *na; i++) for(j = 0; j *nb; j++) ab[i + j] += a[i] * b[j]; } Then, I created a shared file in the Windows, R CMD SHLIB -d -o a.dll a.c Every thing is OK now. I changed the working directory of the R environment to the directory containing the a.dll. I enter two commands in the R console, dyn.load(a.dll) is.loaded(a) [1] FALSE The question is that, why was the a.dll failed to be loaded in the R enviroment? Which step resuted in this problem? It did not fail. is.loaded(a) looks for entry point a, and you have convolve. Any suggestion was welcome. Do note that posting guide said about where to post non-R programming questions. G. Ding [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] save a graph in horizontal way (using pdf())
Hello everybody, I want to save a graphic using the pdf environment, everything in order, but I can not to save the graph in horizontal way. I have read the manual (to plot, par), the FAQ, google, but nothing I found that can help me. Anyone can say me a hint? Thanks a lot, -- Josue [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Load the shared object/DLL
Dear All, I have written a function in c (in a file named 'a.c') as follows, void convolve(double *a, int *na, double *b, int *nb, double *ab) { int i, j, nab = *na + *nb - 1; for(i = 0; i nab; i++) ab[i] = 0.0; for(i = 0; i *na; i++) for(j = 0; j *nb; j++) ab[i + j] += a[i] * b[j]; } Then, I created a shared file in the Windows, R CMD SHLIB -d -o a.dll a.c Every thing is OK now. I changed the working directory of the R environment to the directory containing the a.dll. I enter two commands in the R console, dyn.load(a.dll) is.loaded(a) [1] FALSE The question is that, why was the a.dll failed to be loaded in the R enviroment? Which step resuted in this problem? Any suggestion was welcome. G. Ding [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] X 11
On 16 Apr 2008, at 12:21, Tommi Viitanen wrote: For example I have open x11 with device numbers 1 and 2. I want to make plot to the device 1 without doing anythin to the 2 and not making a new x11. Something like ?: Do you mean something like dev.set(DEVICENUMBER) ? Have a look at ?dev.set --Hans __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Data envelopment analysis and FEAR
Hi I would like to know whether it is possible to implement the concept of weak disposability in FEAR package for Data envelopment analysis. Weak disposability means equality constraint with warm regards Ramelan ___ Yahoo! For Good helps you make a difference http://uk.promotions.yahoo.com/forgood/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] heavy graphs
Georg Ehret wrote: Dear R community,I am creating large graphs with hundreds of thousands of datapoints. My usual way for output was pdf, but now I am getting file sizes of 30Mb that do not open well (or at all) in Adobe. Is there a way to reduce the resolution or get rid of overlaying datapoints? Any other idea is also warmly welcome! Hi Georg, As others have noted, bitmapped graphics will handle overlaid points better than pdf. You might be able to use the count.overplot function that clumps together points and prints the number of points rather than the points themselves. However, with that many points, you might finish up with a jumble of numbers. Another possibility is to bin the points and print a color matrix that represents the number of points in each bin. # not a very elegant function, the example runs pretty slowly bin.points-function(x,y,nxbins,nybins) { binmat-matrix(0,nrow=nybins,ncol=nxbins) xrange-range(x) yrange-range(y) xinc-diff(xrange)/nxbins yinc-diff(yrange)/nybins for(row in 1:nybins) { for(col in 1:nxbins) { binmat[row,col]- sum((x = xrange+xinc*(row-1)) (x xrange+xinc*row) (y = yrange+yinc*(col-1)) (y yrange+yinc*col)) if(col==nxbins) binmat[row,col]-binmat[row,col] + sum((x == xrange[2]) (y = yrange+yinc*(col-1)) (y yrange+yinc*col)) } if(row==nybins) binmat[row,col]-binmat[row,col] + sum((y == yrange[2]) (x = xrange+xinc*(row-1)) (x xrange+xinc*row)) } return(binmat) } binmat-bin.points(rnorm(10),rnorm(10),20,20) require(plotrix) color2D.matplot(binmat,show.legend=TRUE) Jim __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] = vs. ==?
Ted Harding wrote: One is that NA is not a value. Its logical status is, in effect, value not known. Therefore, when 'y' is NA, x==y cannot have a definite resolution, since it is possible for the unkown value of 'y' to be equal to the value of 'x'; and equally possible that it may not be. Hence the value of x==y is itself NA. Similarly the value of x==y is NA when both of 'x' and 'y' are NA. The function to use for testing whether (say) 'x' is NA is is.na(x). Just as an off-topic tangent, I found it quite interesting that real-world language Aymara (see ... http://en.wikipedia.org/wiki/Aymara_language ...) uses this three value logic system (I think the computer jargon is trollean logic). Alberto Monteiro __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] a question of alphabetical order
Thanks Hans! Hans-Joerg Bibiko wrote: Hi, as already mentioned, sorting could be a pain. My solution to that is to write my own order routine for a given language. The idea is to transform the UTF-8 string into ASCII in such a way that the built-in order routine outputs the desired result. But this could be a very stony way. Example for Spanish (please correct me if I'm wrong): -accents are ignored Correct. -ll is one single entity and comes after l (ludar comes before llave) Nope. Nowadays, it is considered as two letters (I mean your use of entity here allows me to say two different entities). Thus, here an example... lama, lazo, leve, llave, lluvia, ludar (if such a word exists), luna -ch is one single entity and comes after c Nope. Here another example: capa, casco, chapa, chepa, cisma, copa, curva Here the original source (in Spanish)... http://tinyurl.com/ysm243 The only thing I do not know if it could happen that a 'll' is not one entity but two (maybe the result of the combination of two nouns). If so then the entire story will be much more complicated. I think this is the case both for ll, ch and even rr although rr was never considered as a single entity What I don't know is how Spanish locales consider these rules. I'll try to understand it and keep this thread (or a follow up created in the r-sig-mac list) updated. Now the big question is how to delete all these accents in åàÿñü etc. to get aaynu. (technically spoken canonical decomposition of a Unicode string NFKD) One possible way is to use a scripting language which can handle it. The only language I know which can do it as default is python. For ruby, perl one has to install an additional library. On a Mac system python is installed as default; on Windows not. If this ordering is also an issue for Windows users then one has to install it in beforehand. The code comes here: orderES - function(x) { #decomposes all accented characters str - NKFD(x) #all combining diacritics nonChars - c(768:879) pattern - paste([, intToUtf8(as.integer(nonChars)), ], sep=) #delete all combining diacritics str - gsub(pattern, , str) #transform ll an ch to l{ and c{ ({ comes after z) str - gsub(ll, l{, gsub(ch, c{, str)) order(str) } NKFD - function(x) { system(paste(echo -en '# coding=utf-8\nimport unicodedata\nfor i,v in enumerate([\ , paste(x, collapse=\, \), \]):print unicodedata.normalize(\NFKD\,unicode(v, \UTF-8\)).encode(\UTF-8\)'|python -, sep=), intern=T) } Notes to NFKD rountine: - only works if R's environment is set to UTF-8! - for instance a Danish ø won't be decompose to o / (these cases has to be solved manually) - this routine is not very fast Cheers, --Hans I don't know if this applies only to Mac or is a general issue. In any case, as I am working with Mac now, I will move the discussion to the r-sig-mac list as proposed by Brian Ripley. Do you agree? See you there! Greetings, Ricardo -- Ricardo Rodríguez Your XEN ICT Team __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] transposition problem
Try this: x - read.table(textConnection(\1989-90\,\1990-91\ Barley,23,34 Oats,15,16), sep = ,, header = T, check.names = FALSE) t(x) or if you want year as column and not rownames: data.frame(Year = names(x), t(unname(x))) On Wed, Apr 16, 2008 at 7:27 AM, Geoff Russell [EMAIL PROTECTED] wrote: Hi use Rs, I have a csv file: 1989-90,1990-91 Barley,23,34 Oats,15,16 Which I want to turn into: year, Barley, Oats 1 1989-90, 23, 15 2 1990-91,34,16 Transpose doesn't quite do it, is there a standard way? Cheers, Geoff Russell __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] save a graph in horizontal way (using pdf())
See in ?pdf function, 'paper' argument. On Wed, Apr 16, 2008 at 7:56 AM, Josué Polanco [EMAIL PROTECTED] wrote: Hello everybody, I want to save a graphic using the pdf environment, everything in order, but I can not to save the graph in horizontal way. I have read the manual (to plot, par), the FAQ, google, but nothing I found that can help me. Anyone can say me a hint? Thanks a lot, -- Josue [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] transposition problem
Many thanks -- the unname makes all the difference. Geoff. On 4/16/08, Henrique Dallazuanna [EMAIL PROTECTED] wrote: Try this: x - read.table(textConnection(\1989-90\,\1990-91\ Barley,23,34 Oats,15,16), sep = ,, header = T, check.names = FALSE) t(x) or if you want year as column and not rownames: data.frame(Year = names(x), t(unname(x))) On Wed, Apr 16, 2008 at 7:27 AM, Geoff Russell [EMAIL PROTECTED] wrote: Hi use Rs, I have a csv file: 1989-90,1990-91 Barley,23,34 Oats,15,16 Which I want to turn into: year, Barley, Oats 1 1989-90, 23, 15 2 1990-91,34,16 Transpose doesn't quite do it, is there a standard way? Cheers, Geoff Russell __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O -- 6 Fifth Ave, St Morris, S.A. 5068 Australia Ph: 041 8805 184 / 08 8332 5069 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] What objects will save.image saves ? And how to specify objects to be saved..
Hi, I have a R script that loads an image R.data, does some operations, then save to the R.data again. Suppose I have done some computation before loading the R script, will all the objects before the R script execution be saved to R.data ? If yes, how can I specify save.image to save only those objects created in the R script ? Thanks Stanley [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] What objects will save.image saves ? And how to specify objects to be saved..
See ?save On Wed, Apr 16, 2008 at 8:46 AM, Ng Stanley [EMAIL PROTECTED] wrote: Hi, I have a R script that loads an image R.data, does some operations, then save to the R.data again. Suppose I have done some computation before loading the R script, will all the objects before the R script execution be saved to R.data ? If yes, how can I specify save.image to save only those objects created in the R script ? Thanks Stanley [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] What objects will save.image saves ? And how to specify objects to be saved..
Read and reread, can't make out. Will try an experiment later On Wed, Apr 16, 2008 at 7:51 PM, Henrique Dallazuanna [EMAIL PROTECTED] wrote: See ?save On Wed, Apr 16, 2008 at 8:46 AM, Ng Stanley [EMAIL PROTECTED] wrote: Hi, I have a R script that loads an image R.data, does some operations, then save to the R.data again. Suppose I have done some computation before loading the R script, will all the objects before the R script execution be saved to R.data ? If yes, how can I specify save.image to save only those objects created in the R script ? Thanks Stanley [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Displaying Grahics to the X Window when calling R from command line
Thank you for your response. I tried searching the archives but did not know that it was called X11() device. Can this be done in version 2.6.2 or do I need to have version 2.7.0 running? Also, when you say wait in my script, I need to put a sleep or something in the script or else it will delete the plot when the script exits? Thanks you again, Tom Please follow the attached hyperlink to an important disclosure: http://www.credit-suisse.com/legal/marketcommentary -Original Message- From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 16, 2008 3:12 AM To: Pologruto, Thomas Cc: r-help@r-project.org Subject: Re: [R] Displaying Grahics to the X Window when calling R from command line The issue is that the X11() device is the default device only in interactive use, and further than the event loop is only run in interactive use. You need to 1) make use of R 2.7.0 RC 2) call R with R --vanilla --interactive 3) arrange for your script to wait for something so the plot remains up. This has come up before, so please search the archives for more details. On Tue, 15 Apr 2008, Pologruto, Thomas wrote: Hi, I am running an R script from the command line by calling: R --vanilla test.R My terminal is part of the Xwin (Xterm) and there is a plot(1:10) command in the test.R script. This will not produce a grahic though. I think it does, on a PostScript or PDF file. When I start R by calling R then plotting from the R command in the same xterm, I do get a graphic display. How do I create a xwin plot by calling R from the command line? Any help is most appreciated. I have preprocessed the data in perl and then feed it into my R script and want to see a plot on the screen. Thanks, Tom == Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html == [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- 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 == Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html == __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Load the shared object/DLL
:) Thanks. I owe you an apology and retract it, as I copied the codes from others and did not check the origin of these codes. 2008/4/16, Prof Brian Ripley [EMAIL PROTECTED]: On Wed, 16 Apr 2008, Guohui Ding wrote: Dear All, I have written a function in c (in a file named 'a.c') as follows, *PLEASE* don't claim credit for the work of others (in this case it is me that you owe the apology and retraction to). That is from 'S Programming' p. 126, and 'Writing R Extensions'. void convolve(double *a, int *na, double *b, int *nb, double *ab) { int i, j, nab = *na + *nb - 1; for(i = 0; i nab; i++) ab[i] = 0.0; for(i = 0; i *na; i++) for(j = 0; j *nb; j++) ab[i + j] += a[i] * b[j]; } Then, I created a shared file in the Windows, R CMD SHLIB -d -o a.dll a.c Every thing is OK now. I changed the working directory of the R environment to the directory containing the a.dll. I enter two commands in the R console, dyn.load(a.dll) is.loaded(a) [1] FALSE The question is that, why was the a.dll failed to be loaded in the R enviroment? Which step resuted in this problem? It did not fail. is.loaded(a) looks for entry point a, and you have convolve. Any suggestion was welcome. Do note that posting guide said about where to post non-R programming questions. G. Ding [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- 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 [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] looking for a string
Thanks Mark! Mark Leeds wrote: Hi Ricardo: you can look at ?regexpr but I'm pretty sure that below returns a vector of TRUES and FALSES depending on whether the condition ( is Jalapa contained in unidad ) is TRUE. So, wherever the vector is TRUE is where Jalapa was contained in unidad. So, it's basically EXACTLY the same as what Henrique did. I just can't remember exactly what Henrique did at the moment. regexpr(Jalapa, as.character( unidad ) ) != -1 So, suppose your dataframe was called DF and it has column called unidad. Then, newDF-DF[(regexpr(Jalapa, as.character( unidad ) ) != -1),] should be a new dataframe , exactly the same as the old one, but only containing the rows where the condition was true. Does that clear things up for you ? Yes. It is clear for me now. Thanks for your detailed explanation! The expression is for the rows and has the TRUES and FALSES as a vector and whenever it is TRUE, the row is kept and whatever is FALSE, the row is not kept. The comma just says to take all the columns. You can also use subset directly if that's easier for you the same way you figured out how to use it in the state.77 example. If it's not clear, it's because you need to understand how logical subscripting is used in R. For that, I think the thing to read is Introduction to R which is one of the documents at www.r-project.org. Do Yes, this is the main problem: I need to understand basic concepts. And I am aware that logical subscripting is not one of my strengths. The example has also forced me to understand another basic concetp: attach() and detach()! I didn't know why unidad was not available just by name in my environment. I used to call variables as name$dataframe. temp- regexpr(Jalapa, as.character( unidad ) ) != -1 print(temp) to see exactly what regexpr does. Thanks again. Cheers, Ricardo -- Ricardo Rodríguez Your XEN ICT Team __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Brown-Forsythe F* Statistic
The Brown-Forsyth test is included in the HH library in function hov(). hov is homogeneity of variance. Use hov(y ~ x, data=mydata) and plot.hov(y ~ x, data=mydata) Rich __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] looking for a string
Charles C. Berry wrote: Like this: conaguaMexicoSub - subset(conagua, regexpr(Jalapa, as.character( unidad ) ) != -1 select = c(equipo,X101:X309)) But it looks like you have to sort out some issues concerning dueling locales first. Chuck Far clear! Thanks! Now, if I survive the duel with locales, I know how to deal with regex and subsetting! My honour is to try and my duty is love Ufa! what a quote! :-) Greetings! -- Ricardo Rodríguez Your XEN ICT Team __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] looking for a string
Mark Leeds wrote: Hi Ricardo: I'm glad it helped but check regexpr(Jalapa, as.character( unidad ) ) != -1 because I think it should be regexpr(Jalapa, as.character( DF$unidad ) ) != -1 if unidad is a column of DF. Checked! attach(DF) did the trick! :-) Greetings, Ricardo -- Ricardo Rodríguez Your XEN ICT Team __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] SVG format from any R graphic GUI?
I have problems with emf files because OpenOffice does a poor job at importing figures in this format. On the other hand, imported eps figures are not displayed, just printed. Is there any R graphic gui able to export as SVG (or other vector format)? I've tried JGR, iplots and svGUI. Thanks! Agus -- Dr. Agustin Lobo Institut de Ciencies de la Terra Jaume Almera (CSIC) LLuis Sole Sabaris s/n 08028 Barcelona Spain Tel. 34 934095410 Fax. 34 934110012 email: [EMAIL PROTECTED] http://www.ija.csic.es/gt/obster __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] a question of alphabetical order
Hans-Joerg Bibiko wrote: Hola, Muchas gracias! This is new to me. I learnt Spanish a bit - well - 20 years ago ;) But this simplifies it. This change happens just 14 years ago! You you are not guilty! Recuerdos Hans Saludos cordiales! Read you in Spanish whenever you want! Ricardo -- Ricardo Rodríguez Your XEN ICT Team __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Displaying Grahics to the X Window when calling R from command line
On Wed, 16 Apr 2008, Pologruto, Thomas wrote: Thank you for your response. I tried searching the archives but did not know that it was called X11() device. Can this be done in version 2.6.2 or do I need to have version 2.7.0 Flag --interactive is only in 2.7.0. There is no simple way to get 2.6.2 to accept input redirected from a script and run the event loop on which X11() depends. (One non-simple way is to write an alternative front end.) running? Also, when you say wait in my script, I need to put a sleep or something in the script or else it will delete the plot when the script exits? You need to ensure that the script does not exit, which will close the device (not just delete the plot). Sys.sleep() may not be sufficiently flexible -- one idea is to use locator() to get the viewer to click on the plot when done with it. Another route is to generate the plot as, say, a PNG file and launch a separate viewer to show that via system(wait=FALSE). Thanks you again, Tom Please follow the attached hyperlink to an important disclosure: http://www.credit-suisse.com/legal/marketcommentary -Original Message- From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 16, 2008 3:12 AM To: Pologruto, Thomas Cc: r-help@r-project.org Subject: Re: [R] Displaying Grahics to the X Window when calling R from command line The issue is that the X11() device is the default device only in interactive use, and further than the event loop is only run in interactive use. You need to 1) make use of R 2.7.0 RC 2) call R with R --vanilla --interactive 3) arrange for your script to wait for something so the plot remains up. This has come up before, so please search the archives for more details. On Tue, 15 Apr 2008, Pologruto, Thomas wrote: Hi, I am running an R script from the command line by calling: R --vanilla test.R My terminal is part of the Xwin (Xterm) and there is a plot(1:10) command in the test.R script. This will not produce a grahic though. I think it does, on a PostScript or PDF file. When I start R by calling R then plotting from the R command in the same xterm, I do get a graphic display. How do I create a xwin plot by calling R from the command line? Any help is most appreciated. I have preprocessed the data in perl and then feed it into my R script and want to see a plot on the screen. Thanks, Tom == Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html == [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- 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 == Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html == -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] SVG format from any R graphic GUI?
On Wed, 16 Apr 2008 13:20:35 +0200 Agustin Lobo wrote: ALI have problems with emf files because OpenOffice does ALa poor job at importing figures in this format. On the other ALhand, imported eps figures are not displayed, just printed. ALIs there any R graphic gui able to export as SVG (or ALother vector format)? I've ALtried JGR, iplots and svGUI. The figures format has nothing to do with the gui. It matters which devices are supported by your R platform on your system (Win/Linux/Mac?). A quick search on r-project.org pointed me to the Cairo package. Maybe you can try that. You will also have reasonable results using the png device/graphics. usually you do something like: png(myplot.png,width=500,height=500) plot(x,y) dev.off() hth Stefan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] SVG format from any R graphic GUI?
R 2.7.0 RC has an svg() device on Unix-alikes, and there are RSvgDevice and RSVGTipsDevice packages on CRAN. I've seen so many problems with SVG renderers (especially related to fonts) that I would prefer not to rely on it. If this is Windows, the preferred route seems to be to use EPS with a preview (which GSView can add for you). On Wed, 16 Apr 2008, Stefan Grosse wrote: On Wed, 16 Apr 2008 13:20:35 +0200 Agustin Lobo wrote: ALI have problems with emf files because OpenOffice does ALa poor job at importing figures in this format. On the other ALhand, imported eps figures are not displayed, just printed. ALIs there any R graphic gui able to export as SVG (or ALother vector format)? I've ALtried JGR, iplots and svGUI. The figures format has nothing to do with the gui. It matters which devices are supported by your R platform on your system (Win/Linux/Mac?). A quick search on r-project.org pointed me to the Cairo package. Maybe you can try that. You will also have reasonable results using the png device/graphics. usually you do something like: png(myplot.png,width=500,height=500) plot(x,y) dev.off() hth Stefan -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] SVG format from any R graphic GUI?
Thanks, I know about saving to file via the graphic devices, and I do use the cairoSVG for example. But I'm looking for a minimum interactivity, such in the windows Gui where you resize your graphic and when you like it you click on save as... The problem is that you only have emf as vector option, and emf files are poorly imported by OO. Agus Stefan Grosse escribió: On Wed, 16 Apr 2008 13:20:35 +0200 Agustin Lobo wrote: ALI have problems with emf files because OpenOffice does ALa poor job at importing figures in this format. On the other ALhand, imported eps figures are not displayed, just printed. ALIs there any R graphic gui able to export as SVG (or ALother vector format)? I've ALtried JGR, iplots and svGUI. The figures format has nothing to do with the gui. It matters which devices are supported by your R platform on your system (Win/Linux/Mac?). A quick search on r-project.org pointed me to the Cairo package. Maybe you can try that. You will also have reasonable results using the png device/graphics. usually you do something like: png(myplot.png,width=500,height=500) plot(x,y) dev.off() hth Stefan -- Dr. Agustin Lobo Institut de Ciencies de la Terra Jaume Almera (CSIC) LLuis Sole Sabaris s/n 08028 Barcelona Spain Tel. 34 934095410 Fax. 34 934110012 email: [EMAIL PROTECTED] http://www.ija.csic.es/gt/obster __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Displaying Grahics to the X Window when calling R from command line
I've just tried the following in 2.6.2 auk% cat x11.R X11() interactive() plot(1:10) locator() q() explicitly launch a device. It seems to be responsive enough (at least on my system) and will stay up until you middle- or right-click on the device surface. In earlier threads others have reported some problems with this approach, but see how it works for you. On Wed, 16 Apr 2008, Pologruto, Thomas wrote: Thank you very much. Most appreciated. Please follow the attached hyperlink to an important disclosure: http://www.credit-suisse.com/legal/marketcommentary -Original Message- From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 16, 2008 8:52 AM To: Pologruto, Thomas Cc: r-help@r-project.org Subject: RE: [R] Displaying Grahics to the X Window when calling R from command line On Wed, 16 Apr 2008, Pologruto, Thomas wrote: Thank you for your response. I tried searching the archives but did not know that it was called X11() device. Can this be done in version 2.6.2 or do I need to have version 2.7.0 Flag --interactive is only in 2.7.0. There is no simple way to get 2.6.2 to accept input redirected from a script and run the event loop on which X11() depends. (One non-simple way is to write an alternative front end.) running? Also, when you say wait in my script, I need to put a sleep or something in the script or else it will delete the plot when the script exits? You need to ensure that the script does not exit, which will close the device (not just delete the plot). Sys.sleep() may not be sufficiently flexible -- one idea is to use locator() to get the viewer to click on the plot when done with it. Another route is to generate the plot as, say, a PNG file and launch a separate viewer to show that via system(wait=FALSE). Thanks you again, Tom Please follow the attached hyperlink to an important disclosure: http://www.credit-suisse.com/legal/marketcommentary -Original Message- From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Sent: Wednesday, April 16, 2008 3:12 AM To: Pologruto, Thomas Cc: r-help@r-project.org Subject: Re: [R] Displaying Grahics to the X Window when calling R from command line The issue is that the X11() device is the default device only in interactive use, and further than the event loop is only run in interactive use. You need to 1) make use of R 2.7.0 RC 2) call R with R --vanilla --interactive 3) arrange for your script to wait for something so the plot remains up. This has come up before, so please search the archives for more details. On Tue, 15 Apr 2008, Pologruto, Thomas wrote: Hi, I am running an R script from the command line by calling: R --vanilla test.R My terminal is part of the Xwin (Xterm) and there is a plot(1:10) command in the test.R script. This will not produce a grahic though. I think it does, on a PostScript or PDF file. When I start R by calling R then plotting from the R command in the same xterm, I do get a graphic display. How do I create a xwin plot by calling R from the command line? Any help is most appreciated. I have preprocessed the data in perl and then feed it into my R script and want to see a plot on the screen. Thanks, Tom = = Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html = = [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- 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 == Please access the attached hyperlink for an important electronic communications disclaimer: http://www.credit-suisse.com/legal/en/disclaimer_email_ib.html == -- 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 == Please access the attached
Re: [R] Questions related to plotting boxplots of time series data
Hi Thomas, I have looked through several R books and searched the web to find answers to my questions with no results. I have an ensemble of time series data (what are essentially Monte Carlo simulations) which I would like to summarize as a time series of boxplots, by date/time at 6-hr intervals. I don't know how to do this and I am not sure how I should structure the data to get what I want. Another related question: while doing this, can I have some of the time series shorter than others? Once you have a (say) matrix containing the data, you can build a time series of boxplots by feeding a formula to boxplot(): times - seq(1:20) values - matrix(rnorm(20*100,0,1),nrow=20,ncol=100) boxplot(values~times) Of course, you would need to align the time series values and take the six-hour-slices first. And then add prettyprinted labels. Ideally I would prefer to depict 99%, 95%, 75%, 50%, etc. confidence intervals to show the distribution of the data. Is this possible? How can I do it? boxplot() by default shows 25%, 50% and 75% quantiles. The whiskers and circles are calculated through the interquartile range, see http://en.wikipedia.org/wiki/Boxplot Unfortunately, I can't seem to find this info in the help file for boxplot(). Thus, you would need to roll your own graphical representations after extracting quantiles via apply(values,2,quantile,probs=c(.99,.95,.75,.5)) or some such. If you do roll your own, just please don't do nonstandard boxplots without telling the reader that your whiskers mean something different than in the ordinary boxplot... Hope that helped Stephan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] sensitivity analysis
Hello list, I am performing a sensitivity analysis using the package ROCR. I am using the class prediction in this aim. My question is, could anyone tell me what the vector cutoffs represent in the result? Thank you all, Eleni [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] New Special Interest Group Mailing List - R-sig-ecology
All, A new Special Interest Group devoted to the use or R in ecology has been created. The list came about through a very thorough and scientific survey that identified a need (i.e. I chatted with Sarah Goslee at a recent conference and she agreed that this might be a good idea). Myself and Sarah will serve as the list administrators and are anxious to grow the list and include anyone who is interested in R and its use in ecology, environmental science, and/or natural resources. The primary purpose of the R-sig-ecology is to provide a forum to discuss the use of R, through statistical methods, scripting, data management, etc., by those who are studying and analyzing ecological data. Additionally, through R-sig-ecology we hope to encourage and foster the use of R by ecologists and as such welcome users of all experiences. If you are interested in ecology and R, head on over to https://stat.ethz.ch/mailman/listinfo/r-sig-ecology to subscribe. Cheers, Jeff *** Dr. Jeffrey W. Hollister US EPA Atlantic Ecology Division 27 Tarzwell Drive Narragansett, RI 02882 (401) 782-9655 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] sensitivity analysis
Eleni Christodoulou elenichri at gmail.com writes: I am performing a sensitivity analysis using the package ROCR. I am using the class prediction in this aim. My question is, could anyone tell me what the vector cutoffs represent in the result? As the docs say: cutoffs: A list in which each element is a vector of all necessary cutoffs. Each cutoff vector consists of the predicted scores (duplicates removed), in descending order. Dieter __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Blank windows in Rcmdr
Dear Fehmi, Curiously, I check the Rcmdr package on an up-to-date Ubuntu 7.10 system running R 2.6.2. I've just checked again after updating both Ubuntu and all R packages, and I can't duplicate your problem -- the Tools - Load packages menu works fine for me, as does everything else that I checked. Perhaps other Ubuntu users can relate their experiences: Do they encounter this problem, or does the Rcmdr seem to work. If the former, I guess that there must be something peculiar about your system. Regards, John On Tue, 15 Apr 2008 23:14:25 -0700 (PDT) Fehmi YAZICI [EMAIL PROTECTED] wrote: I started to learn R and like to use Rcmdr. I have the latest R (R-2.6.2) and R commander (1.3-14). When I go to Tools menu (for example) pull down load packages in Rcmdr, a blank window is up and there is nothing in it. I can not select and move to next step. This also happens with the other functions like in Graphs menu. I know that Rcmdr uses Tcl/Tk interface. I do not have this experience with other programs like amsn. is this related to Rcmdr or my system configuration?. I could not find similar problems in Ubuntu forums. My Ubuntu 7.10 is up to date Thanks for your help library(Rcmdr) Loading required package: tcltk Loading Tcl/Tk interface ... done Loading required package: car Rcmdr Version 1.3-14 Error in get(paste(on, toupper(letter), sep = )) : variable onÝ was not found Dr. Fehmi YAZICI Ondokuz Mayis University TURKEY - [[alternative HTML version deleted]] John Fox, Professor Department of Sociology McMaster University Hamilton, Ontario, Canada http://socserv.mcmaster.ca/jfox/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] = vs. ==?
On 16-Apr-08 11:13:40, Alberto Monteiro wrote: Ted Harding wrote: One is that NA is not a value. Its logical status is, in effect, value not known. Therefore, when 'y' is NA, x==y cannot have a definite resolution, since it is possible for the unkown value of 'y' to be equal to the value of 'x'; and equally possible that it may not be. Hence the value of x==y is itself NA. Similarly the value of x==y is NA when both of 'x' and 'y' are NA. The function to use for testing whether (say) 'x' is NA is is.na(x). Just as an off-topic tangent, I found it quite interesting that real-world language Aymara (see ... http://en.wikipedia.org/wiki/Aymara_language ...) uses this three value logic system (I think the computer jargon is trollean logic). Alberto Monteiro Equally interesting (and equally OT) to us as people concerned with information and evidence is that some real-world langauges have a specific provision for expressing the evidential status of the information they express. It seems that this has only relatively recently been formalised by linguists under the heading of Evidentiality. For example, Turkish has the suffix [transcribed] mish/mush to indicate whether what is stated is known directly or indirectly. Thus, at the Department Meeting we are all waiting for X to turn up, so that we can start. Finally, I phone his home. His wife answers. I ask about X. She says Geliyor [He is coming]. She knows this because she has just seen him leave the house. I turn round to report this: I say Geliyormush, because I don't know it. What I do know is that I have been told it. For more: http://en.wikipedia.org/wiki/Evidentiality In the same vein, you might tell me what I regard as a tall tale. I could respond Mush!, with meaning on the lines (in escalating order)of: So you say!, Pull the other one!, Come off it!, ... Best wishes to all, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 094 0861 Date: 16-Apr-08 Time: 15:38:24 -- XFMail -- __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Don't understand error-message (from lattice, I think)
mypal - trellis.par.get('superpose.line')$col[1:2] mycol - mypal[1] trellis.par.set(list(dot.symbol = list(pch = 16, cex = 1.5))) dotplot(1:6 ~ audRating, data = txtA.ci, + scales = list(y = list(at = 1:6, labels = txtA.ci$pitchAud, col = 'black', cex = 1.1)), + ylab = '', aspect = 1.2, xlab = 'rated duration', ylim = c(0.5, 6.5), xlim = c(0, 100), + ) Wed Apr 16 10:36:19 MK-MacPro.local R[12990] Error: The function `CGFontGetGlyphsForUnicodes' is obsolete and will be removed in an upcoming update. Unfortunately, this application, or a library it uses, is using this obsolete function, and is thereby contributing to an overall degradation of system performance. Please use `CGFontGetGlyphsForUnichars' instead. R version 2.7.0 Under development (unstable) (2008-03-04 r44677) i386-apple-darwin8.10.1 locale: en_US.UTF-8/en_US.UTF-8/en_US.UTF-8/C/en_US.UTF-8/en_US.UTF-8 attached base packages: [1] grid stats graphics grDevices utils datasets methods base other attached packages: [1] Hmisc_3.4-3 doBy_2.3 coda_0.13-1 gmodels_2.14.1lme4_0.99875-9Matrix_0.999375-9 lattice_0.17-6 loaded via a namespace (and not attached): [1] MASS_7.2-41 car_1.2-7 cluster_1.11.10 gdata_2.4.1 gtools_2.4.0 _ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400Charlottesville, VA 22904-4400 Parcels:Room 102Gilmer Hall McCormick RoadCharlottesville, VA 22903 Office:B011+1-434-982-4729 Lab:B019+1-434-982-4751 Fax:+1-434-982-4766 WWW:http://www.people.virginia.edu/~mk9y/ [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Blank windows in Rcmdr
John Fox wrote: Dear Fehmi, Curiously, I check the Rcmdr package on an up-to-date Ubuntu 7.10 system running R 2.6.2. I've just checked again after updating both Ubuntu and all R packages, and I can't duplicate your problem -- the Tools - Load packages menu works fine for me, as does everything else that I checked. Perhaps other Ubuntu users can relate their experiences: Do they encounter this problem, or does the Rcmdr seem to work. If the former, I guess that there must be something peculiar about your system. It's hard to tell exactly what the original poster is seeing without a screenshot, but there are occasional problems with Composition Window Managers (such as Compiz) that can produce all-black windows - I think it's when the graphics card runs low on memory or something. Google for 'ubuntu black window problem' for more. Try switching off 3d-effects or getting a new video card if you really want 3d effects. I've got a Geforce FX 5200 in my Ubuntu box and I don't see the black windows that I used to get with my Geforce MX440 card. Note this is not an R or Rcmdr problem - it happens with all sorts of applications. I used to get it mostly when starting OpenOffice or AcrobatReader, or Emacs. It's possible that recent Ubuntu upgrades or new graphics card drivers could have fixed it. Are you up to date? Or the original problem could be something else! Barry __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] identical scales per panel with relation=free
On 4/16/08, Andreas Krause [EMAIL PROTECTED] wrote: Using xyplot, I am plotting observed versus predicted values conditional to the values of a third variable. I would thus like to have an aspect ratio of 1 and the same axis range. Since the range of the values differs substantially between panels, the axis ranges shall be different for each panel (along the lines of relation=free). However, x- and y-limits shall still be the same for a given panel. Any ideas on how to achieve that? # Example (that produces different x/y-limits per panel) set.seed(3484) x - data.frame( x=c(rnorm(10), rnorm(10, 10)) ) x$y - x$x + rnorm(length(x$x)) x$z - c(rep(c(A, B), c(10, 10))) print(xyplot(y ~ x | z, data=x, aspect=1, scales=list( relation=free ), panel=function(x, y, ...) { panel.abline(0, 1) panel.xyplot(x, y, ...) } )) Try this: print(xyplot(y ~ x | z, data=x, aspect=1, scales=list( relation=free ), prepanel = function(x, y, ...) { r - range(x, y, ...) list(xlim = r, ylim = r) }, panel=function(x, y, ...) { panel.abline(0, 1) panel.xyplot(x, y, ...) } )) -Deepayan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Post hoc tests with lme
Using the ergoStool data cited in Mixed-Effects Models in S and S-PLUS by Pinheiro and Bates as an example, we have library(nlme) fm - lme(effort~Type-1, data=ergoStool, random=~1|Subject) summary(fm) Linear mixed-effects model fit by REML Data: ergoStool AIC BIC logLik 133.1308 141.9252 -60.5654 Random effects: Formula: ~1 | Subject (Intercept) Residual StdDev:1.332465 1.100295 Fixed effects: effort ~ Type - 1 Value Std.Error DF t-value p-value TypeT1 8.56 0.5760123 24 14.85308 0 TypeT2 12.44 0.5760123 24 21.60448 0 TypeT3 10.78 0.5760123 24 18.71102 0 TypeT4 9.22 0.5760123 24 16.01046 0 Correlation: TypeT1 TypeT2 TypeT3 TypeT2 0.595 TypeT3 0.595 0.595 TypeT4 0.595 0.595 0.595 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.80200345 -0.64316591 0.05783115 0.70099706 1.63142054 Number of Observations: 36 Number of Groups: 9 Now suppose I want to test the following hypothesis H0: TypeT1 =0 and TypeT2 = 0 I've tried estimable() and glh.test() in package gmodels, esticon() in package boBy, and linear.hypothesis() in package car, but it seems none of them would work with objects from lme: library(gmodels) estimable(fm, rbind(c(TypeT1=1), c(TypeT2=1))) Error in FUN(newX[, i], ...) : `param' has no names and does not match number of coefficients of model. Unable to construct coefficient vector glh.test(fm, rbind(c(TypeT1=1), c(TypeT2=1))) Error in glh.test(fm, rbind(c(TypeT1 = 1), c(TypeT2 = 1))) : Only defined for lm,glm objects library(doBy) esticon(fm, rbind(c(TypeT1=1), c(TypeT2=1))) Error in t(abs(t(tmp) * obj$fixDF$X)) : dims [product 2] do not match the length of object [4] In addition: Warning message: In esticon.lme(fm, rbind(c(TypeT1 = 1), c(TypeT2 = 1))) : The esticon function has not been thoroughly teste on 'lme' objects library(car) linear.hypothesis(fm, rbind(c(TypeT1=1), c(TypeT2=1))) Error in L %*% b : requires numeric matrix/vector arguments So is there any other package with which I can run this kind of tests? Thanks, Gang __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] ARAR Time Series Analysis in R
Does R have a function for doing an ARAR analysis of a time series? Tom -- View this message in context: http://www.nabble.com/ARAR-Time-Series-Analysis-in-R-tp16722577p16722577.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Confidence intervals of log transformed data
Hi I have a general statistics question on calculating confidence interval of log transformed data. I log transformed both x and y, regressed the transformed y on transformed x: lm(log(y)~log(x)), and I get the following relationship: log(y) = alpha + beta * log(x) with se as the standard error of residuals My question is how do I calculate the confidence interval in the original scale of x and y? Should I use exp(alpha + beta * log(x) +- 2 * se), or, exp(alpha + beta * log(x)) +- exp(2 * se) Thanks, -- Tom [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] SVG format from any R graphic GUI?
A reasonable question here might be, what do you intend to do with the SVG file, once you have it. OO.org does not natively import SVG files and the only import filter that I am aware of for it: http://wiki.services.openoffice.org/wiki/SVG_Import_Filter is an incomplete implementation. This means that your resultant graphic could end up 'brain damaged' after import. Not even OO.org 3.x, which is in development, will support this natively. Though they are adding PDF import functionality. Importing EPS graphs into OO.org works great and if you need a preview image, you can have one if you have the proper tools installed as Prof. Ripley notes. You can either do this from the command line or during the actual import process. Just keep in mind that what you will see in the document is the bitmapped preview, not the vector based EPS image. OO.org, like MS Office, does not render EPS images. You of course also need to print the document to a PS compatible printer, lest you simply get the bitmapped preview image output. Same thing BTW, with the default PDF export functions in OO.org. HTH, Marc Schwartz Prof Brian Ripley wrote: R 2.7.0 RC has an svg() device on Unix-alikes, and there are RSvgDevice and RSVGTipsDevice packages on CRAN. I've seen so many problems with SVG renderers (especially related to fonts) that I would prefer not to rely on it. If this is Windows, the preferred route seems to be to use EPS with a preview (which GSView can add for you). On Wed, 16 Apr 2008, Stefan Grosse wrote: On Wed, 16 Apr 2008 13:20:35 +0200 Agustin Lobo wrote: ALI have problems with emf files because OpenOffice does ALa poor job at importing figures in this format. On the other ALhand, imported eps figures are not displayed, just printed. ALIs there any R graphic gui able to export as SVG (or ALother vector format)? I've ALtried JGR, iplots and svGUI. The figures format has nothing to do with the gui. It matters which devices are supported by your R platform on your system (Win/Linux/Mac?). A quick search on r-project.org pointed me to the Cairo package. Maybe you can try that. You will also have reasonable results using the png device/graphics. usually you do something like: png(myplot.png,width=500,height=500) plot(x,y) dev.off() hth Stefan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] SVG format from any R graphic GUI?
See comments inline: Agustin Lobo wrote: Thanks for your answers, let me summarize the situation: 1. I've tested the SVG import for OO, it's not great but it is much better than what you get for EMF. I know nothing about SVG, though, perhaps it is not the best graphics format. In theory, SVG would be something of an ideal format, because it is open and provides for high quality graphics for viewing AND printing. It is being increasingly used, but still has yet to be fully supported in most applications. For example, OO.org's Draw application can generate SVG graphics, but as noted, does not fully support importing them back into the OO.org apps. 2. I need the figure displayed on the screen, I'm using Impress (the equivalent of ppt). Thus EPS is not an option, Two recommendations, if this is for presentation: 1. Use LaTeX, specifically the Beamer package. This will generate PDF slide files, which you can then display using the full screen viewing features of applications like Adobe's Reader. This is what I with R/Sweave. More information here: http://latex-beamer.sourceforge.net/ http://en.wikipedia.org/wiki/Beamer_(LaTeX) 2. Import the R EPS files into OO.org as per your normal routine. Then, when ready, print the document to a PS file, using a PS compatible printer driver. You don't actually have to have a PS printer, just install a PS driver. When you go to print the document, there will be an option someplace in the dialogs to print to file. Do so. This will give you a PS file, with the high quality vector based EPS images, not the bitmapped previews. Then use 'ps2pdf' to convert the PS file you create above to a PDF file. This leaves you in essentially the same place as LaTeX, where you can then use the full screen viewing mode of a PDF viewer. I used to use this option several years ago, before I began to use LaTeX almost exclusively. 3. I do not see any pdf import functionality in OO, I get it as text and in OO writer. PDF is not listed among the supported formats in Impress for inserting graphic files. I did not try the development version of OO, perhaps this is an alternative. PDF import will be new for OO.org 3.x. It is not available in the current 2.x stable release versions. HTH, Marc Agus Marc Schwartz escribió: A reasonable question here might be, what do you intend to do with the SVG file, once you have it. OO.org does not natively import SVG files and the only import filter that I am aware of for it: http://wiki.services.openoffice.org/wiki/SVG_Import_Filter is an incomplete implementation. This means that your resultant graphic could end up 'brain damaged' after import. Not even OO.org 3.x, which is in development, will support this natively. Though they are adding PDF import functionality. Importing EPS graphs into OO.org works great and if you need a preview image, you can have one if you have the proper tools installed as Prof. Ripley notes. You can either do this from the command line or during the actual import process. Just keep in mind that what you will see in the document is the bitmapped preview, not the vector based EPS image. OO.org, like MS Office, does not render EPS images. You of course also need to print the document to a PS compatible printer, lest you simply get the bitmapped preview image output. Same thing BTW, with the default PDF export functions in OO.org. HTH, Marc Schwartz Prof Brian Ripley wrote: R 2.7.0 RC has an svg() device on Unix-alikes, and there are RSvgDevice and RSVGTipsDevice packages on CRAN. I've seen so many problems with SVG renderers (especially related to fonts) that I would prefer not to rely on it. If this is Windows, the preferred route seems to be to use EPS with a preview (which GSView can add for you). On Wed, 16 Apr 2008, Stefan Grosse wrote: On Wed, 16 Apr 2008 13:20:35 +0200 Agustin Lobo wrote: ALI have problems with emf files because OpenOffice does ALa poor job at importing figures in this format. On the other ALhand, imported eps figures are not displayed, just printed. ALIs there any R graphic gui able to export as SVG (or ALother vector format)? I've ALtried JGR, iplots and svGUI. The figures format has nothing to do with the gui. It matters which devices are supported by your R platform on your system (Win/Linux/Mac?). A quick search on r-project.org pointed me to the Cairo package. Maybe you can try that. You will also have reasonable results using the png device/graphics. usually you do something like: png(myplot.png,width=500,height=500) plot(x,y) dev.off() hth Stefan __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] SVD of a variance matrix
No. The relationship U = V doesn't have to hold for positive-semidefinite matrices, just as it doesn't for an indefinite matrix (i.e. a matrix with both positive and negative eigenvalues), since you can have u_i = +/- (v_i )^T corresponding to the zero eigenvalue. You may refer to, for example, GW Stewart's Matrix Algorithms (vol 1. Basic decompositions, SIAM 1998), page 70. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -Original Message- From: Giovanni Petris [mailto:[EMAIL PROTECTED] Sent: Tuesday, April 15, 2008 8:07 PM To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED]; r-help@r-project.org Subject: Re: [R] SVD of a variance matrix Hi Ravi, Thank you for your useful reply. Does the result also hold for variance-covariance matrices that have one or more zero eigenvalues? Do you have a reference to suggest? Thank you again! Giovanni Date: Tue, 15 Apr 2008 18:14:11 -0400 From: Ravi Varadhan [EMAIL PROTECTED] Thread-index: AcifQeEz9B1geo3TQyesYlQGMCSuNgAAWF1QAACa9sA= Let me correct my reply a bit. U and V will differ by a factor of (-1) corresponding to negative eigenvalues (if any) of a general symmetric A. However, for symmetric positive-definite matrices (e.g. variance-covariance matrix), they will be identical. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Ravi Varadhan Sent: Tuesday, April 15, 2008 6:03 PM To: 'Giovanni Petris'; r-help@r-project.org Subject: Re: [R] SVD of a variance matrix Yes. SVD of any symmetric (which is, of course, also square) matrix will always have U = V. Also, SVD is the same as spectral decomposition, and the columns of U and V are the eigenvectors, but the singular values will be the absolute value of eigenvalues. Ravi. --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Giovanni Petris Sent: Tuesday, April 15, 2008 5:43 PM To: r-help@r-project.org Subject: [R] SVD of a variance matrix Hello! I suppose this is more a matrix theory question than a question on R, but I will give it a try... I am using La.svd to compute the singular value decomposition (SVD) of a variance matrix, i.e., a symmetric nonnegative definite square matrix. Let S be my variance matrix, and S = U D V' be its SVD. In my numerical experiments I always got U = V. Is this necessarily the case? Or I might eventually run into a SVD which has U != V? Thank you in advance for your insights and pointers. Giovanni -- Giovanni Petris [EMAIL PROTECTED] Associate Professor Department of Mathematical Sciences University of Arkansas - Fayetteville, AR 72701 Ph: (479) 575-6324, 575-8630 (fax) http://definetti.uark.edu/~gpetris/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] What objects will save.image saves ? And how to specify objects to be saved..
save.image() is a wrapper for save() (Type 'save.image' (without quotes) at the prompt to see the code for the function.) Try something like this (not tested): load(oldvars.RData) old.vars - ls(all=TRUE) ... computation ... save(list=setdiff(ls(all=TRUE), old.vars), file=newvars.RData) You can play with the args (pattern= all=) of ls() to select which vars you are interested in. If your computations might change some of the existing variables, and you want to save those at the end too, you'll probably have to keep track of those manually. AFAIK, it's not possible to add some new vars to an existing .RData file -- that's why I wrote the above to save them in a .RData file that's different to the one that contained the old variables. -- Tony Plate Ng Stanley wrote: Read and reread, can't make out. Will try an experiment later On Wed, Apr 16, 2008 at 7:51 PM, Henrique Dallazuanna [EMAIL PROTECTED] wrote: See ?save On Wed, Apr 16, 2008 at 8:46 AM, Ng Stanley [EMAIL PROTECTED] wrote: Hi, I have a R script that loads an image R.data, does some operations, then save to the R.data again. Suppose I have done some computation before loading the R script, will all the objects before the R script execution be saved to R.data ? If yes, how can I specify save.image to save only those objects created in the R script ? Thanks Stanley [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.htmlhttp://www.r-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40 S 49° 16' 22 O [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Brown-Forsythe F* Statistic
Richard M. Heiberger wrote: The Brown-Forsyth test is included in the HH library in function hov(). hov is homogeneity of variance. Use hov(y ~ x, data=mydata) and plot.hov(y ~ x, data=mydata) Are you guys talking about the same thing? One seems to be talking about a modified F test for comparison of means, the other about comparison of variances. Rich __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Meaning of /, :, and %in% in lmer
Hello, I asked this question a little while ago ( https://stat.ethz.ch/pipermail/r-help/2008-April/158761.html ) but got no response. Can anybody explain to me the difference between /, :, and %in% in the definition of random effects in lmer, such as: (1|A/B), (1|A:B), (1|B %in% A)? My understanding is that (1|A/B) is the same as (1|A) + (1|A:B), but I have not seen this stated explicitly anywhere. And I don't understand why (1|A/B) seems to be different from (1|A) + (1|B %in% A), isn't that what %in% means? Thanks a lot for your help, Claus Wilke -- Claus Wilke Section of Integrative Biology and Center for Computational Biology and Bioinformatics University of Texas at Austin 1 University Station C0930 Austin, TX 78712 [EMAIL PROTECTED] 512 471 6028 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Formula with no intercept
R may not be giving you what you want, but it is doing the right thing. You can change what the base category is through contrasts but you can't get the marginal effects for every level of all factors because this creates a linear dependence in the model matrix. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gang Chen Sent: Monday, April 14, 2008 5:38 PM To: [EMAIL PROTECTED] Subject: [R] Formula with no intercept I'm trying to analyze a model with two variables, one is Group with two levels (male and female), and other is Time with four levels (T1, T2, T3 and T4). And for the convenience of post-hoc testing I wanted to consider a model with no intercept for factor Time, so I tried formula Group*(Time-1) However this seems to give me the following terms in the model GroupMale, GroupFemale, TimeT2, TimeT3, TimeT4, GroupMale:TimeT2, GroupMale:TimeT3, GroupMale:TimeT4, GroupFemale:TimeT2, GroupFemale:TimeT3, GroupFemale:TimeT4 which is not exactly what I wanted. Also it seems (Group-1)*Time and (Group-1)*(Time-1) also give me exactly the same set of terms as Group*(Time-1). So I have some conceptual trouble understanding this. And how could I create a model with terms including all the levels of factor Time? Thanks, Gang __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] SVG format from any R graphic GUI?
Thanks for your answers, let me summarize the situation: 1. I've tested the SVG import for OO, it's not great but it is much better than what you get for EMF. I know nothing about SVG, though, perhaps it is not the best graphics format. 2. I need the figure displayed on the screen, I'm using Impress (the equivalent of ppt). Thus EPS is not an option, 3. I do not see any pdf import functionality in OO, I get it as text and in OO writer. PDF is not listed among the supported formats in Impress for inserting graphic files. I did not try the development version of OO, perhaps this is an alternative. Agus Marc Schwartz escribió: A reasonable question here might be, what do you intend to do with the SVG file, once you have it. OO.org does not natively import SVG files and the only import filter that I am aware of for it: http://wiki.services.openoffice.org/wiki/SVG_Import_Filter is an incomplete implementation. This means that your resultant graphic could end up 'brain damaged' after import. Not even OO.org 3.x, which is in development, will support this natively. Though they are adding PDF import functionality. Importing EPS graphs into OO.org works great and if you need a preview image, you can have one if you have the proper tools installed as Prof. Ripley notes. You can either do this from the command line or during the actual import process. Just keep in mind that what you will see in the document is the bitmapped preview, not the vector based EPS image. OO.org, like MS Office, does not render EPS images. You of course also need to print the document to a PS compatible printer, lest you simply get the bitmapped preview image output. Same thing BTW, with the default PDF export functions in OO.org. HTH, Marc Schwartz Prof Brian Ripley wrote: R 2.7.0 RC has an svg() device on Unix-alikes, and there are RSvgDevice and RSVGTipsDevice packages on CRAN. I've seen so many problems with SVG renderers (especially related to fonts) that I would prefer not to rely on it. If this is Windows, the preferred route seems to be to use EPS with a preview (which GSView can add for you). On Wed, 16 Apr 2008, Stefan Grosse wrote: On Wed, 16 Apr 2008 13:20:35 +0200 Agustin Lobo wrote: ALI have problems with emf files because OpenOffice does ALa poor job at importing figures in this format. On the other ALhand, imported eps figures are not displayed, just printed. ALIs there any R graphic gui able to export as SVG (or ALother vector format)? I've ALtried JGR, iplots and svGUI. The figures format has nothing to do with the gui. It matters which devices are supported by your R platform on your system (Win/Linux/Mac?). A quick search on r-project.org pointed me to the Cairo package. Maybe you can try that. You will also have reasonable results using the png device/graphics. usually you do something like: png(myplot.png,width=500,height=500) plot(x,y) dev.off() hth Stefan -- Dr. Agustin Lobo Institut de Ciencies de la Terra Jaume Almera (CSIC) LLuis Sole Sabaris s/n 08028 Barcelona Spain Tel. 34 934095410 Fax. 34 934110012 email: [EMAIL PROTECTED] http://www.ija.csic.es/gt/obster __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] memory issues
Hi all, I've read the R for windows FAQ and am a little confused re: memory.limit and memory.size to start using R 2.6.2 on WinXP, 2GB RAM, I have the command line sdi --max-mem-size=2047M Once the Rgui is open, memory.limit() returns 2047, memory.size() returns 11.315, and memory.size(max=T) returns 19.615 Shouldn't memory.size(max=T) return 2047? Upon running several operations involving kriging (gstat package, original data file 3 variables, 12000 observations) the program runs out of memory memory.c, line 57: can't allocate memory in function m_get() Error in predict.gstat(fit.uk, newdata = EcoSAV.grid.clip.spxdf, debug.level = -2, : m_get Immediately following this, memory.limit() returns [1] -Inf Warning message: In memory.limit() : no non-missing arguments to max; returning -Inf memory.size() returns 24.573. memory.size(max=T) returns 46.75 To my untrained eye, it appears that R is not being allowed access to the full memory limit specified in the cmd lineif this is the case, how does one ensure that R is getting access to the full allotment of RAM? Any insight is appreciated... sessionInfo() R version 2.6.2 (2008-02-08) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices datasets tcltk utils methods base other attached packages: [1] maptools_0.7-7 foreign_0.8-23 gstat_0.9-43 rgdal_0.5-24 lattice_0.17-4 sp_0.9-23 svSocket_0.9-5 svIO_0.9-5 R2HTML_1.58svMisc_0.9-5 svIDE_0.9-5 loaded via a namespace (and not attached): [1] grid_2.6.2 tools_2.6.2 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] basehaz and newdata
Survfit returns an Error in temp[, 1] : incorrect number of dimensions error message when I attempt to use newdata to validate my models. The syntax I am using is sfit - survfit(mod1, newdata=testd, individual=T). The dataframe testd has two columns and 39 rows (see below). The rows are the monthly values of the independent variable in subsequent months, and the number of months. When I remove the individual=T option I get the 39 curves I would expect. Am I misunderstanding the intent of survfit/newdata/ individual, or is the syntax incorrect? Mod1 is the following Call: coxph(formula = Surv(Inv_Months) ~ sb_rat_12, data = dfname_c) coef exp(coef) se(coef)z p sb_rat_12 1.22 3.400.132 9.28 0 Likelihood ratio test=84.6 on 1 df, p=0 n= 8405 the dataframe testd is the following: Inv_Months sb_rat_12 1 1.023567 2 0.989322 3 0.952052 4 0.973252 5 0.916755 6 0.891067 7 0.912577 8 0.911228 9 0.886093 10 0.875797 11 0.869389 12 0.859579 13 0.879346 14 0.89506 15 0.925471 16 0.909221 17 0.924457 18 0.967833 19 0.966343 20 0.965692 21 0.972147 22 0.974816 23 0.995564 24 0.961251 25 0.921189 26 0.90495 27 0.908382 28 0.924647 29 0.917796 30 0.841098 31 0.827645 32 0.838338 34 0.916267 36 0.993804 39 1.116348 40 1.093067 41 1.135917 45 1.322135 46 1.302194 Thanks in advance! Mike On Apr 8, 8:47 am, Terry Therneau [EMAIL PROTECTED] wrote: The 'basehaz' function is just a wrapper forsurvfit, and includes only some of the arguments of the former. It's main reason for existence is that another more well known (but inferior :-) package uses that term. I don't understand the final comment in the exchange, however: I had been hoping the tedious alignment of the baseline curve with the value of the variables in the new data set would be [somehow] handled for me. Terry Therneau __ [EMAIL PROTECTED] mailing listhttps://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guidehttp://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] memory issues
Hi all, I've read the R for windows FAQ and am a little confused re: memory.limit and memory.size to start using R 2.6.2 on WinXP, 2GB RAM, I have the command line sdi --max-mem-size=2047M Once the Rgui is open, memory.limit() returns 2047, memory.size() returns 11.315, and memory.size(max=T) returns 19.615 Shouldn't memory.size(max=T) return 2047? Upon running several operations involving kriging (gstat package, original data file 3 variables, 12000 observations) the program runs out of memory memory.c, line 57: can't allocate memory in function m_get() Error in predict.gstat(fit.uk, newdata = EcoSAV.grid.clip.spxdf, debug.level = -2, : m_get Immediately following this, memory.limit() returns [1] -Inf Warning message: In memory.limit() : no non-missing arguments to max; returning -Inf memory.size() returns 24.573. memory.size(max=T) returns 46.75 To my untrained eye, it appears that R is not being allowed access to the full memory limit specified in the cmd lineif this is the case, how does one ensure that R is getting access to the full allotment of RAM? Any insight is appreciated... sessionInfo() R version 2.6.2 (2008-02-08) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices datasets tcltk utils methods base other attached packages: [1] maptools_0.7-7 foreign_0.8-23 gstat_0.9-43 rgdal_0.5-24 lattice_0.17-4 sp_0.9-23 svSocket_0.9-5 svIO_0.9-5 R2HTML_1.58svMisc_0.9-5 svIDE_0.9-5 loaded via a namespace (and not attached): [1] grid_2.6.2 tools_2.6.2 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Weekdays only on x-axis
Hi All, I am a relative newbie at R and I am trying to plot some intraday price data over a long period of time. I would like to use a weekday(only) scale for x-axis. Can anyone tell me how to go about this? When I plot just the prices it looks fine, but when I add in the Dates/Times vs prices - I get gaps on the weekends and holidays... by default R wants to use a continuous time scale inclusive of weekends i looked at zoo and gap.plot from plotrix but neither of these seem to do what I want... Any help is much appreciated Cheers -- View this message in context: http://www.nabble.com/Weekdays-only-on-x-axis-tp16732251p16732251.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [R-sig-ME] Post hoc tests with lme
At the risk of annoying Doug Bates, I'll point out that glht in the multcomp package works with lmer objects. In fact, you can supply your own degrees of freedom value via the df argument (a fact which is not immediately obvious in the glht help page). If you don't supply a df value, it will use Inf (i.e., normal instead of t). Regards, Rob Kushler Gang Chen wrote: Using the ergoStool data cited in Mixed-Effects Models in S and S-PLUS by Pinheiro and Bates as an example, we have library(nlme) fm - lme(effort~Type-1, data=ergoStool, random=~1|Subject) summary(fm) Linear mixed-effects model fit by REML Data: ergoStool AIC BIC logLik 133.1308 141.9252 -60.5654 Random effects: Formula: ~1 | Subject (Intercept) Residual StdDev:1.332465 1.100295 Fixed effects: effort ~ Type - 1 Value Std.Error DF t-value p-value TypeT1 8.56 0.5760123 24 14.85308 0 TypeT2 12.44 0.5760123 24 21.60448 0 TypeT3 10.78 0.5760123 24 18.71102 0 TypeT4 9.22 0.5760123 24 16.01046 0 Correlation: TypeT1 TypeT2 TypeT3 TypeT2 0.595 TypeT3 0.595 0.595 TypeT4 0.595 0.595 0.595 Standardized Within-Group Residuals: Min Q1 Med Q3 Max -1.80200345 -0.64316591 0.05783115 0.70099706 1.63142054 Number of Observations: 36 Number of Groups: 9 Now suppose I want to test the following hypothesis H0: TypeT1 =0 and TypeT2 = 0 I've tried estimable() and glh.test() in package gmodels, esticon() in package boBy, and linear.hypothesis() in package car, but it seems none of them would work with objects from lme: library(gmodels) estimable(fm, rbind(c(TypeT1=1), c(TypeT2=1))) Error in FUN(newX[, i], ...) : `param' has no names and does not match number of coefficients of model. Unable to construct coefficient vector glh.test(fm, rbind(c(TypeT1=1), c(TypeT2=1))) Error in glh.test(fm, rbind(c(TypeT1 = 1), c(TypeT2 = 1))) : Only defined for lm,glm objects library(doBy) esticon(fm, rbind(c(TypeT1=1), c(TypeT2=1))) Error in t(abs(t(tmp) * obj$fixDF$X)) : dims [product 2] do not match the length of object [4] In addition: Warning message: In esticon.lme(fm, rbind(c(TypeT1 = 1), c(TypeT2 = 1))) : The esticon function has not been thoroughly teste on 'lme' objects library(car) linear.hypothesis(fm, rbind(c(TypeT1=1), c(TypeT2=1))) Error in L %*% b : requires numeric matrix/vector arguments So is there any other package with which I can run this kind of tests? Thanks, Gang ___ [EMAIL PROTECTED] mailing list https://stat.ethz.ch/mailman/listinfo/r-sig-mixed-models __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] efficiently replacing values in a matrix
Hello all, I should probably know this by now... Anyway: I have a large matrix (dim(data) is 3000 18000). In each element are one of the following character strings 0/0, 1/1, 1/2, 2/2. I wanted to replace 0/0 with NA and the other three with 0,1,2 respectively. To accomplish just the first of these four steps I did this: data[data==0/0] - NA Which is still running after 13 hours. I have 18 GB RAM and running 64 bit R. What is a more efficient way to accomplish this (I've already done it using sed in UNIX - but want to know how to do so in R)? Thanks in advance, Matt -- Matthew C Keller Asst. Professor of Psychology University of Colorado at Boulder www.matthewckeller.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Weekdays only on x-axis
Hi All, I am a relative newbie at R and I am trying to plot some intraday price data over a long period of time. I would like to use a weekday(only) scale for x-axis. Can anyone tell me how to go about this? When I plot just the prices it looks fine, but when I add in the Dates/Times vs prices - I get gaps on the weekends and holidays... by default R wants to use a continuous time scale inclusive of weekends i looked at zoo and gap.plot from plotrix but neither of these seem to do what I want... Any help is much appreciated Cheers -- View this message in context: http://www.nabble.com/Weekdays-only-on-x-axis-tp16732269p16732269.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Formula with no intercept
On Wed, 16 Apr 2008, Doran, Harold wrote: R may not be giving you what you want, but it is doing the right thing. You can change what the base category is through contrasts but you can't get the marginal effects for every level of all factors because this creates a linear dependence in the model matrix. I suspect that Time*Group - 1 or Time*(Group-1) come closer to the aim. It is the first factor in the model which is coded without contrasts in a no-intercept model. Once you include interactions I think the 'convenience' is largely lost, and packages such as multcomp can post-hoc test any (coherent) set of hypotheses you choose, irrespective of the model parametrization. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gang Chen Sent: Monday, April 14, 2008 5:38 PM To: [EMAIL PROTECTED] Subject: [R] Formula with no intercept I'm trying to analyze a model with two variables, one is Group with two levels (male and female), and other is Time with four levels (T1, T2, T3 and T4). And for the convenience of post-hoc testing I wanted to consider a model with no intercept for factor Time, so I tried formula Group*(Time-1) However this seems to give me the following terms in the model GroupMale, GroupFemale, TimeT2, TimeT3, TimeT4, GroupMale:TimeT2, GroupMale:TimeT3, GroupMale:TimeT4, GroupFemale:TimeT2, GroupFemale:TimeT3, GroupFemale:TimeT4 which is not exactly what I wanted. Also it seems (Group-1)*Time and (Group-1)*(Time-1) also give me exactly the same set of terms as Group*(Time-1). So I have some conceptual trouble understanding this. And how could I create a model with terms including all the levels of factor Time? Thanks, Gang __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] save a graph in horizontal way (using pdf())
You might find the width and height arguments useful also. HTH On Wed, 16-Apr-2008 at 08:19AM -0300, Henrique Dallazuanna wrote: | See in ?pdf function, 'paper' argument. | | On Wed, Apr 16, 2008 at 7:56 AM, Josu? Polanco [EMAIL PROTECTED] wrote: | | Hello everybody, | | I want to save a graphic using the pdf environment, everything in | order, | but I can not | to save the graph in horizontal way. I have read the manual (to plot, | par), the FAQ, google, but nothing I found that can help me. Anyone can | say | me a hint? | | Thanks a lot, | | -- | Josue | | [[alternative HTML version deleted]] | | __ | R-help@r-project.org mailing list | https://stat.ethz.ch/mailman/listinfo/r-help | PLEASE do read the posting guide | http://www.R-project.org/posting-guide.html | and provide commented, minimal, self-contained, reproducible code. | | | | | -- | Henrique Dallazuanna | Curitiba-Paran?-Brasil | 25? 25' 40 S 49? 16' 22 O | | [[alternative HTML version deleted]] | | __ | R-help@r-project.org mailing list | https://stat.ethz.ch/mailman/listinfo/r-help | PLEASE do read the posting guide http://www.R-project.org/posting-guide.html | and provide commented, minimal, self-contained, reproducible code. -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] efficiently replacing values in a matrix
On 17/04/2008, at 7:52 AM, Matthew Keller wrote: Hello all, I should probably know this by now... Anyway: I have a large matrix (dim(data) is 3000 18000). In each element are one of the following character strings 0/0, 1/1, 1/2, 2/2. I wanted to replace 0/0 with NA and the other three with 0,1,2 respectively. To accomplish just the first of these four steps I did this: data[data==0/0] - NA Which is still running after 13 hours. I have 18 GB RAM and running 64 bit R. What is a more efficient way to accomplish this (I've already done it using sed in UNIX - but want to know how to do so in R)? Thanks in advance. Well I just did gorp - c(0/0,1/1,1/2,2/2) mung - matrix(sample(gorp,54e6,TRUE),3000,18000) mung[mung==0/0] - NA and the whole schmear ran in under half a minute of real time. sessionInfo() R version 2.6.2 (2008-02-08) i386-apple-darwin8.10.1 locale: C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] misc_0.0-2 loaded via a namespace (and not attached): [1] rcompgen_0.1-17 I would say that something is seriously snarled up in your system. cheers, Rolf Turner ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] efficiently replacing values in a matrix
On Thu, 17 Apr 2008, Rolf Turner wrote: On 17/04/2008, at 7:52 AM, Matthew Keller wrote: Hello all, I should probably know this by now... Anyway: I have a large matrix (dim(data) is 3000 18000). In each element are one of the following character strings 0/0, 1/1, 1/2, 2/2. I wanted to replace 0/0 with NA and the other three with 0,1,2 respectively. To accomplish just the first of these four steps I did this: data[data==0/0] - NA Which is still running after 13 hours. I have 18 GB RAM and running 64 bit R. What is a more efficient way to accomplish this (I've already done it using sed in UNIX - but want to know how to do so in R)? Thanks in advance. Well I just did gorp - c(0/0,1/1,1/2,2/2) mung - matrix(sample(gorp,54e6,TRUE),3000,18000) mung[mung==0/0] - NA and the whole schmear ran in under half a minute of real time. Likewise. I'll lay odds that Matthew's 'matrix' is actually a data.frame, and I'll not be surprised if the columns are factors. In which case mung2 - as.data.frame(lapply( mung, function(x) { levels(x)[ levels(x)=='0/0' ] - NA x } )) will be faster, but still not as fast as what you show with a matrix. HTH, Chuck sessionInfo() R version 2.6.2 (2008-02-08) i386-apple-darwin8.10.1 locale: C attached base packages: [1] stats graphics grDevices utils datasets methods base other attached packages: [1] misc_0.0-2 loaded via a namespace (and not attached): [1] rcompgen_0.1-17 I would say that something is seriously snarled up in your system. cheers, Rolf Turner ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Charles C. Berry(858) 534-2098 Dept of Family/Preventive Medicine E mailto:[EMAIL PROTECTED] UC San Diego http://famprevmed.ucsd.edu/faculty/cberry/ La Jolla, San Diego 92093-0901 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] efficiently replacing values in a matrix
On 17/04/2008, at 9:33 AM, Charles C. Berry wrote: snip I'll lay odds that Matthew's 'matrix' is actually a data.frame, and I'll not be surprised if the columns are factors. snip I suspect that you're right. ***Why*** can't people distinguish between data frames and matrices? If they were the same expletive deleted thing, there wouldn't be two different terms for them, would there? cheers, Rolf Turner ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] memory issues
I think the clue is that the message you quote comes from gstat, which does not use R's memory allocator. It is gstat and not R that has failed to allocate memory. Try re-reading the help page for memory.size. 'max=T' does not indicate the limit (that is the job of memory.limit()), but the maximum 'used' (acquired from the OS) in that session. So 19Mb looks reasonable for R's usage. I don't understand the message from memory.limit() (and the formatting is odd). memory.limit() does not call max() (it is entirely internal), so I wonder if that really is the output from that command. (If you can reproduce it, please let us have precise reproduction instructions.) There isn't much point in increasing the memory limit from the default 1.5Gb on a 2Gb XP machine. The problem is that the user address space limit is 2Gb and fragmentation means that you are unlikely to be able to get over 1.5Gb unless you have very many small objects, in which case R will run very slowly. In any case, that is not the issue here. On Wed, 16 Apr 2008, Dave Depew wrote: Hi all, I've read the R for windows FAQ and am a little confused re: memory.limit and memory.size to start using R 2.6.2 on WinXP, 2GB RAM, I have the command line sdi --max-mem-size=2047M Once the Rgui is open, memory.limit() returns 2047, memory.size() returns 11.315, and memory.size(max=T) returns 19.615 Shouldn't memory.size(max=T) return 2047? Upon running several operations involving kriging (gstat package, original data file 3 variables, 12000 observations) the program runs out of memory memory.c, line 57: can't allocate memory in function m_get() Error in predict.gstat(fit.uk, newdata = EcoSAV.grid.clip.spxdf, debug.level = -2, : m_get Immediately following this, memory.limit() returns [1] -Inf Warning message: In memory.limit() : no non-missing arguments to max; returning -Inf memory.size() returns 24.573. memory.size(max=T) returns 46.75 To my untrained eye, it appears that R is not being allowed access to the full memory limit specified in the cmd lineif this is the case, how does one ensure that R is getting access to the full allotment of RAM? Any insight is appreciated... sessionInfo() R version 2.6.2 (2008-02-08) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices datasets tcltk utils methods base other attached packages: [1] maptools_0.7-7 foreign_0.8-23 gstat_0.9-43 rgdal_0.5-24 lattice_0.17-4 sp_0.9-23 svSocket_0.9-5 svIO_0.9-5 R2HTML_1.58svMisc_0.9-5 svIDE_0.9-5 loaded via a namespace (and not attached): [1] grid_2.6.2 tools_2.6.2 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] efficiently replacing values in a matrix
Yes Chuck, you're right. Thanks for the help. It was a data.frame not a matrix (I had called as.matrix() in my script much earlier but that line of code didn't run because I misnamed the object!). My bad. Thanks for the help. And I'm VERY relieved R isn't that inefficient... Matt On Wed, Apr 16, 2008 at 3:39 PM, Rolf Turner [EMAIL PROTECTED] wrote: On 17/04/2008, at 9:33 AM, Charles C. Berry wrote: snip I'll lay odds that Matthew's 'matrix' is actually a data.frame, and I'll not be surprised if the columns are factors. snip I suspect that you're right. ***Why*** can't people distinguish between data frames and matrices? If they were the same expletive deleted thing, there wouldn't be two different terms for them, would there? cheers, Rolf Turner ## Attention:This e-mail message is privileged and confidential. If you are not theintended recipient please delete the message and notify the sender.Any views or opinions presented are solely those of the author. This e-mail has been scanned and cleared by MailMarshalwww.marshalsoftware.com ## -- Matthew C Keller Asst. Professor of Psychology University of Colorado at Boulder www.matthewckeller.com __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Brown-Forsythe F* Statistic
You're right-- I think we're not talking about the same thing. It looks to me like the hov() function in the HH package is a test for whether or not the variances are different. What I was looking for was a test (also by Brown-Forsyth, and referred to as the F* statistic in my textbook) for testing whether means are different-- a test useful for the case where the distribution is non-normal (e.g. skewed) and the variances are unequal. On Wed, Apr 16, 2008 at 3:18 PM, Peter Dalgaard [EMAIL PROTECTED] wrote: Richard M. Heiberger wrote: The Brown-Forsyth test is included in the HH library in function hov(). hov is homogeneity of variance. Use hov(y ~ x, data=mydata) and plot.hov(y ~ x, data=mydata) Are you guys talking about the same thing? One seems to be talking about a modified F test for comparison of means, the other about comparison of variances. Rich __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 -- Paul Lynch Aquilent, Inc. National Library of Medicine (Contractor) __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] memory issues
Oddly enough, the variogram modelling is rather quick in Surfer, but one cannot compute the standard errors. I restricted the search to the approximate the range of the variogram model (2000m). I can get R to compute with 12079 observations, but 13453 and I run into the gstat error message. I guess it's really down to 1) trying to reduce the original dataset 2) adding 1 to 2 Gb of RAM 3) running the predictions on a Linux machine with suitable RAM. I couldn't reproduce the memory.limit() issue. I'll chalk that up to errant typing on my part. Quoting Rubén Roa-Ureta [EMAIL PROTECTED]: I think any geostatistical program/R package would have trouble handling 12000 observations on a PC. The empirical variogram would be built with the combinations of 12000 over 2 pairs, nearly 72 millions pairs, and during kriging, if you didn't restrict the search neighbourhood, interpolation would involve solving something very big, more so if you defined a fine grid, ... Try restricting the search neighbourhood, if you didn't, with maxdist and nmax. Rubén Prof Brian Ripley wrote: I think the clue is that the message you quote comes from gstat, which does not use R's memory allocator. It is gstat and not R that has failed to allocate memory. Try re-reading the help page for memory.size. 'max=T' does not indicate the limit (that is the job of memory.limit()), but the maximum 'used' (acquired from the OS) in that session. So 19Mb looks reasonable for R's usage. I don't understand the message from memory.limit() (and the formatting is odd). memory.limit() does not call max() (it is entirely internal), so I wonder if that really is the output from that command. (If you can reproduce it, please let us have precise reproduction instructions.) There isn't much point in increasing the memory limit from the default 1.5Gb on a 2Gb XP machine. The problem is that the user address space limit is 2Gb and fragmentation means that you are unlikely to be able to get over 1.5Gb unless you have very many small objects, in which case R will run very slowly. In any case, that is not the issue here. On Wed, 16 Apr 2008, Dave Depew wrote: Hi all, I've read the R for windows FAQ and am a little confused re: memory.limit and memory.size to start using R 2.6.2 on WinXP, 2GB RAM, I have the command line sdi --max-mem-size=2047M Once the Rgui is open, memory.limit() returns 2047, memory.size() returns 11.315, and memory.size(max=T) returns 19.615 Shouldn't memory.size(max=T) return 2047? Upon running several operations involving kriging (gstat package, original data file 3 variables, 12000 observations) the program runs out of memory memory.c, line 57: can't allocate memory in function m_get() Error in predict.gstat(fit.uk, newdata = EcoSAV.grid.clip.spxdf, debug.level = -2, : m_get Immediately following this, memory.limit() returns [1] -Inf Warning message: In memory.limit() : no non-missing arguments to max; returning -Inf memory.size() returns 24.573. memory.size(max=T) returns 46.75 To my untrained eye, it appears that R is not being allowed access to the full memory limit specified in the cmd lineif this is the case, how does one ensure that R is getting access to the full allotment of RAM? Any insight is appreciated... sessionInfo() R version 2.6.2 (2008-02-08) i386-pc-mingw32 locale: LC_COLLATE=English_United States.1252;LC_CTYPE=English_United States.1252;LC_MONETARY=English_United States.1252;LC_NUMERIC=C;LC_TIME=English_United States.1252 attached base packages: [1] stats graphics grDevices datasets tcltk utils methods base other attached packages: [1] maptools_0.7-7 foreign_0.8-23 gstat_0.9-43 rgdal_0.5-24 lattice_0.17-4 sp_0.9-23 svSocket_0.9-5 svIO_0.9-5 R2HTML_1.58svMisc_0.9-5 svIDE_0.9-5 loaded via a namespace (and not attached): [1] grid_2.6.2 tools_2.6.2 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Problems with R2WinBUGS
Hello, I am trying to use R2WinBUGS to conduct a mixed treatment comparison (MTC) analysis. On the surface, it seems to me that I am following the correct steps: (1) reading the data into R, (2) specifying initial values for the parameters in the model and (3) fitting the model to the data using the bugs() function in R2WinBUGS.However, I get the error message âincompatible copyâ when running bugs(), which is a bit confusing, given that I was able to fit the same model without problems in WinBUGS. The WinBUGS log file produced after calling bugs() indicates that the following items were successfully checked: âmodel is syntactically correctâ, âdata loadedâ and âmodel compiledâ. I suspect R2WinBUGS does not like the initialization of the model parameters (?!) â the log file abruptly ends after listing the inits() command. Has anyone encountered similar problems with R2WinBUGS? If so, can you please point me in the right direction? Is there a preferred way to initialize the values of the parameters? Things one should do or should not do? In case this may help, here is the R code that I used: library(R2WinBUGS) s = c(1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10, 11,11,12,12,13,13,14,14,15,15,16,16,17,17,18,18,19,19,20,20) t = c(1,2, 1,2, 1,2, 1,2, 1,2, 1,3, 1,3, 1,4, 1,4, 1,4, 1,4, 1,4, 1,4, 1,4, 1,4, 1,4, 1,4, 1,4, 1,5, 1,5) r = c(320,297, 1,5, 82,61, 68,70, 212,185, 138,143, 5,4, 78,87, 3,0, 0,1, 135,106, 306,298, 12,13, 79,55, 4,3, 9,5, 0,1, 641,631, 77,80, 9,1) n = c(636,619, 114,240, 1410,1428, 1199,1211, 5137,5168, 1052,1050, 285,283, 1634,2219, 532,530, 254,254, 3293,3302, 2913,2891, 431,433, 3966,3866, 223,224, 81,83, 154,151, 5185,5170, 3301, 3304, 459,460) b = c(rep(1,40)) N = 40 NS = 20 NT = 5 data - list(s,t,r,n,b,N,NS,NT) inits - function(){ list(T=c(0.02,0.02,0.02,0.02,0.02), best=c(0,0.4,0.07,0.13,0.3), d=c(NA,0,0,0,0), lor=c(-0.12,0.03,-0.07,-0.06,0.16,0.04,0.06,0.11,-0.09,0.01), mu=c(0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0, 0,0,0,0,0), or=c(0.88,1.04,0.92,0.95,1.18,1.05,1.08,0.90,0.92,1.02), p=c(0.50,0.47,0.01,0.01,0.05,0.04,0.06,0.05,0.04,0.03,0.13, 0.13,0.01,0.01,0.04,0.04,0.00,0.00,0.00,0.00, 0.03,0.03,0.10,0.10,0.03,0.02,0.01,0.01,0.01, 0.01,0.08,0.08,0.00,0.00,0.12,0.11,0.02,0.02,0.01,0.01)) } model.sim = bugs(data,inits, model.file=model.bug, parameters=c(T,best,d,lor,mu,or,p), n.chains=1,n.iter=2,n.burnin=5000,n.thin=1, bugs.directory=c:/Program Files/WinBUGS14/, codaPkg=FALSE, debug=FALSE) Thank you in advance for any help you may be able to provide! Sincerely, Isabella Isabella R. Ghement, Ph.D. Ghement Statistical Consulting Company 301-7031 Blundell Road, Richmond, B.C., Canada, V6Y 1J5 Tel: 604-767-1250 Fax: 604-270-3922 E-mail: [EMAIL PROTECTED] Web: www.ghement.ca __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Converting from encapsulated postscript to encapsulated pdf
I have several old encapsulated postscript graphics generated by R that I want to include in a LaTeX Beamer presentation so I want them in pdf. Under Ubuntu linux typing convert z.eps z.pdf (to use ImageMagick) results in a nice looking graphic but the bounding box is lost. Doing convert z.eps z.epdf results in a fuzzy image with a good bounding box. Does anyone have a nice solution? Thanks Frank -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Converting from encapsulated postscript to encapsulated pdf
Frank E Harrell Jr wrote: I have several old encapsulated postscript graphics generated by R that I want to include in a LaTeX Beamer presentation so I want them in pdf. Under Ubuntu linux typing convert z.eps z.pdf (to use ImageMagick) results in a nice looking graphic but the bounding box is lost. Doing convert z.eps z.epdf results in a fuzzy image with a good bounding box. Does anyone have a nice solution? Thanks Frank Frank, Do you only have EPS files or do you also need to include PDF files? If the former, you can use Beamer with latex - dvips - ps2pdf as an alternative to using pdflatex as a single step. If you need to have them as PDF's, two other options: 1. Use 'epstopdf': http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/epstopdf.html which is a Perl script that uses GS to do the conversion. 2. Use 'epstopdf.sty', which is part of the oberdiek CTAN bundle. This will enable the conversion of the EPS files to PDF as part of using pdflatex. A link is here: http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/epstopdf-pkg.html This will actually call the epstopdf Perl script above. HTH, Marc __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problems with R2WinBUGS
isabella at ghement.ca writes: Hello, I am trying to use R2WinBUGS to conduct a mixed treatment comparison (MTC) analysis. Thank you in advance for any help you may be able to provide! Can you please provide your model.bug file? Ben Bolker __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how to connect dots by passing NA
This maybe a silly question. I'm trying to figure out a way to draw a line from a data set which contain NA. Say, I have a set of data as: x - c(1.1 2.2 NA 4.4 5.5) ; y - c(1:5) # as x,y of point a, b, c, d, and e. I would like to plot this to a line by using dot-line to connect the two adjacent points before and after the NA, something like: (a)__(b)..(d)__(e) Any help will be very appreciated. -- Smiles, Timothy Huang 黃大ㄧ 43, Lane 525, Section 3, AnKang Road, XinDian City Taipei County, Taiwan 23156, Rep. of China 台北縣23156新店市安康路三段525巷43號 Tel 886-2-2214-0517 Fax 886-2-2214-4201 Get Skype http://www.skype.com/go/download and call me for free. Web: www.dinodragon.com http://www.dinodragon.com/ Blog: http://tw.myblog.yahoo.com/timd_huang/ Blog: http://bloguide.ettoday.com/dinodragon/ Web: http://www.meteoritefossilgallery.com/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Suggestions: Terminology Pkgs for following spectra over time
Hi Folks... No code to troubleshoot here. I need some suggestions about the right terminology to use in further searching, and any suggestions about R pkgs that might be appropriate. I am in the planning stages of a project in which IR, NMR and other spectra (I'm a chemist) would be collected on various samples, and individual samples would be followed over time. The spectra will be feature rich/complex, so one can't see the changes by visual inspection. The spectra are basically 2D matrices: peaks as a function of frequencies. So the data set is in the form of spectra of a single sample over time, for multiple samples. I am wondering about methods R pkgs that can be used to analyze changes in the spectra over time. For instance, I would like to find specific peaks that are changing over time, sets of peaks that are changing in a correlated way over time etc. I'd like to do this in an efficient and statistically valid way. What I am thinking of is somewhat like a time series, somewhat like image analysis (but only 2D), but it's not quite either of those and I need to know what it's really called to investigate further. Any suggestions as to R pkgs and key words/phrases will be appreciated. TIA, Bryan * Bryan Hanson Professor of Chemistry Biochemistry DePauw University, Greencastle Indiana USA __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Converting from encapsulated postscript to encapsulated pdf
Marc Schwartz wrote: Frank E Harrell Jr wrote: I have several old encapsulated postscript graphics generated by R that I want to include in a LaTeX Beamer presentation so I want them in pdf. Under Ubuntu linux typing convert z.eps z.pdf (to use ImageMagick) results in a nice looking graphic but the bounding box is lost. Doing convert z.eps z.epdf results in a fuzzy image with a good bounding box. Does anyone have a nice solution? Thanks Frank Frank, Do you only have EPS files or do you also need to include PDF files? If the former, you can use Beamer with latex - dvips - ps2pdf as an alternative to using pdflatex as a single step. If you need to have them as PDF's, two other options: 1. Use 'epstopdf': http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/epstopdf.html which is a Perl script that uses GS to do the conversion. 2. Use 'epstopdf.sty', which is part of the oberdiek CTAN bundle. This will enable the conversion of the EPS files to PDF as part of using pdflatex. A link is here: http://www.tex.ac.uk/tex-archive/help/Catalogue/entries/epstopdf-pkg.html This will actually call the epstopdf Perl script above. HTH, Marc Thanks very much Marc. Somehow I had missed that Beamer would work with latex instead of pdflatex and I also didn't know about epstopdf.sty. I ran the files through epstopdf and all seems well for me to keep using pdflatex. Frank -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to connect dots by passing NA
On 17/04/2008, at 12:56 PM, DinoDragon wrote: This maybe a silly question. I'm trying to figure out a way to draw a line from a data set which contain NA. Say, I have a set of data as: x - c(1.1 2.2 NA 4.4 5.5) ; y - c(1:5) # as x,y of point a, b, c, d, and e. I would like to plot this to a line by using dot-line to connect the two adjacent points before and after the NA, something like: (a)__ (b)..(d)__(e) How's this? foo - function(x,y,...) { plot(x,y,type=n,...) na - apply(cbind(x,y),1,function(x){any(is.na(x))}) f - c(na[-1],FALSE) x - x[!na] y - y[!na] f - f[!na] n - length(x) f - f[-n] segments(x[-n],y[-n],x[-1],y[-1],lty=ifelse(f,3,1)) } set.seed(42) x - sort(runif(20)) y - rnorm(20) ix - sample(1:20,3) iy - sample(1:20,3) x[ix] - NA y[iy] - NA foo(x,y) cheers, Rolf Turner ## Attention:\ This e-mail message is privileged and confid...{{dropped:9}} __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [R-sig-ME] Post hoc tests with lme
Try glht in package multcomp. Simon. On Wed, 2008-04-16 at 12:00 -0400, Gang Chen wrote: = 1), c(TypeT2 = 1))) : Only defined for lm,glm objec -- Simon Blomberg, BSc (Hons), PhD, MAppStat. Lecturer and Consultant Statistician Faculty of Biological and Chemical Sciences The University of Queensland St. Lucia Queensland 4072 Australia Room 320 Goddard Building (8) T: +61 7 3365 2506 http://www.uq.edu.au/~uqsblomb email: S.Blomberg1_at_uq.edu.au Policies: 1. I will NOT analyse your data for you. 2. Your deadline is your problem. The combination of some data and an aching desire for an answer does not ensure that a reasonable answer can be extracted from a given body of data. - John Tukey. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Constrained Nelder-Mead
Dear Mr, I saw by the web your request about the code in Language C of the method Nelder-Mead with constraints, I would like if you got the program, it's posible you can help us to get the code in C, I'm grateful for your support, Regards, Jorge Angarita [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] NA problem when use paste function
Dear R helpers, I was doing a genetic project with two datasets X and Y. There are some IDs in both data sets, and others in either data set. I used merge(x,y,by=ID,all=TRUE). The data set Y contains a variable (a genotype) which is also in data X. When I merge X with Y, these two variables were automatically re-named by appending .x and .y to the original variable names. As you can see on the following list, I would like to take whatever available (non-missing non-NA) in X or Y as the final value for the genotype S3Allel1. I used paste() function. However, it converts NA to NA as character. Would you please tell me how I can just get the genotype without pasting the NA to it? I checked the document of paste() and noticed that it used as.character() to the vector argument. I guess that is the reason I got NA as a string for the new variable I created (S3Allele1). Should I use any other funtion to avoid this problem? Any insight is appreciated! ID S3Allele1.x S3Allele1.y S3Allele1 1 10003 GNA G NA 2 10004 ANA A NA 3 10005 ANA A NA 4 10006 ANA A NA 5 10007 GNA G NA 6 10008 ANA A NA 7 10009 ANA A NA 8 10010 ANA A NA 9 10011 ANA A NA 10 10013 ANA A NA 11 10014 ANA A NA 12 10015 ANA A NA 13 10016 ANA A NA 14 10017 ANA A NA 15 10018 ANA A NA 16 10019 GNA G NA 17 10020 ANA A NA 18 10021 GNA G NA 19 10022 ANA A NA 20 10023 GNA G NA 21 10024 GNA G NA 22 10025 GNA G NA 23 10027 GNA G NA 24 10028 GNA G NA 25 10029 GNA G NA 26 10031 GNA G NA 27 10032 ANA A NA 28 10033NA NA 29 10035 ANA A NA 30 10037 ANA A NA 31 10038NA A NA A 32 10039NA A NA A __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to connect dots by passing NA
Try this which interpolates the NAs using na.approx from zoo drawing the interpolated series with lty=3 and then overwrites solid lines with the gaps using lines. library(zoo) plot(y ~ x, as.data.frame(na.approx(zoo(cbind(x, y, lty = 3, type = l) lines(y ~ x) On Wed, Apr 16, 2008 at 8:56 PM, DinoDragon [EMAIL PROTECTED] wrote: This maybe a silly question. I'm trying to figure out a way to draw a line from a data set which contain NA. Say, I have a set of data as: x - c(1.1 2.2 NA 4.4 5.5) ; y - c(1:5) # as x,y of point a, b, c, d, and e. I would like to plot this to a line by using dot-line to connect the two adjacent points before and after the NA, something like: (a)__(b)..(d)__(e) Any help will be very appreciated. -- Smiles, Timothy Huang 黃大ㄧ 43, Lane 525, Section 3, AnKang Road, XinDian City Taipei County, Taiwan 23156, Rep. of China 台北縣23156新店市安康路三段525巷43號 Tel 886-2-2214-0517 Fax 886-2-2214-4201 Get Skype http://www.skype.com/go/download and call me for free. Web: www.dinodragon.com http://www.dinodragon.com/ Blog: http://tw.myblog.yahoo.com/timd_huang/ Blog: http://bloguide.ettoday.com/dinodragon/ Web: http://www.meteoritefossilgallery.com/ __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Error in Design package: dataset not found for options(datadist)
Hi, Design isn't strictly an R base package, but maybe someone can explain the following. When lrm is called within a function, it can't find the dataset dd: library(Design) age - rnorm(30, 50, 10) cholesterol - rnorm(30, 200, 25) ch - cut2(cholesterol, g=5, levels.mean=TRUE) fit - function(ch, age) + { +d - data.frame(ch, age) +dd - datadist(d) +options(datadist=dd) +lrm(ch ~ age, data=d, x=TRUE, y=TRUE) + } fit(ch, age) Error in Design(eval(m, sys.parent())) : dataset dd not found for options(datadist=) It works outside a function: d - data.frame(ch, age) dd - datadist(d) options(datadist=dd) l - lrm(ch ~ age, data=d, x=TRUE, y=TRUE) Thanks, Gad sessionInfo() R version 2.6.2 (2008-02-08) x86_64-pc-linux-gnu ... attached base packages: [1] splines stats graphics grDevices utils datasets methods [8] base other attached packages: [1] Design_2.1-1 survival_2.34 Hmisc_3.4-3 loaded via a namespace (and not attached): [1] cluster_1.11.9 grid_2.6.2 lattice_0.17-4 rcompgen_0.1-17 -- Gad Abraham Dept. CSSE and NICTA The University of Melbourne Parkville 3010, Victoria, Australia email: [EMAIL PROTECTED] web: http://www.csse.unimelb.edu.au/~gabraham __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] NA problem when use paste function
On Wed, 16 Apr 2008, Lu, Jiang wrote: Dear R helpers, I was doing a genetic project with two datasets X and Y. There are some IDs in both data sets, and others in either data set. I used merge(x,y,by=ID,all=TRUE). The data set Y contains a variable (a genotype) which is also in data X. When I merge X with Y, these two variables were automatically re-named by appending .x and .y to the original variable names. As you can see on the following list, I would like to take whatever available (non-missing non-NA) in X or Y as the final value for the genotype S3Allel1. I used paste() function. However, it converts NA to NA as character. Would you please tell me how I can just get the genotype without pasting the NA to it? I checked the document of paste() and noticed that it used as.character() to the vector argument. I guess that is the reason I got NA as a string for the new variable I created (S3Allele1). Please don't 'guess': that is not what as.character does. Your example is not reproducible (see the footer of this message) and it is not clear what the structure is. But NA indicates a missing value in a factor or unquoted character vector. E.g. x - c(G, A, A) y - rep(NA_character_, 3) data.frame(x, y) xy 1 G NA 2 A NA 3 A NA paste(x, y) [1] G NA A NA A NA Here y does contain missing values and paste() converted them to NA. As the help says: Note that 'paste()' coerces 'NA_character_', the character missing value, to 'NA' which may seem undesirable, e.g., when pasting two character vectors, or very desirable, e.g. in 'paste(the value of p is , p)'. Possibly you want ifelse(is.na(x), y, x) Should I use any other funtion to avoid this problem? Any insight is appreciated! ID S3Allele1.x S3Allele1.y S3Allele1 1 10003 GNA G NA 2 10004 ANA A NA 3 10005 ANA A NA 4 10006 ANA A NA 5 10007 GNA G NA 6 10008 ANA A NA 7 10009 ANA A NA 8 10010 ANA A NA 9 10011 ANA A NA 10 10013 ANA A NA 11 10014 ANA A NA 12 10015 ANA A NA 13 10016 ANA A NA 14 10017 ANA A NA 15 10018 ANA A NA 16 10019 GNA G NA 17 10020 ANA A NA 18 10021 GNA G NA 19 10022 ANA A NA 20 10023 GNA G NA 21 10024 GNA G NA 22 10025 GNA G NA 23 10027 GNA G NA 24 10028 GNA G NA 25 10029 GNA G NA 26 10031 GNA G NA 27 10032 ANA A NA 28 10033NA NA 29 10035 ANA A NA 30 10037 ANA A NA 31 10038NA A NA A 32 10039NA A NA A __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Fwd: A problem with jointprior
Greetings all, I am trying to use Deal to learn a Bayesian Network for discrete data. I came across the following problem with jointprior function. library(deal) a - read.csv(prepared.cluster1.csv) fit - network(a) fit.prior - jointprior(fit) Error in array(1, Dim) : 'dim' specifies too large an array I have tried debugging array and still can't fully understand what the problem is all about. For further information regarding my data (prepared.cluster1.csv) , I have 77 columns vs 77 rows. Data are in the form of factor (3 levels of -1,0,1). I also have provided a self-contained example. Any comments are highly appreciated. -- Suhaila Zainudin PhD Candidate Universiti Teknologi Malaysia __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.