[R] use of glm and cubic splines
When I fit a model like glm(gb~bs(age,df=6)), I obtain 7 estimates. Can anybody explain me where they stand for? Thank you Niel Hens Center For Statistics Limburgs Universitair Centrum Universitaire Campus, Building D 3590 Diepenbeek Tel: +32-11-26 82 32 Fax: +32-11-26 82 99 Email: [EMAIL PROTECTED] [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Installing R in Linux 8.0
On Tue, 2003-10-07 at 01:00, Peter Dalgaard BSA wrote: Javier Arsuaga [EMAIL PROTECTED] writes: I am trying to install R in Linux 8.0 and I downloaded R-1.7.1-1.i386.rpm and did rpm -hiv R-1.7.1-1.i386.rpm and I am getting the following message: warning: R-1.7.1-1.i386.rpm: V3 DSA signature: NOKEY, key ID 97d3544e error: Failed dependencies: libblas.so.3 is needed by R-1.7.1-1 Then I went and look for libblas (which is a linear algebra library) that I found in http://www.hklpg.org/RPM/libblas.so.3.html and downloaded blas-3.0-9.1mlx.i386.rpm Tried to do rpm -hiv blas-3.0-9.1mlx.i386.rpm and got error: cannot get exclusive lock on /var/lib/rpm/Packages error: cannot open Packages index using db3 - Operation not permitted (1) error: cannot open Packages database in /var/lib/rpm Any suggestions, idea, help...? Wouldn't know about the locking issue -- usually means that you have two processes trying to do RPM things. However, the mlx in the RPM you found suggests that it may be for a non-RedHat distribution (muLinux??). There's supposed to be a blas in RedHat itself: [EMAIL PROTECTED] R]$ rpm -qf /usr/lib/libblas.so.3 blas-3.0-18 so I suggest you get that and install instead. I believe Martyn recently compiled a list of RedHat packages that were necessary to install the RPMs and placed them somewhere easily findable. That was for Red Hat 9. Javier appears to be using Red Hat 8.0 (NB Javier NOT Linux 8.0). I haven't got round to doing a list for 8.0. The R RPMS for Red Hat only depend on other packages that are distributed with Red Hat Linux. Your primary source for the required RPMS should therefore be the set of CDs that you used to install Red Hat, or the Red Hat web site: http://www.redhat.com/download/mirror.html The error message means that you forgot to become super user (root) before attempting to install R. Martyn __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Optimising code
Hi, Does anyone have any advice on speeding up R functions (short of re-implementing them in C :-) )? I have a function that applies a wilcoxon test to 12 sets of about a quarter of a million pairs (and takes about 3 hours). I've replaced the inner loop I had originally with a function call via mapply, and also considered different approximations of the wilcoxon, rather than that which is implemented in wilcox.test, but that makes little difference 9and if anything slows things down :-). Cheers, Crispin This email is confidential and intended solely for the use o...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] monotone spline
Dear all, Sorry for the bad use of the list I did; I'm very young, only 4 days old to this list :-) Thanks a lot for your help and your hints: At 09.01 06/10/03 +0200, you wrote: mono.con(mgcv) Monotonicity constraints for a cubic regression spline. That is what I was looking for. It was under my eyes... Thank you for your help. Best, Alessandro __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Installing R with all packages
Hi, I want R to be installed on a UNIX network (Solaris). I am not the system administrator and so I cannot do it myself. The system administrator wants to know which packages I want, and it may be a lot. Is there an easy way to download and install all packages at once? Is it a good idea? (There is a good chance that I do not need the some few packages that do not install well during such a procedure, and so I would like to tell the sysadmin to do it even if it will not be 100% successful). Unfortunately it may be even more compicated, because it may be (I was not able to find it out absolutely surely) that our net architecture does not allow to do it via install.packages from within R. So what is the easiest way to do it from outside R? If it is not a good idea to install all packages at once, what is the easiest way to download and install a list of, say, 30 packages? R CMD INSTALL accepts a list as input; but how to download a list of 30 packages at once? (The sysadmin would really appreciate if we could do it in a way that later additions of packages are reduced to a minimum.) Best, Christian *** Christian Hennig Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg [EMAIL PROTECTED], http://www.math.uni-hamburg.de/home/hennig/ ### ich empfehle www.boag-online.de __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Optimising code
Crispin Miller wrote: Hi, Does anyone have any advice on speeding up R functions (short of re-implementing them in C :-) )? Some strategies are in every good book on S/R. I have a function that applies a wilcoxon test to 12 sets of about a quarter of a million pairs ... and let me guess: everything is significiant to an almost arbitrary value of \alpha? (and takes about 3 hours). I've replaced the inner loop I had originally with a function call via mapply, and also considered different approximations of the wilcoxon, rather than that which is implemented in wilcox.test, but that makes little difference 9and if anything slows things down :-). Are you using wilcox.test(), or a self written function? Uwe Ligges Cheers, Crispin __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] I need your help....
Hello, I have a problem, I can't install the package 'mgu74av2cdf'. I downloaded the zip file, yet when asked the R console to install it from a zip file, I got the answer: Error in file(file, r) : unable to open connection In addition: Warning messages: 1: error -1 in extracting from zip file 2: cannot open file `mgu74av2cdf/DESCRIPTION' What can I do? please help me Thank you in advance, Yair Snir __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
FW: [R] Optimising code
I have a function that applies a wilcoxon test to 12 sets of about a quarter of a million pairs ... and let me guess: everything is significiant to an almost arbitrary value of \alpha? :-) For each of quarter of a million sets, I do a wilcoxon between two pairs each containing twenty numbers... I do this 12 times... (and takes about 3 hours). I've replaced the inner loop I had originally with a function call via mapply, and also considered different approximations of the wilcoxon, rather than that which is implemented in wilcox.test, but that makes little difference 9and if anything slows things down :-). Are you using wilcox.test(), or a self written function? I started off with wilcox.test, and tried to speed it up by hacking out as much from the original function as possible, since a fair proportion of the code being executed was logic deciding between the different flavours of the test (I didn't expect that to make much difference, but tried it anyway), there was also a call to pnorm() which I replaced with a numeric approximation. This is not inlined into the original function. Crispin This email is confidential and intended solely for the use o...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] I need your help....
Yair Snir wrote: Hello, I have a problem, I can't install the package 'mgu74av2cdf'. I downloaded the zip file, yet when asked the R console to install it from a zip file, I got the answer: Error in file(file, r) : unable to open connection In addition: Warning messages: 1: error -1 in extracting from zip file 2: cannot open file `mgu74av2cdf/DESCRIPTION' What can I do? please help me So it is probably not a valid binary package. Where is the package from (it's not a CRAN package)? Uwe Ligges Thank you in advance, Yair Snir __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: FW: [R] Optimising code
Crispin Miller wrote: I have a function that applies a wilcoxon test to 12 sets of about a quarter of a million pairs ... and let me guess: everything is significiant to an almost arbitrary value of \alpha? :-) For each of quarter of a million sets, I do a wilcoxon between two pairs each containing twenty numbers... I do this 12 times... Ah. Sorry for misunderstanding. (and takes about 3 hours). I've replaced the inner loop I had originally with a function call via mapply, and also considered different approximations of the wilcoxon, rather than that which is implemented in wilcox.test, but that makes little difference 9and if anything slows things down :-). Are you using wilcox.test(), or a self written function? I started off with wilcox.test, and tried to speed it up by hacking out as much from the original function as possible, since a fair proportion of the code being executed was logic deciding between the different flavours of the test (I didn't expect that to make much difference, but tried it anyway), there was also a call to pnorm() which I replaced with a numeric approximation. This is not inlined into the original function. In that case you cannot do very much except for writing it in a language like C / Fortran, if you really need the speed. Uwe Ligges Crispin This email is confidential and intended solely for the use o...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] I need your help....
Uwe Ligges [EMAIL PROTECTED] writes: Yair Snir wrote: Hello, I have a problem, I can't install the package 'mgu74av2cdf'. I downloaded the zip file, yet when asked the R console to install it from a zip file, I got the answer: Error in file(file, r) : unable to open connection In addition: Warning messages: 1: error -1 in extracting from zip file 2: cannot open file `mgu74av2cdf/DESCRIPTION' What can I do? please help me So it is probably not a valid binary package. Where is the package from (it's not a CRAN package)? It's an Affymetrix thingie, so the BioC list would be the more obvious place to ask. Notice that there are R data packages, e.g. http://biowww.dfci.harvard.edu/~bioconductor/data/cdfenvs/Win32/mgu74av2cdf_0.1.zip and (if I understand correctly) S-PLUS data libraries like http://www.insightful.com/support/ArrayAnalyzer/DataLibs/CDFLibs/mgu74cv2cdf.zip and I suspect they are not interchangeable even though both come in .zip files. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] If I produce lots of figures at one time, how can I make R graphics keep all the figures already made?
If I produce lots of figures at one time, how can I make R graphics keep all the figures already made? thanks, Xinyue Ye, Research Assistant Institute for Geo-spatial Research and Education 125 King Hall Eastern Michigan University Ypsilanti MI 48197 http://ceita.emich.edu/ [[alternative HTML version deleted]] __ [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: FW: [R] Optimising code
Yup, my mistake for not being very clear! Alas the computer is already very fast - looks like it's C for me... -Original Message- From: Patrick Burns [mailto:[EMAIL PROTECTED] Sent: 07 October 2003 12:00 Cc: Crispin Miller Subject: Re: FW: [R] Optimising code I had misunderstood also. I agree with Uwe either move to C or buy a faster computer -- or at least another one. Pat Uwe Ligges wrote: Crispin Miller wrote: I have a function that applies a wilcoxon test to 12 sets of about a quarter of a million pairs ... and let me guess: everything is significiant to an almost arbitrary value of \alpha? :-) For each of quarter of a million sets, I do a wilcoxon between two pairs each containing twenty numbers... I do this 12 times... Ah. Sorry for misunderstanding. (and takes about 3 hours). I've replaced the inner loop I had originally with a function call via mapply, and also considered different approximations of the wilcoxon, rather than that which is implemented in wilcox.test, but that makes little difference 9and if anything slows things down :-). Are you using wilcox.test(), or a self written function? I started off with wilcox.test, and tried to speed it up by hacking out as much from the original function as possible, since a fair proportion of the code being executed was logic deciding between the different flavours of the test (I didn't expect that to make much difference, but tried it anyway), there was also a call to pnorm() which I replaced with a numeric approximation. This is not inlined into the original function. In that case you cannot do very much except for writing it in a language like C / Fortran, if you really need the speed. Uwe Ligges Crispin This email is confidential and intended solely for the use o...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help This email is confidential and intended solely for the use o...{{dropped}} __ [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 schrieb: If I produce lots of figures at one time, how can I make R graphics keep all the figures already made? thanks, write it to a postscript() or pdf() file or to several bitmaps, see png() for examples. If you are on Windows, there is a Recording function in the menu, if the graphics window is activated. Thomas Petzoldt __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Installing R with all packages
Christian Hennig wrote: Hi, I want R to be installed on a UNIX network (Solaris). I am not the system administrator and so I cannot do it myself. The system administrator wants to know which packages I want, and it may be a lot. Is there an easy way to download and install all packages at once? Yes. Combination of CRAN.packages() and install.packages() will do, but it's for sure an overhead to install all packages given you are the only one who uses R on that machine. Is it a good idea? (There is a good chance that I do not need the some few packages that do not install well during such a procedure, and so I would like to tell the sysadmin to do it even if it will not be 100% successful). Unfortunately it may be even more compicated, because it may be (I was not able to find it out absolutely surely) that our net architecture does not allow to do it via install.packages from within R. So what is the easiest way to do it from outside R? If it is not a good idea to install all packages at once, what is the easiest way to download and install a list of, say, 30 packages? R CMD INSTALL accepts a list as input; but how to download a list of 30 packages at once? E.g. download.file() within R or wget outside are the tools I'd choose. (The sysadmin would really appreciate if we could do it in a way that later additions of packages are reduced to a minimum.) Have you told the sysadmin that some packages are updated very frequently? I propose to set up your own library section (in a directory accessible by yourself), where you can install packages independently from the sysadmin. Uwe Ligges __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: FW: [R] Optimising code
If you are only interested in calculating the wilcoxon statistic (as one would with calculating permutated p-values for example), the following should suffice. length.na - function(x, ...){ tmp - !(is.na(x) | is.infinite(x)) length(x[tmp], ...) } rank.na - function(x){ y - x[!is.na(x)]; x[!is.na(x)] - rank(y); return(x) } wstats.fn - function(data=NULL, g1=NULL, g2=NULL){ temp - t( apply(data, 1, rank.na)); n1 - apply(temp[ ,g1], 1, length.na); n2 - apply(temp[ ,g2], 1, length.na); wstats - rowSums( temp[,g1], na.rm=TRUE ) - n1*(n2 + 1)/2; return(wstats); } m - matrix( rnorm( 2500*100 ), ncol=100 ) w1 - wstats.fn(data=m, g1=1:50, g2=51:100) w2 - apply(m, 1, function(x) wilcox.test( x[1:50], x[51:100] )$stat) On my machine, it take 2.2s to calculate w1 compared to 15.6s for w2. rank.na and length.na are not necessary if your data does not have missing values. Since you are doing large enough times it might be wise to code in C. My C version of this is at least 20-40 times faster than the one in R but like the one above it does not return p-values. -- Adaikalavan Ramasamy -Original Message- From: Uwe Ligges [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 07, 2003 6:18 PM To: Crispin Miller Cc: R-help (E-mail) Subject: Re: FW: [R] Optimising code Crispin Miller wrote: I have a function that applies a wilcoxon test to 12 sets of about a quarter of a million pairs ... and let me guess: everything is significiant to an almost arbitrary value of \alpha? :-) For each of quarter of a million sets, I do a wilcoxon between two pairs each containing twenty numbers... I do this 12 times... Ah. Sorry for misunderstanding. (and takes about 3 hours). I've replaced the inner loop I had originally with a function call via mapply, and also considered different approximations of the wilcoxon, rather than that which is implemented in wilcox.test, but that makes little difference 9and if anything slows things down :-). Are you using wilcox.test(), or a self written function? I started off with wilcox.test, and tried to speed it up by hacking out as much from the original function as possible, since a fair proportion of the code being executed was logic deciding between the different flavours of the test (I didn't expect that to make much difference, but tried it anyway), there was also a call to pnorm() which I replaced with a numeric approximation. This is not inlined into the original function. In that case you cannot do very much except for writing it in a language like C / Fortran, if you really need the speed. Uwe Ligges Crispin This email is confidential and intended solely for the use o...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Beginner's query - segmentation fault
I am dealing with a huge matrix in R (20 columns, 54000 rows) and have lots of missing values within the dataset which are currently displayed as the value -999.00 I am trying to create a new matrix (or change the existing one) to display these values as NA so that I can then perform the necessary analysis on the columns within the matrix. The matrix name is temp and the column names are t1 to t20 inclusive. I have tried the following command: temp$t1[temp$t1 == -999.00] - NA and it returns a segmentation fault, can someone tell me what I am doing wrong? Thanks Laura __ [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?
At 13:31 2003-10-07 +0200, you wrote: If I produce lots of figures at one time, how can I make R graphics keep all the figures already made? thanks, If you are on Windows, there is a Recording function in the menu, if the graphics window is activated. Actually, the recording of plots can be switched on by windows(record = TRUE). Henric __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Installing R with all packages
I once copied all the contrib package sources from CRAN to a local directory (I used an ftp client, but you could use rsync or wget : just don't do it recursively or you will get the Archive too) and ran R CMD INSTALL *.tar.gz The only overhead in installing all packages at once is disc space: we seem to have 320Mb in R_HOME/library here. On Tue, 7 Oct 2003, Christian Hennig wrote: Hi, I want R to be installed on a UNIX network (Solaris). I am not the system administrator and so I cannot do it myself. The system administrator wants to know which packages I want, and it may be a lot. Is there an easy way to download and install all packages at once? Is it a good idea? (There is a good chance that I do not need the some few packages that do not install well during such a procedure, and so I would like to tell the sysadmin to do it even if it will not be 100% successful). Unfortunately it may be even more compicated, because it may be (I was not able to find it out absolutely surely) that our net architecture does not allow to do it via install.packages from within R. So what is the easiest way to do it from outside R? If it is not a good idea to install all packages at once, what is the easiest way to download and install a list of, say, 30 packages? R CMD INSTALL accepts a list as input; but how to download a list of 30 packages at once? (The sysadmin would really appreciate if we could do it in a way that later additions of packages are reduced to a minimum.) Best, Christian *** Christian Hennig Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg [EMAIL PROTECTED], http://www.math.uni-hamburg.de/home/hennig/ ### ich empfehle www.boag-online.de __ [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
Re: [R] Installing R with all packages
Christian Hennig [EMAIL PROTECTED] writes: I want R to be installed on a UNIX network (Solaris). I am not the system administrator and so I cannot do it myself. The system administrator wants to know which packages I want, and it may be a lot. Is there an easy way to download and install all packages at once? Is it a good idea? (There is a good chance that I do not need the some few packages that do not install well during such a procedure, and so I would like to tell the sysadmin to do it even if it will not be 100% successful). Others have commented on how to do it outside of R. If you end up being able to do it within R, consider the following hack'd function: installNewCRANPackages - function() { test2 - packageStatus()$avail[Status] install.packages(row.names(test2)[which(test2$Status==not installed)]) } best, -tony -- [EMAIL PROTECTED]http://www.analytics.washington.edu/ Biomedical and Health Informatics University of Washington Biostatistics, SCHARP/HVTN Fred Hutchinson Cancer Research Center UW (Tu/Th/F): 206-616-7630 FAX=206-543-3461 | Voicemail is unreliable FHCRC (M/W): 206-667-7025 FAX=206-667-4812 | use Email CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Beginner's query - segmentation fault
Laura Quinn [EMAIL PROTECTED] writes: I am dealing with a huge matrix in R (20 columns, 54000 rows) and have lots of missing values within the dataset which are currently displayed as the value -999.00 I am trying to create a new matrix (or change the existing one) to display these values as NA so that I can then perform the necessary analysis on the columns within the matrix. The matrix name is temp and the column names are t1 to t20 inclusive. I have tried the following command: temp$t1[temp$t1 == -999.00] - NA and it returns a segmentation fault, can someone tell me what I am doing wrong? Not telling us which system and which version you are using, and not giving us a reproducible example... OK, the latter can be tricky, but does it happen all the time? Only after doing X? Also if you deal with a subset of data? The command as such should work as far as I can see, and segmentation faults should basically not happen unless the user has been messing about at the C code level. (BTW, that's a data frame, not a matrix, I assume.) -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Beginner's query - segmentation fault
On Tue, 7 Oct 2003, Laura Quinn wrote: I am dealing with a huge matrix in R (20 columns, 54000 rows) and have lots of missing values within the dataset which are currently displayed as the value -999.00 I am trying to create a new matrix (or change the existing one) to display these values as NA so that I can then perform the necessary analysis on the columns within the matrix. The matrix name is temp and the column names are t1 to t20 inclusive. I have tried the following command: temp$t1[temp$t1 == -999.00] - NA and it returns a segmentation fault, can someone tell me what I am doing wrong? Well, R should not segfault, so there is bug here somewhere. However, I don't think what you have described can actually work. Is temp really a matrix? If so temp$t1 will return NULL, and you should get an error message. If temp is a matrix temp[temp == -999.00] - NA will do what you want. If as is more likely temp is a data frame with all columns numeric, there are several ways to do this, e.g. temp[] - lapply(temp, function(x) ifelse(x == -999, NA, x)) temp[as.matrix(temp) == -999] - NA # only in recent versions of R as well as explicit looping over columns. -- 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
Re: [R] If I produce lots of figures at one time, how can I make R graphics keep all the figures already made?
On Tue, 7 Oct 2003, Henric Nilsson wrote: At 13:31 2003-10-07 +0200, you wrote: If I produce lots of figures at one time, how can I make R graphics keep all the figures already made? thanks, If you are on Windows, there is a Recording function in the menu, if the graphics window is activated. Actually, the recording of plots can be switched on by windows(record = TRUE). and on any platform you can use recordPlot() and replayPlot(x) to record and redisplay plots (on a screen device only). -- 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
RE: [R] Beginner's query - segmentation fault
I cannot explain the segmentation fault but try this instead (which works for matrices) temp[which(temp==-999, arr.ind=T)] - NA Are you sure temp is matrix and not a dataframe ? Use class(temp) to find out. Also, if you are getting these -999.00 because you have read files containing them, it might just be easier to code the missing values when reading in. Try read.table( file=lala.txt, na.strings = -999.00). -- Adaikalavan Ramasamy -Original Message- From: Laura Quinn [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 07, 2003 8:04 PM To: [EMAIL PROTECTED] Subject: [R] Beginner's query - segmentation fault I am dealing with a huge matrix in R (20 columns, 54000 rows) and have lots of missing values within the dataset which are currently displayed as the value -999.00 I am trying to create a new matrix (or change the existing one) to display these values as NA so that I can then perform the necessary analysis on the columns within the matrix. The matrix name is temp and the column names are t1 to t20 inclusive. I have tried the following command: temp$t1[temp$t1 == -999.00] - NA and it returns a segmentation fault, can someone tell me what I am doing wrong? Thanks Laura __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Beginner's query - segmentation fault
Laura Quinn wrote: I am dealing with a huge matrix in R (20 columns, 54000 rows) and have lots of missing values within the dataset which are currently displayed as the value -999.00 I am trying to create a new matrix (or change the existing one) to display these values as NA so that I can then perform the necessary analysis on the columns within the matrix. The matrix name is temp and the column names are t1 to t20 inclusive. I have tried the following command: temp$t1[temp$t1 == -999.00] - NA and it returns a segmentation fault, can someone tell me what I am doing wrong? The crash for this inappropriate usage has already been fixed for R-1.7.1, so you are using an outdated version, I guess. 1. If temp is a matrix, you have to use matrix indexing, not data.frame or list indexing, see the manuals. Now, we have got the (still wrong) line temp[temp[ ,t1] == -999.00, t1] - NA 2. Use is.na(x) - TRUE instead of x - NA: is.na(temp[temp[ ,t1] == -999.00, t1]) - TRUE Or change all values -999 to NA in the whole matrix by is.na(temp[temp == -999.00]) - TRUE Uwe Ligges Thanks Laura __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] I need your help....
This is a question for the Bioconductor listserv, not R-help. In addition, all current versions of affy will automagically download and install any cdfenvs that you may need, so there is no need to do this manually. If anything, you may need to update your version of affy. Jim James W. MacDonald Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 Peter Dalgaard BSA [EMAIL PROTECTED] 10/07/03 06:33AM Uwe Ligges [EMAIL PROTECTED] writes: Yair Snir wrote: Hello, I have a problem, I can't install the package 'mgu74av2cdf'. I downloaded the zip file, yet when asked the R console to install it from a zip file, I got the answer: Error in file(file, r) : unable to open connection In addition: Warning messages: 1: error -1 in extracting from zip file 2: cannot open file `mgu74av2cdf/DESCRIPTION' What can I do? please help me So it is probably not a valid binary package. Where is the package from (it's not a CRAN package)? It's an Affymetrix thingie, so the BioC list would be the more obvious place to ask. Notice that there are R data packages, e.g. http://biowww.dfci.harvard.edu/~bioconductor/data/cdfenvs/Win32/mgu74av2cdf_0.1.zip and (if I understand correctly) S-PLUS data libraries like http://www.insightful.com/support/ArrayAnalyzer/DataLibs/CDFLibs/mgu74cv2cdf.zip and I suspect they are not interchangeable even though both come in .zip files. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Beginner's query - segmentation fault
thanks, have used temp [temp==0]- NA and this seems to have worked, though it won't let me access individual columns (ie temp$t1 etc) to work on - is there any real advantage in using a matrix, or would i be better advised to deal with dataframes? (I have double checked and temp is currently a matrix). On Tue, 7 Oct 2003, Prof Brian Ripley wrote: On Tue, 7 Oct 2003, Laura Quinn wrote: I am dealing with a huge matrix in R (20 columns, 54000 rows) and have lots of missing values within the dataset which are currently displayed as the value -999.00 I am trying to create a new matrix (or change the existing one) to display these values as NA so that I can then perform the necessary analysis on the columns within the matrix. The matrix name is temp and the column names are t1 to t20 inclusive. I have tried the following command: temp$t1[temp$t1 == -999.00] - NA and it returns a segmentation fault, can someone tell me what I am doing wrong? Well, R should not segfault, so there is bug here somewhere. However, I don't think what you have described can actually work. Is temp really a matrix? If so temp$t1 will return NULL, and you should get an error message. If temp is a matrix temp[temp == -999.00] - NA will do what you want. If as is more likely temp is a data frame with all columns numeric, there are several ways to do this, e.g. temp[] - lapply(temp, function(x) ifelse(x == -999, NA, x)) temp[as.matrix(temp) == -999] - NA # only in recent versions of R as well as explicit looping over columns. -- 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
Re: [R] Beginner's query - segmentation fault
Adaikalavan RAMASAMY wrote: I cannot explain the segmentation fault but try this instead (which works for matrices) temp[which(temp==-999, arr.ind=T)] - NA No! Please *do* use is.na()- !!! Uwe Ligges Are you sure temp is matrix and not a dataframe ? Use class(temp) to find out. Also, if you are getting these -999.00 because you have read files containing them, it might just be easier to code the missing values when reading in. Try read.table( file=lala.txt, na.strings = -999.00). -- Adaikalavan Ramasamy -Original Message- From: Laura Quinn [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 07, 2003 8:04 PM To: [EMAIL PROTECTED] Subject: [R] Beginner's query - segmentation fault I am dealing with a huge matrix in R (20 columns, 54000 rows) and have lots of missing values within the dataset which are currently displayed as the value -999.00 I am trying to create a new matrix (or change the existing one) to display these values as NA so that I can then perform the necessary analysis on the columns within the matrix. The matrix name is temp and the column names are t1 to t20 inclusive. I have tried the following command: temp$t1[temp$t1 == -999.00] - NA and it returns a segmentation fault, can someone tell me what I am doing wrong? Thanks Laura __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Beginner's query - segmentation fault
On Tue, 7 Oct 2003, Laura Quinn wrote: thanks, have used temp [temp==0]- NA and this seems to have worked, though it won't let me access individual columns (ie temp$t1 etc) to work on - is there any real advantage in using a matrix, or would i be better advised to deal with dataframes? (I have double checked and temp is currently a matrix). Things are going to be a lot faster for a numerical matrix than a data frame: the advantage of data frames is that the columns can be of different types. BTW, you should really use temp[, t1] for a data frame or a matrix: temp$t1 works for data frames, `by the back door' and has a number of bugs (including failing to detect errors which corrupt the data frame) prior to 1.8.0 (to be). On Tue, 7 Oct 2003, Prof Brian Ripley wrote: On Tue, 7 Oct 2003, Laura Quinn wrote: I am dealing with a huge matrix in R (20 columns, 54000 rows) and have lots of missing values within the dataset which are currently displayed as the value -999.00 I am trying to create a new matrix (or change the existing one) to display these values as NA so that I can then perform the necessary analysis on the columns within the matrix. The matrix name is temp and the column names are t1 to t20 inclusive. I have tried the following command: temp$t1[temp$t1 == -999.00] - NA and it returns a segmentation fault, can someone tell me what I am doing wrong? Well, R should not segfault, so there is bug here somewhere. However, I don't think what you have described can actually work. Is temp really a matrix? If so temp$t1 will return NULL, and you should get an error message. If temp is a matrix temp[temp == -999.00] - NA will do what you want. If as is more likely temp is a data frame with all columns numeric, there are several ways to do this, e.g. temp[] - lapply(temp, function(x) ifelse(x == -999, NA, x)) temp[as.matrix(temp) == -999] - NA # only in recent versions of R as well as explicit looping over columns. -- 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 -- 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
Re: [R] Beginner's query - segmentation fault
Laura Quinn wrote: thanks, have used temp [temp==0]- NA Please use is.na(temp[temp==0]) - TRUE and this seems to have worked, though it won't let me access individual columns (ie temp$t1 etc) No! temp$t1 is a list element or column of a data.frame, but not a column of a matrix. *PLEASE*, read manuals, help pages, or books on R how to use index / extract elements. Please read my previous answer on how to access individual columns. to work on - is there any real advantage in using a matrix, or would i be better advised to deal with dataframes? (I have double checked and temp is currently a matrix). Working on matrices is supposed to be faster. But matrices have the restriction of one data type for all columns (e.g. numeric). Uwe Ligges On Tue, 7 Oct 2003, Prof Brian Ripley wrote: On Tue, 7 Oct 2003, Laura Quinn wrote: I am dealing with a huge matrix in R (20 columns, 54000 rows) and have lots of missing values within the dataset which are currently displayed as the value -999.00 I am trying to create a new matrix (or change the existing one) to display these values as NA so that I can then perform the necessary analysis on the columns within the matrix. The matrix name is temp and the column names are t1 to t20 inclusive. I have tried the following command: temp$t1[temp$t1 == -999.00] - NA and it returns a segmentation fault, can someone tell me what I am doing wrong? Well, R should not segfault, so there is bug here somewhere. However, I don't think what you have described can actually work. Is temp really a matrix? If so temp$t1 will return NULL, and you should get an error message. If temp is a matrix temp[temp == -999.00] - NA will do what you want. If as is more likely temp is a data frame with all columns numeric, there are several ways to do this, e.g. temp[] - lapply(temp, function(x) ifelse(x == -999, NA, x)) temp[as.matrix(temp) == -999] - NA # only in recent versions of R as well as explicit looping over columns. -- 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 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] is.na(x) - TRUE versus x - NA (was: Beginner's query - segmentation fault)
On Tue, 07 Oct 2003 14:37:26 +0200, Uwe Ligges [EMAIL PROTECTED] wrote : 2. Use is.na(x) - TRUE instead of x - NA: is.na(temp[temp[ ,t1] == -999.00, t1]) - TRUE I hadn't heard this advice before. The online help ?is.na gives this cryptic advice: Function 'is.na-' may provide a safer way to set missingness. It behaves differently for factors, for example. I assume it means safer than assigning NA, and differently than assigning NA, but how exactly is it safer, and how is it different? Duncan __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] .First.lib doesn't appear to be running after calling library()
Hi - so I've dusted off the C bits of my brain and gotten a library written for my package... It passes R CMD check ok, and I've put a file called '.First.lib.R' in the pacakge's 'R' subdirectory. Its permissions are 644. It says: .First.lib - function(lib,pkg) { library.dynam(foo,pkg,lib); require(affy,quietly=TRUE); } I build and INSTALL the package, start R and then call library(foo). I deduce that my '.First.lib' isn't running because the affy library doesn't get loaded - and neither does my dynamic library (which complies ok and results in 'foo.so' being put in the 'src/' directory of the package)... Any ideas what I'm doing wrong? Crispin This email is confidential and intended solely for the use o...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Re: Use of the Foreign package to import Stata files
Regarding an old version of foreign allegedly being able to read the file at http://www.ats.ucla.edu/stat/stata/examples/rwg/concord1.dta Thomas Lumley [EMAIL PROTECTED] responded to my call for help: I don't know why it used to work. The file begins with 'h' (0x68), which isn't in my list of valid Stata file types. On the other hand, Stata has no problem with it. It's possible that it is a version 4 file (which would make sense, since version 5 file start with 'i' and increase from there) but that wouldn't explain why it used to work. With the stataread package (which predates 0.5-x of foreign) I get Not a Stata version 5-7 data file. Thomas Lumley [EMAIL PROTECTED] continued: I just found an old 1.6.2 (Mac OS/Darwin) lying around and it doesn't recognize the file as a stata file (with foreign 0.5-8) Thomas, My apologies. It turns out that using R 1.6.2 and an old foreign library, I *can't* read the concord1.dta file at that url, though I *can* read a concord1.dta file that I'd downloaded several months ago. So either the archive at www.ats.ucla.edu overwrote good files with bad, or maybe their site doesn't match an alternate source for the same data files. Either way, I'm sorry to have sent you on a wild goose chase. The error was not in your package. Thank you for your prompt replies. alan -- Alan B. Cobo-Lewis, Ph.D. (207) 581-3840 tel Department of Psychology(207) 581-6128 fax University of Maine Orono, ME 04469-5742[EMAIL PROTECTED] http://www.umaine.edu/visualperception __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Adjusting for within-cluster correlation: robcov() in Design-package and 'ids' in survey-package
On Tue, 7 Oct 2003, Bernd Weiss wrote: Dear all, I would like to know if it possible to use the the robcov()-command in the Design- package in order to obtain a robust variance-estimate that adjusts for within-cluster correlation. Does the ids-option in the survey-package the same job? Yes and roughly yes. The survey package version also can handle stratification and sampling from a finite population, making it more complicated to use. -thomas __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Re: is.na(x) - TRUE versus x - NA
Duncan Murdoch wrote: On Tue, 07 Oct 2003 14:37:26 +0200, Uwe Ligges [EMAIL PROTECTED] wrote : 2. Use is.na(x) - TRUE instead of x - NA: is.na(temp[temp[ ,t1] == -999.00, t1]) - TRUE I hadn't heard this advice before. The online help ?is.na gives this cryptic advice: Function 'is.na-' may provide a safer way to set missingness. It behaves differently for factors, for example. I assume it means safer than assigning NA, and differently than assigning NA, but how exactly is it safer, and how is it different? H. I was sure I had constructed an problematic example for a course I hold last year in Dortmund, but I cannot find it again. Maybe something for NA assignmets (into character vectors, I remember?) has been fixed in the meantime. Anyway, I have had the experience that there are cases, where is.na(x) - TRUE is the more secure way of doing it. Additionally, it's mentioned in ?NA and in S Programming, for example. Uwe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] .First.lib doesn't appear to be running after calling lib rary()
From the R-exts manual: The R subdirectory contains R code files. The code files to be installed must start with a (lower or upper case) letter and have one of the extensions .R, .S, .q, .r, or .s. We recommend using .R, as this extension seems to be not used by any other software. It should be possible to read in the files using source(), so R objects must be created by assignments. Note that there need be no connection between the name of the file and the R objects created by it. If necessary, one of these files (historically zzz.R) should use library.dynam() inside .First.lib() to load compiled code. So the problem is the . that the filename starts with. HTH, Andy From: Crispin Miller [mailto:[EMAIL PROTECTED] Hi - so I've dusted off the C bits of my brain and gotten a library written for my package... It passes R CMD check ok, and I've put a file called '.First.lib.R' in the pacakge's 'R' subdirectory. Its permissions are 644. It says: .First.lib - function(lib,pkg) { library.dynam(foo,pkg,lib); require(affy,quietly=TRUE); } I build and INSTALL the package, start R and then call library(foo). I deduce that my '.First.lib' isn't running because the affy library doesn't get loaded - and neither does my dynamic library (which complies ok and results in 'foo.so' being put in the 'src/' directory of the package)... Any ideas what I'm doing wrong? Crispin This email is confidential and intended solely for the use o...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo /r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] .First.lib doesn't appear to be running after calling library()
On Tue, 7 Oct 2003, Crispin Miller wrote: Hi - so I've dusted off the C bits of my brain and gotten a library written for my package... It passes R CMD check ok, and I've put a file called '.First.lib.R' in the pacakge's 'R' subdirectory. Its permissions are 644. It says: .First.lib - function(lib,pkg) { library.dynam(foo,pkg,lib); require(affy,quietly=TRUE); } I build and INSTALL the package, start R and then call library(foo). I deduce that my '.First.lib' isn't running because the affy library doesn't get loaded - and neither does my dynamic library (which complies ok and results in 'foo.so' being put in the 'src/' directory of the package)... Any ideas what I'm doing wrong? Don't use a file name starting with a dot. Assuming this is Unix and R 1.7.1, INSTALL does Rfiles=`LC_COLLATE=C ls R/*.[RSqrs] R/${R_OSTYPE}/*.[RSqrs] 2/dev/null` and ls will omit file names starting with a dot. `Writing R Extensions' says The @file{R} subdirectory contains @R{} code files. The code files to be installed must start with a (lower or upper case) letter and have one of the extensions @file{.R}, @file{.S}, @file{.q}, @file{.r}, or @file{.s}. but it seems we don't quite enforce that on either Unix nor Windows. -- 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
RE: [R] .First.lib doesn't appear to be running after calling lib rary()
Thanks - it is indeed the first '.' that's the problem... Crispin -Original Message- From: Liaw, Andy [mailto:[EMAIL PROTECTED] Sent: 07 October 2003 15:21 To: Crispin Miller Subject: RE: [R] .First.lib doesn't appear to be running after calling lib rary() I put .First.lib in the file zzz.R, and it works for me. My guess is that the problem is using a filename that starts with .. I see many packages put the .First.lib in zzz.R, so I just follow that. HTH, Andy -Original Message- From: Crispin Miller [mailto:[EMAIL PROTECTED] Sent: Tuesday, October 07, 2003 10:00 AM To: R-help (E-mail) Subject: [R] .First.lib doesn't appear to be running after calling library() Hi - so I've dusted off the C bits of my brain and gotten a library written for my package... It passes R CMD check ok, and I've put a file called '.First.lib.R' in the pacakge's 'R' subdirectory. Its permissions are 644. It says: .First.lib - function(lib,pkg) { library.dynam(foo,pkg,lib); require(affy,quietly=TRUE); } I build and INSTALL the package, start R and then call library(foo). I deduce that my '.First.lib' isn't running because the affy library doesn't get loaded - and neither does my dynamic library (which complies ok and results in 'foo.so' being put in the 'src/' directory of the package)... Any ideas what I'm doing wrong? Crispin This email is confidential and intended solely for the use o...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo /r-help This email is confidential and intended solely for the use o...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Problem getting an ifelse statment to work
Greg - I am puzzled that the total counts in table(qs2) and table(qs9) could be different, if these are in fact two columns from the same data frame. I'm guessing that there are NAs in one or both columns, in addition to the digits 1,2,3,4, and that table() by default does not show them. (It doesn't.) If there are NAs in either column, I would expect both ifelse() and the logic in both Andy's and Richard's code to not produce the result you have in mind. Here's something which might work as is, or might need some extension: new - ifelse(is.na(qs2), ifelse(is.na(qs9), 0, qs9), qs2) You can find out how many NAs there are in column qs2 by doing sum(is.na(qs2)) Do let us know what finally works. - tom blackwell - u michigan medical school - ann arbor - On Mon, 6 Oct 2003, Liaw, Andy wrote: This is a long way; i.e., not necessarily efficient: qs2 [1] 2 1 1 4 4 4 1 1 1 4 2 4 3 1 4 3 3 2 4 3 qs9 [1] 4 4 1 3 4 3 1 3 1 4 1 2 3 3 4 4 1 4 2 3 decision - function(a, b) { + if (a == 1 || b == 1) return(1) + if (a == 2 || b == 2) return(2) + if (a == 3 || b == 3) return(3) + if (a == 4 || b == 4) return(4) + NA + } mapply(decision, qs2, qs9) [1] 2 1 1 3 4 3 1 1 1 4 1 2 3 1 4 3 1 2 2 3 Hope this is what you want. Andy -Original Message- From: Greg Blevins [mailto:[EMAIL PROTECTED] Sent: Monday, October 06, 2003 11:21 PM Subject: [R] Problem getting an ifelse statment to work I trust I have a simple request. I have a dataframe which among its contents are two variables, qs2 and qs9, which have the following frequencies. table(qs2) qs2 1 2 3 4 40 22 11 29 table(qs9) qs9 1 2 3 4 162 172 91 179 I simply want to create a new variable which I have called SchCode that would be filled based on the following logic (written in Systat syntax): if qs2 = 1 or qs9 = 1 then let SchCode = 1 if qs2 = 2 or qs9 = 2 then let SchCode = 2 if qs2 = 3 or qs9 = 3 then let SchCode = 3 if qs2 = 4 or qs9 = 4 then let SchCode = 4 I have looked through my two Ripley texts, searched the R-help, and have tried various ifelse statements, but I cannot get it right. Help would be appreciated. Thanks, Greg Blevins The Market Solutions Group __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Sorting matrix or data frame
Dear all, Could anyone please tell me how to sort a matrix or a data frame against a column/row/component? Many thanks. -MY __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Sorting matrix or data frame
Yao, Minghua wrote: Dear all, Could anyone please tell me how to sort a matrix or a data frame against a column/row/component? See ?order Uwe Ligges Many thanks. -MY __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] R-1.8.0 memory.limit()
Using R-1.8.0 (d/l and compiled on 2003-10-01) on WinXP, I seem to be unable to determine the maximum memory allocated to R. The help still says to use memory.limit(size=NA), but this returns the value NA. In addition, I have set --max-mem-size=2G but I run out of memory somewhere around 500Mb (which is why I am trying to find out how much memory is allocated). I don't have any other programs open, so I should certainly be able to address more memory than that. Any ideas? TIA Jim James W. MacDonald Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] multiple comparisons
I'm having trouble finding an R equivalent to the S-Plus multicomp function, which does post-hoc comparisons of treatments means in ANOVAs. Am I missing something obvious? Thanks, Peter Peter Adler, PhD Dept. Ecology, Evolution and Marine Biology University of California Santa Barbara, CA 93106 tel: (805) 893-7416 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Installing R with all packages
Hi I use the script in the attached file to do this Cheers P.J. On Tue, 7 Oct 2003, Uwe Ligges wrote: Christian Hennig wrote: Hi, I want R to be installed on a UNIX network (Solaris). I am not the system administrator and so I cannot do it myself. The system administrator wants to know which packages I want, and it may be a lot. Is there an easy way to download and install all packages at once? Yes. Combination of CRAN.packages() and install.packages() will do, but it's for sure an overhead to install all packages given you are the only one who uses R on that machine. Is it a good idea? (There is a good chance that I do not need the some few packages that do not install well during such a procedure, and so I would like to tell the sysadmin to do it even if it will not be 100% successful). Unfortunately it may be even more compicated, because it may be (I was not able to find it out absolutely surely) that our net architecture does not allow to do it via install.packages from within R. So what is the easiest way to do it from outside R? If it is not a good idea to install all packages at once, what is the easiest way to download and install a list of, say, 30 packages? R CMD INSTALL accepts a list as input; but how to download a list of 30 packages at once? E.g. download.file() within R or wget outside are the tools I'd choose. (The sysadmin would really appreciate if we could do it in a way that later additions of packages are reduced to a minimum.) Have you told the sysadmin that some packages are updated very frequently? I propose to set up your own library section (in a directory accessible by yourself), where you can install packages independently from the sysadmin. Uwe Ligges __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help Paulo Justiniano Ribeiro Jr Departamento de EstatÃstica Universidade Federal do Paraná Caixa Postal 19.081 CEP 81.531-990 Curitiba, PR - Brasil Tel: (+55) 41 361 3471 Fax: (+55) 41 361 3141 e-mail: [EMAIL PROTECTED] http://www.est.ufpr.br/~paulojus#!/bin/bash RPACKUP=`pwd` echo == echo downloading packages sources echo == cd /home/DOWNLOADS/R rsync -rvz --delete --include contrib/ --include *.tar.gz --exclude * cran.r-project.org::CRAN/src/ . cd contrib for pack in `ls *.tar.gz` do R CMD INSTALL -c $pack cd $RPACKUP __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] R-1.8.0 memory.limit()
James MacDonald wrote: Using R-1.8.0 (d/l and compiled on 2003-10-01) on WinXP, I seem to be unable to determine the maximum memory allocated to R. The help still says to use memory.limit(size=NA), but this returns the value NA. In addition, I have set --max-mem-size=2G but I run out of memory somewhere around 500Mb (which is why I am trying to find out how much memory is allocated). I don't have any other programs open, so I should certainly be able to address more memory than that. Any ideas? Yes. 2GB is a bit more than the possible theoretical maximal value for a single process on 32-bit Windows. Instead, try starting with, e.g., --max-mem-size=1700M and you'll get memory.limit() [1] 1782579200 Uwe Ligges TIA Jim James W. MacDonald Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] multiple comparisons
On 10/07/03 09:05, Peter Adler wrote: I'm having trouble finding an R equivalent to the S-Plus multicomp function, which does post-hoc comparisons of treatments means in ANOVAs. Am I missing something obvious? The package called multcomp? I don't know if it is the same. -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page:http://www.sas.upenn.edu/~baron R page: http://finzi.psych.upenn.edu/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Installing R with all packages
If it's really true that you will be the only user of R, then it might be easier to build it in some place where you do have the necessary permissions. You would then follow the suggestion in the provided INSTALL file (from R 1.7.1): quote INSTALLATION You do not need to install R to run it: you can run R by the script `bin/R' which you can link or copy to any convenient place in your path. end quote Considering that R itself is updated fairly often, your sysadmin may appreciate if you are able to take care of maintaining R yourself. If you are not the only user, your sysadmin might be willing to make the necessary copy or link in some directory in the standard user's path, leaving the installation in some place you own. Then you can do all the updates and package installations, and the sysadmin only needs to update the links/copies when R itself is updated. That's how we do it here, and it works very well. -Don At 10:27 AM +0200 10/7/03, Christian Hennig wrote: Hi, I want R to be installed on a UNIX network (Solaris). I am not the system administrator and so I cannot do it myself. The system administrator wants to know which packages I want, and it may be a lot. Is there an easy way to download and install all packages at once? Is it a good idea? (There is a good chance that I do not need the some few packages that do not install well during such a procedure, and so I would like to tell the sysadmin to do it even if it will not be 100% successful). Unfortunately it may be even more compicated, because it may be (I was not able to find it out absolutely surely) that our net architecture does not allow to do it via install.packages from within R. So what is the easiest way to do it from outside R? If it is not a good idea to install all packages at once, what is the easiest way to download and install a list of, say, 30 packages? R CMD INSTALL accepts a list as input; but how to download a list of 30 packages at once? (The sysadmin would really appreciate if we could do it in a way that later additions of packages are reduced to a minimum.) Best, Christian *** Christian Hennig Fachbereich Mathematik-SPST/ZMS, Universitaet Hamburg [EMAIL PROTECTED], http://www.math.uni-hamburg.de/home/hennig/ ### ich empfehle www.boag-online.de __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- -- Don MacQueen Environmental Protection Department Lawrence Livermore National Laboratory Livermore, CA, USA __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] plot width in Sweave
Hi I didn't find this in the manual: I need to change the width of a plot while I use sweave, so which command/parameters should I insert below, to change the width of a plot \begin{figure}[htbp] \begin{center} echo=TRUE, fig=TRUE= plot(Re(q),ylab =,type=o,col=blue,lwd=1, sub=mystring) @ \caption{Original stick function (stimulus train)} \end{center} \end{figure} many thanks christoph -- Christoph Lehmann [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] plot width in Sweave
On Tuesday 07 October 2003 19:19, Christoph Lehmann wrote: Hi I didn't find this in the manual: I need to change the width of a plot while I use sweave, so which command/parameters should I insert below, to change the width of a plot \begin{figure}[htbp] \begin{center} echo=TRUE, fig=TRUE= plot(Re(q),ylab =,type=o,col=blue,lwd=1, sub=mystring) @ \caption{Original stick function (stimulus train)} \end{center} \end{figure} Depends what exactly you want to change. If you to change the width of the eps/pdf file you could say echo=TRUE,fig=TRUE,height=4,width=6= as you would do in a postscript() or pdf() call in R. If you want to increase the width of the plot in LaTeX, you could do \setkeys{Gin}{width=0.8\textwidth} which corresponds to the setting of \includegraphics[width=0.8\textwidth]{mygraphic} hth, Z many thanks christoph __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] multiple comparisons
On Tue, 7 Oct 2003, Jonathan Baron wrote: On 10/07/03 09:05, Peter Adler wrote: I'm having trouble finding an R equivalent to the S-Plus multicomp function, which does post-hoc comparisons of treatments means in ANOVAs. Am I missing something obvious? The package called multcomp? I don't know if it is the same. It is not, but can often be used in a different way to get similar results. There is also function TukeyHSD() in base R (which is often the simplest competitive method). THe MASS scripts show some of the ways to use these in R to emulate S-PLUS's multicomp. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Still Cannot Install rimage in R-1.7.1 (RH 9.0) Even With fftw Installed
I'm still having problems installing rimage - the installation can't find the fftw headers. As suggested, I installed the fftw rpm (for RH 9 from freshrpms). It installed without any errors or warnings. Yet I get exactly the same error message - it can't find the fftw headers. What do I have to do to get the headers? Rick B. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Still Cannot Install rimage in R-1.7.1 (RH 9.0) Even With fftw Installed
Rick Bilonick [EMAIL PROTECTED] writes: I'm still having problems installing rimage - the installation can't find the fftw headers. As suggested, I installed the fftw rpm (for RH 9 from freshrpms). It installed without any errors or warnings. Yet I get exactly the same error message - it can't find the fftw headers. What do I have to do to get the headers? Is there an fftw-devel package? -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Compiling/using R on IBM AIX
Hi, I plan to use R on IBM AIX machines (4.x.x), and hoping some feedbacks from R users on this OS. I've looked at the R search site, my impression is that there would be very few peoples who are currently using R on AIX, correct me if I'm wrong. To compile R on AIX, I have two little questions: 1. which compiles would be recommanded (IBM C Fortran compilers vs GNU compiles), and are there any restrictions on the version to be used ? 2. is Perl 5.0.0 usable instead of the version 5.6.1 recommanded ? Many thanks in advance for your help -- Fan __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Still Cannot Install rimage in R-1.7.1 (RH 9.0) Even With fftwInstalled
Aren't the headers usually in the devel package (e.g., fftw-devel-2.1.5-0.dag.rh73.i386.rpm)? You might try installing the devel package too. HTH Jim James W. MacDonald Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 Rick Bilonick [EMAIL PROTECTED] 10/07/03 03:39PM I'm still having problems installing rimage - the installation can't find the fftw headers. As suggested, I installed the fftw rpm (for RH 9 from freshrpms). It installed without any errors or warnings. Yet I get exactly the same error message - it can't find the fftw headers. What do I have to do to get the headers? Rick B. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
is.na(v)-b (was: Re: [R] Beginner's query - segmentation fault)
I am puzzled by the advice to use is.na(x) - TRUE instead of x - NA. ?NA says Function `is.na-' may provide a safer way to set missingness. It behaves differently for factors, for example. However, MAY provide is a bit scary, and it doesn't say WHAT the difference in behaviour is. I must say that is.na(x) - ... is rather repugnant, because it doesn't work. What do I mean? Well, as the designers of SETL who many years ago coined the term sinister function call to talk about f(...)-..., pointed out, if you do f(x) - y then afterwards you expect f(x) == y to be true. So let's try it: x - c(1,NA,3) is.na(x) - c(FALSE,FALSE,TRUE) x [1] 1 NA NA is.na(x) [1] FALSE TRUE TRUE v So I _assigned_ c(FALSE,FALSE,TRUE) to is.na(x), but I _got_ c(FALSE,TRUE, TRUE) instead. ^ That is not how a well behaved sinister function call should work, and it's enough to scare someone off is.na()- forever. The obvious way to set elements of a variable to missing is ... - NA. Wouldn't it be better if that just plain worked? Can someone give an example of is.na()- and -NA working differently with a factor? I just tried it: x - factor(c(3,1,4,1,5,9)) y - x is.na(x) - x==1 y[y==1] - NA x [1] 3NA 4NA 59 Levels: 1 3 4 5 9 y [1] 3NA 4NA 59 Levels: 1 3 4 5 9 Both approaches seem to have given the same answer. What did I miss? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Saving workspace image
Hi folks, On quitting R with q(), is it possible to save the workspace to a directory other than the one R was started from? (I sometimes have a project master directory with the major R code and data in that directory, but divisions of the project having their specific stuff in sub-directories. So if I quit while running a sub-project, I'd like to save the workspace back into its sub-directory. I see that this could be achieved by starting R in that sub-directory, and invoking master code as source(../whatever), but this would be a lot less convenient than doing it the other way round). With thanks, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 167 1972 Date: 08-Oct-03 Time: 01:00:30 -- XFMail -- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Saving workspace image
On Tue, 2003-10-07 at 19:00, [EMAIL PROTECTED] wrote: Hi folks, On quitting R with q(), is it possible to save the workspace to a directory other than the one R was started from? (I sometimes have a project master directory with the major R code and data in that directory, but divisions of the project having their specific stuff in sub-directories. So if I quit while running a sub-project, I'd like to save the workspace back into its sub-directory. I see that this could be achieved by starting R in that sub-directory, and invoking master code as source(../whatever), but this would be a lot less convenient than doing it the other way round). With thanks, Ted. Ted, Use: setwd(PathToDir) prior to quitting. That will set your working directory. Alternatively, you can always use: save.image(PathToDir/.RData) to save the workspace image explicitly where you want it. See ?setwd and ?save.image HTH, Marc Schwartz __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Getting alternative editor to stay as a foreground task
I apologise in advance if this question ought to be directed elsewhere. I'm trying to use the R sytnax highlighter for JEdit. This was mentioned in R-help a while ago and I'm hoping a few R users will have a (probably obvious) solution. (http://finzi.psych.upenn.edu/R/Rhelp02/archive/8812.html) Usually when one goes fix(myfun), the function is opened in the text editor, R stops responding until the editing is done, and changes are saved back into myfun. With JEdit, however, control passes straight back to R and changes made within JEdit aren't reflected in myfun. Any advice would be very welcome. I'm using R 1.7.1 on Windows 2000. Regards, Andrew C. Ward CAPE Centre Department of Chemical Engineering The University of Queensland Brisbane Qld 4072 Australia __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help