Re: [R] extracting correlations from nlme
Hi, I would like to know how (if) I can extract some of the information from the summary of my nlme. This is R. There is no if. Only how. at present, I get a summary looking something like this: summary(fit.nlme) [snip] I would like to extract the table of correlations, but have not been able to do it. ss - summary(fit.nlme) ss$corFixed Cheers, Simon. Any assistance, much appreciated. Cheers, Evelyn Evelyn Hall PhD Student Faculty of Veterinary Science The University of Sydney PMB 3 Camden, NSW, 2570 Phone: +61 2 9036 7736 Email: [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 -- Simon Blomberg, B.Sc.(Hons.), Ph.D, M.App.Stat. Visiting Fellow School of Botany Zoology The Australian National University Canberra ACT 0200 Australia T: +61 2 6125 8057 email: [EMAIL PROTECTED] F: +61 2 6125 5573 CRICOS Provider # 00120C __ 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] glm family=binomial logistic sigmoid curve problem
I'm trying to plot an extrapolated logistic sigmoid curve using glm(..., family=binomial) as follows, but neither the fitted() points or the predict()ed curve are plotting correctly: year - c(2003+(6/12), 2004+(2/12), 2004+(10/12), 2005+(4/12)) percent - c(0.31, 0.43, 0.47, 0.50) plot(year, percent, xlim=c(2003, 2007), ylim=c(0, 1)) lm - lm(percent ~ year) abline(lm) bm - glm(percent ~ year, family=binomial) Warning message: non-integer #successes in a binomial glm! in: eval(expr, envir, enclos) points(year, fitted(bm), pch=+) NULL curve(predict(bm, data.frame(year=x)), add=TRUE) All four of the binomial-fitted points fall exactly on the simple linear regression line, and the predict() curve is nowhere near any of the data points. What am I doing wrong? What does the warning mean? Do I need more points? I am using R on Windows, Version 2.0.1 (2004-11-15) Thank you for your kind help. Sincerely, James Salsman __ 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] Building R packages under Windows.
Hello, My question is the following. Has anyone put together an idiots checklist of the steps needed to build a (small personal) package under Windows, or documented their own experiences of building packages under Windows? I ask this as last week there were some very interesting comments regarding the advantages of putting personally written functions together as a package rather than sourcing them in at the start of a session using .Rprofile. They inspired me to try to build my own package for a few functions I use in teaching on my laptop running Windows XP . I read and reread Writing R extensions I installed Pearl and tried build on a modified package.skeleton. I fairly quickly worked out I needed to do things like setting Tmpdir as an environment variable, but then I got stuck and frustrated and gave up. I'm sure that with more time I would get things working, but I don't have more time. Could the process be made smoother through better documentation? This may sound like laziness, but I do guess that there are others are in the same position who find that the initiial hassles of building a package (under Windows) leads to a negative cost benefit balance over less elegant solutions. Thanks, Duncan Golicher -- Dr Duncan Golicher Ecologia y Sistematica Terrestre Conservación de la Biodiversidad El Colegio de la Frontera Sur San Cristobal de Las Casas, Chiapas, Mexico Tel. 967 1883 ext 1310 Celular 044 9671041021 [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] plotting Principal components vs individual variables.
BillV == [EMAIL PROTECTED] on Mon, 11 Apr 2005 14:15:08 +1000 writes: BillV At the cost of breaking the thread I'm going to BillV change your subject and replace 'Principle' by BillV 'Principal'. I just can't stand it any longer... I understand - having had similar feelings. I'm starting to contemplate adding a filter to the mailing list software to do this automatically at least if this appears in a subject line... Martin __ 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] glm family=binomial logistic sigmoid curve problem
Couple of points: * If you provide relative frequencies for the binomial response, you need also to give weights so that the actual counts can be reconstructed. This is what the warning message is telling you: if you reconstruct the counts using the default (unity) weights, the counts are not integers... In this case the simplest work-around is to use a quasibinomial family, which at least shuts up the warning message. * predict with glm objects, by default, predicts *linear predictors*. You need to predict responses. Here's how I would (minimally) correct your script: year - c(2003+(6/12), 2004+(2/12), 2004+(10/12), 2005+(4/12)) percent - c(0.31, 0.43, 0.47, 0.50) plot(year, percent, xlim = c(2003, 2007), ylim = c(0, 1)) Lm - lm(percent ~ year) abline(Lm) bm - glm(percent ~ year, family = quasibinomial) points(year, fitted(bm), pch = 3) curve(predict(bm, data.frame(year = x), type = resp), add = TRUE) Supplementary points: * It is a good idea to work with data frames, despite the fact that you need not. * Using lm as the name for a fitted linear model object can cause problems, not to say confusion. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of James Salsman Sent: Monday, 11 April 2005 4:51 PM To: r-help@stat.math.ethz.ch Subject: [R] glm family=binomial logistic sigmoid curve problem I'm trying to plot an extrapolated logistic sigmoid curve using glm(..., family=binomial) as follows, but neither the fitted() points or the predict()ed curve are plotting correctly: year - c(2003+(6/12), 2004+(2/12), 2004+(10/12), 2005+(4/12)) percent - c(0.31, 0.43, 0.47, 0.50) plot(year, percent, xlim=c(2003, 2007), ylim=c(0, 1)) lm - lm(percent ~ year) abline(lm) bm - glm(percent ~ year, family=binomial) Warning message: non-integer #successes in a binomial glm! in: eval(expr, envir, enclos) points(year, fitted(bm), pch=+) NULL curve(predict(bm, data.frame(year=x)), add=TRUE) All four of the binomial-fitted points fall exactly on the simple linear regression line, and the predict() curve is nowhere near any of the data points. What am I doing wrong? What does the warning mean? Do I need more points? I am using R on Windows, Version 2.0.1 (2004-11-15) Thank you for your kind help. Sincerely, James Salsman __ 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] R_LIBS difficulty ?
François Pinard [EMAIL PROTECTED] writes: Hi, R people. I'm shy reporting this, as a bug in this area sounds very unlikely. Did I make my tests wrongly? I'm still flaky at all this. Let me dare nevertheless, who knows, just in case... Please don't kill me! :-) Not so long ago, I wrote to this list: (For now, [the library code] works only for me when I do _not_ use `-l MY/OWN/LIBDIR' at `R CMD INSTALL' time, I surely made a simple blunder somewhere. Hopefully, I'll figure it out.) Now using this line within `~/.Renviron': R_LIBS=/home/pinard/etc/R my tiny package is correctly found by R. However, R does not seem to see any library within that directory if I rather use either of: R_LIBS=$HOME/etc/R R_LIBS=$HOME/etc/R The last writing (I mean, something similar) is suggested somewhere in the R manuals (but I do not have the manual with me right now to give the exact reference, I'm in another town). ?Startup gets you there soon enough (and help.search(Renviron) points you at Startup): Lines in a site or user environment file should be either comment lines starting with '#', or lines of the form 'name=value'. The latter sets the environmental variable 'name' to 'value', overriding an existing value. If 'value' is of the form '${foo-bar}', the value is that of the environmental variable 'foo' if that exists and is set to a non-empty value, otherwise 'bar'. This construction can be nested, so 'bar' can be of the same form (as in '${foo-${bar-blah}}'). so R_LIBS=${HOME}/etc/R is what should work. Notice that this is processed by R internally, not by the shell, so syntax may differ from the command-line equivalent. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ 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] writing to an Excel file
On Mon, 11 Apr 2005, Petr Pikal wrote: Hi Laura Pretty common question. You could find an answer going through archives. To copy to Excel through clipboard: write.excel-function(tab, ...) write.table( tab, clipboard, sep=\t, row.names=F) write.excel(your.data.frame) open Excel and press ctrl-C Well, that is essentially `writing to a regular data file and importing into Excel', it just stores the data file on the clipboard. Another way is to use RDCOM and Rexcel and drive this from Excel. But that needs additional software installed. Cheers Petr On 10 Apr 2005 at 19:56, Laura Holt wrote: Hi R! Is there a special function that writes data to an Excel file, please? I found read.spss and so on in the foreign library, but nothing to write. Of course, writing to a regular data file and importing into Excel works fine, but I thought that there might be another way. Thanks in advance. Sincerely, Laura Holt mailto: [EMAIL PROTECTED] R Version 2.0.1 Windows __ 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 Petr Pikal [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 -- 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] extracting correlations from nlme
Simon Blomberg [EMAIL PROTECTED] writes: I would like to know how (if) I can extract some of the information from the summary of my nlme. This is R. There is no if. Only how. I think Simon Yoda Blomberg just entered the fortune package -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ 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] Building R packages under Windows.
I presume you got this error message: Error: environment variable Tmpdir not set (or set to unusable value) and not default available. at ...\perl/R/Utils.pm line 67 The simplest thing to do is to create a folder named Temp in your C drive. I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Duncan Golicher [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Monday, April 11, 2005 8:58 AM Subject: [R] Building R packages under Windows. Hello, My question is the following. Has anyone put together an idiots checklist of the steps needed to build a (small personal) package under Windows, or documented their own experiences of building packages under Windows? I ask this as last week there were some very interesting comments regarding the advantages of putting personally written functions together as a package rather than sourcing them in at the start of a session using .Rprofile. They inspired me to try to build my own package for a few functions I use in teaching on my laptop running Windows XP . I read and reread Writing R extensions I installed Pearl and tried build on a modified package.skeleton. I fairly quickly worked out I needed to do things like setting Tmpdir as an environment variable, but then I got stuck and frustrated and gave up. I'm sure that with more time I would get things working, but I don't have more time. Could the process be made smoother through better documentation? This may sound like laziness, but I do guess that there are others are in the same position who find that the initiial hassles of building a package (under Windows) leads to a negative cost benefit balance over less elegant solutions. Thanks, Duncan Golicher -- Dr Duncan Golicher Ecologia y Sistematica Terrestre Conservación de la Biodiversidad El Colegio de la Frontera Sur San Cristobal de Las Casas, Chiapas, Mexico Tel. 967 1883 ext 1310 Celular 044 9671041021 [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
[R] gcmrec -- new package for recurrent events
Dear R-Users, We would like to announce a new package called gcmrec. This package fits the parameters for the general semiparametric model for recurrent events proposed by Peña and Hollander (2004). This class of models incorporates an effective age function which encodes the changes that occur after each event occurrence such as the impact of an intervention, it allows for the modeling of the impact of accumulating event occurrences on the unit, it admits a link function in which the effect of possibly time-dependent covariates are incorporated, and it allows the incorporation of unobservable frailty components which induce dependencies among the inter-event times for each unit. Future versions will include functions for estimating this model using Penalized approach. Regards, Juan R Gonzalez Cancer Prevention and Control Unit Catalan Institute of Oncology, Barcelona (Spain) [[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] R_LIBS difficulty ?
On Sun, 10 Apr 2005, François Pinard wrote: Hi, R people. I'm shy reporting this, as a bug in this area sounds very unlikely. Did I make my tests wrongly? I'm still flaky at all this. Let me dare nevertheless, who knows, just in case... Please don't kill me! :-) Not so long ago, I wrote to this list: (For now, [the library code] works only for me when I do _not_ use `-l MY/OWN/LIBDIR' at `R CMD INSTALL' time, I surely made a simple blunder somewhere. Hopefully, I'll figure it out.) Now using this line within `~/.Renviron': R_LIBS=/home/pinard/etc/R my tiny package is correctly found by R. However, R does not seem to see any library within that directory if I rather use either of: R_LIBS=$HOME/etc/R R_LIBS=$HOME/etc/R Correct, and as documented. See the description in ?Startup, which says things like ${foo-bar} are allowed but not $HOME, and not ${HOME}/bah or even ${HOME}. But R_LIBS=~/etc/R will work in .Renviron since ~ is intepreted by R in paths. The last writing (I mean, something similar) is suggested somewhere in the R manuals (but I do not have the manual with me right now to give the exact reference, I'm in another town). It is not mentioned in an R manual, but it is mentioned in the FAQ. R_LIBS=$HOME/etc/R will work in a shell (and R_LIBS=~/etc/R may not). Another hint that it could be expected to work is that the same `~/.Renviron' once contained the line: R_BROWSER=$HOME/bin/links which apparently worked as expected. (This `links' script launches the real program with `-g' appended whenever `DISPLAY' is defined.) Yes, but that was not interpreted by R, rather a shell script called by R. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595__ 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] multi-class modeling
All of this is addressed in the reference for multinom(): it is support software for a book. (You are likely to get a more sympathetic response if you use a real name and a signature giving your true affiliation.) On Sun, 10 Apr 2005, 'array chip' wrote: Just wonder if someone could comment on using linear discriminant analysis (LDA) vs. multinomial logistic regression in multi-class classification/prediction (nomial dependent variable, not ordinal)? What kind of difference in results can I expect from the 2 methods, which is better or more appropriate, or under what condiditon should I used one instead of the other? And is there other methods I can try? On another note, if I want to use logistic regression using multinom() in package nnet, how can I address the problem that each class of the dependent variable has an unequal prevalence? In lda(), I can do this by using prior argument, but there is no similar argument in multinom(). Depends what you think the `problem' is. In lda(), you usually do not adjust by the 'prior' argument. Is the problem that your training set is a biased sample? If so, see my PRNN book. -- 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] R_LIBS difficulty ?
Prof Brian Ripley [EMAIL PROTECTED] writes: See the description in ?Startup, which says things like ${foo-bar} are allowed but not $HOME, and not ${HOME}/bah or even ${HOME}. Argh, Brian is right (again!) and I was extrapolating beyond what actually works. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ 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] Building R packages under Windows.
Duncan Golicher wrote: Hello, My question is the following. Has anyone put together an idiots checklist of the steps needed to build a (small personal) package under Windows, or documented their own experiences of building packages under Windows? I ask this as last week there were some very interesting comments regarding the advantages of putting personally written functions together as a package rather than sourcing them in at the start of a session using .Rprofile. They inspired me to try to build my own package for a few functions I use in teaching on my laptop running Windows XP . I read and reread Writing R extensions I installed Pearl and tried build on a modified package.skeleton. I fairly quickly worked out I needed to do things like setting Tmpdir as an environment variable, but then I got stuck and frustrated and gave up. I'm sure that with more time I would get things working, but I don't have more time. Could the process be made smoother through better documentation? This may sound like laziness, but I do guess that there are others are in the same position who find that the initiial hassles of building a package (under Windows) leads to a negative cost benefit balance over less elegant solutions. The docs are already very condensed for this topic and you need to read each line (sometimes each word!). Do you want more text to read through that contains the same information? Telling us what your problem is would be much better. I do not know what is missing in the docs - it's just working for me. Uwe Ligges Thanks, Duncan Golicher __ 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] Building R packages under Windows.
Duncan Golicher wrote: Hello, My question is the following. Has anyone put together an idiots checklist of the steps needed to build a (small personal) package under Windows, or documented their own experiences of building packages under Windows? I ask this as last week there were some very interesting comments regarding the advantages of putting personally written functions together as a package rather than sourcing them in at the start of a session using .Rprofile. They inspired me to try to build my own package for a few functions I use in teaching on my laptop running Windows XP . I read and reread Writing R extensions I installed Pearl and tried build on a modified package.skeleton. I fairly quickly worked out I needed to do things like setting Tmpdir as an environment variable, but then I got stuck and frustrated and gave up. I'm sure that with more time I would get things working, but I don't have more time. Could the process be made smoother through better documentation? This may sound like laziness, but I do guess that there are others are in the same position who find that the initiial hassles of building a package (under Windows) leads to a negative cost benefit balance over less elegant solutions. In versions up to 2.0.1, the description is a little spread out, but the main file you want to look at is readme.packages. I have tried to collect all the information into one place in the 2.1.0 release (and put it in the R Admin manual). As far as I recall there are no important differences between the instructions, so if you download the beta version of that manual and try those instructions, I would be very happy to hear from you about anything that is unclear or incorrect. You can get the Windows beta build from http://cran.r-project.org/bin/windows/base/rdevel.html. I do not think the beta manuals are online anywhere separate from the full release. 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] Building R packages under Windows.
Duncan Murdoch wrote: Duncan Golicher wrote: Hello, My question is the following. Has anyone put together an idiots checklist of the steps needed to build a (small personal) package under Windows, or documented their own experiences of building packages under Windows? I ask this as last week there were some very interesting comments regarding the advantages of putting personally written functions together as a package rather than sourcing them in at the start of a session using .Rprofile. They inspired me to try to build my own package for a few functions I use in teaching on my laptop running Windows XP . I read and reread Writing R extensions I installed Pearl and tried build on a modified package.skeleton. I fairly quickly worked out I needed to do things like setting Tmpdir as an environment variable, but then I got stuck and frustrated and gave up. I'm sure that with more time I would get things working, but I don't have more time. Could the process be made smoother through better documentation? This may sound like laziness, but I do guess that there are others are in the same position who find that the initiial hassles of building a package (under Windows) leads to a negative cost benefit balance over less elegant solutions. In versions up to 2.0.1, the description is a little spread out, but the main file you want to look at is readme.packages. I have tried to collect all the information into one place in the 2.1.0 release (and put it in the R Admin manual). As far as I recall there are no important differences between the instructions, so if you download the beta version of that manual and try those instructions, I would be very happy to hear from you about anything that is unclear or incorrect. You can get the Windows beta build from http://cran.r-project.org/bin/windows/base/rdevel.html. I do not think the beta manuals are online anywhere separate from the full release. They are available from http://stat.ethz.ch/R-manual/R-devel/doc/manual/R-admin.html Uwe 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 __ 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] How to search an element in matrix ?
Actually, you will need to use arr.ind=TRUE which is not the default option. You will get the results in form [i, j] indicating the i^{th} row and j^{th} column of the element that passes the criteria. m - matrix( rnorm(6), nc=3 ) m [,1] [,2] [,3] [1,] 0.5066194 0.786876 -1.2848658 [2,] -0.2018563 2.007892 0.4581891 which( m 0.5, arr.ind=T ) row col [1,] 1 1 [2,] 1 2 [3,] 2 2 Regards, Adai On Sun, 2005-04-10 at 21:51 -0700, Vadim Ogranovich wrote: A matrix is a vector as well (it is stored by columns), so it has two ways of indexing [i,j] and [i]. It may be easier for you to use the latter, thus which(x == 1) returns all indexes where the matrix x is equal to 1. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of tong wang Sent: Sunday, April 10, 2005 9:37 PM To: r-help@stat.math.ethz.ch Subject: [R] How to search an element in matrix ? Hi you guys, I know this might be too simple a question to post, but i searched a lot still couldn't find it. Just want to find an element in matrix and return its index , i think there should be some matrix version of match which only works for vector to me. thanks in advance for your help. best, tong __ 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] Princomp$Scores
The scores can be manually computed as center(your.matrix,scale=F) %*% eigen(cov(your.matrix))$vector # or cor() i.e. a linear combination of your mean-corrected data. negative coefficients does not imply anything, because computation of the signs of eigenvectors is arbitrary. Absolute value of princomp(your.matrix)$load indicates which variable influences a principal component most (this is closer to the correlate thing you are thinking of, I guess). On Apr 9, 2005 1:09 AM, Ken Termiso [EMAIL PROTECTED] wrote: Hi all, I was hoping that someone could verify this for me- when I run princomp() on a matrix, it is my understanding that the scores slot of the output is a measure of how well each row correlates (for lack of a better word) with each principal component. i.e. say I have a 300x6 log2 scaled matrix, and I run princomp(). I would get back a $scores slot that is also 300x6, where each value can be negative or positive. I'd assume that the negative values correspond to rows that are negatively correlated with that particular PC, and vice-versa for positives. Thanks in advance for the help, Ken __ 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] How to change letters after space into capital letters
What is the easiest way to change within vector of strings each letter after a space into a capital letter? E.g.: c( this is an element of the vector of strings, second element ) becomes: c( This Is An Element Of The Vector Of Strings, Second Element ) My reason to try to do this is to get more readable abbreviations. (A suggestion would be to add an option to abbreviate() which changes letters after space to uppercase letters before executing the abbreviation algorithm.) Thanks - Wolfram __ 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] dealing with multicollinearity
I have a linear model y~x1+x2 of some data where the coefficient for x1 is higher than I would have expected from theory (0.7 vs 0.88) I wondered whether this would be an artifact due to x1 and x2 being correlated despite that the variance inflation factor is not too high (1.065): I used perturbation analysis to evaluate collinearity library(perturb) P-perturb(A,pvars=c(x1,x2),prange=c(1,1)) summary(P) Perturb variables: x1 normal(0,1) x2 normal(0,1) Impact of perturbations on coefficients: mean s.d. min max (Intercept) -26.0670.270 -27.235 -25.481 x1 0.7260.0250.6720.882 x2 0.0600.0110.0370.082 I get a mean for x1 of 0.726 which is closer to what is expected. I am not an statistical expert so I'd like to know if my evaluation of the effects of collinearity is correct and in that case any solutions to obtain a reliable linear model. Thanks, Manuel Some more detailed information: A-lm(y~x1+x2) summary(A) Call: lm(formula = y ~ x1 + x2) Residuals: Min1QMedian3Q Max -4.221946 -0.484055 -0.004762 0.397508 2.542769 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) -27.234720.27996 -97.282 2e-16 *** x10.882020.02475 35.639 2e-16 *** x20.081800.01239 6.604 2.53e-10 *** --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Residual standard error: 0.823 on 241 degrees of freedom Multiple R-Squared: 0.8411, Adjusted R-squared: 0.8398 F-statistic: 637.8 on 2 and 241 DF, p-value: 2.2e-16 cor.test(x1,x2) Pearson's product-moment correlation data: x1 and x2 t = -3.9924, df = 242, p-value = 8.678e-05 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: -0.3628424 -0.1269618 sample estimates: cor -0.248584 __ 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] About importing CSV file
I have a problem for reading a data from excel (.csv) to R, because the numeric variables ( float) are separeted by comma (,) and not by point (.). And all the variables are separated by comma (,). The string variables are between (). So importing to R the numeric variable (float) are reading as integer, and not with decimal part. Is there a way to solve this problem? The data set is like this: CODE,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,NOTE1,A13,A14,A15,NOTE2,A16,A17,A18,A19,A20,A21,NOTE3,A22,A23,A24,A25,A26,A27,A28,NOTE4,CONCLUSION 991,1,14,17,TM LUNG,19,CARCINOMA,17,,,14,14,14,15,57,2,17,17,17,3,8,14,14,14,17,13,4,4,14,17,14,14,14,17,15,15,24 992,1,17,17,BPCO,17,TM LUNG,17,,,17,17,17,17,2,17,17,17,3,17,17,17,17,17,17,4,17,17,17,14,17,17,16,5,16,88 993,1,17,17,TM LUNG,17,BPCO,17,,,17,17,17,17,2,17,17,17,3,14,17,17,17,17,16,4,4,17,17,17,17,14,17,16,5,16,73 994,1,14,14,NN,17,NN,17,NN,17,14,17,17,15,88,2,14,14,14,3,14,17,14,17,14,15,2,4,14,8,17,14,14,14,13,5,14,64 I use this command in R: read.csv(file=prova.csv , header=TRUE , sep=, , dec=, , fill=TRUE). But for example in the first record with code 991: the last part is recorded in three integer variable 15 - 15 - 24 and not in two float variable as 15 - 15.24 In the second record with code 992: the last part is recorded in four integer variable 16 - 5 - 16 - 88 and not in two float variable as 16.5 - 16.88 In the third record with code 993: the middle part is recorded in two integer variable 16 - 4 and not in one float variable as 16.4. And the last part is recorded in four integer variable 16 - 5 - 16 - 73 and not in two float variable as 16.5 - 16.73 And so on. I there a solution? Thanks. Silvia __ 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] R: function code
HI sorry to be a nuisance to all!!! how can i see the code of a particular function? e.g. nnet just as an example__ 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] About importing CSV file
So you expect R to do the following : convert 15,15,24to 15.00, 15.24 AND convert 16,5,16,88 to 16.50, 16.88 The second conversion should be fairly easy BUT how do you expect R to know that the first conversion should produce 15.00, 15.24 and not 15.15, 24.00 ? Without knowing which is which, it would be dangerous and hard to write any sort of automated script for this. The best thing would be for you to go back and change your inputs manually. You can either use 15,,15,24 for consistency or better yet simply use 15.0, 15.24. Regards, Adai On Mon, 2005-04-11 at 12:23 +0200, Silvia Bachetti wrote: I have a problem for reading a data from excel (.csv) to R, because the numeric variables ( float) are separeted by comma (,) and not by point (.). And all the variables are separated by comma (,). The string variables are between (). So importing to R the numeric variable (float) are reading as integer, and not with decimal part. Is there a way to solve this problem? The data set is like this: CODE,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,NOTE1,A13,A14,A15,NOTE2,A16,A17,A18,A19,A20,A21,NOTE3,A22,A23,A24,A25,A26,A27,A28,NOTE4,CONCLUSION 991,1,14,17,TM LUNG,19,CARCINOMA,17,,,14,14,14,15,57,2,17,17,17,3,8,14,14,14,17,13,4,4,14,17,14,14,14,17,15,15,24 992,1,17,17,BPCO,17,TM LUNG,17,,,17,17,17,17,2,17,17,17,3,17,17,17,17,17,17,4,17,17,17,14,17,17,16,5,16,88 993,1,17,17,TM LUNG,17,BPCO,17,,,17,17,17,17,2,17,17,17,3,14,17,17,17,17,16,4,4,17,17,17,17,14,17,16,5,16,73 994,1,14,14,NN,17,NN,17,NN,17,14,17,17,15,88,2,14,14,14,3,14,17,14,17,14,15,2,4,14,8,17,14,14,14,13,5,14,64 I use this command in R: read.csv(file=prova.csv , header=TRUE , sep=, , dec=, , fill=TRUE). But for example in the first record with code 991: the last part is recorded in three integer variable 15 - 15 - 24 and not in two float variable as 15 - 15.24 In the second record with code 992: the last part is recorded in four integer variable 16 - 5 - 16 - 88 and not in two float variable as 16.5 - 16.88 In the third record with code 993: the middle part is recorded in two integer variable 16 - 4 and not in one float variable as 16.4. And the last part is recorded in four integer variable 16 - 5 - 16 - 73 and not in two float variable as 16.5 - 16.73 And so on. I there a solution? Thanks. Silvia __ 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] DSE package: estVARXls Method
I am trying to use the estVARXls in the DSE1 Package method to run a VAR. However i keep on receiving the following message Error in periodsOutput(data) : no applicable method for periodsOutput . Can anyone help with me this? I am sorry if this question sounds really stupid but i havent got a lot of experience with R. Thank you very much Thomas The information contained herein is confidential and is inte...{{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] R: function code
Clark Allan wrote: HI sorry to be a nuisance to all!!! how can i see the code of a particular function? e.g. nnet just as an example Most easily by downloading the package sources and looking in the R directory. Or in the console: library(nnet) nnet methods(nnet) nnet.formula nnet.default nnet:::predict.nnet and so on ... Uwe Ligges __ 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] R: function code
# In your specific case : library(nnet) methods(nnet) [1] nnet.default nnet.formula nnet.default function (x, y, weights, size, Wts, mask = rep(TRUE, length(wts)), linout = FALSE, entropy = FALSE, softmax = FALSE, censored = FALSE, skip = FALSE, rang = 0.7, decay = 0, maxit = 100, Hess = FALSE, trace = TRUE, MaxNWts = 1000, abstol = 1e-04, reltol = 1e-08, ...) { SNIP # More generally 1) Download http://www.cran.r-project.org/src/contrib/VR_7.2-12.tar.gz (nnet is part of VR bundle) 2) Uncompress it 3) All the R codes should be VR/nnet/R directory and C codes in VR/nnet/src directory Regards, Adai On Mon, 2005-04-11 at 12:52 +0200, Clark Allan wrote: HI sorry to be a nuisance to all!!! how can i see the code of a particular function? e.g. nnet just as an example __ 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] R: function code
On Mon, 2005-04-11 at 12:52 +0200, Clark Allan wrote: HI sorry to be a nuisance to all!!! how can i see the code of a particular function? e.g. nnet just as an example for some function just type the function name and you get the code: ls function (name, pos = -1, envir = as.environment(pos), all.names = FALSE, pattern) { if (!missing(name)) { nameValue - try(name) if (identical(class(nameValue), try-error)) { name - substitute(name) if (!is.character(name)) name - deparse(name) pos - name } else pos - nameValue } all.names - .Internal(ls(envir, all.names)) if (!missing(pattern)) { if ((ll - length(grep([, pattern, fixed = TRUE))) 0 ll != length(grep(], pattern, fixed = TRUE))) { if (pattern == [) { pattern - \\[ warning(paste(replaced regular expression pattern, sQuote([), by, sQuote([))) } else if (length(grep([^]\\[-, pattern) 0)) { pattern - sub(\\[-, \\[-, pattern) warning(paste(replaced, sQuote([-), by, sQuote([-), in regular expression pattern)) } } grep(pattern, all.names, value = TRUE) } else all.names } environment: namespace:base or check out the source code itself. HTH F -- Federico C. F. Calboli Department of Epidemiology and Public Health Imperial College, St Mary's Campus Norfolk Place, London W2 1PG Tel +44 (0)20 7594 1602 Fax (+44) 020 7594 3193 f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com __ 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] How to change letters after space into capital letters
Wolfram Fischer a écrit : What is the easiest way to change within vector of strings each letter after a space into a capital letter? E.g.: c( this is an element of the vector of strings, second element ) becomes: c( This Is An Element Of The Vector Of Strings, Second Element ) My reason to try to do this is to get more readable abbreviations. (A suggestion would be to add an option to abbreviate() which changes letters after space to uppercase letters before executing the abbreviation algorithm.) Thanks - Wolfram __ 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 cap.leading - function (string) { fn - function(x) { v - unlist(strsplit(x, split = )) u - sapply(v, function(x) { x - tolower(x) substring(x, 1, 1) - toupper(substring(x, 1, 1)) x }) paste(u, collapse = ) } unname(sapply(string, fn)) } cap.leading(c( this is an element of the vector of strings, second element )) [1] This Is An Element Of The Vector Of Strings Second Element Best, Renaud -- Dr Renaud Lancelot, vétérinaire C/0 Ambassade de France - SCAC BP 834 Antananarivo 101 - Madagascar e-mail: [EMAIL PROTECTED] tel.: +261 32 40 165 53 (cell) +261 20 22 665 36 ext. 225 (work) +261 20 22 494 37 (home) __ 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] R: function code
check these: library(nnet) methods(nnet) nnet.default nnet.formula print.nnet nnet:::print.nnet I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Clark Allan [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Monday, April 11, 2005 12:52 PM Subject: [R] R: function code HI sorry to be a nuisance to all!!! how can i see the code of a particular function? e.g. nnet just as an example __ 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] How to change letters after space into capital letters
Wolfram Fischer wrote: What is the easiest way to change within vector of strings each letter after a space into a capital letter? This perl code seems to work: #!/usr/bin/perl $s1=this is a lower-cased string; $s1=~s/ ([a-z])/ \u\1/g; print $s1.\n; producing: this Is A Lower-cased String but sticking it in a gsub in R doesn't work, even with perl=TRUE: s1 [1] this is a lowercased string gsub( ([a-z]), \\u\\1,s1,perl=TRUE) [1] this uis ua ulowercased ustrin But ?gsub does warn you that perl REs may vary depending on the phase of the moon and the PCRE lib on your system. I've just noticed the missing 'g' on the end. Anyone know where that went? Its looking like a bug in the regex processing: gsub( ([a-z]), \\1,s1,perl=TRUE) [1] this is a lowercased strin gsub( ([a-z]), \\1,s1,perl=TRUE) [1] this is a lowercased st Anyway, back on topic: My reason to try to do this is to get more readable abbreviations. (A suggestion would be to add an option to abbreviate() which changes letters after space to uppercase letters before executing the abbreviation algorithm.) I think this is what's known as 'Camel Case', because the pattern of upper and lower case looks like humps: http://en.wikipedia.org/wiki/Camel_case Baz __ 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] Sweave and abbreviating output from R
Dear List, I'm using Sweave to produce a series of class handouts for a course I am running. The students in previous years have commented about wanting output within the handouts so they can see what to expect the output to look like. So Sweave is a godsend for producing this type of handout - with one exception: Is there a way to suppress some rows of printed output so as to save space in the printed documentation? E.g rnorm(100) produces about 20 lines of output (depending on options(width)). I'd prefer something like: rnorm(100) [1] 0.527739021 0.185551107 -1.239195562 0.020991608 -1.225632520 [6] -1.000243373 -0.020180393 2.552180776 -1.719061533 -0.195024625 ... [96] -0.744916379 0.863733400 -0.186667848 1.378236663 -0.499201046 The actual application would be printing of output from summary() methods. Ideally it would be nice to ask for line 1-10, 30-40, 100-102, for example, so you could print the first few lines of several sections of output. I'd like to automate this so I don't need to keep copying and pasting into the final tex source or forget to do it if I alter some previous part of the Sweave source. Has anyone tried to do this? Does anyone know of an automatic way of achieving the simple abbreviation or the more complicated version I described? Any thoughts on this? Thanks in advance, Gav -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [T] +44 (0)20 7679 5522 ENSIS Research Fellow [F] +44 (0)20 7679 7565 ENSIS Ltd. ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/ 26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/ London. WC1H 0AP. %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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] How to change letters after space into capital letters
On Apr 11, 2005 6:22 AM, Wolfram Fischer [EMAIL PROTECTED] wrote: What is the easiest way to change within vector of strings each letter after a space into a capital letter? E.g.: c( this is an element of the vector of strings, second element ) becomes: c( This Is An Element Of The Vector Of Strings, Second Element ) My reason to try to do this is to get more readable abbreviations. (A suggestion would be to add an option to abbreviate() which changes letters after space to uppercase letters before executing the abbreviation algorithm.) Look for the thread titled String manipulation---mixed case in the r-help archives. __ 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] Sweave and abbreviating output from R
On Apr 11, 2005 7:22 AM, Gavin Simpson [EMAIL PROTECTED] wrote: Dear List, I'm using Sweave to produce a series of class handouts for a course I am running. The students in previous years have commented about wanting output within the handouts so they can see what to expect the output to look like. So Sweave is a godsend for producing this type of handout - with one exception: Is there a way to suppress some rows of printed output so as to save space in the printed documentation? E.g rnorm(100) produces about 20 lines of output (depending on options(width)). I'd prefer something like: rnorm(100) [1] 0.527739021 0.185551107 -1.239195562 0.020991608 -1.225632520 [6] -1.000243373 -0.020180393 2.552180776 -1.719061533 -0.195024625 ... [96] -0.744916379 0.863733400 -0.186667848 1.378236663 -0.499201046 The actual application would be printing of output from summary() methods. Ideally it would be nice to ask for line 1-10, 30-40, 100-102, for example, so you could print the first few lines of several sections of output. I'd like to automate this so I don't need to keep copying and pasting into the final tex source or forget to do it if I alter some previous part of the Sweave source. Has anyone tried to do this? Does anyone know of an automatic way of achieving the simple abbreviation or the more complicated version I described? Any thoughts on this? Maybe you could use head(rnorm(100)) instead. Check ?head for other arguments. __ 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] ??
R people, I'd like to know how can I make inequations with are, specially work with lineal programming. Thanks for your unvaluable help Adrián __ 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] Sweave and abbreviating output from R
On Mon, 11 Apr 2005, Gavin Simpson wrote: Dear List, I'm using Sweave to produce a series of class handouts for a course I am running. The students in previous years have commented about wanting output within the handouts so they can see what to expect the output to look like. So Sweave is a godsend for producing this type of handout - with one exception: Is there a way to suppress some rows of printed output so as to save space in the printed documentation? E.g rnorm(100) produces about 20 lines of output (depending on options(width)). I'd prefer something like: rnorm(100) [1] 0.527739021 0.185551107 -1.239195562 0.020991608 -1.225632520 [6] -1.000243373 -0.020180393 2.552180776 -1.719061533 -0.195024625 ... [96] -0.744916379 0.863733400 -0.186667848 1.378236663 -0.499201046 The actual application would be printing of output from summary() methods. Ideally it would be nice to ask for line 1-10, 30-40, 100-102, for example, so you could print the first few lines of several sections of output. I'd like to automate this so I don't need to keep copying and pasting into the final tex source or forget to do it if I alter some previous part of the Sweave source. Has anyone tried to do this? Does anyone know of an automatic way of achieving the simple abbreviation or the more complicated version I described? Semi-automatic is: res - capture.output(rnorm(100)) cat(res[1:2], ..., res[length(res)], sep=\n) but I've found that 1) it needs masking from the users, and 2) it is difficult to automate when the numbers of output lines generated by print methods vary with input data (like in print.htest()). But capture.output is very useful. Roger Any thoughts on this? Thanks in advance, Gav -- 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] About importing CSV file
Adaikalavan Ramasamy [EMAIL PROTECTED] writes: So you expect R to do the following : convert 15,15,24to 15.00, 15.24 AND convert 16,5,16,88 to 16.50, 16.88 The second conversion should be fairly easy BUT how do you expect R to know that the first conversion should produce 15.00, 15.24 and not 15.15, 24.00 ? Without knowing which is which, it would be dangerous and hard to write any sort of automated script for this. The best thing would be for you to go back and change your inputs manually. You can either use 15,,15,24 for consistency or better yet simply use 15.0, 15.24. Regards, Adai Also, if Excel is really generating this format, something is seriously wrong with Excel or your locale settings. Normally, locales with comma as decimal point also use semicolon as the field separator in CSV files, which is the format that read.csv2() handles. Or, just export as text (TAB delimited) and use read.delim2(). On Mon, 2005-04-11 at 12:23 +0200, Silvia Bachetti wrote: I have a problem for reading a data from excel (.csv) to R, because the numeric variables ( float) are separeted by comma (,) and not by point (.). And all the variables are separated by comma (,). The string variables are between (). So importing to R the numeric variable (float) are reading as integer, and not with decimal part. Is there a way to solve this problem? The data set is like this: CODE,A1,A2,A3,A4,A5,A6,A7,A8,A9,A10,A11,A12,NOTE1,A13,A14,A15,NOTE2,A16,A17,A18,A19,A20,A21,NOTE3,A22,A23,A24,A25,A26,A27,A28,NOTE4,CONCLUSION 991,1,14,17,TM LUNG,19,CARCINOMA,17,,,14,14,14,15,57,2,17,17,17,3,8,14,14,14,17,13,4,4,14,17,14,14,14,17,15,15,24 992,1,17,17,BPCO,17,TM LUNG,17,,,17,17,17,17,2,17,17,17,3,17,17,17,17,17,17,4,17,17,17,14,17,17,16,5,16,88 993,1,17,17,TM LUNG,17,BPCO,17,,,17,17,17,17,2,17,17,17,3,14,17,17,17,17,16,4,4,17,17,17,17,14,17,16,5,16,73 994,1,14,14,NN,17,NN,17,NN,17,14,17,17,15,88,2,14,14,14,3,14,17,14,17,14,15,2,4,14,8,17,14,14,14,13,5,14,64 I use this command in R: read.csv(file=prova.csv , header=TRUE , sep=, , dec=, , fill=TRUE). But for example in the first record with code 991: the last part is recorded in three integer variable 15 - 15 - 24 and not in two float variable as 15 - 15.24 In the second record with code 992: the last part is recorded in four integer variable 16 - 5 - 16 - 88 and not in two float variable as 16.5 - 16.88 In the third record with code 993: the middle part is recorded in two integer variable 16 - 4 and not in one float variable as 16.4. And the last part is recorded in four integer variable 16 - 5 - 16 - 73 and not in two float variable as 16.5 - 16.73 And so on. I there a solution? Thanks. Silvia __ 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 -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ 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] Sweave and abbreviating output from R
Gabor Grothendieck wrote: On Apr 11, 2005 7:22 AM, Gavin Simpson [EMAIL PROTECTED] wrote: Dear List, I'm using Sweave to produce a series of class handouts for a course I am running. The students in previous years have commented about wanting output within the handouts so they can see what to expect the output to look like. So Sweave is a godsend for producing this type of handout - with one exception: Is there a way to suppress some rows of printed output so as to save space in the printed documentation? E.g snip Any thoughts on this? Maybe you could use head(rnorm(100)) instead. Check ?head for other arguments. Thanks for this Gabor. Head/tail works just fine for my rnorm example, but for printed output from summary methods for example it doesn't quite work as I would like. But that got me thinking a bit more and I remembered capture.output() and I saw that noquote() is used in head.function(). So, I can now get this far: noquote(capture.output(summary(pondsca)))[1:10] [1] [2] Call: [3] [4] Partitioning of mean squared contingency coefficient: [5] [6] Total 4.996 [7] Unconstrained 4.996 [8] [9] Eigenvalues, and their contribution to the mean squared contingency coefficient [10] Now all I need is to find out how to print without the indices [1],[2]...[n] being printed? Also, I noticed that with some objects, more than one line of output is printed per line - just like a vector would. In the example below we see 3 lines of output printed per row. x - rnorm(100) y - rnorm(100) noquote(capture.output(summary(lm(x ~ y[1:5] [1] Call: lm(formula = x ~ y) [4] Residuals: Is there a way to print only a single element of a vector per line? Thanks in advance. Gav -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [T] +44 (0)20 7679 5522 ENSIS Research Fellow [F] +44 (0)20 7679 7565 ENSIS Ltd. ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/ 26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/ London. WC1H 0AP. %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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] ??
Hello Adrián, Look e.g. at http://tolstoy.newcastle.edu.au/R/help/04/06/0869.html and use e.g. http://finzi.psych.upenn.edu/search.html for searching help files, manuals and mailing list archives. Best, Matthias R people, I'd like to know how can I make inequations with are What is are? , specially work with lineal programming. Linear programming, not lineal. Thanks for your unvaluable help Adrián __ 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 suppress the printing of warnings (Windows)?
Dear all, I'm a newbie in R. I am running simulations using a fixed bandwidth in nonparametric regressions, sending all the output to a file myoutput.txt using sink(myoutput.txt), R is printing all warnings by the end of the simulation on the file. I know the source of the problem can take care of it. However, finding a 50 MB file (where all the output is printed, e.g. myoutput.txt) by the end of the simulation exercise is not quite pleasant. How could I turn them off completely?, so they are not printed in myoutput.txt file. Thanks in advanced for your help. David __ 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] Building R packages under Windows.
On Apr 11, 2005 2:58 AM, Duncan Golicher [EMAIL PROTECTED] wrote: Hello, My question is the following. Has anyone put together an idiots checklist of the steps needed to build a (small personal) package under Windows, or documented their own experiences of building packages under Windows? I ask this as last week there were some very interesting comments regarding the advantages of putting personally written functions together as a package rather than sourcing them in at the start of a session using .Rprofile. They inspired me to try to build my own package for a few functions I use in teaching on my laptop running Windows XP . I read and reread Writing R extensions I installed Pearl and tried build on a modified package.skeleton. I fairly quickly worked out I needed to do things like setting Tmpdir as an environment variable, but then I got stuck and frustrated and gave up. I'm sure that with more time I would get things working, but I don't have more time. Could the process be made smoother through better documentation? This may sound like laziness, but I do guess that there are others are in the same position who find that the initiial hassles of building a package (under Windows) leads to a negative cost benefit balance over less elegant solutions. Thanks, Other resources are: - http://www.murdoch-sutherland.com/Rtools/ - README.packages in \Program Files\R\rw2001 or whatever version of R - posts by me, John Fox, Andy Liao in r-help or r-devel I use Windows XP and it also took me quite a bit of time until I figured it out too. I was really wondering as I got frustrated how it was possible that 500+ packages got developed for R when it was so hard to figure out how to create a package, particularly if you want to put in a vignette. One of the problems is that its dependent on so many other pieces of software and also there can be path problems that you have to figure out. I suspect that the process is somewhat smoother under UNIX and maybe most people use that. Fortunately, it does all work once you get it figured out and its worth it if you are going to do a lot of development since it really helps organize you. If you are just going to use it briefly or casually its probably not worth the hassle. Once you do figure it out it does work although there are a few annoyances. R CMD CHECK is really great although I wish there were some way of telling it to ignore the files referenced in .Rbuildignore so one does not have to do a build first. Also the error messages from the process are often less than helpful but I suspect it would be difficult to improve since it can go wrong at a point which is different than the source of the problem. I think the fixable problems are: - a guide is needed, as you mention - the prerequisites need to be reduced: -- significant portions are written in perl which is probably a holdover from the days when R was less powerful and now could all be ported to R -- it would be nice it the tools were not needed either. -- reduced functionality with no Microsoft style help should be possible to optionally allow one to create packages without downloading the Microsoft help compiler - the TEXINPUTS problems with MiKTeX needs to be solved by MiKTeX (they know about it and intend to solve it but I am not sure how quickly that will happen. In the meantime there are workarounds at: http://www.murdoch-sutherland.com/Rtools/miktex.html The fourth alternative is the easiest. I think this only affects you if you are building vignettes.) __ 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] How to change letters after space into capital letters
On Mon, 11 Apr 2005, Barry Rowlingson wrote: Wolfram Fischer wrote: What is the easiest way to change within vector of strings each letter after a space into a capital letter? [Example omitted, that did somthing different! c( this is an element of the vector of strings, second element ) becomes: c( This Is An Element Of The Vector Of Strings, Second Element ) ] Similarly, Gabor G is referring to a thread which answers a _different_ question. This perl code seems to work: #!/usr/bin/perl $s1=this is a lower-cased string; $s1=~s/ ([a-z])/ \u\1/g; print $s1.\n; producing: this Is A Lower-cased String But that is not what his example does, which capitalized the first word too. I think he intended s/\b([a-z])/\u\1/g; gannet% echo this is a lower-cased string | perl -p -e 's/\b([a-z])/\u\1/g' This Is A Lower-Cased String but sticking it in a gsub in R doesn't work, even with perl=TRUE: s1 [1] this is a lowercased string gsub( ([a-z]), \\u\\1,s1,perl=TRUE) [1] this uis ua ulowercased ustrin But ?gsub does warn you that perl REs may vary depending on the phase of the moon and the PCRE lib on your system. This is not actually to do with REs, but substitutions. \u is not interpreted in substitutions (and only \1 to \9 are, as documented). I've just noticed the missing 'g' on the end. Anyone know where that went? Yes. Use R-2.1.0 beta which has many bugs in gsub fixed. -- 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] Sweave and abbreviating output from R
On Apr 11, 2005, at 8:12 AM, Gavin Simpson wrote: Gabor Grothendieck wrote: On Apr 11, 2005 7:22 AM, Gavin Simpson [EMAIL PROTECTED] wrote: Dear List, I'm using Sweave to produce a series of class handouts for a course I am running. The students in previous years have commented about wanting output within the handouts so they can see what to expect the output to look like. So Sweave is a godsend for producing this type of handout - with one exception: Is there a way to suppress some rows of printed output so as to save space in the printed documentation? E.g snip Any thoughts on this? Maybe you could use head(rnorm(100)) instead. Check ?head for other arguments. Any thought you would want to locally modify the print methods for object of interest? I haven't tried it, but it might allow you to treat large objects like matrices, long vectors, and data.frames differently than objects like model.fits, etc. Sean __ 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] How to suppress the printing of warnings (Windows)?
try, options(warn=-1) I hope it helps. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Jacho-Chavez,DT (pgr) [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Monday, April 11, 2005 2:14 PM Subject: [R] How to suppress the printing of warnings (Windows)? Dear all, I'm a newbie in R. I am running simulations using a fixed bandwidth in nonparametric regressions, sending all the output to a file myoutput.txt using sink(myoutput.txt), R is printing all warnings by the end of the simulation on the file. I know the source of the problem can take care of it. However, finding a 50 MB file (where all the output is printed, e.g. myoutput.txt) by the end of the simulation exercise is not quite pleasant. How could I turn them off completely?, so they are not printed in myoutput.txt file. Thanks in advanced for your help. David __ 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] Trying to undo an assignment
Hi, I defined corr to be a function, not realising that this was also the name for correlation in package=boot. How do I explicitly call the corr function within package boot (so, scope up over the current frame, I guess is another way of saying it) without removing my new corr function ? Thanks, Tolga Please follow the attached hyperlink to an important disclaimer http://www.csfb.com/legal_terms/disclaimer_europe.shtml == This message is for the sole use of the intended recipient. ...{{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] How to suppress the printing of warnings (Windows)?
I'm a newbie in R. I am running simulations using a fixed bandwidth in nonparametric regressions, sending all the output to a file myoutput.txt using sink(myoutput.txt), R is printing all warnings by the end of the simulation on the file. I know the source of the problem can take care of it. However, finding a 50 MB file (where all the output is printed, e.g. myoutput.txt) by the end of the simulation exercise is not quite pleasant. How could I turn them off completely?, so they are not printed in myoutput.txt file. Look at ?options and scroll to 'warn.' Also, ?warnings gives an example. HTH, Andy __ 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] dealing with multicollinearity
Manuel, The problem you describe does not sound like it is due to multicolinearity. I state this because you variance inflation factor is modest (1.1) and, more importantly, the correlation between your independent variables (x1 and x2) is modest, -0.25. I suspect the problem is due to one, or more, observations having a disproportionally large influence on your coefficients. I suggest you plot your residuals vs. predicted values. I would also do a formal analysis of the influence each observation has on the reported coefficients. You might consider computing Cook's distance for each observation. I hope this has helped. John John Sorkin M.D., Ph.D. Chief, Biostatistics and Informatics Baltimore VA Medical Center GRECC and University of Maryland School of Medicine Claude Pepper OAIC University of Maryland School of Medicine Division of Gerontology Baltimore VA Medical Center 10 North Greene Street GRECC (BT/18/GR) Baltimore, MD 21201-1524 410-605-7119 - NOTE NEW EMAIL ADDRESS: [EMAIL PROTECTED] Manuel Gutierrez [EMAIL PROTECTED] 4/11/2005 6:22:55 AM I have a linear model y~x1+x2 of some data where the coefficient for x1 is higher than I would have expected from theory (0.7 vs 0.88) I wondered whether this would be an artifact due to x1 and x2 being correlated despite that the variance inflation factor is not too high (1.065): I used perturbation analysis to evaluate collinearity library(perturb) P-perturb(A,pvars=c(x1,x2),prange=c(1,1)) summary(P) Perturb variables: x1 normal(0,1) x2 normal(0,1) Impact of perturbations on coefficients: mean s.d. min max (Intercept) -26.0670.270 -27.235 -25.481 x1 0.7260.0250.6720.882 x2 0.0600.0110.0370.082 I get a mean for x1 of 0.726 which is closer to what is expected. I am not an statistical expert so I'd like to know if my evaluation of the effects of collinearity is correct and in that case any solutions to obtain a reliable linear model. Thanks, Manuel Some more detailed information: A-lm(y~x1+x2) summary(A) Call: lm(formula = y ~ x1 + x2) Residuals: Min1QMedian3Q Max -4.221946 -0.484055 -0.004762 0.397508 2.542769 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) -27.234720.27996 -97.282 2e-16 *** x10.882020.02475 35.639 2e-16 *** x20.081800.01239 6.604 2.53e-10 *** --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Residual standard error: 0.823 on 241 degrees of freedom Multiple R-Squared: 0.8411,Adjusted R-squared: 0.8398 F-statistic: 637.8 on 2 and 241 DF, p-value: 2.2e-16 cor.test(x1,x2) Pearson's product-moment correlation data: x1 and x2 t = -3.9924, df = 242, p-value = 8.678e-05 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: -0.3628424 -0.1269618 sample estimates: cor -0.248584 __ 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
Re: [R] How to suppress the printing of warnings (Windows)?
On Mon, 11 Apr 2005, Jacho-Chavez,DT (pgr) wrote: Dear all, I'm a newbie in R. I am running simulations using a fixed bandwidth in nonparametric regressions, sending all the output to a file myoutput.txt using sink(myoutput.txt), R is printing all warnings by the end of the simulation on the file. I know the source of the problem can take care of it. However, finding a 50 MB file (where all the output is printed, e.g. myoutput.txt) by the end of the simulation exercise is not quite pleasant. How could I turn them off completely?, so they are not printed in myoutput.txt file. options(warn=-1) However, warnings and errors are sent to stderr not stdout except on obselete versions (95/98/ME) of Windows, and so not redirected by that sink() call. For me (Windows XP) sink(foo.out) warning(test) Warning message: test as expected. So is this an obsolete version of Windows or a very old version of R? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ 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] Trying to undo an assignment
Uzuner, Tolga wrote on 4/11/2005 7:33 AM: Hi, I defined corr to be a function, not realising that this was also the name for correlation in package=boot. How do I explicitly call the corr function within package boot (so, scope up over the current frame, I guess is another way of saying it) without removing my new corr function ? Thanks, Tolga Tolga, You can use the :: operator, as in `boot::corr'. --sundar __ 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] How to suppress the printing of warnings (Windows)?
I'm running R v2.0.0 on Windows 2000. The command options(warn=-1) did the trick. However, is there a way I may also stop these warnings from printing on my screen while using R interactively. I am working with the LOCFIT library. I'm also planning to run my simulations in my department's Unix machine (R v1.9.0) in batch mode, would `option(warn=-1)' do the trick there as well? David -Original Message- From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Sent: 11 April 2005 13:48 To: Jacho-Chavez,DT (pgr) Cc: r-help@stat.math.ethz.ch Subject: Re: [R] How to suppress the printing of warnings (Windows)? On Mon, 11 Apr 2005, Jacho-Chavez,DT (pgr) wrote: Dear all, I'm a newbie in R. I am running simulations using a fixed bandwidth in nonparametric regressions, sending all the output to a file myoutput.txt using sink(myoutput.txt), R is printing all warnings by the end of the simulation on the file. I know the source of the problem can take care of it. However, finding a 50 MB file (where all the output is printed, e.g. myoutput.txt) by the end of the simulation exercise is not quite pleasant. How could I turn them off completely?, so they are not printed in myoutput.txt file. options(warn=-1) However, warnings and errors are sent to stderr not stdout except on obselete versions (95/98/ME) of Windows, and so not redirected by that sink() call. For me (Windows XP) sink(foo.out) warning(test) Warning message: test as expected. So is this an obsolete version of Windows or a very old version of R? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ 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] TSeries GARCH Estimates accuracy
Hi, I am trying to fit a GARCH(1,1) model to a financial timeseries using the 'garch' function in the tseries package. However the parameter estimates obtained sometimes match with those obtained using SAS or S-Plus (Finmetrics) and sometimes show a completely different result. I understand that this could be due to the way optimization of MLEs are done, however, I would appreciate any help to obtain consistent results using R. Also is there any garch simulation function available other than garchSim from fseries package? Thanks in advance, Sanjay __ 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] How to suppress the printing of warnings (Windows)?
On Mon, 11 Apr 2005, Jacho-Chavez,DT (pgr) wrote: I'm running R v2.0.0 on Windows 2000. The command options(warn=-1) did the trick. However, is there a way I may also stop these warnings from printing on my screen while using R interactively. I am working with the LOCFIT library. Then sink() is not sinking warnings on that OS, so something else is wrong. Yes, option(warn=-1) works in interactive sessions too. I'm also planning to run my simulations in my department's Unix machine (R v1.9.0) in batch mode, would `option(warn=-1)' do the trick there as well? Yes. David -Original Message- From: Prof Brian Ripley [mailto:[EMAIL PROTECTED] Sent: 11 April 2005 13:48 To: Jacho-Chavez,DT (pgr) Cc: r-help@stat.math.ethz.ch Subject: Re: [R] How to suppress the printing of warnings (Windows)? On Mon, 11 Apr 2005, Jacho-Chavez,DT (pgr) wrote: Dear all, I'm a newbie in R. I am running simulations using a fixed bandwidth in nonparametric regressions, sending all the output to a file myoutput.txt using sink(myoutput.txt), R is printing all warnings by the end of the simulation on the file. I know the source of the problem can take care of it. However, finding a 50 MB file (where all the output is printed, e.g. myoutput.txt) by the end of the simulation exercise is not quite pleasant. How could I turn them off completely?, so they are not printed in myoutput.txt file. options(warn=-1) However, warnings and errors are sent to stderr not stdout except on obselete versions (95/98/ME) of Windows, and so not redirected by that sink() call. For me (Windows XP) sink(foo.out) warning(test) Warning message: test as expected. So is this an obsolete version of Windows or a very old version of R? -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 -- 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] Error on X11 or on R?
Dear list, I am using R version 2.0.0 under Linux Mandrake 10.0. I have installed R by using the rpm file on CRAN. By executing the following code, I have this output (the text file formaggio.txt is attached): dati - read.table(formaggio.txt, header=TRUE) plot(dati) Error in text.default(x, y, txt, cex = cex, font = font) : X11 font at size 16 could not be loaded Is it a X11 problem or a R problem? What can I do to solve this problem? Thanks in advance, Elio Taste Acetic H2S Lactic 12.3 4.543 3.135 0.86 20.9 5.159 5.043 1.53 39 5.366 5.438 1.57 47.9 5.759 7.496 1.81 5.64.663 3.807 0.99 25.9 5.697 7.601 1.09 37.3 5.892 8.726 1.29 21.9 6.078 7.966 1.78 18.1 4.898 3.85 1.29 21 5.242 4.174 1.58 34.9 5.74 6.142 1.68 57.2 6.446 7.908 1.9 0.74.477 2.996 1.06 25.9 5.236 4.942 1.3 54.9 6.151 6.752 1.52 40.9 6.365 9.588 1.74 15.9 4.787 3.912 1.16 6.45.412 4.71.49 18 5.247 6.174 1.63 38.9 5.438 9.064 1.99 14 4.564 4.949 1.15 15.2 5.298 5.22 1.33 32 5.455 9.242 1.44 56.7 5.855 10.199 2.01 16.8 5.366 3.664 1.31 11.6 6.043 3.219 1.46 26.5 6.458 6.962 1.72 0.75.328 3.912 1.25 13.4 5.802 6.685 1.08 5.56.176 4.787 1.25__ 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] dealing with multicollinearity
why not use vif command (from car library) to caculate the VIF to help you assess is a collinearity is infulential? I have never seen any book dealling with this topics by perturbation analysis. the VIF,tolerance,principal component analysis are the tools dealing with collinearity.you can get the information from john fox's book. generally,caculating the correlation directly is not essential. one more thing,if your purpose of modeling is prediction but not interpretation,collinearity does not matter much. On Mon, 11 Apr 2005 12:22:55 +0200 (CEST) Manuel Gutierrez [EMAIL PROTECTED] wrote: I have a linear model y~x1+x2 of some data where the coefficient for x1 is higher than I would have expected from theory (0.7 vs 0.88) I wondered whether this would be an artifact due to x1 and x2 being correlated despite that the variance inflation factor is not too high (1.065): I used perturbation analysis to evaluate collinearity library(perturb) P-perturb(A,pvars=c(x1,x2),prange=c(1,1)) summary(P) Perturb variables: x1 normal(0,1) x2 normal(0,1) Impact of perturbations on coefficients: mean s.d. min max (Intercept) -26.0670.270 -27.235 -25.481 x1 0.7260.0250.6720.882 x2 0.0600.0110.0370.082 I get a mean for x1 of 0.726 which is closer to what is expected. I am not an statistical expert so I'd like to know if my evaluation of the effects of collinearity is correct and in that case any solutions to obtain a reliable linear model. Thanks, Manuel Some more detailed information: A-lm(y~x1+x2) summary(A) Call: lm(formula = y ~ x1 + x2) Residuals: Min1QMedian3Q Max -4.221946 -0.484055 -0.004762 0.397508 2.542769 Coefficients: Estimate Std. Error t value Pr(|t|) (Intercept) -27.234720.27996 -97.282 2e-16 *** x10.882020.02475 35.639 2e-16 *** x20.081800.01239 6.604 2.53e-10 *** --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 Residual standard error: 0.823 on 241 degrees of freedom Multiple R-Squared: 0.8411, Adjusted R-squared: 0.8398 F-statistic: 637.8 on 2 and 241 DF, p-value: 2.2e-16 cor.test(x1,x2) Pearson's product-moment correlation data: x1 and x2 t = -3.9924, df = 242, p-value = 8.678e-05 alternative hypothesis: true correlation is not equal to 0 95 percent confidence interval: -0.3628424 -0.1269618 sample estimates: cor -0.248584 __ 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] Sweave and abbreviating output from R
Roger Bivand wrote: On Mon, 11 Apr 2005, Gavin Simpson wrote: Dear List, I'm using Sweave to produce a series of class handouts for a course I am running. The students in previous years have commented about wanting output within the handouts so they can see what to expect the output to look like. So Sweave is a godsend for producing this type of handout - with one exception: Is there a way to suppress some rows of printed output so as to save space in the printed documentation? E.g snip Semi-automatic is: res - capture.output(rnorm(100)) cat(res[1:2], ..., res[length(res)], sep=\n) but I've found that 1) it needs masking from the users, and 2) it is difficult to automate when the numbers of output lines generated by print methods vary with input data (like in print.htest()). But capture.output is very useful. Roger Thanks Roger - that got it! using combinations of: echo=true,eval=FALSE= summary(pondspca, scaling = 2) @ echo=false,eval=true= out - capture.output(summary(pondspca)) cat(out[1:27], , out[43:48], , sep = \n) @ displays the relevant commands to the user but hides the semi-automatic printing of the selected sections. All the best, Gav -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [T] +44 (0)20 7679 5522 ENSIS Research Fellow [F] +44 (0)20 7679 7565 ENSIS Ltd. ECRC [E] gavin.simpsonATNOSPAMucl.ac.uk UCL Department of Geography [W] http://www.ucl.ac.uk/~ucfagls/cv/ 26 Bedford Way[W] http://www.ucl.ac.uk/~ucfagls/ London. WC1H 0AP. %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ 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] Two y-axis in lattice
Hi, I am trying to plot two time series in each panel of an xyplot in lattice, but I need a different y-axis for each time series. Is this possible? How? Thanks for any suggestions. Sincerely, Sharon Kühlmann Sharon Kühlmann Berenzon Biostatistics/Epidemiology Swedish Institute for Infectious Disease Control (SMI) [EMAIL PROTECTED] tel. +46-8-457 2376; fax. +46-8-32 83 30 __ 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] static analysis tools for R code?
An R script will terminate when one tries to use an undefined variable, with a message such as Error in print(x) : Object x not found This run-time error might occur after the script has already been running for some time. In some cases it would be nice to get such warnings before the script is run, just as a syntax error caused by a missing parenthesis is caught. Are there any static analysis tools for R? Such a tool would not have to be perfect to be useful. Besides using undefined variables, defining variables that are never used is something I'd like to be warned about. __ 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 use the hmm packgae?
Hi all, Can someone help me how to use the hmm package? I see the description,but i didnot know how to use it. I got the y.sim value for the sim.hmm function, then I want the example try - hmm(y.sim,K=2,verb=T to work , How can I do it successly? Thank's for your help. Eric [[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] static analysis tools for R code?
If I understand well what you need then (I think) the answer is No; this is a feature of the language called Lazy Evaluation. For more info look at e.g., the R Language Definition document, section 4.3.3. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Vivek Rao [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Monday, April 11, 2005 4:18 PM Subject: [R] static analysis tools for R code? An R script will terminate when one tries to use an undefined variable, with a message such as Error in print(x) : Object x not found This run-time error might occur after the script has already been running for some time. In some cases it would be nice to get such warnings before the script is run, just as a syntax error caused by a missing parenthesis is caught. Are there any static analysis tools for R? Such a tool would not have to be perfect to be useful. Besides using undefined variables, defining variables that are never used is something I'd like to be warned about. __ 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] Trying to undo an assignment
On Mon, 11 Apr 2005, Uzuner, Tolga wrote: Hi, I defined corr to be a function, not realising that this was also the name for correlation in package=boot. How do I explicitly call the corr function within package boot (so, scope up over the current frame, I guess is another way of saying it) without removing my new corr function ? boot::corr -- 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] static analysis tools for R code?
There are some preliminary tools available in the codetools package at http://www.stat.uiowa.edu/~luke/R/codetools/ Hopefully these will be cleaned up and released via CRAN or incorporated into R this summer. luke On Mon, 11 Apr 2005, Dimitris Rizopoulos wrote: If I understand well what you need then (I think) the answer is No; this is a feature of the language called Lazy Evaluation. For more info look at e.g., the R Language Definition document, section 4.3.3. Best, Dimitris Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/16/336899 Fax: +32/16/337015 Web: http://www.med.kuleuven.ac.be/biostat/ http://www.student.kuleuven.ac.be/~m0390867/dimitris.htm - Original Message - From: Vivek Rao [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Monday, April 11, 2005 4:18 PM Subject: [R] static analysis tools for R code? An R script will terminate when one tries to use an undefined variable, with a message such as Error in print(x) : Object x not found This run-time error might occur after the script has already been running for some time. In some cases it would be nice to get such warnings before the script is run, just as a syntax error caused by a missing parenthesis is caught. Are there any static analysis tools for R? Such a tool would not have to be perfect to be useful. Besides using undefined variables, defining variables that are never used is something I'd like to be warned about. __ 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 -- Luke Tierney Chair, Statistics and Actuarial Science Ralph E. Wareham Professor of Mathematical Sciences University of Iowa Phone: 319-335-3386 Department of Statistics andFax: 319-335-3017 Actuarial Science 241 Schaeffer Hall email: [EMAIL PROTECTED] Iowa City, IA 52242 WWW: http://www.stat.uiowa.edu __ 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] static analysis tools for R code?
Look at Luke Tierney's codetools package. https://stat.ethz.ch/pipermail/r-devel/2003-July/027103.html It is useful, and has been run over R itself several times. On Mon, 11 Apr 2005, Vivek Rao wrote: An R script will terminate when one tries to use an undefined variable, with a message such as Error in print(x) : Object x not found This run-time error might occur after the script has already been running for some time. In some cases it would be nice to get such warnings before the script is run, just as a syntax error caused by a missing parenthesis is caught. Are there any static analysis tools for R? Such a tool would not have to be perfect to be useful. Besides using undefined variables, defining variables that are never used is something I'd like to be warned about. -- 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] Two y-axis in lattice
On Monday 11 April 2005 08:58, Sharon Kuhlmann wrote: Hi, I am trying to plot two time series in each panel of an xyplot in lattice, but I need a different y-axis for each time series. Is this possible? Depends. How do you want the axes to be displayed? A small reproducible example that we can work with would be helpful. Deepayan How? Thanks for any suggestions. Sincerely, Sharon Kühlmann Sharon Kühlmann Berenzon Biostatistics/Epidemiology Swedish Institute for Infectious Disease Control (SMI) [EMAIL PROTECTED] tel. +46-8-457 2376; fax. +46-8-32 83 30 __ 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] Building R packages under Windows.
Gabor Grothendieck wrote: Other resources are: - http://www.murdoch-sutherland.com/Rtools/ My plan is that this is only going to include updates of the information in the R Admin manual, e.g. when a new version of one of the tools is available, this page will give advice on whether to use it or not. - README.packages in \Program Files\R\rw2001 or whatever version of R As mentioned, all of this has moved into the admin manual. - posts by me, John Fox, Andy Liao in r-help or r-devel I use Windows XP and it also took me quite a bit of time until I figured it out too. I was really wondering as I got frustrated how it was possible that 500+ packages got developed for R when it was so hard to figure out how to create a package, particularly if you want to put in a vignette. One of the problems is that its dependent on so many other pieces of software and also there can be path problems that you have to figure out. I suspect that the process is somewhat smoother under UNIX and maybe most people use that. Fortunately, it does all work once you get it figured out and its worth it if you are going to do a lot of development since it really helps organize you. If you are just going to use it briefly or casually its probably not worth the hassle. Once you do figure it out it does work although there are a few annoyances. R CMD CHECK is really great although I wish there were some way of telling it to ignore the files referenced in .Rbuildignore so one does not have to do a build first. Also the error messages from the process are often less than helpful but I suspect it would be difficult to improve since it can go wrong at a point which is different than the source of the problem. I think the fixable problems are: - a guide is needed, as you mention Comments on the new organization are welcome. They'll be unlikely to make it into 2.1.0, but 2.1.1 or 2.2.0 will benefit from them. - the prerequisites need to be reduced: -- significant portions are written in perl which is probably a holdover from the days when R was less powerful and now could all be ported to R This would be nice, but, as you say, there's a significant amount of work there. It seems to me that giving instructions on how to install Perl is a lot easier, and the work a user does in installing Perl is small compared to all the other things someone writing a package would be doing, and only needs to be done once. So I have no intention of redoing this, and wouldn't even be all that enthusiastic about testing a submission of rewrites from someone else. -- it would be nice it the tools were not needed either. I don't think this is likely any time soon. The tools are there to provide make and a Unix-like environment in which to run it. I don't think it's likely anyone would rewrite make in R. Some of the other tools could be replaced with R code, but since you're installing one, why not install several? -- reduced functionality with no Microsoft style help should be possible to optionally allow one to create packages without downloading the Microsoft help compiler This is possible, by editing the MkRules file and/or using the --docs=normal option to BUILD or INSTALL. I've just fixed up the R-admin description a bit to make this clearer. - the TEXINPUTS problems with MiKTeX needs to be solved by MiKTeX (they know about it and intend to solve it but I am not sure how quickly that will happen. In the meantime there are workarounds at: http://www.murdoch-sutherland.com/Rtools/miktex.html The fourth alternative is the easiest. I think this only affects you if you are building vignettes.) I'm no longer sure they intend to fix it. Since I wrote those instructions, they came out with a new release that breaks one of the workarounds. 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] how to use the hmm packgae?
``Eric'' ([EMAIL PROTECTED]) wrote: Hi all, Can someone help me how to use the hmm package? I see the description,but i didnot know how to use it. I got the y.sim value for the sim.hmm function, then I want the example try - hmm(y.sim,K=2,verb=T to work , How can I do it successly? Thank's for your help. Your posting is very un-helpful. Please read the Posting Guide. What goes wrong? The example ``works'' precisely as specified --- provided you remember to close your parentheses! cheers, Rolf Turner [EMAIL PROTECTED] P. S. Questions about contributed packages should be directed to the maintainers of those packages (in this case me) and NOT to the list. R. T. __ 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] Error on X11 or on R?
Elio Mineo [EMAIL PROTECTED] writes: Dear list, I am using R version 2.0.0 under Linux Mandrake 10.0. I have installed R by using the rpm file on CRAN. By executing the following code, I have this output (the text file formaggio.txt is attached): dati - read.table(formaggio.txt, header=TRUE) plot(dati) Error in text.default(x, y, txt, cex = cex, font = font) : X11 font at size 16 could not be loaded Is it a X11 problem or a R problem? What can I do to solve this problem? It's a buglet in R, but it is easily fixed by ensuring that you install both 75dpi and 100dpi X11 fonts, or stop telling your font server not to scale fonts. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ 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] embedding fonts in eps files
Hi, I'm again struggling with embedding of fonts in eps files using R. Is this really possible? I don't agree with prof. Ripley saying that all necessary information is in the help file. The aim is to include the complete definitions of the fonts (eventually only the used characters), not only the DSC comments (Document Structuring Conventions), so that we don't use the font definitions of the PS interpreter who renders the eps file. I tried this command postscript(fig2.eps, width = 6.50, height = 3.43, pointsize = 10,horizontal = FALSE, onefile = TRUE, paper = special, family=Times, fonts=Times) I also tried the same command, except for that I gave the following value to the family and to the fonts arguments: c(tir_.afm,tib_.afm,tii_.afm,tibi.afm, sy__.afm) After reading the help file (again) I hoped setting the fonts argument should do what I want. It doesn't. Probably it only includes the DSC comments in the eps .? Prof. Ripley refers to this sentence: The software including the PostScript plot file should either embed the font outlines (usually from '.pfb' or '.pfa' files) or use DSC comments to instruct the print spooler to do so. The question then is: how to make the software including the PostScript plot file embed the font oulines..? Do you have any clue? I work on SUSE Linux 8.1 and I use R 2.0.0. kind regards, Rudi Alberts. On Tue, 2005-01-18 at 03:48, [EMAIL PROTECTED] wrote: On 18-Jan-05 Rudi Alberts wrote: Hi, I have to make eps files with fonts embedded. I use the following postscript command: postscript(fig3a.eps, width = 5.2756, height = 7.27, pointsize = 7,horizontal = FALSE, onefile = FALSE, paper = special,family = Times) plot(...) dev.off() Are fonts automatically embedded in this way? How can I see that? If not, how to do it? Well, it seems to have set Times as the working font family when I used your postscript(...) command above; but see further down. I viewed the resulting .eps file (using 'less' in Linux but Windows users should also have some way of looking into a text file). The first few lines of the file are: %!PS-Adobe-3.0 EPSF-3.0 %%DocumentNeededResources: font Times-Roman %%+ font Times-Bold %%+ font Times-Italic %%+ font Times-BoldItalic %%+ font Symbol %%Title: R Graphics Output ... These are so-called DSC (Document Structuring Conventions) comments and are not directly executed by whatever renders the PostScript code. They do, however, provided useful information for programs which have to handle the PS file. From the above, it can be seen that R's postscript() function has taken note of the 'family=Times' option. Further down the .eps file are the lines %%IncludeResource: font Times-Roman /Times-Roman findfont dup length dict begin {1 index /FID ne {def} {pop pop} ifelse} forall /Encoding ISOLatin1Encoding def currentdict end /Font1 exch definefont pop %%IncludeResource: font Times-Bold /Times-Bold findfont dup length dict begin {1 index /FID ne {def} {pop pop} ifelse} forall /Encoding ISOLatin1Encoding def currentdict end /Font2 exch definefont pop %%IncludeResource: font Times-Italic /Times-Italic findfont dup length dict begin {1 index /FID ne {def} {pop pop} ifelse} forall /Encoding ISOLatin1Encoding def currentdict end /Font3 exch definefont pop %%IncludeResource: font Times-BoldItalic /Times-BoldItalic findfont dup length dict begin {1 index /FID ne {def} {pop pop} ifelse} forall /Encoding ISOLatin1Encoding def currentdict end /Font4 exch definefont pop %%IncludeResource: font Symbol /Symbol findfont dup length dict begin {1 index /FID ne {def} {pop pop} ifelse} forall currentdict end /Font5 exch definefont pop Apart from the %% DSC comments, this is executable PS code which calls on the interpreter to set up the Times fonts Times-Roman as Font1, Times-Bold as Font2, Times-Italic as Font3, Times-BoldItalic as Font4, and Symbol (not a Times font) as Font5. If, instead of 'family=Times', you had used the option 'family=Helvetica', you would have got (try it and see) exactly the same with Helvetica substituted for Times throughout. So far so good. Now comes the crunch. The above (and this is the only part of the .eps file which has anything to do with setting up fonts) assumes that the PS interpreter (i.e. the program, including printer firmware, which renders the PS visible) already has access to the PostScript definitions of these fonts. There is a default assumption (not just in R but in practically any software which outputs PostScript) that the rendering device will have built-in access to the Standard Adobe Font Set -- a set of 13 fonts comprising the Times, Helvetica and Courier families, and the Symbol font, together with the encoding vectors StandardEncoding and ISOLatin1Encoding; most software also assumes the presence
Re: [R] Error on X11 or on R?
Ok. Thanks Peter. Peter Dalgaard wrote: Elio Mineo [EMAIL PROTECTED] writes: Dear list, I am using R version 2.0.0 under Linux Mandrake 10.0. I have installed R by using the rpm file on CRAN. By executing the following code, I have this output (the text file formaggio.txt is attached): dati - read.table(formaggio.txt, header=TRUE) plot(dati) Error in text.default(x, y, txt, cex = cex, font = font) : X11 font at size 16 could not be loaded Is it a X11 problem or a R problem? What can I do to solve this problem? It's a buglet in R, but it is easily fixed by ensuring that you install both 75dpi and 100dpi X11 fonts, or stop telling your font server not to scale fonts. __ 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] Re: [R-SIG-Mac] BUG in RODBC with OS X?
Drew, On Apr 8, 2005, at 11:53 AM, Drew Balazs wrote: This is my second posting on this topic, the first recieved no replies. Has anyone successfully used RODBC on the OS X platform? Yes - it works pretty much out of the box. I tested it with the Actual drivers and they work pretty well (although I don't have any MS box to test the MS SQL part of it). If I try to connect through the GUI using chan - odbcConnect(drewdb, uid=user, pwd =pwd) it simply crashes R with the following crash report: Well, you didn't send the crash report, but only a small (unfortunately useless) part of it. Given the error below, chances are that the error is caused by the driver. As of the GUI, you should include the version (and possibly revision) of the GUI along with the full report so we can try to track it down. However, this won't help with the ODBC problem you have. However, if I try it through an xterm (command line), I get the following: Warning messages: 1: [RODBC] ERROR: state IM004, code 0, message [iODBC][Driver Manager]Driver's SQLAllocEnv() failed If you think this is not a driver problem, you should consider contacting the package maintainer, although I don't give it much hope as most ODBC problems are driver-related (and most drivers have very little OS X support). Alternatively you could ask on the iODBC pages. Cheers, Simon __ 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] (no subject)
Hello R-people, I have searched the mailing list messages and the R site (through the web search and google) I didnt find anything related to Particle Swarm Optimization (PSO) for R. Is there a package that implements such algorithm? Thanks in advance, Ulises __ 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] How to change letters after space into capital letters
Gabor == Gabor Grothendieck [EMAIL PROTECTED] on Mon, 11 Apr 2005 07:31:00 -0400 writes: Gabor On Apr 11, 2005 6:22 AM, Wolfram Fischer [EMAIL PROTECTED] wrote: What is the easiest way to change within vector of strings each letter after a space into a capital letter? E.g.: c( this is an element of the vector of strings, second element ) becomes: c( This Is An Element Of The Vector Of Strings, Second Element ) My reason to try to do this is to get more readable abbreviations. (A suggestion would be to add an option to abbreviate() which changes letters after space to uppercase letters before executing the abbreviation algorithm.) Gabor Look for the thread titled Gabor String manipulation---mixed case Gabor in the r-help archives. Indeed! Thank you, Gabor. If you use R 2.1.0 beta (which you should consider seriously as a good netizen ;-), this is as simple as RSiteSearch(String manipulation---mixed case) A search query has been submitted to http://search.r-project.org The results page should open in your browser shortly Martin. __ 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] Building R packages under Windows.
On Apr 11, 2005 10:58 AM, Duncan Murdoch [EMAIL PROTECTED] wrote: Gabor Grothendieck wrote: Other resources are: - http://www.murdoch-sutherland.com/Rtools/ My plan is that this is only going to include updates of the information in the R Admin manual, e.g. when a new version of one of the tools is available, this page will give advice on whether to use it or not. - README.packages in \Program Files\R\rw2001 or whatever version of R As mentioned, all of this has moved into the admin manual. - posts by me, John Fox, Andy Liao in r-help or r-devel I use Windows XP and it also took me quite a bit of time until I figured it out too. I was really wondering as I got frustrated how it was possible that 500+ packages got developed for R when it was so hard to figure out how to create a package, particularly if you want to put in a vignette. One of the problems is that its dependent on so many other pieces of software and also there can be path problems that you have to figure out. I suspect that the process is somewhat smoother under UNIX and maybe most people use that. Fortunately, it does all work once you get it figured out and its worth it if you are going to do a lot of development since it really helps organize you. If you are just going to use it briefly or casually its probably not worth the hassle. Once you do figure it out it does work although there are a few annoyances. R CMD CHECK is really great although I wish there were some way of telling it to ignore the files referenced in .Rbuildignore so one does not have to do a build first. Also the error messages from the process are often less than helpful but I suspect it would be difficult to improve since it can go wrong at a point which is different than the source of the problem. I think the fixable problems are: - a guide is needed, as you mention Comments on the new organization are welcome. They'll be unlikely to make it into 2.1.0, but 2.1.1 or 2.2.0 will benefit from them. I am probably missing something here but is there some new material that perhaps I am unaware of? - the prerequisites need to be reduced: -- significant portions are written in perl which is probably a holdover from the days when R was less powerful and now could all be ported to R This would be nice, but, as you say, there's a significant amount of work there. It seems to me that giving instructions on how to install Perl is a lot easier, and the work a user does in installing Perl is small compared to all the other things someone writing a package would be doing, and only needs to be done once. So I have no intention of redoing this, and wouldn't even be all that enthusiastic about testing a submission of rewrites from someone else. I assume you are primarily interested in working on the part that is specific to Windows but this is not really a Windows job though that would be a key application of it. Its really a job for R in general since it affects all ports of R, not just Windows. The biggest problem with porting this is that someone has to know R, perl and the scripts themselves or else they have to learn some of these which would be much more work. Not only does it make it harder to create packages but the package development tools are held back since presumably few people know R, perl and the scripts. The key growth of R will not be driven so much by changes to the core but by addon packages so making it easy to create such packages are key to the success of R, at least IMHO. -- it would be nice it the tools were not needed either. I don't think this is likely any time soon. The tools are there to provide make and a Unix-like environment in which to run it. I don't think it's likely anyone would rewrite make in R. Some of the other There is a perl power tools project to rewrite all the UNIX tools in perl. http://ppt.perl.org/ It does include make so I guess its doable. It would be neat if there were an R power tools project although even better would just be to eliminate the need for the tools in the first place, if feasible. The path problems are annoying. Maybe there is some way of creating a package of tools that one simply installs in the same way one installs other R packages even if the tools themselves are not changed? By the way, there is another free help compiler on the net. I have never really looked at it but its at vizacc.com . Not sure if there are any implications to that. tools could be replaced with R code, but since you're installing one, why not install several? -- reduced functionality with no Microsoft style help should be possible to optionally allow one to create packages without downloading the Microsoft help compiler This is possible, by editing the MkRules file and/or using the --docs=normal option to BUILD or INSTALL. I've just fixed up the R-admin description
Re: [R] How to change letters after space into capital letters
On Apr 11, 2005 11:28 AM, Martin Maechler [EMAIL PROTECTED] wrote: If you use R 2.1.0 beta (which you should consider seriously as a good netizen ;-), this is as simple as RSiteSearch(String manipulation---mixed case) A search query has been submitted to http://search.r-project.org The results page should open in your browser shortly It would be nice if RSiteSearch were an entry in the Help menu in the Windows GUI. __ 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 calculate the AUC in R
Hello R-listers, I'm working in an experiment that try to determine the degree of infection of different clones of a fungus and, one of the measures we use to determine these degree is the counting of antibodies in the plasma at different dilutions, in this experiment the maximum number of dilutions was eleven. I already checked for differences on the maximum concentration of the antibodies in function of each clone of the fungus. However one measure of interest is the area under the curve (AUC) for the counting of antibodies in function of dilution. Unfortunately I don't know how to calculate the AUC. Someone can point me an example of this procedure or a package that implements this calculation? Thanks for the help, João Paulo Dubas. __ 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] How to calculate the AUC in R
Dubas, João Paulo wrote: Hello R-listers, I'm working in an experiment that try to determine the degree of infection of different clones of a fungus and, one of the measures we use to determine these degree is the counting of antibodies in the plasma at different dilutions, in this experiment the maximum number of dilutions was eleven. I already checked for differences on the maximum concentration of the antibodies in function of each clone of the fungus. However one measure of interest is the area under the curve (AUC) for the counting of antibodies in function of dilution. Unfortunately I don't know how to calculate the AUC. Someone can point me an example of this procedure or a package that implements this calculation? Thanks for the help, João Paulo Dubas. One of many ways: trap.rule - function(x,y) sum(diff(x)*(y[-1]+y[-length(y)]))/2 -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ 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] How to calculate the AUC in R
Also see the function AUC in the ROC package. On Mon, 2005-04-11 at 13:34 -0400, Frank E Harrell Jr wrote: Dubas, Joo Paulo wrote: Hello R-listers, I'm working in an experiment that try to determine the degree of infection of different clones of a fungus and, one of the measures we use to determine these degree is the counting of antibodies in the plasma at different dilutions, in this experiment the maximum number of dilutions was eleven. I already checked for differences on the maximum concentration of the antibodies in function of each clone of the fungus. However one measure of interest is the area under the curve (AUC) for the counting of antibodies in function of dilution. Unfortunately I don't know how to calculate the AUC. Someone can point me an example of this procedure or a package that implements this calculation? Thanks for the help, Joo Paulo Dubas. One of many ways: trap.rule - function(x,y) sum(diff(x)*(y[-1]+y[-length(y)]))/2 __ 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] ANNOUNCE: S-PLUS 7.0
Insightful is proud to announce a major update to S-PLUS available today: S-PLUS 7. S-PLUS 7 was designed to enable statisticians to create targeted statistical applications with large data sets that can be deployed to business users, researchers, analysts and other end users who do not have special expertise in statistical methods. S-PLUS 7 is the result of scores of interviews with S-PLUS users which drove the design and development of the new features. S-PLUS 7 has also benefited from an extensive beta test program involving many participants on s-news and r-help, to whom I offer sincere thanks for their feedback during the development process. The S-PLUS 7 release includes a new member of the S-PLUS product family, S-PLUS Enterprise Developer, that provides additional new features to S-PLUS, including: * PIPELINE ARCHITECTURE and BIG DATA LIBRARY: S-PLUS 7 Enterprise Developer introduces a new pipeline architecture by making it possible to process gigabyte-sized data sets, even on machines with modest amounts of RAM. With the new big data library, S-PLUS programmers can import or create extremely large data objects by using out-of-memory processing techniques. Instead of holding a large data set entirely in memory, the pipeline architecture caches the data file on disk and uses specialized streaming algorithms to process the data, reading only a small portion of the data into memory at a time. * S-PLUS WORKBENCH INTEGRATED DEVELOPMENT ENVIRONMENT: an integrated environment for S code development, based on the Eclipse framework. This release offers the core functionality of code editing, syntax error detection, project and task management, interfaces with source code control systems, and interaction with the S language engine. You can read about the new features of S-PLUS, including a link to a detailed white paper about the new big data library at: www.insightful.com/products/splus/s7_features.asp You can also learn more about the new capabilities of S-PLUS 7 at a webinar I will be giving on April 19. More info at: www.insightful.com/news_events/webcasts/2005/04splus Finally, my thanks to all the members of the S community -- including R folk -- who have provided such great discussion and debate over the years, which has helped make S-PLUS what it is today. # David Smith -- David M Smith [EMAIL PROTECTED] Senior Product Manager, Insightful Corp, Seattle WA Tel: +1 (206) 802 2360 Fax: +1 (206) 283 6310 New S-PLUS 7! Create advanced statistical applications with large data sets. www.insightful.com/splus __ 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] nested random effects
Hello For an unbalanced longitudinal data set with subjects nested within family as the random effect (random= ~1 | FAMILY/ID)-- I am unclear as to why the subject within family random coefficient is not zero when there is only one person in a family with only one data point. Thanks Dede Greenstein __ 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] How to calculate the AUC in R
Quoting Frank E Harrell Jr: Dubas, João Paulo wrote: Quoting Frank E Harrell Jr: Do you know any book where I can get more information about the subject? Thanks for the help João Paulo Dubas. No, other than an algebra or calculus book where numerical integration is discussion. Thanks to all listers that helped me in this question. The function AUC on the ROC package can be used for the analysis of of the relationship sensitivity x sensibility of a test, I couldn't adjust that function to my purpose. __ 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] ANNOUNCE: S-PLUS 7.0
David, From the white paper, the BIG DATA THING looks quite impressive. IMHO, it addresses the biggest limitation the S family has had so far. I could, of course, think of few features that I wish to see there, but the existing functionality looks fairly complete. Congratulations! An R folk Vadim -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of David Smith Sent: Monday, April 11, 2005 11:26 AM To: r-help@stat.math.ethz.ch Subject: [R] ANNOUNCE: S-PLUS 7.0 Insightful is proud to announce a major update to S-PLUS available today: S-PLUS 7. S-PLUS 7 was designed to enable statisticians to create targeted statistical applications with large data sets that can be deployed to business users, researchers, analysts and other end users who do not have special expertise in statistical methods. S-PLUS 7 is the result of scores of interviews with S-PLUS users which drove the design and development of the new features. S-PLUS 7 has also benefited from an extensive beta test program involving many participants on s-news and r-help, to whom I offer sincere thanks for their feedback during the development process. The S-PLUS 7 release includes a new member of the S-PLUS product family, S-PLUS Enterprise Developer, that provides additional new features to S-PLUS, including: * PIPELINE ARCHITECTURE and BIG DATA LIBRARY: S-PLUS 7 Enterprise Developer introduces a new pipeline architecture by making it possible to process gigabyte-sized data sets, even on machines with modest amounts of RAM. With the new big data library, S-PLUS programmers can import or create extremely large data objects by using out-of-memory processing techniques. Instead of holding a large data set entirely in memory, the pipeline architecture caches the data file on disk and uses specialized streaming algorithms to process the data, reading only a small portion of the data into memory at a time. * S-PLUS WORKBENCH INTEGRATED DEVELOPMENT ENVIRONMENT: an integrated environment for S code development, based on the Eclipse framework. This release offers the core functionality of code editing, syntax error detection, project and task management, interfaces with source code control systems, and interaction with the S language engine. You can read about the new features of S-PLUS, including a link to a detailed white paper about the new big data library at: www.insightful.com/products/splus/s7_features.asp You can also learn more about the new capabilities of S-PLUS 7 at a webinar I will be giving on April 19. More info at: www.insightful.com/news_events/webcasts/2005/04splus Finally, my thanks to all the members of the S community -- including R folk -- who have provided such great discussion and debate over the years, which has helped make S-PLUS what it is today. # David Smith -- David M Smith [EMAIL PROTECTED] Senior Product Manager, Insightful Corp, Seattle WA Tel: +1 (206) 802 2360 Fax: +1 (206) 283 6310 New S-PLUS 7! Create advanced statistical applications with large data sets. www.insightful.com/splus __ 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] correlation range estimates with nlme::gls
I'm trying to do a simple (?) analysis of a 1D spatial data set, allowing for spatial autocorrelation. (Actually, I'm comparing expected vs. observed for a spatial model of a 1D spatial data set.) I'm using models like gls(obs~exp,correlation=corExp(form=~pos),data=data) or gls(obs~exp,correlation=corLin(form=~pos),data=data) This form is supposed to fit a linear model of obs=a*exp+b using an autocorrelation model based on the position variable pos. The problem: I get reasonable answers for the slope intercept, but the estimated ranges for the autocorrelation functions are huge and seemingly unconnected to the pictures I get when I plot acf(resid(M0)) [where M0 is the OLS fit to the data]. I tried simulating a bunch of data with different data sizes: the disturbing thing is that the range results get (much) worse, not better, as the number of data points goes up [from n=30, around the real size, to n=50, to n=100]. When I am able to get confidence intervals on the range, they often don't make sense either. On the other hand, the estimates of slope and intercept are reasonable in reality and in the simulations. I've skipped the gory details at this point. A more complete write-up is at http://www.zoo.ufl.edu/bolker/tiwari-new-reg.pdf if anyone wants more information ... Should I be concerned about this? Are there any obvious diagnostics of non-convergence etc.? (Reported AIC values suggest that the models with autocorrelation *are* preferable, by quite a bit -- I could pursue this further.) Or should I just not worry about it and move on? Ben Bolker -- simulation code: library(MASS) simdata - function(sd=200,range=2,n=NULL,mmin=0) { if (is.null(n)) mile - seq(mmin,17.5,by=0.5) else { mile - seq(mmin,17.5,length=n) } mean - 3000-50*(mile-10)^2 v - sd^2 dist - abs(outer(mile,mile,-)) Sigma - v*exp(-dist/range) X - mvrnorm(1,mu=mean,Sigma=Sigma) data.frame(mile=mile,X=X,mean=mean) } -- 620B Bartram Hall[EMAIL PROTECTED] Zoology Department, University of Floridahttp://www.zoo.ufl.edu/bolker Box 118525 (ph) 352-392-5697 Gainesville, FL 32611-8525 (fax) 352-392-3704 __ 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] dependent competing risks
I am a beginner in R. I want to estimate a dependent competing risks model as proposed by Han and Hausman (1990). Especially because I want to estimate a model with TVC, I write to inquire whether any one else has written up such a model in R and whether I could take a peek at snippets of code. Thanks for any help! Hein. __ 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] Regression and time series
Can someone shed some light on this obscure portion of the help for lm? Considerable care is needed when using 'lm' with time series. Unless 'na.action = NULL', the time series attributes are stripped from the variables before the regression is done. (This is necessary as omitting 'NA's would invalidate the time series attributes, and if 'NA's are omitted in the middle of the series the result would no longer be a regular time series.) Even if the time series attributes are retained, they are not used to line up series, so that the time shift of a lagged or differenced regressor would be ignored. It is good practice to prepare a 'data' argument by 'ts.intersect(..., dframe = TRUE)', then apply a suitable 'na.action' to that data frame and call 'lm' with 'na.action = NULL' so that residuals and fitted values are time series. I found that ts.intersect does not shorten a set of time series just because the series has NAs. It only shortens a set of time series to the length of the shortest time series (with NAs counting for the length calculation). That being the case, the utility of ts.inersect seems limited to me, unless I am missing something (which I probably am). In particular, I am currently having to pad the beginning of a time series when I call diff. For example, a - ts(c(1, 2, 4)) b - ts(c(NA, diff(a))) ab - ts.intersect(a, b) Time Series: Start = 1 End = 3 Frequency = 1 a b 1 1 NA 2 2 1 3 4 2 I was hoping that something like ts.intersect would spare me the trouble of explicitly padding b in the example above. However, if I don't pad b the time series get misaligned: a - ts(c(1, 2, 4)) b - ts(diff(a)) ab - ts.intersect(a, b) Time Series: Start = 1 End = 2 Frequency = 1 a b 1 1 1 2 2 2 Any comments, suggestions? FS __ 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] RE:Building R packages under Windows.
Many, many thanks to Renaud Lancelot who sent me exactly the sort of guide I was looking for. It is in French, but exceptionally clear and easy to follow and I got a rough and ready test package built in no time. It really is not that hard if you don't bother with TeX/LaTeX. Most of my previous hassles seemed to have arisen from path problems. Even so it would be nice to see the process streamlined a bit more in the future. Thanks again to everyone, Duncan Golicher -- Dr Duncan Golicher Ecologia y Sistematica Terrestre Conservación de la Biodiversidad El Colegio de la Frontera Sur San Cristobal de Las Casas, Chiapas, Mexico Tel. 967 1883 ext 1310 Celular 044 9671041021 [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] RE:Building R packages under Windows.
On Apr 11, 2005 8:55 PM, Duncan Golicher [EMAIL PROTECTED] wrote: Many, many thanks to Renaud Lancelot who sent me exactly the sort of guide I was looking for. It is in French, but exceptionally clear and easy to follow and I got a rough and ready test package built in no time. It really is not that hard if you don't bother with TeX/LaTeX. Most of my previous hassles seemed to have arisen from path problems. Even so it would be nice to see the process streamlined a bit more in the future. Thanks again to everyone, Duncan Golicher Maybe this could be contributed? __ 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] calling svydesign function that uses model.frame
I need help on calling the svydesign function in the survey package (although this error appears not to be specific to svydesign). I am passing parameters incorrectly but am not sure how to correct the problem. ## Call the main function PS.sim (one of mine). The dots are parameters I omitted to simplify the question. ## y.col, str.col, clus.id, and PS.col are names of columns in the object pop. PS.sim(pop=small, y.col=NOTCOV, ...,str.col=new.str, clus.id=new.psu, PS.col=PS.var, ...) ## A data.frame called sam.dat is generated by PS.sim. Its first 3 lines are: ID new.str PS.var new.psu NOTCOV wts 213 1 32 2 37.7 236 1 32 2 37.7 286 1 22 2 37.7 ## Next, try to generate a survey design object. ## This fails (note the use of the calling parms clus.id and str.col): svydesign(id = ~clus.id, strata = ~str.col, weights = wts, data = sam.dat, nest = TRUE) ## with this error: Error in model.frame(formula, rownames, variables, varnames, extras, extranames, : invalid variable type ## It looks like clus.id is substituted as new.psu, likewise for str.col ## The call below works when I use the actual column names not the calling parms: svydesign(id = ~new.psu, strata = ~new.str, weights = wts,data = sam.dat, nest = TRUE) I need to call svydesign with the parms I use to invoke the main function PS.sim, i.e., ~clus.id and ~str.col. How do I do that? Thanks, Richard __ 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] adding R site search to Rgui
From: Gabor Grothendieck On Apr 11, 2005 11:28 AM, Martin Maechler maechler at stat.math.ethz.ch wrote: If you use R 2.1.0 beta (which you should consider seriously as a good netizen ;-), this is as simple as RSiteSearch(String manipulation---mixed case) A search query has been submitted to http://search.r-project.org The results page should open in your browser shortly It would be nice if RSiteSearch were an entry in the Help menu in the Windows GUI. One can easily add another menu (and menu item) for this in Rgui: winSearch - function() { string - winDialogString(Search string, ) RSiteSearch(string) } winMenuAdd(Search) winMenuAddItem(Search, Search R Site, winSearch()) Andy __ 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] where is internal function of sample()?
Hi there, I am trying to write a c++ shared library for R. I need a function which has the same functionality as sample() in R, i.e., does permutation, sample with/without replacement. Does R have internal sample routine so that I can call it directly? I did not find it in R.h, Rinternal.h. 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
Re: [R] where is internal function of sample()?
On Mon, 2005-04-11 at 23:04 -0400, Weijie Cai wrote: Hi there, I am trying to write a c++ shared library for R. I need a function which has the same functionality as sample() in R, i.e., does permutation, sample with/without replacement. Does R have internal sample routine so that I can call it directly? I did not find it in R.h, Rinternal.h. Thanks A quick grep of the source code tree tells you that the function is in .../src/main/random.c A general pattern for C .Internal functions is to use a prefix of do_ in conjunction with the R function name. So in this case, the C function is called do_sample and begins at line 391 (for 2.0.1 patched) in the aforementioned C source file. HTH, Marc Schwartz __ 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] adding R site search to Rgui
On Apr 11, 2005 10:39 PM, Liaw, Andy [EMAIL PROTECTED] wrote: From: Gabor Grothendieck On Apr 11, 2005 11:28 AM, Martin Maechler maechler at stat.math.ethz.ch wrote: If you use R 2.1.0 beta (which you should consider seriously as a good netizen ;-), this is as simple as RSiteSearch(String manipulation---mixed case) A search query has been submitted to http://search.r-project.org The results page should open in your browser shortly It would be nice if RSiteSearch were an entry in the Help menu in the Windows GUI. One can easily add another menu (and menu item) for this in Rgui: winSearch - function() { string - winDialogString(Search string, ) RSiteSearch(string) } winMenuAdd(Search) winMenuAddItem(Search, Search R Site, winSearch()) Thanks. It would be nice if it came like that out-of-the-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] RE:Building R packages under Windows.
Gabor Grothendieck a écrit : On Apr 11, 2005 8:55 PM, Duncan Golicher [EMAIL PROTECTED] wrote: Many, many thanks to Renaud Lancelot who sent me exactly the sort of guide I was looking for. It is in French, but exceptionally clear and easy to follow and I got a rough and ready test package built in no time. It really is not that hard if you don't bother with TeX/LaTeX. Most of my previous hassles seemed to have arisen from path problems. Even so it would be nice to see the process streamlined a bit more in the future. Thanks again to everyone, Duncan Golicher Maybe this could be contributed? __ 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 Thank you for your kind comments. I will consider to make it available on the contributed section of CRAN documentation after possible revisions needed for R 2.1.0. Best, Renaud -- Dr Renaud Lancelot, vétérinaire C/0 Ambassade de France - SCAC BP 834 Antananarivo 101 - Madagascar e-mail: [EMAIL PROTECTED] tel.: +261 32 40 165 53 (cell) +261 20 22 665 36 ext. 225 (work) +261 20 22 494 37 (home) __ 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] R Package: mmlcr and/or flexmix
Greetings I'm a relatively new R user and I'm trying to build a latent class model. I've used the 'R Site Search' and it appears there's not much dialogue on these packages On mmlcr, I've gotten it working, but not sure if I'm using it correctly. On flexmix, I can only seem to get results for one class. I'm attaching my code below - if anyone is familiar with either of these packages, I'd really appreciate some assistance or direction. I'm also attaching a small sample dataset. Many thanks for your help! Scott Geller library(mmlcr) model2 = mmlcr(outer = ~ first_brand_HOLIDAY + perc_zone1 + perc_Group_nights + perc_num_asian + DaysBetweenStays + CROStays + DaysSinceLastStay + wghtmean_median_age_pop100 + perc_num_white + perc_num_hispanic + perc_CROStays + numMonthsActive + WEBStays + property_loyalty + perc_NoZone + ltgold1 + ltgold3 + rho + p_hat_PCR| gst_id, components = list(list(formula = nts ~ PCR_Dummy_class, class = poislong)),data=Dataset, n.groups = 5, max.iter = 5000) libray(flexmix) m1-flexmix(nts ~ first_brand_HOLIDAY+ perc_zone1+ perc_Group_nights+ perc_num_asian+ DaysBetweenStays+ CROStays+ DaysSinceLastStay+ wghtmean_median_age_pop100+ perc_num_white+ perc_num_hispanic+ perc_CROStays+ numMonthsActive+ WEBStays+ property_loyalty+ perc_NoZone+ rho+ PCR_Dummy_class+ ltgold1+ ltgold3+ p_hat_PCR, data = data, k = 2, model = FLXglm(family = poisson)) rm1-refit(m1) summary(rm1) Scott Geller Advanced Analytics, Decision Sciences Department, InterContinental Hotels Group 770-604-5149 __ 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