Re: [R] running R from PHP
@biology.nmsu.edu [EMAIL PROTECTED] wrote: I would like to construct a PHP script that runs R to generate a graphics file. Running R itself is no problem. However, it seems impossible to instantiate one of the graphics devices to create output. For example, the normal bitmap devices (e.g., jpeg, png, etc.) are derived from X11, which requires a display. This seems true, even if no output is ever directed to a real display. For some reason, the postscript device seems to suffer from similar problems. Is there a trick to creating a graphics device in the absence of an actual display in order to create an image in a file? If you need a bitmap graphic file, I would suggest the use of ImageMagick: cunegonde:~/tmp ls foo cunegonde:~/tmp cat foo pdf(file=g.pdf) plot(1:5) dev.off() cunegonde:~/tmp R --no-save foo/dev/null convert g.pdf g.png cunegonde:~/tmp ls -g -rw---1 glaziou 3374 2004-02-03 11:58 g.pdf -rw---1 glaziou 4115 2004-02-03 11:58 g.png -rw---1 glaziou80 2004-02-03 11:58 foo This works from a unix console without X running (the postcript device works similarly on my machine). R can easily be fed this way with a file and parameters passed from a php script. -- Philippe Glaziou, MD Epidemiologist Institut Pasteur du Cambodge __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] print comment lines on `sink'ed files?
SI [EMAIL PROTECTED] wrote: I am using many comment lines like this # a comment line in a script. Is there any way to print comment lines when I use sink() function? Or, are there any plans to include as an option to sink() function in the near future? I would not want to use cat() function as it will look messy in the original script file. Since you are using script files, you may not need to use R in an interactive session. One suggestion under unix would be: cunegonde:~ R --no-save --quiet test saved cunegonde:~ cat saved # a comment line i-1:10 outer(i,i,*) [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] [1,]12345678910 [2,]2468 10 12 14 16 1820 [3,]369 12 15 18 21 24 2730 [4,]48 12 16 20 24 28 32 3640 [5,]5 10 15 20 25 30 35 40 4550 [6,]6 12 18 24 30 36 42 48 5460 [7,]7 14 21 28 35 42 49 56 6370 [8,]8 16 24 32 40 48 56 64 7280 [9,]9 18 27 36 45 54 63 72 8190 [10,] 10 20 30 40 50 60 70 80 90 100 # the end All commands including comments appear in the saved output. HTH, -- Philippe Glaziou Epidemiologist __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] OC curve in Quality Control
WilDscOp [EMAIL PROTECTED] wrote: Can anyone please help me about any of the following questions: 1. How can i find factorial of any number in R? I tried prod(170:1) # to find factorial of 170 or 170! Is it the only procedure - or R has any better process / operational character to calculate factorial? Also, is it possible to calculate factorial of 500? Or is there any statistical table available for this? gamma(x+1) # gives x! As for the factorial of 500, I would go for a log transformation: lgamma(501) [1] 2611.330 But if you really need to see all the digits of 500!, PARI http://pari.math.u-bordeaux.fr/ --or rather its shell, may be called from within R. It returns all digits of that large number in a fraction of a second on my old laptop: system.time(system(echo '500!' | gp)) [...] %1 = 12201368259911100687012387854230469262535743428031928421 9241358838584537315388199760549644750220328186301361647714820 [about a thousand other digits follow] Good bye! [1] 0.00 0.00 0.05 0.03 0.02 For a more readable output: system(echo '500!*1.0' | gp) [...] %1 = 1.220136825991110068701238785 E1134 2. Is there any direct procedure / package in R to find permutation / combination? To permute the elements of a vector, you may use: perm - function(v)sample(v,size=length(v),replace=FALSE) v - 1:8 v [1] 1 2 3 4 5 6 7 8 set.seed(101) perm(v) [1] 3 1 5 4 7 6 2 8 Re combinations, does the function choose() do what you are looking for? 3. Can i find Probability Density of Hypergeometric Disribution in R, given all values of the parameter? I can not find any table of Hypergeometric Disribution (if such tables are available on the internet, please let me know). Does dhyper() do what you are looking for? -- Philippe Glaziou Epidemiologist __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Re: OC curve in Quality Control
WilDscOp [EMAIL PROTECTED] wrote: For Number 1 problem: about http://pari.math.u-bordeaux.fr/, sorry i didnot understand what to download or what to call! From http://pari.math.u-bordeaux.fr/download.html can you please tell me what should i download and how to use(i could not find any doc)? An exact link for download may be helpful:) The download page gives links to the sources of PARI. There is also a self-installing MS-Windows executable there. As for the doc, there is a menu item which reads Documentation. Click on it, and there you have a user's guide, tutorial, installation guide, ref card, manual pages. By the way, there are other packages out there to handle large entities (on a 32-bit machine) like 500! (Octave, Matlab, Maple, Mathematica, Yacas...). I suggested that one because I do not know the others. - --- For Number 3 problem: i had some problem using dhyper() because i cannot match the parameters there. I used N-5000; n-50; D-seq(0,500,1); d-0 # (For d = 1 i just recalculated it with d-1) hypg - (choose(D, d)* choose((N-D), (n-d)) / choose(N,n)) instead and it surves my purpose. Anyway, is there any better procedure? I could not find Hypergeometric() in the base. You needed phyper for that specific problem, not dhyper (the help page for dhyper explains what dhyper, phyper, qhyper and rhyper do). hypg - phyper(d,D,N-D,n) does the job in a slightly more efficient manner. I would suggest that you check out the following: help.search(hypergeometric) ?Hypergeometric -- Philippe Glaziou Epidemiologist __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] question
Fuensanta Saura Igual [EMAIL PROTECTED] Saura Igual [EMAIL PROTECTED] wrote: Does anyone know how I can read from a .txt file the lines that are between two strings whose location is unknown? My problem is that I have a .txt file with data separated by a sentence, for example: 2.22 3.45 1.56 2.31 pattern 1 4.67 7.91 3.34 2.15 5.32 3.88 pattern 2 ... I do not know the number of lines where these separating sentences are located, because the number of lines in between them can be random. If it was fixed, I think I could use read.table using the option skip, but in this case, I do not know how I could manage to do that automatically. This is a job for sed. The following command will delete any line not starting with a digit from file.txt and save the results in file2.txt: cat file.txt | sed -e '/^$\|^[^0-9]/D' file2.txt -- Philippe Institut Pasteur du Cambodge __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] question
Peter Dalgaard [EMAIL PROTECTED] wrote: My problem is that I have a .txt file with data separated by a sentence, for example: 2.22 3.45 1.56 2.31 pattern 1 4.67 7.91 3.34 2.15 5.32 3.88 pattern 2 ... I do not know the number of lines where these separating sentences are located, because the number of lines in between them can be random. If it was fixed, I think I could use read.table using the option skip, but in this case, I do not know how I could manage to do that automatically. This is a job for sed. The following command will delete any line not starting with a digit from file.txt and save the results in file2.txt: cat file.txt | sed -e '/^$\|^[^0-9]/D' file2.txt Er, no, that wasn't the requirement. It's a job for awk or perl, e.g. #!/usr/bin/perl -n if (/pattern 1/){ $copy = 1; next; } if (/pattern 2/){ $copy = 0; } print if $copy; or awk '/pattern 1/{copy=1;next};/pattern 2/{copy=0};copy==1' file.txt file2.txt Peter, I cannot see your point. sed can get rid of any pattern in a text file. Fuensanta's example seemed to show that the sentences (pattern 1, 2,...) were on separate lines from lines containing data, thus my approach. Another one closer to your awk example would use: sed -e '/pattern 1\|pattern 2\|pattern xyz//g' file.txtfile2.txt Or is this just a perl versus sed versus awk troll? -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] question
Philippe Glaziou [EMAIL PROTECTED] wrote: Peter, I cannot see your point. sed can get rid of any pattern in a text file. Fuensanta's example seemed to show that the sentences (pattern 1, 2,...) were on separate lines from lines containing data, thus my approach. Another one closer to your awk example would use: sed -e '/pattern 1\|pattern 2\|pattern xyz//g' file.txtfile2.txt I meant sed -e 's/pattern... ^ Sorry for the additional noise. -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] question
Peter Dalgaard [EMAIL PROTECTED] wrote: blueberry:~/ sed -e 's/pattern 1\|pattern 2\|pattern xyz//g' tst.txt 2.22 3.45 1.56 2.31 4.67 7.91 3.34 2.15 5.32 3.88 blueberry:~/ awk '/pattern 1/{copy=1;next};/pattern 2/{copy=0};copy==1' tst.txt 4.67 7.91 3.34 2.15 5.32 3.88 blueberry:~/ perl -ne 'if(/pattern 1/){$copy=1;next;} if(/pattern 2/){$copy=0;}print if $copy' tst.txt 4.67 7.91 3.34 2.15 5.32 3.88 I see and here is my (corrected) sed solution: cunegonde:~/tmp cat test 2.22 3.45 1.56 2.31 pattern 1 4.67 7.91 3.34 2.15 5.32 3.88 pattern 2 cunegonde:~/tmp sed -e '/pattern 1\|pattern 2/D' test 2.22 3.45 1.56 2.31 4.67 7.91 3.34 2.15 5.32 3.88 -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] question
Philippe Glaziou [EMAIL PROTECTED] wrote: I see and here is my (corrected) sed solution: cunegonde:~/tmp cat test 2.22 3.45 1.56 2.31 pattern 1 4.67 7.91 3.34 2.15 5.32 3.88 pattern 2 cunegonde:~/tmp sed -e '/pattern 1\|pattern 2/D' test 2.22 3.45 1.56 2.31 4.67 7.91 3.34 2.15 5.32 3.88 Ray Brownrigg rightly pointed out my mistake: we want the lines between the patterns not just to remove the patterns. I pulled the trigger too fast. cunegonde:~/tmp sed -e '/pattern 1/,/pattern 2/!D;/pattern 1\|pattern 2/D' test 4.67 7.91 3.34 2.15 5.32 3.88 I feel embarrassed now. -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] problem with x11 and PS devices on different machines
Timur Elzhov [EMAIL PROTECTED] wrote: I run R at home and the work, I have Debian Linux on both machines and the same 'r-base-core' deb packages installed. So I tried to run the same R script, which plots graph in x11 device and then dump it to eps file (x11 and eps you'll find attached). On the home machine there are some stranges in x11 plot as well as in eps file. On the work machine all the ok, despite of that I use the _same_ version of binary deb package. May be any troubles with the font paths? Thank you in advance for any suggestions! I ran the unix tool 'file' on your two attached files: x11-good.png: PNG image data, 600 x 420, 8-bit/color RGB, non-interlaced x11-bad.png: PNG image data, 449 x 315, 8-bit/color RGB, non-interlaced It could be that your X11 Modes differ between both machines, with a different number of dots per inch. Hth, -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] problem with x11 and PS devices on different machines
Timur Elzhov [EMAIL PROTECTED] wrote: It could be that your X11 Modes differ between both machines, with a different number of dots per inch. I use the same resolution, 1024x768 on both machines. Anyway, I do not think that xserver resolution is important for screenshot size (in pixels) :) The width and height of a default R x11 plotting window are both 7 inches. There will be a different number of dots within those 7x7 square inches if the number of dots per inch is not similar. This could be the case even though your two xservers are set at 1024x768. Does 'xdpyinfo | grep dots' return the same numbers on both machines? -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Chron, as.POSIXct problem
Prof Brian Ripley [EMAIL PROTECTED] wrote: Does not happen on Solaris or Linux, so looks like a MacOS X problem. It does not happen on my Mac G4 box (R 1.8.0 on MacOSX 10.2.6). --Philippe Here is some crosschecks: unclass(datesTest) [1] -6301 -6300 -6299 attr(,format) [1] m/d/y attr(,origin) month day year 1 1 1970 unclass(as.POSIXct(datesTest)) [1] -544406400 -54432 -544233600 On Wed, 12 Nov 2003, Brian Beckage wrote: Dear R list, I noticed the following 'problem' when changing the format of dates created with seq.dates() (from the Chron library) using as.POSIXct() (R 1.8.0 on OSX 10.2.8): datesTest-seq.dates(from=10/01/1952, length=3, by=days); datesTest [1] 10/01/52 10/02/52 10/03/52 # Now changing the format to show year as 1952. datesTest-format(as.POSIXct(datesTest), %m/%d/%Y) datesTest [1] 09/30/1952 10/01/1952 10/02/1952 The dates were shifted by one day. The work around is simple enough, e.g., datesTest-format(as.POSIXct(datesTest+1), %m/%d/%Y) [1] 10/01/1952 10/02/1952 10/03/1952 but I wonder if this is the intended behavior? Brian __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] map does not display maps, MacOSX
Hi, I installed the maps and mapdata libraries on my R-1.8.0 on MacOSX 10.2.8 (jaguar on a powerbook G4), and failed to make the map function work properly: R : Copyright 2003, The R Development Core Team Version 1.8.0 (2003-10-08) [...] library(maps) map() Error in file(file, r) : unable to open connection In addition: Warning message: cannot open file `/Users/glaziou/Library/R/maps/mapdata//world.N' map('usa') Error in file(file, r) : unable to open connection In addition: Warning message: cannot open file `/Users/glaziou/Library/R/maps/mapdata//usa.N' system('ls -l /Users/glaziou/Library/R/maps/mapdata') total 1796 -rw-r--r-- 1 root staff 143902 Oct 14 11:30 county.G -rw-r--r-- 1 root staff 690260 Oct 14 11:30 county.L -rw-r--r-- 1 root staff 618 Oct 14 11:30 nz.G -rw-r--r-- 1 root staff 13040 Oct 14 11:30 nz.L -rw-r--r-- 1 root staff2642 Oct 14 11:30 state.G -rw-r--r-- 1 root staff 96892 Oct 14 11:30 state.L -rw-r--r-- 1 root staff 282 Oct 14 11:30 usa.G -rw-r--r-- 1 root staff 58232 Oct 14 11:30 usa.L -rw-r--r-- 1 root staff 74434 Oct 14 11:30 world.G -rw-r--r-- 1 root staff 295152 Oct 14 11:30 world.L -rw-r--r-- 1 root staff 74434 Oct 14 11:30 world2.G -rw-r--r-- 1 root staff 295152 Oct 14 11:30 world2.L -rw-r--r-- 1 root staff 54832 Oct 14 11:30 world2.N Most of contributed libraries are installed in ~/Library/R because I am the only user of that mac and this simplifies backup. I checked the access rights of relevant files and directories and they all seem correct (these are owned by root but are world readable and directories are world cd'able). Compilation of both libraries maps and mapdata went ok. I have the same libraries installed on a linux server where they work perfectly well. A similar error message occurs whether R is started in an xterm, within emacs/ESS on X11, or using the RAqua interface. Any hint appreciated, -- Philippe Glaziou __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Match data.frames with different number of rows
Bernd Weiss [EMAIL PROTECTED] wrote: I have two data.frames a and b: i - c(1,1,2,2,3,3,4,4) x - c(1,53,7,3,4,23,6,2) a - data.frame(i,x) and j - c(1,2,3,4) y - c(99,88,77,66) b - data.frame(j,y) Now, I would like to match 'b' to 'a', so that a new data.frame 'c' is c i xz 1 1 199 2 1 5399 3 2 788 4 2 388 5 3 477 6 3 2377 7 4 666 8 4 266 Merge should do the job: merge(a,b,by=1) i x y 1 1 1 99 2 1 53 99 3 2 7 88 4 2 3 88 5 3 4 77 6 3 23 77 7 4 6 66 8 4 2 66 -- Philippe Glaziou __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] map does not display maps, MacOSX
Prof Brian D Ripley [EMAIL PROTECTED] wrote: Notice the // in the path /Users/glaziou/Library/R/maps/mapdata//world.N Some Windows filesystems do not like that, and my guess is that some MacOS X ones may not either. I noticed that. However, this does not to seem to bother MacOSX too much (R internals on MacOSX may not like it): madeleine:~ pwd /Users/glaziou madeleine:~ ls Library/R//maps//mapdata county.G nz.G state.G usa.G world.G world2.G world2.N county.L nz.L state.L usa.L world.L world2.L madeleine:~ cd Library///R/maps//mapdata madeleine:~/Library/R/maps/mapdata pwd /Users/glaziou/Library/R/maps/mapdata -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] R 1.8 for debian
Dirk Eddelbuettel [EMAIL PROTECTED] wrote: Sure, got uploaded the day of the 1.8 release. You may want to learn how to point apt at different archives. Debian has 1.8 in unstable; CRAN has it in testing (thanks to Doug Bates) and even in stable (thanks to Korbinian Strimmer) Please, note also that if your debian box has the compilers and header files required to compile R from source, then building your own deb packages should be easy because the developers included all relevant debian files in the sources. There is little need to tweak /etc/apt/sources.list to get the latest vintage of debianized R, nor to wait if you need non-intel binaries. sudo apt-get install fakeroot # if not already installed tar xvzf R-1.8.0.tgz cd R-1.8.0 dpkg-buildpackage -rfakeroot # now is time to have a coffee... cd .. sudo dpkg -i r-* # this will install everything -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] summary with names
Christoph Bier [EMAIL PROTECTED] wrote: how can I tell 'summary' to print the name of the summarised variable? This is probably an awkward newbie question but I didn't find an answer in the Docus, the FAQ and maillist archive. I want a summary for about 250 variables and realise it the following way (I know, that I shouldn't use iterations that way in R; but at the moment it's the easiest way for me): for(i in fb.12.unt[varA1:varZ9]){print (summary(i, na.rm=t))} It works fine, but I don't know which summary corresponds to This surprises me. which variable, because the variable names are not printed. Can somebody give me a hint? Can you give us an example of summary not giving variable names? df-data.frame(var1=c(1,2,3),var2=c(4,5,6),factor1=c('a','a','b')) summary(df) var1 var2 factor1 Min. :1.0 Min. :4.0 a:2 1st Qu.:1.5 1st Qu.:4.5 b:1 Median :2.0 Median :5.0 Mean :2.0 Mean :5.0 3rd Qu.:2.5 3rd Qu.:5.5 Max. :3.0 Max. :6.0 summary(df[1:2]) var1 var2 Min. :1.0 Min. :4.0 1st Qu.:1.5 1st Qu.:4.5 Median :2.0 Median :5.0 Mean :2.0 Mean :5.0 3rd Qu.:2.5 3rd Qu.:5.5 Max. :3.0 Max. :6.0 -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Problems with arrow keys
Andrew Criswell [EMAIL PROTECTED] wrote: I just built R-1.8.0 on my Linux-Mandrake 9.0 using the commands, ./configure --enable-R-shlib make make install It all seems to have gone fine. But when I open R and use the arrow keys to try to go back to previous lines, it doesn't work. What I get instead is something like. ^[[A^[[A^[[A^[[A^[[A I didn't have this problem when I installed R-1.7.1 as rpm. I could make use of the arrow keys. This was answered recently. Check the archives. -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Integration between R latex
Christoph Bier [EMAIL PROTECTED] wrote: i just tried to install Hmisc with install.packages(Hmisc,installWithVers = true) but get the following error: Error in unique(pkgs) : Object Hmisc not found It searches in http://cran.r-project.org/src/contrib/PACKAGES where Hmisc *is* listed. Did *I* make a mistake or is there something else wrong? You may need to quote the Hmisc object's name: install.packages(Hmisc) -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Previous Commands
Philippe Glaziou [EMAIL PROTECTED] wrote: Rau, Roland [EMAIL PROTECTED] wrote: yesterday I took the R-1.8.0-source file and compiled it on my own. As I am using Linux just for a couple of weeks, it was my first compiling session with ./configure, make, Everything went fine, except for one thing: if I want to look at the commands history by using the cursor keys, it does not work. Instead of displaying the previous commands, it returns something like [[A. Is this a common problem? Does anyone have a solution? You may need to install the ncurses dev libraries. oops, sorry, I meant readline. And then re-configure. -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] If I produce lots of figures at one time, how can I make R graphics keep all the figures already made?
xinyue ye [EMAIL PROTECTED] wrote: If I produce lots of figures at one time, how can I make R graphics keep all the figures already made? thanks, Open as many graphics devices as needed. See the examples in: ?dev.list -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] var on a vector
[EMAIL PROTECTED] [EMAIL PROTECTED] wrote: I am an R newbie. I have a problem with computing a variance on a vector. data(cars) variance - function (x) mean(x^2)-mean(x)^2; variance(cars[,1]) [1] 27.4 var(cars[,1]) [1] 27.95918 What did I assume/understand wrong ? You wrongly assumed that the 'var' help file would not help. However, that page states that the denominator n-1 is used. 27.4*50/49 [1] 27.95918 -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Remove comma (,) in data set
Muhammad Subianto [EMAIL PROTECTED] wrote: I am new learning R. Now, I have a data set like: 24,2,3,3,1,1,2,3,0,1 45,1,3,10,1,1,3,4,0,1 ... with 3730 rows I want to remove comma (,) in data set. The result like: 24 2 3 3 1 1 2 3 0 1 45 1 3 10 1 1 3 4 0 1 ... How can I do it. Thanks you for your help. Assuming your dataset is stored in a flat ascii file, you need not use R for this trivial translation of the character , into a space . From your shell (i.e., if standard shell tools are available on your machine), type the following: cat file1 | tr ,file2 -- Philippe Glaziou Institut Pasteur du Cambodge __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Using POSIX?t rather than chron or date
Martin Maechler [EMAIL PROTECTED] wrote: Could chron and date users be heard about what functionality they are missing in POSIX.t ? As a chron user, I suppose none. But I find chron more friendly and it saves some typing. In my opinion, as.POSIXct and most related functions have rather complicated names to type, which make them prone to typos. Typos slow down the thinking. -- Philippe Glaziou Pasteur Institute of Cambodia __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] selecting by variable
Eugene Salinas [EMAIL PROTECTED] wrote: How do I select one variable by another one? Ie if I want to draw the histogram of variable X only for those individuals that also have a value Y in a certain range? In STATA I would give something like: histogram X if ((Y=A Y=B)) hist(x[Y=A Y=B]) See: ?Subscript ? -- Philippe Glaziou __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] problems with lda , data included,can somebody test with the new version
Nicolaas Busscher [EMAIL PROTECTED] wrote: enclosed a simple R script (and a data file, and the output) , with calls lda similar to the example with the iris data in the documentation. it is not working and i dont understand the error message. I tested your data and commands without any error message on a linux debian distribution: [...] z-lda(assignment ~ .,actaData,prior=prio,tol=1.0e-08) z Call: lda.formula(assignment ~ ., data = actaData, prior = prio, tol = 1e-08) Prior probabilities of groups: 5 6 0.5 0.5 Group means: diagonal.moment cluster.shade histogram.kurtosis 584.94982 -11989.17 -0.1116342 6 138.31495 -18892.15 -0.1205776 Coefficients of linear discriminants: LD1 diagonal.moment-1.575854e-03 cluster.shade -1.209398e-04 histogram.kurtosis -2.028278e+02 can anybody help me? i am using R 1.5.1 (2002.06.17) on debian woody stable. I would like to avoid updating now, because i want to keep the system in stable. You can upgrade your old R while keeping the system in stable. You may download the 1.7.1 deb packages from CRAN, and install them with dpkg. Or even better, you can create your own debs from the sources, all the required files are the package. tar xvzf R-1.7.1.tgz cd R-1.7.1 dpkg-buildpackage -rfakeroot And a few coffees later, you will find a fairly large number of deb files in the parent directory. -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Re: www.acd.ucar.edu mailing list memberships reminder
Daniel Bayard [EMAIL PROTECTED] wrote: how do you add x and y error bars on a plot. Have queried the search engine? help.search(error bar) -- Philippe Glaziou Pasteur Institute of Cambodia __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] installing add-on packages on OS X
mpie [EMAIL PROTECTED] wrote: This is probably a stupid question, but since I'm a newbie on R, here it goes. I got R 1.6.2 running on OS 10.1.5 and I'm trying to install an add-on package. I couldn't find info on installing this in a mac. Can anyone give me some pointers? See R-admin. It may be a good idea to consider upgrading your R. It compiles very well on MacOSX, provided that you install all the missing soft that Apple could not be bothered to include in the OS. -- Philippe Glaziou Pasteur Institute of Cambodia __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Re: www.acd.ucar.edu mailing list memberships reminder
I [EMAIL PROTECTED] wrote: Daniel Bayard [EMAIL PROTECTED] wrote: how do you add x and y error bars on a plot. Have queried the search engine? help.search(error bar) Well, I would have been more helpful if I had indicated that error bars are dealt with in the Hmisc and gregmisc libraries. -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] R on Solaris 9
Donnie Payne [EMAIL PROTECTED] wrote: I am attempting an install of R-1.7.1 on a Sun Solaris 9 box. It is a V880. It has 8 processors at 950MHz each and 32 Gb of physical memory. configure: WARNING: you cannot build DVI versions of the R manuals configure could not find latex configure: WARNING: you cannot build info versions of the R manuals configure could not find makeinfo configure: WARNING: you cannot build PDF versions of the R manuals configure could not find pdflatex I can run the 'make' fine, but when I run the 'make check' I receive the following errors: running code in 'base-Ex.R' ...*** Error code 1 make: Fatal error: Command failed for target `base-Ex.Rout' You will need to check base-Ex.Rout to see what went wrong, and what other important piece of software is missing. -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] configuration error when installing gtkDevice
Dimitri Giunchi [EMAIL PROTECTED] wrote: when I try to install gtkDevice on Mandrake Linux 9.1 (R v. 1.7.1), I get the following comfiguration error (see below). Has anyone else had this problem? Any hints are greatly appreciated. [...] trying URL `http://cran.r-project.org/src/contrib/gtkDevice_0.5-3.tar.gz' Content type `application/x-tar' length 41535 bytes opened URL .. .. .. .. downloaded 40Kb * Installing *source* package 'gtkDevice' ... checking for gtk-config... no checking for gtk12-config... no ERROR: Cannot find gtk-config. The ./configure script could not find gtk-config, as stated in the error message. Hint: you may need to install that tool for the script to find it on your system. A google search will give you the directions to the right rpm package(s). -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] X-emacs and R for Windows
Chriss, Neil [EMAIL PROTECTED] wrote: Is there any way to make XEmacs (or any other editor) the default editor for R so that when I type sample - function(x,y) { + z-x+y + } + edit(sample) the XEmacs (or other editor) is the editor for this function (the default seems to be MS Notepad, blech). See ?options options()$editor [1] /usr/bin/vim options(editor=emacs) options()$editor [1] emacs -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Re: your mail
Frank E Harrell Jr [EMAIL PROTECTED] wrote: Dear Patrick - That was very helpful, especially the output comparing the old and new latex( ) function results - thanks. I'm sorry Philippe that I did not see the problem before. If you edit the source code for latex.default by adding the line extracolheads - c('', extracolheads) after the line col.just - c(rowlabel.just, col.just) the problem should be fixed. The next release of Hmisc will have this fix. Thanks a lot Frank. This fixes the problem and also impresses me a lot. I have not seen such a level of support and speed of reaction to fix minor bugs very often. Best regards, -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [long:] Re: [R] problem with latex of object summary reverse
A.J. Rossini [EMAIL PROTECTED] wrote: Philippe Glaziou [EMAIL PROTECTED] writes: No file file66334873.aux. Underfull \hbox (badness 1) in paragraph at lines 20--21 Not an error. I know, I never said this was an error. [1] (./file66334873.aux) LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. I'm confused. Is this the error you are talking about wanting to fix? Not at all. The error is that the 2nd row (with N=...) produced by the latex command on a summary(...,method='reverse') (Hmisc lib) object is wrong in the produced tex file (on my systems, that is, on two different machines with different versions of Linux Debian, both with the standard tetex distribution). summary(y~x,method='reverse')-a The summary command gives (within the R interface): +-+-+-+-+ | |a|b|c| | |(N=27) |(N=38) |(N=35) | +-+-+-+-+ |x|0.474/0.548/0.724|0.261/0.446/0.626|0.284/0.591/0.853| +-+-+-+-+ latex(a)-la This command produces a tex file which, once compiled, looks like this: (the same command without the -la part results in an immediate compilation of a temp file, followed by a call to xdvi, and shows the same problem) +---+-+-+-+ | |a|b|c| |(N=27) |(N=38) |(N=35) | | +---+-+-+-+ |x |0.474/0.548/0.724|0.261/0.446/0.626|0.284/0.591/0.853| +---+-+-+-+ My previous message pointed out the wrong code on the tex file. I understand that I am the only person having such a problem, and I am really wondering about what is wrong with my two systems, one of which is really a linux debian out of the box. This problem is truly annoying because I want to use these features in an automated way with Sweave. I am really sorry for bothering the list with this. -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[long:] Re: [R] problem with latex of object summary reverse
Frank E Harrell Jr [EMAIL PROTECTED] wrote: Sorry to bother you again, I use the latex command with Sweave, and I would like to see the reports come out well without manual interventions on some tex files. latex(object, file='') works with Sweave's results=tex= construct. As in my previous note I could not duplicate that on Linux using the standard tetex distribution of latex etc. Please send output from the version command (I need to at least see the OS you are using) and your complete script (which you did not send before) so that I can run it exactly as you do, if you still cannot get it to work. Thanks a lot for your help. I use the standard tetex distribution that comes with linux debian (sarge). I could also duplicate the problem on a another machine running debian woody. cunegonde:~ latex --version TeX (Web2C 7.3.7) 3.14159 kpathsea version 3.3.7 Copyright (C) 1999 D.E. Knuth. [... snip copyright info] Here is the transcript of a very short R session showing the latex problem with summary: ## R : Copyright 2003, The R Development Core Team Version 1.7.0 (2003-04-16) [snip the R intro text] options(STERM='iESS', editor='emacsclient') library(Hmisc) Hmisc library by Frank E Harrell Jr Type library(help='Hmisc'), ?Overview, or ?Hmisc.Overview') to see overall documentation. Hmisc redefines [.factor to drop unused levels of factor variables when subscripting. To prevent this behaviour, issue the command options(drop.unused.levels=F). Attaching package 'Hmisc': The following object(s) are masked from package:methods : show The following object(s) are masked from package:base : [.factor %in% interaction [.terms set.seed(1) y-factor(sample(c('a','b','c'),100,T)) x-runif(100) a-summary(y~x,method='reverse') options(digits=3) a Descriptive Statistics by y +-+-+-+-+ | |a|b|c| | |(N=27) |(N=38) |(N=35) | +-+-+-+-+ |x|0.474/0.548/0.724|0.261/0.446/0.626|0.284/0.591/0.853| +-+-+-+-+ latex(a)-la This is TeX, Version 3.14159 (Web2C 7.3.7) (/tmp/Rtmp973/file66334873.tex LaTeX2e 2001/06/01 Babel v3.7h and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/usr/share/texmf/tex/latex/misc/geometry.sty (/usr/share/texmf/tex/latex/graphics/keyval.sty) (/usr/share/texmf/tex/latex/config/geometry.cfg)) No file file66334873.aux. Underfull \hbox (badness 1) in paragraph at lines 20--21 [1] (./file66334873.aux) LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. ) (see the transcript file for additional information) Output written on file66334873.dvi (1 page, 820 bytes). Transcript written on file66334873.log. ### And now, the faulty latex file (a.tex): % latex.default(cstats, title = title, caption = caption, rowlabel = rowlabel, col.just = col.just, numeric.dollar = FALSE, insert.bottom = legend, rowname = lab, dcolumn = dcolumn, extracolheads = extracolheads, extracolsize = Nsize, ...) % \begin{table}[!tbp] \begin{center} \caption{Descriptive Statistics by y\label{a}} \begin{tabular}{lccc}\hline\hline \multicolumn{1}{l}{} \multicolumn{1}{c}{a} \multicolumn{1}{c}{b} \multicolumn{1}{c}{c} \\ \multicolumn{1}{l}{{\scriptsize $N=27$}}\multicolumn{1}{c}{{\scriptsize $N=38$}}\multicolumn{1}{c}{{\scriptsize $N=35$}}\\ \hline x{\scriptsize 0.474~}{0.548 }{\scriptsize 0.724} {\scriptsize 0.261~}{0.446 }{\scriptsize 0.626} {\scriptsize 0.284~}{0.591 }{\scriptsize 0.853} \\ \hline \end{tabular} \end{center} \noindent {\scriptsize $a$\ }{$b$\ }{\scriptsize $c$\ } represent the lower quartile $a$, the median $b$, and the upper quartile $c$\ for continuous variables.\\ \end{table} ### The line which starts with: \\\multicolumn{l}{1}{{\scriptsize$N=27$}}\multicolumn{1}{c}{[...] should read: \\\multicolumn{l}{1}{}\multicolumn{1}{c}{\scriptsize$N=27$}{[...] I use your libraries and also Sweave a lot (Sweave is actually the major reason why I decided recently to use R rather than Stata: documenting the analysis is fun when you can produce nice tables and graphs automatically in a LaTeX document). Also, I find your libraries and documentation truly amazing. Thanks again, -- Philippe Glaziou Epidemiologist Pasteur Institute of Cambodia __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] problem with latex of object summary reverse
Frank E Harrell Jr [EMAIL PROTECTED] wrote: I tried this on the latest version of Hmisc (1.6-0): library(Hmisc) set.seed(1) y - factor(sample(c('a','b','c'),100,T)) x - runif(100) a - summary(y ~ x, method='reverse') options(digits=3) latex(a) and everything was fine. The following also worked: data(iris) a - summary(Species~Sepal.Length, method='reverse',data=iris) latex(a) See if a bug fix in Hmisc has fixed your problem since the last time you updated the package. Sorry to bother you again, I use the latex command with Sweave, and I would like to see the reports come out well without manual interventions on some tex files. My Hmisc package version is also 1.6-0, and your first example gives me the same problem: the first N on the second row goes into the first column instead of the second one, all the other Ns are one column to the left of the column where they should appear, although the summary command prints ok within R. Also, \multicolumn{} inherits the position parameter {l} of the remaining of the first column, rather than for instance {c} if it where on the second column. The remaining of the latex table is right. Are there any unix tools or latex styles called by your programmes, that I should check on my system? Below is the latex compilation output that appears after the command latex(a) of your first example. This is TeX, Version 3.14159 (Web2C 7.3.7) (/tmp/Rtmp1996/file66334873.tex LaTeX2e 2001/06/01 Babel v3.7h and hyphenation patterns for american, french, german, ngerman, n ohyphenation, loaded. (/usr/share/texmf/tex/latex/base/report.cls Document Class: report 2001/04/21 v1.4e Standard LaTeX document class (/usr/share/texmf/tex/latex/base/size10.clo)) (/usr/share/texmf/tex/latex/misc/geometry.sty (/usr/share/texmf/tex/latex/graphics/keyval.sty) (/usr/share/texmf/tex/latex/config/geometry.cfg)) No file file66334873.aux. Underfull \hbox (badness 1) in paragraph at lines 19--20 [1] (./file66334873.aux) LaTeX Warning: Label(s) may have changed. Rerun to get cross-references right. ) (see the transcript file for additional information) Output written on file66334873.dvi (1 page, 760 bytes). Transcript written on file66334873.log. Thanks for your help, -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] car package dependencies
Martin Wegmann [EMAIL PROTECTED] wrote: I tried to install the car package but I can't solve the dependencies. car needs grid, lattice and dr but when I try to install grid I get this error prompt: wz3x64:/home/oggi/R/software/contrib # rpm -i R-car-1.0.R3-1.i386.rpm error: failed dependencies: R-grid is needed by R-car-1.0.R3-1 R-lattice is needed by R-car-1.0.R3-1 [...] how do I solve this problem? thanks in advance, cheers Martin Why would you want to use rpm? See ?install.packages and (at least) pages 7-8 of R Installation and Administration -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Re: [BioC] installing XML in linux
Mahbub Latif [EMAIL PROTECTED] wrote: To install libhdf5 what I am getting $ apt-get install libhdf5-serial-dev libhdf5-serial-dev: Depends: libhdf5-serial (= 1.4.5-2) but it is not going to be installed then I try... $ apt-get install libhdf5-serial libhdf5-serial: Depends: libc6 (= 2.3.1-1) but 2.2.5-11.5 is to be installed That means I need libc6 2.3.1-1 or higher. How can I get that? libc6-2.3.1 is in testing (sarge), while libc6-2.2.5 is still in the stable (woody) distribution of debian. What confuses me a bit from your message is that libhdf5 is _not_ in woody (libhdf4 is), and that the version that you are trying to install is not even in sarge. On a sarge system, the current package libhdf5-serial-dev has version number 1.4.4-0.2 and depends on libc6-2.2.5-13, not the newer libc6-2.3.1. In other words, it looks like your /etc/apt/sources.list points towards the unstable (sid) distribution, while your debian system has not been upgraded. My 1ยข piece of advice would be to steer away from sid until you master the intricacies of the debian packaging system. Aside from fixing this mess, you may just retrieve the sources and compile them against your current libc. -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help