[R] include C functions from nmath in my own C functions
Hi: I followed the README in src/nmath/standalone/ to make the use the command make shared to make the libRmath.so file. I also add the directories containg libRmath.so to LD_LIBRARY_PATH by using command export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$/home/zhliu/Backup/R-2.0.1/src/nmath/standalon e However, when I try to run the following codes. /***/ #define MATHLIB_STANDALONE 1 #include Rmath.h int main() { /* something to force the library to be included */ qnorm(0.7, 0.0, 1.0, 0, 0); return 0; } /**/ It gives me the following error message. It seems definitions of some R functions can not be found in the libRmath.so file. Anyone has any idea about this problem? Thank you very much! /usr/local/lib/libRmath.so: undefined reference to `expm1' /usr/local/lib/libRmath.so: undefined reference to `log' /usr/local/lib/libRmath.so: undefined reference to `sqrt' /usr/local/lib/libRmath.so: undefined reference to `rint' /usr/local/lib/libRmath.so: undefined reference to `cos' /usr/local/lib/libRmath.so: undefined reference to `sin' /usr/local/lib/libRmath.so: undefined reference to `pow' /usr/local/lib/libRmath.so: undefined reference to `sinh' /usr/local/lib/libRmath.so: undefined reference to `log10' /usr/local/lib/libRmath.so: undefined reference to `exp' /usr/local/lib/libRmath.so: undefined reference to `tan' /usr/local/lib/libRmath.so: undefined reference to `log1p' /usr/local/lib/libRmath.so: undefined reference to `hypot' collect2: ld returned 1 exit status __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] connexion problem getHdata (HMisc)
Sorry about the missing info, I'm just trying to do too many things at the same time! I installed R on my Windows2000 computer (no choice there) . version platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor1.1 year 2005 month06 day 20 language R Hmisc version: 3.0-6 ; On my home computer (LINUX and Windows XT) with the same (latest) R and Hmisc version installed, I had no problem with getHdata... Thanks Anne Frank E Harrell Jr [EMAIL PROTECTED] 09.08.2005 22:19 A [EMAIL PROTECTED] cc r-help@stat.math.ethz.ch Objet Re: [R] connexion problem getHdata (HMisc) [EMAIL PROTECTED] wrote: ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. ** Hi Just installing R and some packages in my new job; trying to download dataset directly from biostatistics dptm of Vanderbilt University using getHdata from Hmisc I get the following: Error in file (file, r) : connexion openinig not possible Furthermore : connexion to 'biostat.mc.vanderbilt.edu' impossible on port 80 Can one get around this problem? NOTE: I am not an administrator on the system Anne Piotet It is hard for me to help when you provided no code and no output from typing version at the command prompt. You also did not include the version of Hmisc. I tried a small test: library(Hmisc) getHdata(titanic3) and it worked fine, using the most recent Hmisc. Frank tél: 022 809 54 36 e-mail: [EMAIL PROTECTED] Office cantonal de l'assurance-invalidité (OCAI) rue de Lyon 97 1203 Genève GE [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] background colors in image()
Le 11.08.2005 00:59, array chip a écrit : Thanks for the suggestion! It works in a way that the entire graph window is in the background color, is there a way to only have the plotting area (i.e. the area within the axis box in the background color, but leave the area outside the axes to be unchanged (white)? Thanks! You need to learn how to use par('usr') and argument add in image. demo('graphics') is one way to learn or look at graph 8 on r graph gallery R image(matrix(c(1,2,NA, 1),2, 2)) R usr - par('usr') R rect(usr[1], usr[3], usr[2], usr[4], col=cornsilk) R image(matrix(c(1,2,NA, 1),2, 2),add=TRUE) Romain --- Prof Brian Ripley [EMAIL PROTECTED] wrote: On Wed, 10 Aug 2005, someone needing to conceal his real name wrote: Hi, I am using image() function to plot a matrix which has some missing valuies (NA). It looks like, by default, missing values were drawn in white color, How can I change that into a different color, say a gray color? I tried to use bg='gray' argument with no luck. Anyone has a suggestion? They are not drawn in white: in fact they are not drawn at all, so the current background (or if transparent, the canvas) is what you see. par(bg=yellow) image(matrix(c(1,2,NA, 1),2, 2)) works, for example. -- 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 -- visit the R Graph Gallery : http://addictedtor.free.fr/graphiques ~ ~~ Romain FRANCOIS - http://addictedtor.free.fr ~~ Etudiant ISUP - CS3 - Industrie et Services ~~http://www.isup.cicrp.jussieu.fr/ ~~ Stagiaire INRIA Futurs - Equipe SELECT ~~ http://www.inria.fr/recherche/equipes/select.fr.html~~ ~ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] connexion problem getHdata (HMisc)
Hi Anne, does update.packages() work, or does it just hang? cheers! Sean On 11/08/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Sorry about the missing info, I'm just trying to do too many things at the same time! I installed R on my Windows2000 computer (no choice there) . version platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor1.1 year 2005 month06 day 20 language R Hmisc version: 3.0-6 ; On my home computer (LINUX and Windows XT) with the same (latest) R and Hmisc version installed, I had no problem with getHdata... Thanks Anne Frank E Harrell Jr [EMAIL PROTECTED] 09.08.2005 22:19 A [EMAIL PROTECTED] cc r-help@stat.math.ethz.ch Objet Re: [R] connexion problem getHdata (HMisc) [EMAIL PROTECTED] wrote: ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. ** Hi Just installing R and some packages in my new job; trying to download dataset directly from biostatistics dptm of Vanderbilt University using getHdata from Hmisc I get the following: Error in file (file, r) : connexion openinig not possible Furthermore : connexion to 'biostat.mc.vanderbilt.edu' impossible on port 80 Can one get around this problem? NOTE: I am not an administrator on the system Anne Piotet It is hard for me to help when you provided no code and no output from typing version at the command prompt. You also did not include the version of Hmisc. I tried a small test: library(Hmisc) getHdata(titanic3) and it worked fine, using the most recent Hmisc. Frank tél: 022 809 54 36 e-mail: [EMAIL PROTECTED] Office cantonal de l'assurance-invalidité (OCAI) rue de Lyon 97 1203 Genève GE [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] include C functions from nmath in my own C functions
First, please read the posting guide: it says C programming questions should go to R-devel so it seems you have not done so. Second, you have not told us your OS nor what you did to run your code, so we have to guess. But sin etc are not 'R functions' but C mathematical functions, and the quess is that you failed to link against libm. Most C compilers will do that for you automatically or do not even have a separate libm, so telling us your OS (as the posting guide does ask) was important. Please seek local C programming help on how to do this on your OS. On Wed, 10 Aug 2005, yyan liu wrote: Hi: I followed the README in src/nmath/standalone/ to make the use the command make shared to make the libRmath.so file. I also add the directories containg libRmath.so to LD_LIBRARY_PATH by using command export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$/home/zhliu/Backup/R-2.0.1/src/nmath/standalon e However, when I try to run the following codes. /***/ #define MATHLIB_STANDALONE 1 #include Rmath.h int main() { /* something to force the library to be included */ qnorm(0.7, 0.0, 1.0, 0, 0); return 0; } /**/ It gives me the following error message. It seems definitions of some R functions can not be found in the libRmath.so file. Anyone has any idea about this problem? Thank you very much! /usr/local/lib/libRmath.so: undefined reference to `expm1' /usr/local/lib/libRmath.so: undefined reference to `log' /usr/local/lib/libRmath.so: undefined reference to `sqrt' /usr/local/lib/libRmath.so: undefined reference to `rint' /usr/local/lib/libRmath.so: undefined reference to `cos' /usr/local/lib/libRmath.so: undefined reference to `sin' /usr/local/lib/libRmath.so: undefined reference to `pow' /usr/local/lib/libRmath.so: undefined reference to `sinh' /usr/local/lib/libRmath.so: undefined reference to `log10' /usr/local/lib/libRmath.so: undefined reference to `exp' /usr/local/lib/libRmath.so: undefined reference to `tan' /usr/local/lib/libRmath.so: undefined reference to `log1p' /usr/local/lib/libRmath.so: undefined reference to `hypot' collect2: ld returned 1 exit status __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] connexion problem getHdata (HMisc)
Hi Sean, Your intuition is spots on: update.package also hang: Message d'avis : connexion à 'cran.ch.r-project.org' impossible sur le port 80 Avis : unable to access index for repository http://cran.ch.r-project.org/bin/windows/contrib/2.1 (sorry for the french...) I did not try it before as I installed R on this machine for the 1st time last week (so had nothing to update) Probably it all hangs with the system manager here (who has NO previous experience of working with statisticians and other number crunchers). Any idea about which systems parameters are necessary to allow the connexion? Anne Sean O'Riordain [EMAIL PROTECTED] 11.08.2005 08:16 Veuillez répondre à [EMAIL PROTECTED] A [EMAIL PROTECTED] [EMAIL PROTECTED], r-help r-help@stat.math.ethz.ch cc Objet Re: [R] connexion problem getHdata (HMisc) Hi Anne, does update.packages() work, or does it just hang? cheers! Sean On 11/08/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Sorry about the missing info, I'm just trying to do too many things at the same time! I installed R on my Windows2000 computer (no choice there) . version platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor1.1 year 2005 month06 day 20 language R Hmisc version: 3.0-6 ; On my home computer (LINUX and Windows XT) with the same (latest) R and Hmisc version installed, I had no problem with getHdata... Thanks Anne Frank E Harrell Jr [EMAIL PROTECTED] 09.08.2005 22:19 A [EMAIL PROTECTED] cc r-help@stat.math.ethz.ch Objet Re: [R] connexion problem getHdata (HMisc) [EMAIL PROTECTED] wrote: ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. ** Hi Just installing R and some packages in my new job; trying to download dataset directly from biostatistics dptm of Vanderbilt University using getHdata from Hmisc I get the following: Error in file (file, r) : connexion openinig not possible Furthermore : connexion to 'biostat.mc.vanderbilt.edu' impossible on port 80 Can one get around this problem? NOTE: I am not an administrator on the system Anne Piotet It is hard for me to help when you provided no code and no output from typing version at the command prompt. You also did not include the version of Hmisc. I tried a small test: library(Hmisc) getHdata(titanic3) and it worked fine, using the most recent Hmisc. Frank tél: 022 809 54 36 e-mail: [EMAIL PROTECTED] Office cantonal de l'assurance-invalidité (OCAI) rue de Lyon 97 1203 Genève GE [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] how to disable RODBC log file
I am using RODBC with Postgresql. I have disabled the log file in ~/.odbc.ini, but nevertheless I still get a logfile in /tmp, which can grow to gigabytes, so I would like to disable it. It appears that the logfile is generated by R: % lsof | grep /tmp/psqlodbc_tpapp7482.log R 7482 tpapp3w REG3,5 31271668135 /tmp/psqlodbc_tpapp7482.log Could somebody please tell me how to disable this logfile? I have searched the list and help, but found nothing about this. Thanks, Tamas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] connexion problem getHdata (HMisc)
Hi Sean, Thanks for the tip, I will try to set up the command line in the target field as recommended in the faq Anne Sean O'Riordain [EMAIL PROTECTED] 11.08.2005 08:36 Veuillez répondre à [EMAIL PROTECTED] A [EMAIL PROTECTED] [EMAIL PROTECTED] cc Objet Re: [R] connexion problem getHdata (HMisc) Hi Anne, going back to my previous email, have a look at the FAQ... http://cran.r-project.org/bin/windows/base/rw-FAQ.html#The-internet-download-functions-fail_002e cheers! Sean On 11/08/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Hi Sean, Your intuition is spots on: update.package also hang: Message d'avis : connexion à 'cran.ch.r-project.org' impossible sur le port 80 Avis : unable to access index for repository http://cran.ch.r-project.org/bin/windows/contrib/2.1 (sorry for the french...) I did not try it before as I installed R on this machine for the 1st time last week (so had nothing to update) Probably it all hangs with the system manager here (who has NO previous experience of working with statisticians and other number crunchers). Any idea about which systems parameters are necessary to allow the connexion? Anne Sean O'Riordain [EMAIL PROTECTED] 11.08.2005 08:16 Veuillez répondre à [EMAIL PROTECTED] A [EMAIL PROTECTED] [EMAIL PROTECTED], r-help r-help@stat.math.ethz.ch cc Objet Re: [R] connexion problem getHdata (HMisc) Hi Anne, does update.packages() work, or does it just hang? cheers! Sean On 11/08/05, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote: Sorry about the missing info, I'm just trying to do too many things at the same time! I installed R on my Windows2000 computer (no choice there) . version platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major2 minor1.1 year 2005 month06 day 20 language R Hmisc version: 3.0-6 ; On my home computer (LINUX and Windows XT) with the same (latest) R and Hmisc version installed, I had no problem with getHdata... Thanks Anne Frank E Harrell Jr [EMAIL PROTECTED] 09.08.2005 22:19 A [EMAIL PROTECTED] cc r-help@stat.math.ethz.ch Objet Re: [R] connexion problem getHdata (HMisc) [EMAIL PROTECTED] wrote: ** This email and any files transmitted with it are confidential and intended solely for the use of the individual or entity to whom they are addressed. If you have received this email in error please notify the system manager. ** Hi Just installing R and some packages in my new job; trying to download dataset directly from biostatistics dptm of Vanderbilt University using getHdata from Hmisc I get the following: Error in file (file, r) : connexion openinig not possible Furthermore : connexion to 'biostat.mc.vanderbilt.edu' impossible on port 80 Can one get around this problem? NOTE: I am not an administrator on the system Anne Piotet It is hard for me to help when you provided no code and no output from typing version at the command prompt. You also did not include the version of Hmisc. I tried a small test: library(Hmisc) getHdata(titanic3) and it worked fine, using the most recent Hmisc. Frank tél: 022 809 54 36 e-mail: [EMAIL PROTECTED] Office cantonal de l'assurance-invalidité (OCAI) rue de Lyon 97 1203 Genève GE [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] conjoint optim
Hi, have anybody a starting point or experince how i could optimize the results from a conjoint-ananlysis. I have the idea to optimize this with 2 function , one for the parth-worth utilities which have to maximize and a secondconcurrent for the cost's of the parth-worth utilities (product-parts) which should be minimize or smaller than value x? My main problem how i have to construct the formula, beacuse i'm not operation research expert. Easy Example: Parth-Worth Utilities Attribute1: Color (red=0.1,blue=0.3) Attribute2: Price (100$=0.4,200$=0.2) So how i could use it in a formular that only one color and one price is choosen from an optimizer to maximize it (..dummy!?). In real life it could be up to 20 Attributes and different count's of levels. many thanks regards, Christian __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] off-topic ODBC Q (was how to disable RODBC log file)
RODBC does not have a log file, and this is nothing to do with RODBC or R. What you are talking about here is an *ODBC* log file, and for that you need to consult your (unstated) device manager documentation for your (unstated) OS. The name of the log file (psqlodbc_*) should have given you a clue: it seems to be coming from the ODBC driver. On Thu, 11 Aug 2005, Tamas K Papp wrote: I am using RODBC with Postgresql. I have disabled the log file in ~/.odbc.ini, but nevertheless I still get a logfile in /tmp, which can grow to gigabytes, so I would like to disable it. It appears that the logfile is generated by R: % lsof | grep /tmp/psqlodbc_tpapp7482.log R 7482 tpapp3w REG3,5 31271668135 /tmp/psqlodbc_tpapp7482.log Could somebody please tell me how to disable this logfile? I have searched the list and help, but found nothing about this. PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html PLEASE do as we ask! -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] getting xpinch and ypinch
Hello! I would like to know if it is possible (and how) to get xpinch and ypinch values that R gets (from the system) for drawing plots. If I understand correctly; with this values I could save the same picture as I see on computer 1 on computer 2 as a let say wmf file. Thank you in advance, Ales Ziberna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] rpart plot question
Petr Pikal wrote: Dear all I am quite confused by rpart plotting. Here is example. set.seed(1) y - (c(rnorm(10), rnorm(10)+2, rnorm(10)+5)) x - c(rep(c(1,2,5), c(10,10,10)) fit - rpart(x~y)## NB should be y~x plot(fit) text(fit) Text on first split says x 3.5 and on the second split x 1.5 what I understand: If x 3.5 so y is lower and y values go to the left split. OK. But, sometimes there is whatever = nnn and it seems to me that if this condition is true response variable follow to right split. try: y1-(c(rnorm(10)+5,rnorm(10)+2, rnorm(10))) fit-rpart(y1~x) plot(fit) text(fit) Well, I am not sure I express myself clearly. Am I correct that when there is sign I shall follow left node but when there is = sign I shall follow the right one? Best regards Petr Pikal Petr Pikal https://stat.ethz.ch/mailman/listinfo/r-helppetr.pikal at precheza.cz If instead of rpart you use mvpart, ie library(mvpart) fit - mvpart(y~x, data=data.frame(cbind(x,y))) plot(fit) text.rpart(fit,which=4) then the plot will be much clearer about the condition for splits. summary(fit) will also help. Regards, John = John Field Consulting Pty Ltd 10 High St, Burnside SA 5066, Australia ph: +61 8 8332 5294 or +61 409 097 586 fax: +61 8 8332 1229 email: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] sub set selection
hi all is there a package that undertakes subset selection but BASED ON AIC or any other information criteria. i've seen the subselect and the leaps package but i have not played around with them yet. thanx__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] tcltk programming guide
Dear List, I'm looking for some documentation about the R tcltk package The one I found in the help doesn't look exaustive, I need information on the use of the single tk widget, maybe with some examples thank you, simone gabbriellini __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] tcltk programming guide
Go to http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/. There are good examples. X-Original-To: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] X-Virus-Scanned: by amavisd-new at stat.math.ethz.ch Mime-Version: 1.0 (Apple Message framework v733) To: R-help@stat.math.ethz.ch From: Simone Gabbriellini [EMAIL PROTECTED] Date: Thu, 11 Aug 2005 14:04:58 +0200 Subject: [R] tcltk programming guide X-BeenThere: r-help@stat.math.ethz.ch X-Mailman-Version: 2.1.6 List-Id: Main R Mailing List: Primary help r-help.stat.math.ethz.ch List-Unsubscribe: https://stat.ethz.ch/mailman/listinfo/r-help, mailto:[EMAIL PROTECTED] List-Archive: https://stat.ethz.ch/pipermail/r-help List-Post: mailto:r-help@stat.math.ethz.ch List-Help: mailto:[EMAIL PROTECTED] List-Subscribe: https://stat.ethz.ch/mailman/listinfo/r-help, mailto:[EMAIL PROTECTED] Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.0.1 (2004-10-22) on pascal.dfci.harvard.edu X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00 autolearn=ham version=3.0.1 Dear List, I'm looking for some documentation about the R tcltk package The one I found in the help doesn't look exaustive, I need information on the use of the single tk widget, maybe with some examples thank you, simone gabbriellini __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Jianhua Zhang Department of Medical Oncology Dana-Farber Cancer Institute 44 Binney Street Boston, MA 02115-6084 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Error in autoloader
Hi, After installing the latest versions of lme4, Matrix, VR on a Debian Box, I have run into a problem. When I use library(lme4) on R Version 2.1.0 (2005-04-18) I get the following error message: library(lme4) Loading required package: Matrix Error in autoloader(name = confint, package = MASS) : autoloader did not find 'confint' in 'MASS' An example of the complete session is given at the end of this email. A search in the docs. At present I have 3 directories where packages are kept, as I use apt-get install r-cran-package_ name when one is available in Debian and when it is not R, R CMD INSTALL package_name. This gives me the following directories when use help.start(): (1) Packages in /usr/local/lib/R/site-library (packages installed by R CMD INSTALL) (2) Packages in /usr/lib/R/site-library (packages installed with apt-get install) (3) Packages in /usr/lib/R/library (base install with apt-get install) Matrix, lme4 and other suggested packages were first installed with R CMD INSTALL. and can be found in /usr/local/lib/R/site-library. After the error occured, I updated VR with apt-get install (found in /usr/lib/R/library) and got the same error message. Installing a second version of lme4 and matrix with apt-get install puts these packages in /usr/lib/R/site-library and gives the same error as before. Looking at the MASS no function 'confint' exists, only confint.glm, confint.nls,confint.profile.glm and confint.profile.nls Can anyone suggest a solution to the problem or why I am unable to access lme4 or as the error statement suggests, a problem with the Matrix package and Mass? Thanks Peter # R : Copyright 2005, The R Foundation for Statistical Computing Version 2.1.0 (2005-04-18), ISBN 3-900051-07-0 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. Natural language support but running in an English locale R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for a HTML browser interface to help. Type 'q()' to quit R. Loading Tcl/Tk interface ... done Loading required package: tcltk Loading required package: rgl Loading required package: zoo Loading required package: strucchange Loading required package: sandwich Loading required package: relimp Loading required package: nnet Loading required package: graphics Loading required package: grDevices Loading required package: stats Loading required package: nlme Attaching package: 'nlme' The following object(s) are masked from package:stats : contr.SAS Loading required package: mvtnorm Loading required package: multcomp Loading required package: mgcv This is mgcv 1.2-4 Loading required package: MASS Loading required package: lmtest Loading required package: lattice Loading required package: grid Loading required package: foreign Loading required package: effects Loading required package: car Loading required package: abind [Previously saved workspace restored] library(lme4) Loading required package: Matrix Error in autoloader(name = confint, package = MASS) : autoloader did not find 'confint' in 'MASS' __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] sub set selection
in what model, glm or gam? I believe you can use aic in both. On 8/11/05, Clark Allan [EMAIL PROTECTED] wrote: hi all is there a package that undertakes subset selection but BASED ON AIC or any other information criteria. i've seen the subselect and the leaps package but i have not played around with them yet. thanx __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- WenSui Liu, MS MA Senior Decision Support Analyst Division of Health Policy and Clinical Effectiveness Cincinnati Children Hospital Medical Center __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] translation Hmisc Design
** This email and any files transmitted with it are confidenti...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] repeated - R package - Compilation Error
On Wed, 10 Aug 2005 [EMAIL PROTECTED] wrote: Thompson's Manual to Accompany Agresti's book refers to a package named repeated. It's not on CRAN from what I can see. I have seen rpm's for it. Where is the best place to download this package? See the FAQ, Q5.1.5. As to the `best' place, it is hard to say as the URI keeps changing: currently it seems to be http://popgen.unimaas.nl/~jlindsey/rcode.html. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 I downloaded from the site you suggested but I get an error when installing: drwxr-xr-x 5 root root 4096 Apr 25 2003 repeated -rw-rw-r-- 1 chippy chippy 176563 Aug 10 17:05 repeated.tgz [EMAIL PROTECTED] R]# man R [EMAIL PROTECTED] R]# R CMD INSTALL repeated * Installing *source* package 'repeated' ... ** libs gfortran -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c chidden.f -o chidden.o gfortran -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c cphidden.f -o cphidden.o gcc -I/usr/lib/R/include -I/usr/local/include -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c cutil.c -o cutil.o gcc -I/usr/lib/R/include -I/usr/local/include -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c dist.c -o dist.o gcc -I/usr/lib/R/include -I/usr/local/include -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c gar.c -o gar.o gfortran -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c hidden.f -o hidden.o gcc -I/usr/lib/R/include -I/usr/local/include -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c kcountb.c -o kcountb.o gcc -I/usr/lib/R/include -I/usr/local/include -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c kserieb.c -o kserieb.o gfortran -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c logitord.f -o logitord.o gfortran -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c binnest.f -o binnest.o In file binnest.f:638 Gradient(t1+t2+kk) = Gradient(t1+t2+kk) + (D1_Sig2(kk) / Li 1 Error: Expected a right parenthesis in expression at (1) make: *** [binnest.o] Error 1 ERROR: compilation failed for package 'repeated' I guess I can go in and fix this and try re-compiling. Rick B. When I go into binnest.f, here is what I see: C Calculate First Derivative Do kk = 1, t1 Gradient(kk) = Gradient(kk) + (D1_beta(kk) / Li) End do Do kk = 1, t2 Gradient(t1+kk) = Gradient(t1+kk) + (D1_Sig1(kk) / Li) End do Do kk = 1, t3 line 638 -Gradient(t1+t2+kk) = Gradient(t1+t2+kk) + (D1_Sig2(kk) / Li) End do As you can see, line 638 looks just fine. Why do I get a compilation error? Rick B. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] repeated - R package - Compilation Error
On Wed, 10 Aug 2005 [EMAIL PROTECTED] wrote: Thompson's Manual to Accompany Agresti's book refers to a package named repeated. It's not on CRAN from what I can see. I have seen rpm's for it. Where is the best place to download this package? See the FAQ, Q5.1.5. As to the `best' place, it is hard to say as the URI keeps changing: currently it seems to be http://popgen.unimaas.nl/~jlindsey/rcode.html. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 I downloaded from the site you suggested but I get an error when installing: drwxr-xr-x 5 root root 4096 Apr 25 2003 repeated -rw-rw-r-- 1 chippy chippy 176563 Aug 10 17:05 repeated.tgz [EMAIL PROTECTED] R]# man R [EMAIL PROTECTED] R]# R CMD INSTALL repeated * Installing *source* package 'repeated' ... ** libs gfortran -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c chidden.f -o chidden.o gfortran -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c cphidden.f -o cphidden.o gcc -I/usr/lib/R/include -I/usr/local/include -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c cutil.c -o cutil.o gcc -I/usr/lib/R/include -I/usr/local/include -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c dist.c -o dist.o gcc -I/usr/lib/R/include -I/usr/local/include -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c gar.c -o gar.o gfortran -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c hidden.f -o hidden.o gcc -I/usr/lib/R/include -I/usr/local/include -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c kcountb.c -o kcountb.o gcc -I/usr/lib/R/include -I/usr/local/include -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c kserieb.c -o kserieb.o gfortran -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c logitord.f -o logitord.o gfortran -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c binnest.f -o binnest.o In file binnest.f:638 Gradient(t1+t2+kk) = Gradient(t1+t2+kk) + (D1_Sig2(kk) / Li 1 Error: Expected a right parenthesis in expression at (1) make: *** [binnest.o] Error 1 ERROR: compilation failed for package 'repeated' I guess I can go in and fix this and try re-compiling. Rick B. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] sub set selection
just normal linear model: multiple regression in particular Wensui Liu wrote: in what model, glm or gam? I believe you can use aic in both. On 8/11/05, Clark Allan [EMAIL PROTECTED] wrote: hi all is there a package that undertakes subset selection but BASED ON AIC or any other information criteria. i've seen the subselect and the leaps package but i have not played around with them yet. thanx __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- WenSui Liu, MS MA Senior Decision Support Analyst Division of Health Policy and Clinical Effectiveness Cincinnati Children Hospital Medical Center__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] repeated - R package - Compilation Error
When I go into binnest.f, here is what I see: C Calculate First Derivative Do kk = 1, t1 Gradient(kk) = Gradient(kk) + (D1_beta(kk) / Li) End do Do kk = 1, t2 Gradient(t1+kk) = Gradient(t1+kk) + (D1_Sig1(kk) / Li) End do Do kk = 1, t3 line 638 -Gradient(t1+t2+kk) = Gradient(t1+t2+kk) + (D1_Sig2(kk) / Li) End do As you can see, line 638 looks just fine. Why do I get a compilation error? Rick B. I used a text editor to remove two blanks from the front of line 638 and it compiled without errors. Now I have to find the rmutil package and install it to get repeated working. Rick B. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] repeated - R package - Now rmutil Compilation Errors
In my quest to install the repeated package, I have also to install the rmutil package. (BTW, I'm running Fedora Core 4 and R 2.1.1.) But I now get several compilation errors for rmutil and I'm afraid to try to fix them: [EMAIL PROTECTED] R]# R CMD INSTALL rmutil * Installing *source* package 'rmutil' ... ** libs gcc -I/usr/lib/R/include -I/usr/local/include -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c cutil.c -o cutil.o gcc -I/usr/lib/R/include -I/usr/local/include -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c dist.c -o dist.o gfortran -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c gettvc.f -o gettvc.o In file gettvc.f:55 tvcov2(n,i)=-1e301 1 Error: Real constant overflows its kind at (1) In file gettvc.f:79 recx=1e301 1 Error: Real constant overflows its kind at (1) In file gettvc.f:84 reck=1e301 1 Error: Real constant overflows its kind at (1) In file gettvc.f:86 if((recx.ge.1e300).and.(reck.ge.1e300)) ldone=.true. 1 Error: Real constant overflows its kind at (1) make: *** [gettvc.o] Error 1 ERROR: compilation failed for package 'rmutil' I downloaded both repeated and rmutil (for R 2.0) from: http://popgen.unimaas.nl/~jlindsey/rcode.html Rick B. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] repeated - R package - Compilation Error
On Thu, 11 Aug 2005 [EMAIL PROTECTED] wrote: When I go into binnest.f, here is what I see: C Calculate First Derivative Do kk = 1, t1 Gradient(kk) = Gradient(kk) + (D1_beta(kk) / Li) End do Do kk = 1, t2 Gradient(t1+kk) = Gradient(t1+kk) + (D1_Sig1(kk) / Li) End do Do kk = 1, t3 line 638 -Gradient(t1+t2+kk) = Gradient(t1+t2+kk) + (D1_Sig2(kk) / Li) End do As you can see, line 638 looks just fine. Why do I get a compilation error? Rick B. I used a text editor to remove two blanks from the front of line 638 and it compiled without errors. Now I have to find the rmutil package and install it to get repeated working. Well spotted, almost certainly the closing bracket was not seen by the compiler because it ran into the comment field of the line (columns beyond 72), and failed with unmatched brackets. Some compilers allow arbitrarily long lines, but apparently not yours. Rick B. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] sub set selection
check stepAIC in MASS package. On 8/11/05, Clark Allan [EMAIL PROTECTED] wrote: hi all is there a package that undertakes subset selection but BASED ON AIC or any other information criteria. i've seen the subselect and the leaps package but i have not played around with them yet. thanx __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- WenSui Liu, MS MA Senior Decision Support Analyst Division of Health Policy and Clinical Effectiveness Cincinnati Children Hospital Medical Center __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] p-values
Spencer, Here is an example from rayner and best 2001 and the script sent by Felipe. This can be done as follows using the function durbin.grupos() in the attached file ###Ice cream example from Rayner and Best 2001 . Chapter 7 judge - rep(c(1:7),rep(3,7)) variety - c(1,2,4,2,3,5,3,4,6,4,5,7,1,5,6,2,6,7,1,3,7) cream - c(2,3,1,3,1,2,2,1,3,1,2,3,3,1,2,3,1,2,3,1,2) durbin.grupos(judge,variety,cream,k=3,r=3,alpha=0.01) Prueba de Durbin .. Chi Cuadrado : 12 Gl. : 6 P-valor : 0.0619688 .. Comparación de tratamientos Alpha: 0.01 Gl. : 8 t-Student: 3.355387 Diferencia minima para la diferencia entre suma de rangos = 4.109493 Grupos, Tratamientos y la Suma de sus rangos a2 9 ab 1 8 abc 7 7 abc 6 6 abc 5 5 bc 3 4 c 4 3 trat prom M 129 a 218 ab 377 abc 466 abc 555 abc 634 bc 743 c You can see that the p-value is the same with pchisq(12, df= 6, lower.tail=F) [1] 0.0619688 I am hoping that someone, maybe Torsten, might be able to suggest how I can incorporate Monte-Carlo p-values using pperm(). The statistical issues are beyond my comprehension and I assume that Rayner and Best suggestion to use Monte-Carlo p-values instead of Chi-square p-values to be correct. In the above example the Monte-Carlo p-value is 0.02. This is a significant difference, resulting in the rejection of the null hypothesis when using Monte-Carlo p-values. I hope this example might help. Thanks again for your answer and also to Felipe for sending the function for Durbin's test. Peter Spencer Graves wrote: pperm seems reasonable, though I have not looked at the details. We should be careful about terminology, however. So-called exact p-values are generally p-values computed assuming a distribution over a finite set of possible outcomes assuming some constraints to make the outcome space finite. For example, Fisher's exact test for a 2x2 table assumes the marginals are fixed. I don't remember the details now, but I believe there is literature claiming that this may not be the best thing to do when, for example, when it is reasonable to assume that the number in each cell is Poisson. In such cases, you may lose statistical power by conditioning on the marginals. I hope someone else will enlighten us both, because I'm not current on the literature in this area. The situation with exact tests and exact p-values is not nearly as bad as with so-called exact confidence intervals, which promise to deliver at least the indicated coverage probability. With discrete distributions, it is known that 'Approximate is better than exact' for interval estimation of binomial proportions', as noted in an article of this title by A. Agresti and B. A. Coull (1998) American Statistician, 52: 119-126. (For more on this particular issue, see Brown, Cai and Dasgupta 2003 Interval Estimation in Exponential Families, Statistica Sinica 13: 19-49). If this does not answer your question adequately, may I suggest you try the posting guide. People report having found answers to difficult questions in the process of preparing a question following that guide, and when they do post a question, they are much more likely to get a useful reply. spencer graves Peter Ho wrote: Spencer, Thank you for referring me to your other email on Exact goodness-of-fit test. However, I'm not entirely sure if what you mentioned is the same for my case. I'm not a statistician and it would help me if you could explain what you meant in a little more detail. Perhaps I need to explain the problem in more detail. I am looking for a way to calculate exaxt p-values by Monte Carlo Simulation for Durbin's test. Durbin's test statistic is similar to Friedman's statistic, but considers the case of Balanced Incomplete block designs. I have found a function written by Felipe de Mendiburu for calculating Durbin's statistic, which gives the chi-squared p-value. I have also been read an article by Torsten Hothorn On exact rank Tests in R (R News 1(1), 11–12.) and he has shown how to calculate Monte Carlo p-values using pperm. In the article by Torsten Hothorn he gives: R pperm(W, ranks, length(x)) He compares his method to that of StatXact, which is the program Rayner and Best suggested using. Is there a way to do this for example for the friedman test. A paper by Joachim Rohmel discusses The permutation distribution for the friendman test (Computational Statistics Data Analysis 1997, 26: 83-99). This seems to be on the lines of what I need, although I am not quite sure. Has anyone tried to recode his APL program for R? I have tried a number of things, all unsucessful. Searching through previous postings have not been very
Re: [R] repeated - R package - Compilation Error
You know what spams are? It is highly recommended to try such basic things and to get the depencies right _before_ posting to mailing lists. Regards Michael [EMAIL PROTECTED] wrote: When I go into binnest.f, here is what I see: C Calculate First Derivative Do kk = 1, t1 Gradient(kk) = Gradient(kk) + (D1_beta(kk) / Li) End do Do kk = 1, t2 Gradient(t1+kk) = Gradient(t1+kk) + (D1_Sig1(kk) / Li) End do Do kk = 1, t3 line 638 -Gradient(t1+t2+kk) = Gradient(t1+t2+kk) + (D1_Sig2(kk) / Li) End do As you can see, line 638 looks just fine. Why do I get a compilation error? Rick B. I used a text editor to remove two blanks from the front of line 638 and it compiled without errors. Now I have to find the rmutil package and install it to get repeated working. Rick B. I'm not sure what your point is. I'm getting a compilation error for a package that should compile without errors. The error message doesn't say anything about needing anything - it doesn't complain about dependencies. Now once I got repeated to compile, it did give a *warning message about needing rmutils. But rmutils won't compile and gives several error messages (in my other post). I've installed many R packages and I've never seen problems like this before. Rick B. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] repeated - R package - Now rmutil Compilation Errors
On Thu, 11 Aug 2005 [EMAIL PROTECTED] wrote: In my quest to install the repeated package, I have also to install the rmutil package. (BTW, I'm running Fedora Core 4 and R 2.1.1.) But I now get several compilation errors for rmutil and I'm afraid to try to fix them: [EMAIL PROTECTED] R]# R CMD INSTALL rmutil * Installing *source* package 'rmutil' ... ** libs gcc -I/usr/lib/R/include -I/usr/local/include -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c cutil.c -o cutil.o gcc -I/usr/lib/R/include -I/usr/local/include -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c dist.c -o dist.o gfortran -fPIC -O2 -g -pipe -Wp,-D_FORTIFY_SOURCE=2 -fexceptions -m32 -march=i386 -mtune=pentium4 -fasynchronous-unwind-tables -c gettvc.f -o gettvc.o In file gettvc.f:55 tvcov2(n,i)=-1e301 1 Error: Real constant overflows its kind at (1) In file gettvc.f:79 recx=1e301 1 Error: Real constant overflows its kind at (1) In file gettvc.f:84 reck=1e301 1 Error: Real constant overflows its kind at (1) In file gettvc.f:86 if((recx.ge.1e300).and.(reck.ge.1e300)) ldone=.true. 1 Error: Real constant overflows its kind at (1) make: *** [gettvc.o] Error 1 ERROR: compilation failed for package 'rmutil' I downloaded both repeated and rmutil (for R 2.0) from: http://popgen.unimaas.nl/~jlindsey/rcode.html Please note that you are using gfortran rather than g77 - they are not the same, and very possibly differ in how they react to code. The 1e301 constants do overflow the maximum real value (of the order of 3e+38), but 1d301 is less than the maximum double value of the order of 1.7e+308. So the variable declarations in the code do not seem to match the constants being used, which probably ought to have been written as d rather than e anyway. It doesn't look as though you'll be able to compile this code with your chosen compiler, could you rather try g77? There seems to be useful advice on the Fedora lists. Rick B. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] repeated - R package - Now rmutil Compilation Errors
Please note that you are using gfortran rather than g77 - they are not the same, and very possibly differ in how they react to code. The 1e301 constants do overflow the maximum real value (of the order of 3e+38), but 1d301 is less than the maximum double value of the order of 1.7e+308. So the variable declarations in the code do not seem to match the constants being used, which probably ought to have been written as d rather than e anyway. It doesn't look as though you'll be able to compile this code with your chosen compiler, could you rather try g77? There seems to be useful advice on the Fedora lists. Rick B. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] I think you are correct. Before I read your message I did a man page for gfortran and it says that it is not complete. Why FC4 choose this incomplete fortran compiler is beyond me. I have installed g77 and now trying to remove gfortran. Thanks. Rick B. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Kouros Owzar is out
I will be out of the office starting 08/10/2005 and will not return until 08/15/2005. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] sub set selection
On Thu, 11 Aug 2005, Clark Allan wrote: hi all is there a package that undertakes subset selection but BASED ON AIC or any other information criteria. i've seen the subselect and the leaps package but i have not played around with them yet. The leaps package finds a best model of each size, so all the standard criteria are equivalent. It can report AIC or BIC for each of these models. -thomas __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] How to insert a certain model in SVM regarding to fixed kernels
Dear David, Dear R Users , Suppose that we want to regress for example a certain autoregressive model using SVM. We have our data and also some fixed kernels in libSVM behinde e1071 in front. The question: Where can we insert our certain autoregressive model ? During creating data frame ? Or perhaps we can make a relationship between our variables ended to desired autoregressive model ? Thanks a lot for your help. Amir Safari __ [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] tcltk programming guide
thank you, I knew that link, but I need something more document- oriented, more specific, i.e. if I want to know how to use tkadd, where should I look? or tkinsert and so on... thanx, simone Il giorno 11/ago/05, alle ore 14:18, John Zhang ha scritto: Go to http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/. There are good examples. X-Original-To: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] X-Virus-Scanned: by amavisd-new at stat.math.ethz.ch Mime-Version: 1.0 (Apple Message framework v733) To: R-help@stat.math.ethz.ch From: Simone Gabbriellini [EMAIL PROTECTED] Date: Thu, 11 Aug 2005 14:04:58 +0200 Subject: [R] tcltk programming guide X-BeenThere: r-help@stat.math.ethz.ch X-Mailman-Version: 2.1.6 List-Id: Main R Mailing List: Primary help r- help.stat.math.ethz.ch List-Unsubscribe: https://stat.ethz.ch/mailman/listinfo/r-help, mailto:[EMAIL PROTECTED] List-Archive: https://stat.ethz.ch/pipermail/r-help List-Post: mailto:r-help@stat.math.ethz.ch List-Help: mailto:[EMAIL PROTECTED] List-Subscribe: https://stat.ethz.ch/mailman/listinfo/r-help, mailto:[EMAIL PROTECTED] Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.0.1 (2004-10-22) on pascal.dfci.harvard.edu X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00 autolearn=ham version=3.0.1 Dear List, I'm looking for some documentation about the R tcltk package The one I found in the help doesn't look exaustive, I need information on the use of the single tk widget, maybe with some examples thank you, simone gabbriellini __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting- guide.html Jianhua Zhang Department of Medical Oncology Dana-Farber Cancer Institute 44 Binney Street Boston, MA 02115-6084 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting- guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] tcltk programming guide
Dear Simone, tcltk functions correspond closely to Tcl and Tk commands, so documentation for the latter, available at http://wiki.tcl.tk/3109, is helpful. I also found Welsch's Practical Programming in Tcl and Tk useful. I expect that you've already seen Peter Dalgaard's two R News articles on the tcltk package. I hope this helps, John John Fox Department of Sociology McMaster University Hamilton, Ontario Canada L8S 4M4 905-525-9140x23604 http://socserv.mcmaster.ca/jfox -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Simone Gabbriellini Sent: Thursday, August 11, 2005 9:43 AM To: John Zhang Cc: R-help@stat.math.ethz.ch Subject: Re: [R] tcltk programming guide thank you, I knew that link, but I need something more document- oriented, more specific, i.e. if I want to know how to use tkadd, where should I look? or tkinsert and so on... thanx, simone Il giorno 11/ago/05, alle ore 14:18, John Zhang ha scritto: Go to http://bioinf.wehi.edu.au/~wettenhall/RTclTkExamples/. There are good examples. X-Original-To: [EMAIL PROTECTED] Delivered-To: [EMAIL PROTECTED] X-Virus-Scanned: by amavisd-new at stat.math.ethz.ch Mime-Version: 1.0 (Apple Message framework v733) To: R-help@stat.math.ethz.ch From: Simone Gabbriellini [EMAIL PROTECTED] Date: Thu, 11 Aug 2005 14:04:58 +0200 Subject: [R] tcltk programming guide X-BeenThere: r-help@stat.math.ethz.ch X-Mailman-Version: 2.1.6 List-Id: Main R Mailing List: Primary help r- help.stat.math.ethz.ch List-Unsubscribe: https://stat.ethz.ch/mailman/listinfo/r-help, mailto:[EMAIL PROTECTED] List-Archive: https://stat.ethz.ch/pipermail/r-help List-Post: mailto:r-help@stat.math.ethz.ch List-Help: mailto:[EMAIL PROTECTED] List-Subscribe: https://stat.ethz.ch/mailman/listinfo/r-help, mailto:[EMAIL PROTECTED] Content-Transfer-Encoding: 7bit X-Spam-Checker-Version: SpamAssassin 3.0.1 (2004-10-22) on pascal.dfci.harvard.edu X-Spam-Level: X-Spam-Status: No, score=-2.6 required=3.0 tests=BAYES_00 autolearn=ham version=3.0.1 Dear List, I'm looking for some documentation about the R tcltk package The one I found in the help doesn't look exaustive, I need information on the use of the single tk widget, maybe with some examples thank you, simone gabbriellini __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting- guide.html Jianhua Zhang Department of Medical Oncology Dana-Farber Cancer Institute 44 Binney Street Boston, MA 02115-6084 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting- guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Creating new columns inside a loop
Ok, here's an english pseudo coded version of what I'd like to do... 10 columns of (somedata) names(somedata): C1 C2 C3 C4 C5 Loop through each column FOR ColName = C1 through C5 Compute a new column, named ColNameA = some result for each row Compute another new Column named ColNameB = some other result for each row NEXTColName Desired Result: Names(somedata): C1 C1A C1B C2 C2A C2B C3 C3A C3B C4 C4A C4B C5 C5A C5B So, basically, my question is how to both address and assign the names of the variables rather than the values of the variables while coding my loop. I hope that's clearer... kind of hard to explain! On 10 Aug 2005 21:55:01 +0200, Peter Dalgaard [EMAIL PROTECTED] wrote: David L. Van Brunt, Ph.D. [EMAIL PROTECTED] writes: Ok, I know R isn't an optimal environment for looping (or so I've heard) but I have a need to loop through columns of data and create new columns of data based on calculations within rows... I'm sure there's a help file, but I'm not sure what search terms to use to find it! The problem is that these new columns need to have names that I can later access... Like NewVar1, NewVar2, etc In php I'd call this indirection but I'm not sure what to call it in R so that I can find instructions on how to create, name, and address the values stored this way... any gentle nudges in the right direction would be greatly appreciated! A little more information about what you're actually trying to do and I'm sure someone will give you a nudge with a sledgehammer... At present, your description is just that little bit too nebulous. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 -- --- David L. Van Brunt, Ph.D. mailto:[EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] question on creating a new logical variable
I have two variables. A - rep(c(1:9), 2) B - rep(c(2:10),2) -- Renuka Sane http://www.nyx.net/~rsane [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] question on creating a new logical variable
I think there was an incomplete mail that was accidently sent by me. I apologize for the inconvenience. Here is the full text. I have two variables. A - rep(c(1:9), 2) B - rep(c(2:10),2) I want to know the the value for A==1 and B==1 If I do A== 1 | B==1, I get FALSE TRUE 16 2 This is incorrect. Similarly table(A==1) +table(B==1) reports an error as the arrays are non conformable. To solve the problem I therefore create a new variable C - c(A, B) and then do table(C==1) which gives me FALSE TRUE 34 2 Is there a way to do this without making the new variable C? Thanks, Renuka -- Renuka Sane http://www.nyx.net/~rsane [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] strips according to groups in xYplot or xyplot
Dear all, using the follwing code, i have been trying group the individual plots from trellis graphics according to genus. adding a groups=genus colours the lines on the individual plots accordingly. However, i need the strips to be coloured according to genus with the lines in each plot remaining black. using xyplot and conditioning to genus and species light|species+genus draws an extra strip with the genus name, this almost there, but then i have lots of blanc plots for all the nonexistant genus species conbinations - and also i wish to retain my error bars from xYplot. I understand that the solution is probably making my own strip function, but this is a little beyond my programming skills. Does anyone have any similar examples? an example dataframe is pasted below Many thanks Chris xYplot(Cbind(rgr.biomass,rgr.biomass-se,rgr.biomass+se) ~ light|species, data=data2, between=list(x=c(0.3,0.3,0.3,0.3,0.3),y=c(0.3,0.3,0.3)), type=c(l), col.line=black,ylab= rgr biomass (g-day-1), xlab=% light in nursery, main=Relative Growth rates of Diperocarps in three simulated light conditions, par.strip.text=list(cex=0.9, font=3),par.settings=list(axis.text=list(cex=0.7)),layout=c(6,4), grid=T) genus light rgr.biomassspecies se conformis.0.3 Dipterocarpus 0.3 0.0071360017 conformis 0.0005639106 conformis.3Dipterocarpus 3.0 0.0114787998 conformis 0.0005139212 conformis.18 Dipterocarpus 18.0 0.0128981690 conformis 0.0007443577 beccarii.0.3Dryobalanops 0.3 0.0043183235 beccarii 0.0008404544 lanceolata.0.3 Dryobalanops 0.3 0.0037914641 lanceolata 0.0012840799 beccarii.3 Dryobalanops 3.0 0.0086008217 beccarii 0.0007029627 lanceolata.3Dryobalanops 3.0 0.0066640135 lanceolata 0.0010293987 beccarii.18 Dryobalanops 18.0 0.0113213323 beccarii 0.0014422309 lanceolata.18 Dryobalanops 18.0 0.0107687387 lanceolata 0.0014388931 nervosa.0.3Hopea 0.3 -0.0009249978nervosa 0.0018732192 sangal.0.3 Hopea 0.3 0.0019374847 sangal 0.0007375358 spp.0.3Hopea 0.3 0.0086367776spp 0.0004649476 nervosa.3 Hopea 3.0 0.0028767234nervosa 0.0006551664 sangal.3 Hopea 3.0 0.0056669364 sangal 0.0005872821 spp.3 Hopea 3.0 0.0118224681spp 0.0005562180 nervosa.18 Hopea 18.0 0.0016949373nervosa 0.0016615030 sangal.18 Hopea 18.0 0.0041026605 sangal 0.0018584946 spp.18 Hopea 18.0 0.0114581095spp 0.0012815084 malaanonan.0.3Parashorea 0.3 0.0055797534 malaanonan 0.0007918039 tomentella.0.3Parashorea 0.3 0.0123015741 tomentella 0.0008293033 malaanonan.3 Parashorea 3.0 0.0099503268 malaanonan 0.0006376027 tomentella.3 Parashorea 3.0 0.0155581595 tomentella 0.0006379742 malaanonan.18 Parashorea 18.0 0.0092196940 malaanonan 0.0017303947 tomentella.18 Parashorea 18.0 0.0163406724 tomentella 0.0013648430 argentifolia.0.3 Shorea 0.3 0.0083378142 argentifolia 0.0010850323 beccariana.0.3Shorea 0.3 0.0070930251 beccariana 0.0004610866 faguetiana.0.3Shorea 0.3 0.0045384372 faguetiana 0.0010002449 gibbosa.0.3 Shorea 0.3 0.0120252725gibbosa 0.0015315410 guiso.0.3 Shorea 0.3 0.0016886809 guiso 0.0004390734 johorensis.0.3Shorea 0.3 0.0046130010 johorensis 0.0013987125 leprosula.0.3 Shorea 0.3 0.0054931197 leprosula 0.0007935381 macrophylla.0.3 Shorea 0.3 0.0071376385macrophylla 0.0006889700 macroptera.0.3Shorea 0.3 0.0044181634 macroptera 0.0005528986 oleosa.fallax.0.3 Shorea 0.3 0.0045416334 oleosa.fallax 0.0004696663 ovalis.0.3Shorea 0.3 0.0021653329 ovalis 0.0014667085 parvifolia.0.3Shorea 0.3 0.0031730144 parvifolia 0.0002314153 parvistipulata.0.3Shorea 0.3 0.0108939901 parvistipulata 0.0007272541 superba.0.3 Shorea 0.3 0.0048611998superba 0.0005558181 argentifolia.3Shorea 3.0 0.0130474184 argentifolia 0.0005603928 beccariana.3 Shorea 3.0 0.0116513374 beccariana 0.0006809518 faguetiana.3 Shorea 3.0 0.0056884859 faguetiana 0.0024317150 gibbosa.3 Shorea 3.0 0.0163350328gibbosa 0.0008753554 guiso.3 Shorea 3.0 0.0039323112 guiso 0.0008966266 johorensis.3 Shorea 3.0 0.0057245098 johorensis 0.0012002584 leprosula.3 Shorea 3.0 0.0110078404 leprosula 0.0006868679 macrophylla.3
Re: [R] Please don't blame your tools (was Error in autoloader)
The problem is **NOT** in MASS. confint is in stats, not MASS, and has been (in base then stats) since R 1.7.0. You could (and should) have checked that from the (O)NEWS files of R and MASS. Nor is there an error in autoloader, as your title stated. Some other piece of software on your system is seriously out of date. Running traceback() might tell you what it is. My suspicion is that you have somewhere a long-outdated version of lme4. Starting each R session with that long list of packages is surely not a good idea. Part of the homework before posting should be to run R --vanilla and see what happens there. If this were me I would scrap all of the outdated R installation you have and start again with R 2.1.1 (or R-patched). On Thu, 11 Aug 2005, Peter Ho wrote: Hi, After installing the latest versions of lme4, Matrix, VR on a Debian Box, I have run into a problem. When I use library(lme4) on R Version 2.1.0 (2005-04-18) I get the following error message: library(lme4) Loading required package: Matrix Error in autoloader(name = confint, package = MASS) : autoloader did not find 'confint' in 'MASS' An example of the complete session is given at the end of this email. A search in the docs. At present I have 3 directories where packages are kept, as I use apt-get install r-cran-package_ name when one is available in Debian and when it is not R, R CMD INSTALL package_name. This gives me the following directories when use help.start(): (1) Packages in /usr/local/lib/R/site-library (packages installed by R CMD INSTALL) (2) Packages in /usr/lib/R/site-library (packages installed with apt-get install) (3) Packages in /usr/lib/R/library (base install with apt-get install) Matrix, lme4 and other suggested packages were first installed with R CMD INSTALL. and can be found in /usr/local/lib/R/site-library. After the error occured, I updated VR with apt-get install (found in /usr/lib/R/library) and got the same error message. Installing a second version of lme4 and matrix with apt-get install puts these packages in /usr/lib/R/site-library and gives the same error as before. Looking at the MASS no function 'confint' exists, only confint.glm, confint.nls,confint.profile.glm and confint.profile.nls Can anyone suggest a solution to the problem or why I am unable to access lme4 or as the error statement suggests, a problem with the Matrix package and Mass? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] question on creating a new logical variable
table(ifelse(A==2B==3, TRUE, FALSE)) On 8/11/05, Renuka Sane [EMAIL PROTECTED] wrote: I think there was an incomplete mail that was accidently sent by me. I apologize for the inconvenience. Here is the full text. I have two variables. A - rep(c(1:9), 2) B - rep(c(2:10),2) I want to know the the value for A==1 and B==1 If I do A== 1 | B==1, I get FALSE TRUE 16 2 This is incorrect. Similarly table(A==1) +table(B==1) reports an error as the arrays are non conformable. To solve the problem I therefore create a new variable C - c(A, B) and then do table(C==1) which gives me FALSE TRUE 34 2 Is there a way to do this without making the new variable C? Thanks, Renuka -- Renuka Sane http://www.nyx.net/~rsane [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- WenSui Liu (http://statcompute.blogspot.com) Senior Decision Support Analyst Cincinnati Children Hospital Medical Center __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] question on creating a new logical variable
On Thu, 11 Aug 2005, Renuka Sane wrote: I have two variables. A - rep(c(1:9), 2) B - rep(c(2:10),2) I want to know the the value for A==1 and B==1 [SNIP] To solve the problem I therefore create a new variable C - c(A, B) and then do table(C==1) which gives me FALSE TRUE 34 2 Is there a way to do this without making the new variable C? You mean something besides not explicitly creating it? table(c(A, B) == 1) -- SIGSIG -- signature too long (core dumped) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Creating new columns inside a loop
On Thu, 11 Aug 2005, David L. Van Brunt, Ph.D. wrote: Ok, here's an english pseudo coded version of what I'd like to do... 10 columns of (somedata) names(somedata): C1 C2 C3 C4 C5 Loop through each column FOR ColName = C1 through C5 Compute a new column, named ColNameA = some result for each row Compute another new Column named ColNameB = some other result for each row NEXTColName A direct translation is for(name in names(somedata)){ somedata[[paste(name,A,sep=)]]-some.result(somedata[[name]]) somedata[[paste(name,B,sep=)]]-some.other.result(somedata[[name]]) } Possibly more efficient is some.more.data - lapply(somedata, some.result) names(some.more.data)-paste(names(somedata),A,sep=) yet.more.data - lapply(somedata, some.other.result) names(yet.more.data)-paste(names(somedata),B,sep=) somedata-cbind(somedata, some.more.data, yet.more.data) -thomas Desired Result: Names(somedata): C1 C1A C1B C2 C2A C2B C3 C3A C3B C4 C4A C4B C5 C5A C5B So, basically, my question is how to both address and assign the names of the variables rather than the values of the variables while coding my loop. I hope that's clearer... kind of hard to explain! On 10 Aug 2005 21:55:01 +0200, Peter Dalgaard [EMAIL PROTECTED] wrote: David L. Van Brunt, Ph.D. [EMAIL PROTECTED] writes: Ok, I know R isn't an optimal environment for looping (or so I've heard) but I have a need to loop through columns of data and create new columns of data based on calculations within rows... I'm sure there's a help file, but I'm not sure what search terms to use to find it! The problem is that these new columns need to have names that I can later access... Like NewVar1, NewVar2, etc In php I'd call this indirection but I'm not sure what to call it in R so that I can find instructions on how to create, name, and address the values stored this way... any gentle nudges in the right direction would be greatly appreciated! A little more information about what you're actually trying to do and I'm sure someone will give you a nudge with a sledgehammer... At present, your description is just that little bit too nebulous. -- O__ Peter Dalgaard ?ster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 -- --- David L. Van Brunt, Ph.D. mailto:[EMAIL PROTECTED] [[alternative HTML version deleted]] Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle__ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Converting strings with internal delimiters into lists
Hi UserRs, I know that there has to be an easy way to do this in R (probably easy enough that once someone clues me in I'll smack myself on the forehead for not figuring it out myself), but my searches on my own have not yielded any hints. I have many fields in my dataset that participants entered as free lists - i.e., the field constitutes a varying number of names each separated by a delimiter. The resulting data frame might look something like: testtable- as.data.frame(cbind(c(Joe,Mary,Jane,Mary),c(Fred,Joe,Pete,Joe,Mary,Fred))) In actuality the names are typically multi-word organization names, but you get the idea... What I need to do is to convert these text strings into lists comprised of the elements separated by the commas so that I can work with these elements across the dataset, manipulate them, etc. Thanks in advance to any kind soul who can offer me a tip to the appropriate functions or a line of code! Best, Shelby __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] background colors in image()
Romain, Thanks for the code. It worked perfectly! --- Romain Francois [EMAIL PROTECTED] wrote: Le 11.08.2005 00:59, array chip a écrit : Thanks for the suggestion! It works in a way that the entire graph window is in the background color, is there a way to only have the plotting area (i.e. the area within the axis box in the background color, but leave the area outside the axes to be unchanged (white)? Thanks! You need to learn how to use par('usr') and argument add in image. demo('graphics') is one way to learn or look at graph 8 on r graph gallery R image(matrix(c(1,2,NA, 1),2, 2)) R usr - par('usr') R rect(usr[1], usr[3], usr[2], usr[4], col=cornsilk) R image(matrix(c(1,2,NA, 1),2, 2),add=TRUE) Romain --- Prof Brian Ripley [EMAIL PROTECTED] wrote: On Wed, 10 Aug 2005, someone needing to conceal his real name wrote: Hi, I am using image() function to plot a matrix which has some missing valuies (NA). It looks like, by default, missing values were drawn in white color, How can I change that into a different color, say a gray color? I tried to use bg='gray' argument with no luck. Anyone has a suggestion? They are not drawn in white: in fact they are not drawn at all, so the current background (or if transparent, the canvas) is what you see. par(bg=yellow) image(matrix(c(1,2,NA, 1),2, 2)) works, for example. -- 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 -- visit the R Graph Gallery : http://addictedtor.free.fr/graphiques ~ ~~ Romain FRANCOIS - http://addictedtor.free.fr ~~ Etudiant ISUP - CS3 - Industrie et Services ~~http://www.isup.cicrp.jussieu.fr/ ~~ Stagiaire INRIA Futurs - Equipe SELECT ~~ http://www.inria.fr/recherche/equipes/select.fr.html ~~ ~ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] easier way to print heatmap on multiple pages?
Hi All, I've worked on some code to take a heatmap with 1000 row entries, and split this up into 20 pages, each with 50 rows from the original heatmap. I want to preserve the row order such that all 20 pages, if put together, would comprise the original heatmap. Here's what I've done: ##make the initial heatmap, with all 1000 rows and write it to an object 'heatAll' heatAll = heatmap.2(combined.int.top, col = cm.colors(256), trace = none) pdf(file=~/Desktop/Alfalfa-Ladak-StemV3.pdf, width=8, height=12, pointsize=4) for(i in 1:20){ selected = heatAll$rowInd[((i-1)*50):((i-1)*50+50)] ##get original row order in groups of 50 heatmap.2(combined.int.top[selected,], Rowv = FALSE, ##prevent row re-ordering Colv=heatAll$colInd, col=cm.colors(256), trace=none, margins = c(9,8), main=paste(page, i, sep= )) } dev.off() I can't think of why this wouldn't work, but for some reason things are completely out of order. For example, the first page of the PDF shows many genes found at the bottom of the original heatmap, but in a different order. Strange. So, have I made this insanely complicated? Is there an easier, better way to print a large heatmap on multiple pages? Thanks in advance for any help. --Jake __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Converting strings with internal delimiters into lists
??? I guess I don't get it. Note that testtable- as.data.frame(cbind(c(Joe,Mary,Jane,Mary),c(Fred,Joe,Pete,Joe,Mary,Fr ed))) is probably not what you want since cbind expects vectors of equal length. By default, shorter vectors are recycled to the length of the longest one, which I doubt is what you want. Why isn't mylist-list(c(Joe,Mary,Jane,Mary),c(Fred,Joe,Pete,Joe,Mary,Fred),.. .) suitable? S lists are specifically designed to handle different objects with different lengths (or totally different objects). lapply(), sapply() and friends or for() loops can then work over such a list to do what you want. -- Bert Gunter Genentech Non-Clinical Statistics South San Francisco, CA The business of the statistician is to catalyze the scientific learning process. - George E. P. Box __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Converting strings with internal delimiters into lists
On Thu, 11 Aug 2005, shelby berkowitz wrote: Hi UserRs, I know that there has to be an easy way to do this in R (probably easy enough that once someone clues me in I'll smack myself on the forehead for not figuring it out myself), but my searches on my own have not yielded any hints. I think you are looking for strsplit() -thomas I have many fields in my dataset that participants entered as free lists - i.e., the field constitutes a varying number of names each separated by a delimiter. The resulting data frame might look something like: testtable- as.data.frame(cbind(c(Joe,Mary,Jane,Mary),c(Fred,Joe,Pete,Joe,Mary,Fred))) In actuality the names are typically multi-word organization names, but you get the idea... What I need to do is to convert these text strings into lists comprised of the elements separated by the commas so that I can work with these elements across the dataset, manipulate them, etc. Thanks in advance to any kind soul who can offer me a tip to the appropriate functions or a line of code! Best, Shelby __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] Converting strings with internal delimiters into lists
yes, that does it. thanks! --- Thomas Lumley [EMAIL PROTECTED] wrote: On Thu, 11 Aug 2005, shelby berkowitz wrote: Hi UserRs, I know that there has to be an easy way to do this in R (probably easy enough that once someone clues me in I'll smack myself on the forehead for not figuring it out myself), but my searches on my own have not yielded any hints. I think you are looking for strsplit() -thomas I have many fields in my dataset that participants entered as free lists - i.e., the field constitutes a varying number of names each separated by a delimiter. The resulting data frame might look something like: testtable- as.data.frame(cbind(c(Joe,Mary,Jane,Mary),c(Fred,Joe,Pete,Joe,Mary,Fred))) In actuality the names are typically multi-word organization names, but you get the idea... What I need to do is to convert these text strings into lists comprised of the elements separated by the commas so that I can work with these elements across the dataset, manipulate them, etc. Thanks in advance to any kind soul who can offer me a tip to the appropriate functions or a line of code! Best, Shelby __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Thomas Lumley Assoc. Professor, Biostatistics [EMAIL PROTECTED] University of Washington, Seattle __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] A coding question involving variable assignments
Dear List, I have the following code that does what I want: x - replicate(5,replicate(10,sum(rnorm(rpois(1,10) How might one change it such that the maximum value generated by rnorm(rpois(1,10)) can be retrieved for later use? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] getting xpinch and ypinch
Hello! I would like to know if it is possible (and how) to get xpinch and ypinch values that R gets (from the system) for drawing plots. If I understand correctly; with this values I could save the same picture as I see on computer 1 on computer 2 as a let say wmf file. Thank you in advance, Ales Ziberna __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] signal handling
Is ther a signal handling model in R? similar to Perl's %SIG hash. I want to do fast clean up in my R code before exit when a kill signal is issued. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] clustering or homegenity approaches?
Hi, there: I have a question on the following dataset rbind(t2[which(t40.3),][1:3,], t2[1:3,]) # don't worry about what this line means [,1] [,2] [,3] [,4] [,5] [1,] 34.216166 96.928587 330.125990 330.183222 330.201215 [2,] 2.819183 8.134491 8.275841 8.525256 8.828448 [3,] 2.819183 7.541680 7.550333 8.374636 8.690998 [4,] 4.672551 5.036353 5.072710 5.152218 5.223204 [5,] 5.470131 5.500513 5.674139 5.689151 5.770423 [6,] 4.480287 4.628300 4.797686 4.814106 4.823345 I want to filter out the first 3 cases from the rest and the criteria is I am looking for a gap. My way is using std(eachrow)/median(each) and set up a threshold, which is very naive, but fast and good enough. But I want it better and more academic. Please be advised. I think clustering might help, but it needs to be quick since t2 has 3 rows. Thanks, Weiwei -- Weiwei Shi, Ph.D Did you always know? No, I did not. But I believed... ---Matrix III __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] error tracing
Hi, I am running some Cox modeling on large number of variables (thousands) using apply. For some reasons, some of the variables have problems in Cox regression, so the the run was stopped automatically. Is there a way to keep the running for all the variables to complete and let us, when done, to trace back which of the variables cause the problem? Thanks __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] scatter plot
I'd like to do a simple scatter plot but instead of using the variable values on the X axis I would like to plot the percentiles. I searched in the manual for percentiles but did not find what I was looking for. I've been using SAS for several years but I new to R. -- Dean Sonneborn Programmer Analyst Department of Public Health Sciences University of California, Davis (916) 734-6656 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] scatter plot
Here is a hack par(mfrow=c(1,2)) x - rnorm(1000) y - x + rnorm(1000) xp - (rank(x)-1)/(length(x)-1) plot( x, y ) plot( xp, y ) But do notice that by using percentiles, it spreads the 'x' values evenly. This may be important for points at the extremes. Regards, Adai On Thu, 2005-08-11 at 15:40 -0700, Dean Sonneborn wrote: I'd like to do a simple scatter plot but instead of using the variable values on the X axis I would like to plot the percentiles. I searched in the manual for percentiles but did not find what I was looking for. I've been using SAS for several years but I new to R. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] scatter plot
I'm doing this scatter plot and it's almost what I want. What I would like to change is to have the X axis (the lipid_adj_pcb_cent variable) be plotted in percentiles not the variable values. Here's the code I currently using: xyplot(zawgt_sk_cent ~ lipid_adj_pcb_cent, panel=function(x,y){ panel.xyplot(x,y) panel.lmline(x,y)}, auto.key=TRUE, data=centered, na.strings=, fontfamily = HersheySans , scales = list( tick.number = 10)) -- Dean Sonneborn Programmer Analyst Department of Public Health Sciences University of California, Davis (916) 734-6656 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] signal handling
Omar Lakkis wrote: Is ther a signal handling model in R? similar to Perl's %SIG hash. I want to do fast clean up in my R code before exit when a kill signal is issued. I don't know Perl's %SIG hash. However, there are several things you can do: the on.exit() function lets a function do cleanup, and there are various hooks available (see ?setHook), and finalizers (see ?reg.finalizer) for some kinds of objects. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] A coding question involving variable assignments
On 12/08/05 05:55, xpRt.wannabe wrote,: Dear List, I have the following code that does what I want: x - replicate(5,replicate(10,sum(rnorm(rpois(1,10) How might one change it such that the maximum value generated by rnorm(rpois(1,10)) can be retrieved for later use? set.seed(99) x - replicate(5,replicate(10,sum(rnorm(rpois(1,10) set.seed(99) mx - replicate(5,replicate(10,max(rnorm(rpois(1,10) should work? Ted. -- Dr E.A. Catchpole Visiting Fellow Univ of New South Wales at ADFA, Canberra, Australia and University of Kent, Canterbury, England - www.ma.adfa.edu.au/~eac - fax: +61 2 6268 8786 - ph: +61 2 6268 8895 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] A coding question involving variable assignments
Jim and List, Thank you for the prompt reply. Perhaps I should have been more specific in the way I phrased the question. The code you gave would return the max value just one time. I was interested in getting as many max values generated by rnorm(rpois(1,10)) as specified by: replicate(5,replicate(10 ... ) In the end, I expect to get 10 x 5 max values. In that context, how might the code be changed? On 8/11/05, jim holtman [EMAIL PROTECTED] wrote: temp - rnorm(rpois(1,10)) x - replicate(5,replicate(10,sum(temp))) temp - max(temp) On 8/11/05, xpRt.wannabe [EMAIL PROTECTED] wrote: Dear List, I have the following code that does what I want: x - replicate(5,replicate(10,sum(rnorm(rpois(1,10) How might one change it such that the maximum value generated by rnorm(rpois(1,10)) can be retrieved for later use? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- Jim Holtman Convergys +1 513 723 2929 What the problem you are trying to solve? __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] A coding question involving variable assignments
Ted and List, In your code that produced 'mx', you dropped sum() from my original code though. As a result, the 10 x 5 max's are of the same value. Unfortunately, that's not what I need. On 8/11/05, ecatchpole [EMAIL PROTECTED] wrote: On 12/08/05 05:55, xpRt.wannabe wrote,: Dear List, I have the following code that does what I want: x - replicate(5,replicate(10,sum(rnorm(rpois(1,10) How might one change it such that the maximum value generated by rnorm(rpois(1,10)) can be retrieved for later use? set.seed(99) x - replicate(5,replicate(10,sum(rnorm(rpois(1,10) set.seed(99) mx - replicate(5,replicate(10,max(rnorm(rpois(1,10) should work? Ted. -- Dr E.A. Catchpole Visiting Fellow Univ of New South Wales at ADFA, Canberra, Australia and University of Kent, Canterbury, England - www.ma.adfa.edu.au/~eac - fax: +61 2 6268 8786 - ph: +61 2 6268 8895 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] A coding question involving variable assignments
Sorry, I don't follow. What's wrong with this? Ted. set.seed(99) x - replicate(5,replicate(10,sum(rnorm(rpois(1,10) set.seed(99) mx - replicate(5,replicate(10,max(rnorm(rpois(1,10) x [,1][,2][,3] [,4] [,5] [1,] -2.0071674 -7.0883335 -0.03766649 2.6859415 -5.4685172 [2,] -4.7211799 2.4177121 -0.92575948 -7.2201952 -2.5969177 [3,] 0.2325584 -0.1790635 -3.17988580 -2.0249829 1.6994276 [4,] -1.7738725 1.5836438 5.06193854 -5.4798269 -2.4363479 [5,] -3.0394562 2.8859440 2.67993750 5.0534413 0.6560877 [6,] 6.2436591 -4.0226431 1.97545757 -1.5641548 4.0443831 [7,] 0.4641453 -10.4417831 1.08048629 2.4675178 -5.5114109 [8,] 1.1570728 -3.6081361 1.37858782 0.3534015 1.8282236 [9,] 4.3988625 3.0692562 -0.69898483 -1.6882952 -1.1548913 [10,] -3.7288105 -1.4455309 5.80146323 -6.1962790 -1.3698381 mx [,1] [,2] [,3] [,4] [,5] [1,] 0.4896243 1.4110132 0.7329387 3.2700493 1.861891 [2,] 1.0989215 1.6215407 1.5980779 2.2921963 1.417614 [3,] 1.4000518 1.4867612 1.0130372 0.5686142 1.442630 [4,] 0.5981696 2.0916016 2.0894395 0.9760749 1.419316 [5,] 1.0066032 1.8084703 1.6556502 2.1431458 2.393037 [6,] 2.7329641 1.8689793 1.1494738 1.2899945 1.702919 [7,] 0.5851713 0.6224785 2.4466643 1.1955567 0.951106 [8,] 1.3850466 0.9305735 1.4003689 1.5209779 1.864211 [9,] 1.8645760 1.1958389 0.9270208 0.4971312 1.576020 [10,] 1.5889265 1.0253490 4.6865908 0.9852816 1.032410 On 12/08/05 12:17, xpRt.wannabe wrote,: Ted and List, In your code that produced 'mx', you dropped sum() from my original code though. As a result, the 10 x 5 max's are of the same value. Unfortunately, that's not what I need. On 8/11/05, ecatchpole [EMAIL PROTECTED] wrote: On 12/08/05 05:55, xpRt.wannabe wrote,: Dear List, I have the following code that does what I want: x - replicate(5,replicate(10,sum(rnorm(rpois(1,10) How might one change it such that the maximum value generated by rnorm(rpois(1,10)) can be retrieved for later use? set.seed(99) x - replicate(5,replicate(10,sum(rnorm(rpois(1,10) set.seed(99) mx - replicate(5,replicate(10,max(rnorm(rpois(1,10) should work? Ted. -- Dr E.A. Catchpole Visiting Fellow Univ of New South Wales at ADFA, Canberra, Australia and University of Kent, Canterbury, England - www.ma.adfa.edu.au/~eac - fax: +61 2 6268 8786 - ph: +61 2 6268 8895 -- Dr E.A. Catchpole Visiting Fellow Univ of New South Wales at ADFA, Canberra, Australia and University of Kent, Canterbury, England - www.ma.adfa.edu.au/~eac - fax: +61 2 6268 8786 - ph: +61 2 6268 8895 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] access assigned objects
Dear list, I am trying to write a function that will make a matrix of each row of a data frame (4 columns), calculate a fisher.test on each resulting matrix and assign a vector of the p-values. I have gotten through making the matrices, but cannot calculate the fisher.test. fm-function(x) {dfrow-nrow(x) mm - vector(list, dfrow) for(i in 1:dfrow) mm[[i]] - matrix(x[i,],nr=2) } I don't know how to access each mm[[i]] as everything I've tried gives me the error that Error in fisher.test(mm[[i]]) : all entries of x must be nonnegative and finite All the numbers in the matrices are between 1 and 600. Thanks, Beth [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] A coding question involving variable assignments
Ted and List, What I need is I need to know what max of rnorm(rpois(1,10)) is before R does sum(), replicate(10, ...) and replicate(5, ...). The fact that you have set.seed(99) twice, does that mean, say, entry [1,1] 0.4896243 in 'mx' is one of the z number of values generated by rnorm(rpois(1,10)) that add up to [1,1] -2.0071674 in 'x'? Another way to ask the question, I guess, is, by doing set.seed(99) twice are the values generated by rnorm(rpois(1,10)) for 'x' same as those for 'mx'? On 8/11/05, ecatchpole [EMAIL PROTECTED] wrote: Sorry, I don't follow. What's wrong with this? Ted. set.seed(99) x - replicate(5,replicate(10,sum(rnorm(rpois(1,10) set.seed(99) mx - replicate(5,replicate(10,max(rnorm(rpois(1,10) x [,1][,2][,3] [,4] [,5] [1,] -2.0071674 -7.0883335 -0.03766649 2.6859415 -5.4685172 [2,] -4.7211799 2.4177121 -0.92575948 -7.2201952 -2.5969177 [3,] 0.2325584 -0.1790635 -3.17988580 -2.0249829 1.6994276 [4,] -1.7738725 1.5836438 5.06193854 -5.4798269 -2.4363479 [5,] -3.0394562 2.8859440 2.67993750 5.0534413 0.6560877 [6,] 6.2436591 -4.0226431 1.97545757 -1.5641548 4.0443831 [7,] 0.4641453 -10.4417831 1.08048629 2.4675178 -5.5114109 [8,] 1.1570728 -3.6081361 1.37858782 0.3534015 1.8282236 [9,] 4.3988625 3.0692562 -0.69898483 -1.6882952 -1.1548913 [10,] -3.7288105 -1.4455309 5.80146323 -6.1962790 -1.3698381 mx [,1] [,2] [,3] [,4] [,5] [1,] 0.4896243 1.4110132 0.7329387 3.2700493 1.861891 [2,] 1.0989215 1.6215407 1.5980779 2.2921963 1.417614 [3,] 1.4000518 1.4867612 1.0130372 0.5686142 1.442630 [4,] 0.5981696 2.0916016 2.0894395 0.9760749 1.419316 [5,] 1.0066032 1.8084703 1.6556502 2.1431458 2.393037 [6,] 2.7329641 1.8689793 1.1494738 1.2899945 1.702919 [7,] 0.5851713 0.6224785 2.4466643 1.1955567 0.951106 [8,] 1.3850466 0.9305735 1.4003689 1.5209779 1.864211 [9,] 1.8645760 1.1958389 0.9270208 0.4971312 1.576020 [10,] 1.5889265 1.0253490 4.6865908 0.9852816 1.032410 On 12/08/05 12:17, xpRt.wannabe wrote,: Ted and List, In your code that produced 'mx', you dropped sum() from my original code though. As a result, the 10 x 5 max's are of the same value. Unfortunately, that's not what I need. On 8/11/05, ecatchpole [EMAIL PROTECTED] wrote: On 12/08/05 05:55, xpRt.wannabe wrote,: Dear List, I have the following code that does what I want: x - replicate(5,replicate(10,sum(rnorm(rpois(1,10) How might one change it such that the maximum value generated by rnorm(rpois(1,10)) can be retrieved for later use? set.seed(99) x - replicate(5,replicate(10,sum(rnorm(rpois(1,10) set.seed(99) mx - replicate(5,replicate(10,max(rnorm(rpois(1,10) should work? Ted. -- Dr E.A. Catchpole Visiting Fellow Univ of New South Wales at ADFA, Canberra, Australia and University of Kent, Canterbury, England - www.ma.adfa.edu.au/~eac - fax: +61 2 6268 8786 - ph: +61 2 6268 8895 -- Dr E.A. Catchpole Visiting Fellow Univ of New South Wales at ADFA, Canberra, Australia and University of Kent, Canterbury, England - www.ma.adfa.edu.au/~eac - fax: +61 2 6268 8786 - ph: +61 2 6268 8895 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] A coding question involving variable assignments
On 12/08/05 13:27, xpRt.wannabe wrote,: Ted and List, What I need is I need to know what max of rnorm(rpois(1,10)) is before R does sum(), replicate(10, ...) and replicate(5, ...). The fact that you have set.seed(99) twice, does that mean, say, entry [1,1] 0.4896243 in 'mx' is one of the z number of values generated by rnorm(rpois(1,10)) that add up to [1,1] -2.0071674 in 'x'? Another way to ask the question, I guess, is, by doing set.seed(99) twice are the values generated by rnorm(rpois(1,10)) for 'x' same as those for 'mx'? Yes, that's the reason for having a set.seed() function. Ted. -- Dr E.A. Catchpole Visiting Fellow Univ of New South Wales at ADFA, Canberra, Australia and University of Kent, Canterbury, England - www.ma.adfa.edu.au/~eac - fax: +61 2 6268 8786 - ph: +61 2 6268 8895 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] Help converting a function from S-Plus to R: family$weight
Hi all I am converting an S-Plus function into R. The S-Plus code uses some of the glm families, and family objects. The family objects in S-Plus and R have many different features, for example: In R: names(Gamma()) [1] family link linkfunlinkinvvariance [6] dev.resids aicmu.eta initialize validmu [11] valideta In S-Plus: names(Gamma()) [1] family names link inversederiv [6] initialize variance deviance weight My question concerns the variable weight in the S-Plus function. I'm not sure what it is. (I have searched the S-Plus mailing list archive, and my S-Plus for linux 6.1 documentation.) For almost all family objects, the weight variable is the same as variance, just weighted (and the former as a function; the later as an expression): Gamma()$variance function(mu) mu^2 Gamma()$weight expression(w * mu^2.) The same applies for most families. So I thought I could determine what this weight variable was. But alas--not the inverse,gaussian: inverse.gaussian()$variance function(mu) mu^3 inverse.gaussian()$weight expression(w/((sqrt(family$variance(mu)) * family$deriv(mu))^2.)) So: - can anyone tell me what this expression weight represents? - why is the inverse.gaussian family different than all others? Thanks in advance. P. My S-Plus version: version Version 6.2.1 for Linux 2.4.18 : 2003 My R version: version _ platform i386-pc-linux-gnu arch i386 os linux-gnu system i386, linux-gnu status major2 minor1.0 year 2005 month04 day 18 language R -- Dr Peter Dunn | Senior Lecturer in Statistics Faculty of Sciences, University of Southern Queensland Web:http://www.sci.usq.edu.au/staff/dunn Email: dunn at usq.edu.au CRICOS: QLD 00244B | NSW 02225M | VIC 02387D | WA 02521C __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Re: [R] A coding question involving variable assignments
Thank you! That was helpful. Another thing I learned was that I would need to do set.seed(99) not once but twice in this context. On 8/11/05, ecatchpole [EMAIL PROTECTED] wrote: On 12/08/05 13:27, xpRt.wannabe wrote,: Ted and List, What I need is I need to know what max of rnorm(rpois(1,10)) is before R does sum(), replicate(10, ...) and replicate(5, ...). The fact that you have set.seed(99) twice, does that mean, say, entry [1,1] 0.4896243 in 'mx' is one of the z number of values generated by rnorm(rpois(1,10)) that add up to [1,1] -2.0071674 in 'x'? Another way to ask the question, I guess, is, by doing set.seed(99) twice are the values generated by rnorm(rpois(1,10)) for 'x' same as those for 'mx'? Yes, that's the reason for having a set.seed() function. Ted. -- Dr E.A. Catchpole Visiting Fellow Univ of New South Wales at ADFA, Canberra, Australia and University of Kent, Canterbury, England - www.ma.adfa.edu.au/~eac - fax: +61 2 6268 8786 - ph: +61 2 6268 8895 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] chisq warning
Hi I am running chisq as below and getting a warning. Can anyone tell me the significance or the warning? chisq.test(c(10 ,4 ,2 ,6 ,5 ,3 ,4 ,4 ,6 ,3 ,2 ,2 ,2 ,4 ,7 ,10 ,0 ,6 ,19 ,3 ,2 ,7 ,2 ,2 ,2 ,1 ,32 ,2 ,3 ,10 ,1 ,3 ,9 ,4 ,10 ,2 ,2 ,4 ,5 ,7 ,6 ,3 ,7 ,4 ,3 ,3 ,7 ,1 ,4 ,2 ,2 ,3 ,3 ,5 ,5 ,4 ), p =c(0.01704142 ,0.017988166 ,0.018224852 ,0.017751479 ,0.017988166 ,0.018224852 ,0.017278107 ,0.017514793 ,0.017988166 ,0.017988166 ,0.017988166 ,0.017988166 ,0.017988166 ,0.017751479 ,0.017751479 ,0.017988166 ,0.017988166 ,0.017514793 ,0.017751479 ,0.017751479 ,0.017988166 ,0.017751479 ,0.017514793 ,0.017751479 ,0.017988166 ,0.018224852 ,0.017988166 ,0.017278107 ,0.017988166 ,0.017751479 ,0.017988166 ,0.018224852 ,0.017751479 ,0.018224852 ,0.017751479 ,0.018224852 ,0.017751479 ,0.017514793 ,0.018224852 ,0.017514793 ,0.017988166 ,0.018224852 ,0.017278107 ,0.017988166 ,0.018224852 ,0.018224852 ,0.018224852 ,0.017514793 ,0.018224852 ,0.018224852 ,0.017988166 ,0.018224852 ,0.017751479 ,0.017278107 ,0.017278107 ,0.017514793)) Chi-squared test for given probabilities data: c(10, 4, 2, 6, 5, 3, 4, 4, 6, 3, 2, 2, 2, 4, 7, 10, 0, 6, 19, 3, 2, 7, 2, 2, 2, 1, 32, 2, 3, 10, 1, 3, 9, 4, 10, 2, 2, 4, 5, 7, 6, 3, 7, 4, 3, 3, 7, 1, 4, 2, 2, 3, 3, 5, 5, 4) X-squared = 267.0767, df = 55, p-value 2.2e-16 Warning message: Chi-squared approximation may be incorrect in: chisq.test(c(10, 4, 2, 6, 5, 3, 4, 4, 6, 3, 2, 2, 2, 4, 7, 10, all help welcome. Stephen -- No virus found in this outgoing message. Checked by AVG Anti-Virus. 11/08/2005 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html