RE: [R] Newbie
Try typing R --gui=gnome at a terminal prompt and see if that works for you. I don't know if the binary for RedHat has the GNOME support compiled in. Andy -Original Message- From: Marcos Llobera [mailto:[EMAIL PROTECTED] Sent: Thursday, August 07, 2003 9:42 AM To: [EMAIL PROTECTED] Subject: [R] Newbie I just installed R's RPM on a Linux box using red hat 8.0. I would like to use some graphical interface (e.g. gnome) but I have not managed to do it. Marcos [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo /r-help -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] A question on orthogonal basis vectors
On 13 Aug 2003 at 10:50, John Fox wrote: Dear Fred, If I understand correctly what you want, the answer is not unique. Think about the 3D case where you start with one vector. (I assume, by the way, that you mean orthonormal and that you mean unique up to a reflection.) There are infinitely many pairs of orthonormal basis vectors for the plane orthogonal to the initial vector. On the other hand, picking an arbitrary orthonormal basis isn't hard: The Gram-Schmidt method does this, for example. To add to this, the qr decomposition is really a version of Gram-Schmidt. So if your basis vectors are the columns of X, you can do something like qr.Q(qr(X), complete=TRUE) Kjetil Halvorsen I hope that this helps, John At 09:16 AM 8/13/2003 -0500, Feng Zhang wrote: Hey, R-listers, I have a question about determining the orthogonal basis vectors. In the d-dimensinonal space, if I already know the first r orthogonal basis vectors, should I be able to determine the remaining d-r orthognal basis vectors automatically? Or the answer is not unique? Thanks for your attention. Fred - John Fox Department of Sociology McMaster University Hamilton, Ontario, Canada L8S 4M4 email: [EMAIL PROTECTED] phone: 905-525-9140x23604 web: www.socsci.mcmaster.ca/jfox __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Rcgi
On 30 Jul 2003 at 19:01, Chris Evans wrote: I am keen to look at Rcgi as I want to put up some simple bits of R to do prescribed tasks on HTML form input. Rweb is overkill and worryingly flexible for what I want and it sounds as if Rcgi is more what I need. However, I can't get any of the URLs I've found for it to work over the last few days. Does anyone have a recent copy they could Email me or a working URL for it? Replying to myself to have this documented in the list archives. I had found the pointer to RCGI from the R-FAQ: http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html#R%20Web%20Interfaces However, http://stats.mth.uea.ac.uk/Rcgi/ remains offline and Email to Mark J. Ray bounces and I see that someone was asking if the project was dead back in 2001 so I guess it should be removed from the FAQ and I've Emailed Kurt Hornik to suggest that he changes that section of the FAQ to remove Rcgi and add the excellent CGIwithR package which does just what I want. Thanks to David Firth for writing it and to both he and Adelchi Azzalini for pointing it out to me ... and to everyone on the R enterprise for this wonderful tool. Trivial, less impressive than Adelchi Azzalini's example: http://tango.stat.unipd.it/SN/sn-fit.html but I am underway with the sorts of things I wanted to do: http://www.psyctc.org/stats/R/binconf1.html http://www.psyctc.org/stats/R/binconf2.html One afterthought: does anyone have any ideas about how to secure GGIwithR to prevent some idiot simply hitting repeatedly with a small script to get a DoS on any server running it? I suspect there may be throtting settings I can use in Apache or even calls to the system inside R to check how many instances of it are running ... but I suspect that others are cleverer than I am at this sort of thing or just less paranoid?! Chris -- Chris Evans [EMAIL PROTECTED] Consultant Psychiatrist in Psychotherapy, Rampton Hospital; Forensic Research Programme Director, Nottinghamshire NHS Trust, Research Consultant, Tavistock Portman NHS Trust; Hon. SL Institute of Psychiatry *** My views are my own and not representative of those institutions *** __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] problems with lda
On Wed, 6 Aug 2003, Nicolaas Busscher wrote: enclosed a simple R script (and a data file) , with calls lda similar to the example with the iris data in the documentation. it is not working and i dont understand the error message. can anybody help me? Nothing arrived attached: please include the problem in your message. i am using R 1.5.1 (2002.06.17) on debian woody stable. thanks Oh, please, upgrade your R! We can't help about systems that are six releases back. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] read.spss doesn't work anymore [more info]
Some more information about my read.spss issues: on a cleanly installed Debian Woody machine: ~/TMP % R R : Copyright 2003, The R Development Core Team Version 1.7.1 (2003-06-16) [...] library(foreign); x - read.spss(dataDef.sav) Error in read.spss(dataDef.sav) : Calloc could not allocate (-2147483648 of 1) memory x - read.spss(dataDef.sav) x - read.spss(dataDef.sav) Segmentation fault However, using R Version 1.7.0 (2003-04-16) installed using Fink on Mac OS X, the .sav file reads without a problem. The .sav file has in its header the following reference: SPSS DATA FILE SPSS for Unix Release 6.1 (HP9000 700 ) Although for the moment I'm reading in a Mac OS X R save'd version of the SPSS data file, I would like to read in the original .sav file. Does anyone know what the problem might be? The .sav file can be downloaded from: http://viropage.psy.cmu.edu/~rijn/dataDef.sav.bz2 (approx 100 kb) - Hedderik. On Sunday, Aug 10, 2003, at 17:15 US/Eastern, Hedderik van Rijn wrote: A couple of months ago, probably using an older version of R, R used to run the following code just fine: library(foreign) data.exp1 - as.data.frame(read.spss(dataDef.sav)) Issuing the same commands now (after starting R using --vanilla), gives me the following behavior: library(foreign) x - read.spss(dataDef.sav) Error in read.spss(dataDef.sav) : Calloc could not allocate (-2147483648 of 1) memory x - read.spss(dataDef.sav) x - read.spss(dataDef.sav) Segmentation fault The first two assignments return instantaneously, after the second x contains all original SPSS variable/column names but no data, after the last read.spss - it takes a while before R returns with the Segmentation fault. During that time, the harddisk seems to be working quite hard. Does anyone know what the problem might be? - Hedderik. version _ platform i386-pc-linux-gnu arch i386 os linux-gnu system i386, linux-gnu status major1 minor7.1 year 2003 month06 day 16 language R __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] spdep error message
Hello, I have been using the package spdep to run spatial regressions on a data set with about 2500 observations. It has performed well up until now, but the following code resulted in an error: load(Panel.90s.ok.R) attach(Panel.90s.ok) neighs-dnearneigh(cbind(x,y),0,5) help(nbdists) dists-nbdists(neighs,cbind(x,y)) Weights-nb2listw(neighs,zero.policy=T,glist=dists) error.model.rprice-errorsarlm(log(wells+1)~log(year)+log(area)+log(lag.rprice )+log(marketable+1)+log(prov.rds+1)+log(ind.rds+1)+log(seismic+1)+log(pipeline s+1)+log(min.year)+log(max.year)+log(avg.year),listw=Weights,zero.policy=T) Error in eigen(w, only.values = TRUE) : error code 2311 from Lapack routine dgeev The problem seems to be with the inclusion of the Euclidean distances (dists) in the spatial weights matrix, as regressions using weights matrices without a glist worked fine. I tried switching the method used in errorsarlm to eigenw but this also resulted in an error: Error in switch(method, eigen = if (!quiet) cat(neighbourhood matrix eigenvalues\n), : ... Unknown method Similarly, switching methods to sparse also resulted in an error: Error in spwdet(sparseweights, rho = rho, debug = debug) : Suspicious allocation of memory in sparse functions ...bailing out! Save workspace and quit R! Any help on how to incorporate distance measures into the spatial weights matrix for the errorsarlm/lagsarlm spatial regression commands would be greatly appreciated! Hopefully I haven't overlooked something very obvious. Regards, Robin Naidoo Department of Rural Economy University of Alberta Canada __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] graph for selected lines in stars()
Tito de Morais Luis [EMAIL PROTECTED] writes: Dear listers, The following command (derived from the example in the ?stars help page) works : data(mtcars) stars(mtcars[, 1:7]) But the following gives an error: stars(mtcars[1, 1:7]) Error in s.y[i, ] : incorrect number of dimensions I was expecting to have the star graph for the first line (Mazda Rx4) I don't think that makes sense. Star graphs are only defined for an ensemble of rowss, at least with the default setting of 'scale=TRUE'. The following give an incorrect graph for the first two cars : stars(mtcars[1:2, 1:7]) Looks correct to me. 1st two models are identical on five variables, and the remaining two are scaled to [0,1], which in this case means that you get two zeros for the first car and two ones for the other. The following gives the correct graphs for all cars: stars(mtcars[1:32, 1:7]) How can I have correct graphs for a selection of lines ? First define correct. You can use scale=FALSE and do the scaling yourself in some way that is independent of the subset chosen. -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Mapping function dependencies
Hi Does anyone know of any automatic way of mapping out the dependencies of a function -- i.e. automatically listing which other functions that function calls? I tried using all.names or all.vars, but I can't get it to work on a function: e.g. test = function(x, y) return(sin(x + y)*cos(x + y)) all.names(expression(test)) [1] test I guess the problem is that all.names is not being applied to the body of the function, whereas if I write the function definition out explicitly in the expression, I can readily get what I want: tmp = all.names(expression(function(x, y) return(sin(x + y)*cos(x + y tmp [1] function return *sin +x [7] ycos +xy and further process this to get the functional dependencies pos.fn = sapply(tmp,function(.x) if (exists(.x)) is.function(get(.x)) else FALSE) tmp[pos.fn] [1] function return *sin +cos + However, this relies on writing out the function definition explicitly out in the expression which I cannot do as I wish to map the dependencies of large complex functions. Thanks for your help. David __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] How to get the pseudo left inverse of a singular square matrix?
Dear R-listers, I have a dxr matrix Z, where d r. And the product Z*Z' is a singular square matrix. The problem is how to get the left inverse U of this singular matrix Z*Z', such that U*(Z*Z') = I? Is there any to figure it out using matrix decomposition method? Thanks a lot for your help. Fred __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] nls confidence intervals
On Thu, 14 Aug 2003 09:08:26 -0700, Spencer Graves [EMAIL PROTECTED] wrote : This seems to identify a possible bug in R 1.7.1 under Windows 2000: tstDf - data.frame(y = 1:11, x=1:11) fit - nls(y~a/x, data=tstDf, start=list(a=1)) predict(fit, se.fit=TRUE) [1] 7.0601879 3.5300939 2.3533960 1.7650470 1.4120376 1.1766980 1.0085983 [8] 0.8825235 0.7844653 0.7060188 0.6418353 The same code in S-Plus 6.1 produces the following: predict(fit, se.fit = TRUE) $fit: [1] 7.0601876 3.5300938 2.3533959 1.7650469 1.4120375 1.1766979 1.0085982 0.8825234 [9] 0.7844653 0.7060188 0.6418352 $se.fit: [1] 5.2433042 2.6216521 1.7477681 1.3108261 1.0486608 0.8738840 0.7490435 0.6554130 [9] 0.5825894 0.5243304 0.4766640 I think that's a documented difference, rather than a bug. The ?predict.nls says near the top that at present, se.fit is ignored. I can see in the log that this comment was added in 1999; a contribution of code to actually do this would probably be welcomed! Perhaps the description below of what se.fit is supposed to do should be modified. p.s. The following command in S-Plus 6.1 seems to work fine but produces an error in R 1.7.1: nls(y~a, data=tstDf, start=list(a=1)) Error in nlsModel(formula, mf, start) : singular gradient matrix at initial parameter estimates This looks like a bug in numericDeriv, which finds a derivative of 0 rather than 1 for da/da. I've cc'd the author. Duncan __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] nls confidence intervals
On Thu, 14 Aug 2003, Spencer Graves wrote: This seems to identify a possible bug in R 1.7.1 under Windows 2000: tstDf - data.frame(y = 1:11, x=1:11) fit - nls(y~a/x, data=tstDf, start=list(a=1)) predict(fit, se.fit=TRUE) [1] 7.0601879 3.5300939 2.3533960 1.7650470 1.4120376 1.1766980 1.0085983 [8] 0.8825235 0.7844653 0.7060188 0.6418353 ?predict.nls states: At present `se.fit' and `interval' are ignored. and therefore works as advertised. Torsten The same code in S-Plus 6.1 produces the following: predict(fit, se.fit = TRUE) $fit: [1] 7.0601876 3.5300938 2.3533959 1.7650469 1.4120375 1.1766979 1.0085982 0.8825234 [9] 0.7844653 0.7060188 0.6418352 $se.fit: [1] 5.2433042 2.6216521 1.7477681 1.3108261 1.0486608 0.8738840 0.7490435 0.6554130 [9] 0.5825894 0.5243304 0.4766640 $residual.scale: [1] 6.544753 $df: [1] 10 Unfortunately, I'm not in a position to fix the problem, but this toy example might make it easier for someone else to fix it. spencer graves p.s. The following command in S-Plus 6.1 seems to work fine but produces an error in R 1.7.1: nls(y~a, data=tstDf, start=list(a=1)) Error in nlsModel(formula, mf, start) : singular gradient matrix at initial parameter estimates # Enrique Portilla wrote: Hi, Does anyone know how to compute the confidence prediction intervals for a nonlinear least squares models (nls)? I was trying to use the function 'predict' as I usually do for other models fitting (glm, lm, gams...), but it seems that se.fit, and interval computation is not implemented for the nls... Cheers Enrique ~~~ Fisheries Research Services, Marine Laboratory, Victoria Road, Torry, Aberdeen, UK. Tel. 44 (0) 1224 295314 ~~~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] How to get the pseudo left inverse of a singular squarematrix?
Thank, Jerome The question is if this generalized inverse can make their product to be identity matrix? - Original Message - From: Jerome Asselin [EMAIL PROTECTED] To: Feng Zhang [EMAIL PROTECTED]; R-Help [EMAIL PROTECTED] Sent: Thursday, August 14, 2003 11:52 AM Subject: Re: [R] How to get the pseudo left inverse of a singular square matrix? Singular matrices are not invertible. However you can calculate the generalized inverse with the function ginv() from package MASS. HTH, Jerome On August 14, 2003 09:24 am, Feng Zhang wrote: Dear R-listers, I have a dxr matrix Z, where d r. And the product Z*Z' is a singular square matrix. The problem is how to get the left inverse U of this singular matrix Z*Z', such that U*(Z*Z') = I? Is there any to figure it out using matrix decomposition method? Thanks a lot for your help. Fred __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] X11 not configured on linux RedHat 9
I'm using Linux version 2.4.20-8smp (gcc version 3.2.2, RedHat 9). I installed R-1.7.1-1.src.rpm following INSTALL. However, no X11 device is found when I run R. X11() Error in X11() : X11 is not available In the configuration, I found checking for X... no How do I configure so that X11 device capability is installed? -- Justin Fay Assistant Professor of Genetics Washington University School of Medicine 4566 Scott Ave, St. Louis, MO 63110 PH: 314.747.1808 Fax: 314.362.7855 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Integer precision etc.
Thanks to James Holtman for the confirmation of the IEEE definition, and to Marc Schwartz and Roger Koenker for pointing out .Machine which I had not been aware of! For the latter, the information I wanted is in .Machine$double.digits [1] 53 so that the largest integer exactly represented is indeed 2^53 -1. Best wishes to all, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 167 1972 Date: 13-Aug-03 Time: 14:48:48 -- XFMail -- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Regexpr with .
Trevor, The . is a regex meta-character that matches any character. In order to look specifically for a ., the you must escape it with a \, and that \ must also be escaped, thus, regexpr(\\., Female.Alabama) [1] 7 attr(,match.length) [1] 1 HTH steve Thompson, Trevor wrote: I'm trying to use the regexpr function to locate the decimal in a character string. Regardless of the position of the decimal, the function returns 1. For example, regexpr(., Female.Alabama) [1] 1 attr(,match.length) [1] 1 In trying to figure out what was going on here, I tried the below command: gsub(., ,, Female.Alabama) [1] ,, It looks like R is treating every character in the string as if it were decimal. I didn't see anything in the help file about . being some kind of special character. Any idea why R is treating a decimal this way in these functions? Any suggestions how to get around this? Thanks for any suggestions. -Trevor [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] vectorization question
Thank you very much. I just would expect that 'as.matrix' would have the same behaviour as 'data.matrix' when all columns in a data frame are numeric. Regards Alberto On Thursday 14 August 2003 16:41, Liaw, Andy wrote: If you look at the structure, you'll see: x$V4 - 0 str(x) `data.frame': 4 obs. of 4 variables: $ V1: int 1 2 3 4 $ V2: int 5 6 7 8 $ V3: int 9 10 11 12 $ V4: num 0 Don't know if this is the intended result. In any case, you're probably better off using data.matrix, as data.matrix(x) V1 V2 V3 V4 1 1 5 9 0 2 2 6 10 0 3 3 7 11 0 4 4 8 12 0 HTH, Andy -Original Message- From: Alberto Murta [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2003 12:50 PM To: [EMAIL PROTECTED] Subject: [R] vectorization question Dear all I recently noticed the following error when cohercing a data.frame into a matrix: example - matrix(1:12,4,3) example - as.data.frame(example) example$V4 - 0 example V1 V2 V3 V4 1 1 5 9 0 2 2 6 10 0 3 3 7 11 0 4 4 8 12 0 example - as.matrix(example) Error in as.matrix.data.frame(example) : dim- length of dims do not match the length of object However, if the column to be added has the right number of lines, there's no error: example - matrix(1:12,4,3) example - as.data.frame(example) example$V4 - rep(0,4) example V1 V2 V3 V4 1 1 5 9 0 2 2 6 10 0 3 3 7 11 0 4 4 8 12 0 example - as.matrix(example) example V1 V2 V3 V4 1 1 5 9 0 2 2 6 10 0 3 3 7 11 0 4 4 8 12 0 Shouldn't it work well both ways? I checked the attributes and dims of the data frame and they are the same in both cases. Where's the difference that originates the error message? Thanks in advance Alberto platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major1 minor7.1 year 2003 month06 day 16 language R -- Alberto G. Murta Institute for Agriculture and Fisheries Research (INIAP-IPIMAR) Av. Brasilia, 1449-006 Lisboa, Portugal | Phone: +351 213027062 Fax:+351 213015948 | http://www.ipimar-iniap.ipimar.pt/pelagicos/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo /r-help --- --- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Alberto G. Murta Institute for Agriculture and Fisheries Research (INIAP-IPIMAR) Av. Brasilia, 1449-006 Lisboa, Portugal | Phone: +351 213027062 Fax:+351 213015948 | http://www.ipimar-iniap.ipimar.pt/pelagicos/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] stars graphs
Hi listers, A few days ago I posted a question about the use of the stars function on selected lines of a frame. Thanks to two helpers, a closer look at the scale argument allowed to partially solve the problem. Yet I still have a problem with stars. Allow me to explain what I intend to do (sorry for my poor English and the long post): I want to graph an activity index of a fish during the day cycle with a star or radar type graph. I know that the R stars function was not written for that purpose. But I couldn't find another way to try to do it. I would appreciate if you could point me to a more appropriate function. I looked at the archives and only found the link below, which pointed me to the stars function: http://maths.newcastle.edu.au/~rking/R/help/01c/2464.html My data frame (2 cols, 55 rows) has the activity index (range 0:1) in the first column. In the second column is the cumulated time (in minutes - range 0:1440) between successive measures of activity. I would like the radius length be the activity index and the angle between two successive plots proportional to elapsed time. In addition time or a character label, is to be written on the graph. I tried with no success to graph it using both the data frame and its transposed (2 rows, 55 cols). As in the actual file there are 55 measures of activity at different hours of the day (not regularly spaced). You can simulate data with something like : df - data.frame(activ=runif(55),cumtime=round(seq(1,1440,l=55))) df$cumtime[1]=0 df looks like my actual data except that the actual data are not regularly spaced in time. But this is not important for the graph. Maybe stars() is totally inadequate for the purpose. If no other solution is available in R, I will try to write down my own and post it. But it may take me a while as I am a newbie in R. Any hint will be appreciated. Regards, Tito -- L. Tito de Morais UR RAP IRD de Dakar BP 1386 Dakar Sénégal Tél.: + 221 849 33 31 Fax: +221 832 16 75 Courriel: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] placing labels in polygon center ?
This is rather simple-minded: rot - function(x, k=1) { k - k %% length(x) x[c((k+1):length(x), 1:k)] } Andy -Original Message- From: Richard A. O'Keefe [mailto:[EMAIL PROTECTED] Sent: Thursday, August 14, 2003 1:28 AM To: [EMAIL PROTECTED] Subject: Re: [R] placing labels in polygon center ? I wrote: I found myself wishing for a function to rotate a vector. Is there one? I know about ?lag, but help.search(rotate) didn't find anything to the point. Here I was regarding a vector as a _sequence_. The (one-step) rotation of c(u,v,w,x,y,z) is c(v,w,x,y,z,u). This is pretty much the way APL uses the word rotate (the vertical-bar-overstruck-with-a-circle operator). Spencer Graves [EMAIL PROTECTED] replied: I didn't study your code, but regarding a function to rotate a vector: Multiplication by an orthogonal matrix does that. This is a misunderstanding. We were both using the word rotate in a standard way, the problem is that it has more than one standard meaning. As a matter of fact, / 0 1 0 0 \ / u \ / v \ | 0 0 1 0 | | v | | w | | 0 0 0 1 | | w | = | x | \ 1 0 0 0 / \ x / \ u / so you *can* do the kind of rotation I want using a matrix multiplication, and this is mathematically useful; it's just not a very good way to do it in a computer. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo /r-help -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] A question on orthogonal basis vectors
Dear Fred, If I understand correctly what you want, the answer is not unique. Think about the 3D case where you start with one vector. (I assume, by the way, that you mean orthonormal and that you mean unique up to a reflection.) There are infinitely many pairs of orthonormal basis vectors for the plane orthogonal to the initial vector. On the other hand, picking an arbitrary orthonormal basis isn't hard: The Gram-Schmidt method does this, for example. I hope that this helps, John At 09:16 AM 8/13/2003 -0500, Feng Zhang wrote: Hey, R-listers, I have a question about determining the orthogonal basis vectors. In the d-dimensinonal space, if I already know the first r orthogonal basis vectors, should I be able to determine the remaining d-r orthognal basis vectors automatically? Or the answer is not unique? Thanks for your attention. Fred - John Fox Department of Sociology McMaster University Hamilton, Ontario, Canada L8S 4M4 email: [EMAIL PROTECTED] phone: 905-525-9140x23604 web: www.socsci.mcmaster.ca/jfox __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] vectorization question
From ?data.frame: Details: A data frame is a list of variables of the same length with unique row names, given class `data.frame'. Your example constructs an object that does not conform to the definition of a data frame (the new column is not the same length as the old columns). Some data frame functions may work OK with such an object, but others will not. For example, the print function for data.frame silently handles such an illegal data frame (which could be described as unfortunate.) It would probably be far easier to construct a correct data frame in the first place than to try to find and fix functions that don't handle illegal data frames. For adding a new column to a data frame, the expressions x[,new.column.name] - value and x[[new.column.name]] - value will replicate the value so that the new column is the same length as the existing ones, while the $ operator in an assignment will not replicate the value. (One could argue that this is a deficiency, but I think it has been that way for a long time, and the behavior is the same in the current version of S-plus.) x1 - data.frame(a=1:3) x2 - x1 x3 - x1 x1$b - 0 x2[,b] - 0 x3[[b]] - 0 sapply(x1, length) a b 3 1 sapply(x2, length) a b 3 3 sapply(x3, length) a b 3 3 as.matrix(x2) a b 1 1 0 2 2 0 3 3 0 as.matrix(x1) Error in as.matrix.data.frame(x1) : dim- length of dims do not match the length of object At Thursday 04:50 PM 8/14/2003 +, Alberto Murta wrote: Dear all I recently noticed the following error when cohercing a data.frame into a matrix: example - matrix(1:12,4,3) example - as.data.frame(example) example$V4 - 0 example V1 V2 V3 V4 1 1 5 9 0 2 2 6 10 0 3 3 7 11 0 4 4 8 12 0 example - as.matrix(example) Error in as.matrix.data.frame(example) : dim- length of dims do not match the length of object However, if the column to be added has the right number of lines, there's no error: example - matrix(1:12,4,3) example - as.data.frame(example) example$V4 - rep(0,4) example V1 V2 V3 V4 1 1 5 9 0 2 2 6 10 0 3 3 7 11 0 4 4 8 12 0 example - as.matrix(example) example V1 V2 V3 V4 1 1 5 9 0 2 2 6 10 0 3 3 7 11 0 4 4 8 12 0 Shouldn't it work well both ways? I checked the attributes and dims of the data frame and they are the same in both cases. Where's the difference that originates the error message? Thanks in advance Alberto platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major1 minor7.1 year 2003 month06 day 16 language R -- Alberto G. Murta Institute for Agriculture and Fisheries Research (INIAP-IPIMAR) Av. Brasilia, 1449-006 Lisboa, Portugal | Phone: +351 213027062 Fax:+351 213015948 | http://www.ipimar-iniap.ipimar.pt/pelagicos/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Removing variables
Hi all, Is there any way to remove at the same time several variables that share a suffix, for example (similar to * or ? in DOS) ? Thanks in advance, Aurora __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] leave-one-out
Hi, is there a package for performing leave-one-out cross validation in R? __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] Mapping function dependencies
TL == Thomas Lumley [EMAIL PROTECTED] on Wed, 13 Aug 2003 07:16:43 -0700 (PDT) writes: TL On Wed, 13 Aug 2003, David Khabie-Zeitoune wrote: With regards to my question below, I've found a way to do it: all.names(body(test)) TL This also gives all the variable names, which you may not want. TL This question came up a few months ago: TL http://finzi.psych.upenn.edu/R/Rhelp02/archive/18497.html If you are willing to (install and) use R-devel, Luke Tierney has written a package codetools which does what you want, at least gives you the building blocks: You need R-devel (which will become R 1.8 in October): library(help=codetools) Information on Package 'codetools' Description: Package: codetools Version: 0.0-0 Author: Luke Tierney [EMAIL PROTECTED] Description: Code analysis tools for R Title: Code Analysis Tools for R Depends: R (= 1.8) Maintainer: Luke Tierney [EMAIL PROTECTED] License: GPL Built: R 1.8.0; ; 2003-08-13 17:13:31 Index: callCC Call With Current Continuation checkUsage Check R Code for Possible Problems codetools Low Level Code Analysis Tools for R findGlobals Find Global Functions and Variables Used by a Closure showTreePrint Lisp-Style Representation of R Expression library(codetools) findGlobals(lm) [1] - == - [5] ! != ( [ [9] [[- { $-* [13] as.character as.nameattr [17] c class-eval if [21] is.empty.model is.matrix is.nulllapply [25] length levels list lm.fit [29] lm.wfitmatch.call model.matrix model.offset [33] model.response model.weights NROW numeric [37] parent.frame return sapply stop [41] warning If you are not an R newbie the package __IN SOURCE FORM__ (i.e. not compiled for Windows!) can be downloaded from http://www.stat.uiowa.edu/~luke/R/codetools/ (Again: You need R-devel, and need to be able to install packages from source!) Regards, Martin Maechler [EMAIL PROTECTED] http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO C16Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] please advise re: data mining in Germany
Our CEO, Dr. Dan Steinberg, is planning to visit Germany in September. He would like the opportunity to introduce statisticians (and statistically minded people) to data mining, data mining applications and to forefront data mining tools. Our algorithms are probably familiar to many statisticians (CART, MARS and MART), although it isn't necessary to be a statistician to use our tools. We co-develop with Jerome Friedman of Stanford University and Leo Breiman of Berkeley. I am trying to locate people/companies in Germany who would benefit from data mining. If you know of any, I would appreciate it if you would let me know. Below is information about Salford Systems, Dr. Steinberg and the abstract of a recent presentation. Sincerely, Lisa Solomon [EMAIL PROTECTED] mailto:[EMAIL PROTECTED] http://www.salford-systems.com?germany 001-619-543-8880 x21 Salford Systems Background: Founded in 1983, Salford Systems specializes in providing new generation data mining and choice modeling software and consultation services. Applications in both software and consulting span market research segmentation, direct marketing, fraud detection, credit scoring, risk management, bio-medical research and manufacturing quality control. Industries using Salford Systems products and consultation services include telecommunications, transportation, banking, financial services, insurance, health care, manufacturing, retail and catalog sales, and education. Salford Systems software is installed at more than 3,500 sites worldwide, including 300 major Universities. Key customers include ATT Universal Card Services, Pfizer Pharmaceuticals, General Motors, Sears, and Roebuck and Co. Dan Steinberg Background: Dan Steinberg is a well respected member of the data mining, statistics and analytical consultation communities. His more than 20 years of experience in the field include Member of Technical Staff at ATT Bell Laboratories, and Assistant Professor of Econometrics at the University of California, San Diego, as well as numerous consultation engagements with Fortune 100 clients. He received his Ph.D. in Economics from Harvard University, and he has received honors from the SAS User's Group International. Steinberg has published articles in statistics, econometrics, computer science, and marketing journals, and he is the developer of a series of advanced statistical analysis programs. In addition, he has been a featured data mining issues speaker for the American Marketing Association, American Statistical Association and the Direct Marketing Association Recent Presentation to San Antonio Chapter American Statistical Society: Data Mining in Practice: Banking, Insurance, Bioinformatics Abstract Part I: Data mining is the application of modern, highly automated nonparametric analytical methods to recognize enduring patterns in data. The methods can produce a variety of models for a variety of industries. Models include classification schemes, regressions, and finding clusters of objects and attributes. This review will focus on classification problems, including, recognizing customers who are most at risk of switching to a competitor, recognizing loan applicants most likely to default, and recognizing unsafe product designs. Most data mining problems are fundamentally minor variations on just a few key themes and we will use the examples to illustrate this point. Part II: Data mining methods have been experimented with for some time in the bioinformatics world, originally being applied to the problems of drug discovery, selection of patients into clinical trials, and epidemiological studies. In the last year or so the number of researchers using data mining methods has expanded considerably, and the range of methods has expanded as well. In particular, CART has been used extensively in the analysis of proteomics and genomics data, and Treenet stochastic gradient boosting has been quite successful in the analysis of DNA microarray data. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Regexpr with .
I'm trying to use the regexpr function to locate the decimal in a character string. Regardless of the position of the decimal, the function returns 1. You need to escape it. gsub(\\.,,,Female.Alabama) [1] Female,Alabama __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] How to copy and paste a R plot onto Word (or PowerPoint)
Either ?savePlot and import using Import -- Picture -- File in Word/PowerPoint or right click, copy as..., and paste in Word/Power point Jim James W. MacDonald Affymetrix and cDNA Microarray Core University of Michigan Cancer Center 1500 E. Medical Center Drive 7410 CCGC Ann Arbor MI 48109 734-647-5623 Yao, Minghua [EMAIL PROTECTED] 08/06/03 11:47AM All, Anybody can tell how to export a R plot onto Word (or Power Point)? Many thanks in advance. -MY __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Binary file reading problem
I am trying to read data from a binary file. The file has a header of mixed data modes:- Bytes Length Mode 1-4 4 Integer 5-6 2 integer 7-8 2 integer .. 15-18 4 integer 19-20 2 integer .. 29-32 4 integer 33-34 2 integer 35 1 character 36 1 character 37 1 character 38 1 character 39-42 4 integer 43-44 2 integer .. I cannot find a way to set a file pointer, so that I can set readBin to read each datum individually. I'd be very grateful for any help with this. Jonathan Williams Jonathan Williams OPTIMA Radcliffe Infirmary Woodstock Road OXFORD OX2 6HE Tel +1865 (2)24356 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Newbie
On Thu, 7 Aug 2003 14:41:51 +0100 Marcos Llobera [EMAIL PROTECTED] wrote: I just installed R's RPM on a Linux box using red hat 8.0. I would like to use some graphical interface (e.g. gnome) but I have not managed to do it. type R at the prompt in a gnome terminal and you can use R. There is the GUI Rcmdr (see message of Sir John Fox preceding your message), a package you should install. Install packages car and foreign first, because Rcmdr needs them. (see the R documentation on CRAN on how to install a package) If you installed the packages successfully, type library(Rcmdr) at the R prompt and you will have a GUI. HTH, Tobias PS using the command line increases speed and flexibility IMHO __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] error message in fitdistr
Hi R lovers Here is a numerical vector test test [1] 206 53 124 112 92 77 118 75 48 176 90 74 107 126 99 84 114 147 99 114 99 84 99 99 99 99 99 104 1 159 100 53 [33] 132 82 85 106 136 99 110 82 99 99 89 107 99 68 130 99 99 110 99 95 153 93 136 51 103 95 99 72 99 50 110 37 [65] 102 104 92 90 94 99 76 81 109 91 98 96 104 104 93 99 125 89 99 99 108 90 105 92 106 103 99 99 99 94 102 103 [97] 97 99 118 91 110 99 99 99 98 105 99 97 99 101 95 98 99 102 99 99 99 99 95 93 86 96 113 87 112 120 71 99 [129] 99 81 96 113 85 116 112 84 120 88 97 104 99 105 153 103 92 99 99 99 90 108 104 99 105 97 94 93 99 85 91 99 [161] 118 99 91 99 103 101 102 96 99 123 85 101 88 99 93 73 97 89 94 69 74 99 97 91 92 Assuming it follows a lognormal distribution I'd like to determine the mean and the sd thanks to maximum likelihood estimation fitdistr(test,lognormal,start=list(200,10)) Error in print.fitdistr(structure(list(estimate = c(4.54666263736726, : more elements supplied than there are to replace I chose the parameter start randomly I don't understand the error message. Has anybody ever encountered such one? thanks for the help have a wonderful day ** The sender's email address has changed to firstname.lastname@ sgcib.com. You may want to update your personal address book. Please see http://www.sgcib.com for more information. ** This message and any attachments (the message) are confide...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Importing Data
These functions are in the library foreign. You may not have loaded the library. Load it first, before using the functions. I tried the following on R1.7.1 on Windows; the functions are available. library(foreign) help(read.xport) help(read.table) In a message dated 8/6/03 11:48:56 AM Eastern Daylight Time, [EMAIL PROTECTED] writes: Im trying to import data from an excel sheet or a sas file to R...im not succeeding. Apparently the function read.xport for reading a SAS file doesnt exist. What do i have to type in EXACTLY to read from an excel sheet(i guess i would be using read.table?)? Thanks in advance for an answer [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Standard error of standard deviation: bootstrap or theoreticalresults?
On Wed, 6 Aug 2003, Thomas W Blackwell wrote: Huan - The difference between the empirical (bootstrap') result and the theoretical results shows evidence for autocorrelation in the time series data. I don't think that's where the correlation is (and for positive autocorrelation I would expect 4 to be larger than 1 to 3). - tom blackwell - u michigan medical school - ann arbor - On Wed, 6 Aug 2003 [EMAIL PROTECTED] wrote: This is more a statistical question rather than an R question. I'd appreciate it if you can give me some suggestions. Suggestion: R-help is not a source of free statistical consultancy. Please seek expert advice within your company, or employ a qualified consultant. Which is why I am only pointing out the most obvious mistakes here, and not proffering possible solutions. I have a sample of a time series (sample size 500, fat tail in density). I am trying to calculate the Standard error of standard deviation of a sub-block-sample (sample size 250). I take 100 this kind of sub-block-sample, randomly. For these 100 subsamples, I use the following 3 methods to calculate the standard error of standard deviation: But those 100 subsamples cannot be independent. If you take a blocks of size 250 out of 500, they are almost bound to overlap. 1. From book Handbook of applicable mathematics, Walter Ledermann (chief editor) Volumn VI: Statistics, Part A, Lloyd, John Wiley Sons. Page 30-32: var(S) = (mu4 - mu2^2)/(4 * mu2 * n) mu4 = E(X - mu)^4, mu2 = E(X - mu)^2, S^2 = sum(X - mu)^2/n The results are about: 0.00090 That is assuming independent samples. 2. From http://davidmlane.com/hyperstat/A19196.html The results are about 0.00066 That's for iid *normal* samples. 3. From http://mathworld.wolfram.com/StandardDeviationDistribution.html The results are about 0.00065 Same. Finally I calculate the standard deviation for each of the 100 subsamples and the standard error of those 100 standard deviations ( I reckon this is the bootstrap result for the standard error of the standard deviation I want). That is not a bootstrap, at least not in any valid sense. You can bootstrap time series, but it is tricky to find a valid method. I get 0.00024 I tried all above a couple of times and got similar results for each methods I used. The results from the first 3 methods are apparently higher than the bootstrap one. I am a bit confused. Do I miss anything? Which one do you believe? You seem to have missed the need to check your assumptions, none. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Sorting a dataframe
Why won't order solve your problem? ?order in R 1.7.1 for Windows includes an example sorting lexicographically 3 variables in ascending order. spencer graves Paul, David A wrote: Undoubtedly a simple question: I've looked at order() and sort() in the help pages for R1.7.1. It doesn't appear that these functions are immediately suited to doing the same thing as PROC SORT DATA = BLAH; BY X Y Z; RUN; in SAS. I have also checked Frank Harrell's Hmisc library. Could someone point me in the right direction so I can sort by the levels of Z within the levels of Y within the levels of X? Everything needs to be in ascending order. Much thanks in advance, david paul __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Plot ticks and tick labels: thickness, colour?
On Wed, 6 Aug 2003, Thomas W Blackwell wrote: You can certainly make tickmarks thinner than the axis line by multiple calls to axis() with different values for lwd. MAYBE you can overwrite an earlier call by setting col.axis=white (and no tickmarks) but I've never tried this. mtext() allows building custom tick labels. col.axis=transparent would be better: col.axis=white would overplot in white. In R-1.7.1, help(axis) seems to disagree with help(par) on whether the arguments to axis() are called col and font (as in help(axis)) or col.axis, col.lab and font.lab (as in help(par)). In my experience, help(par) rules. I think there is no disagreement in the help, but your experience does disagree with my experiments. font: font for text. col: color for the axis line and the tick marks. The default 'NULL' means to use 'par(fg)'. 'col.axis' The color to be used for axis annotation. 'col.lab' The color to be used for x and y labels. 'font.axis' The font to be used for axis annotation. Try plot(1:10, col.axis=gold, col.lab=blue, font.axis=3) axis(side=4, at=1:10, col=green, col.axis=gold, col.lab=blue, font.axis=3, font=2) So when calling axis, the colour of the line and the tick marks is set by col and that of the labels by col.axis and the xlab and ylab by col.lab. Three separate components, three colour settings. As for fonts, font rules when supplied to axis, otherwise font.axis is used. I'll add a note to axis.Rd. BDR __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Thanks: batch package install advice
Thanks for the help, example follows. pkg-c(gregmisc,e1071,car,foreign,tree) install.packages(pkg,destdir=/tmp) __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Filtering Time Series / apply STL method
No graph was shown: R-help strips most attachments. On Wed, 6 Aug 2003, Jan Verbesselt wrote: Dear R Helpers, Which technique can I apply to get the noise out of the following graph? The data displayed shows the seasonal variation of NDVI (vegetation photosynthesis) extracted from the VEGETATION satellite sensor. It contains big errors caused by cloud cover, which gives very low values in the time series (= outliers have to be deleted). Are there certain smoothing or filtering techniques I could use? I tested the Holt-winters filtering and the kernel smoothing technique but none of these give sufficient results. Thanks, Jan Ps: Thanks for the previous answer: setting the dim(Timeserie) - NULL was the solution. The aim is to apply the STL function on these results because at the moment STL runs but results are not logical. *** Jan Verbesselt Research Associate Lab of Geomatics and Forest Engineering K.U. Leuven Vital Decosterstraat 102. B-3000 Leuven Belgium Tel:+32-16-329750 Fax: +32-16-329760 http://perswww.kuleuven.ac.be/~u0027178/VCard/mycard.php?name=janv *** -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] bwplot colours
Dear All, is any way I can change the colours of the box and umbrella of a bwplot without having to go to the length of: box.rectangle-trellis.par.get(box.rectangle) box.rectangle$col-black trellis.par.set(box.rectangle, box.rectangle) etc... but straight from the call: bwplot(y ~ x | z, mydata) ? Regards, Federico Calboli = Federico C.F. Calboli Department of Biology University College London Room 327 Darwin Building Gower Street London WClE 6BT Tel: (+44) 020 7679 4395 Fax (+44) 020 7679 7096 f.calboli at ucl.ac.uk __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] capturing output from Win 98 shell
Prof Brian Ripley writes: If you insist on using a long-obselete OS, please help us continue ot support it by supplying patches and workarounds. I think we (like Microsoft) are going to have to think seriously about withdrawing support from non-NT-based versions of Windows fairly soon. Believe me, using Win98 is NOT my choice. I would only ever use Unix/Linux. Are there other statisticians similarly limited? I am already sticking my neck out quite a lot using R in an industry obsessed with SAS. If I tell IT I'm going to use a nonstandard shell, emacs, ess, bash, and CygWin as well as R they'll probably revoke my username. Still, I for one can understand withdrawing support for old OSs and if I have to stick with 1.7.1 as being the last version to work with Win98 so be it - it as, after all, as is, the most amazing piece of software any statistician could have wished for. Simon Fear Senior Statistician Syne qua non Ltd Tel: +44 (0) 1379 69 Fax: +44 (0) 1379 65 email: [EMAIL PROTECTED] web: http://www.synequanon.com Number of attachments included with this message: 0 This message (and any associated files) is confidential and\...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] A little problem
Hi, Does anybody knows a easy way (without for-loops, maybe with something like match) to solve this problem: x - rep(1,3) y - c(0,1,0,1,0,1,1,1,0,0,0,0,1,0) if (x is a part of y){ find out where it is and do something } Thanks a lot Thomas __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Importing Data
Hadassa Brunschwig wrote: Im trying to import data from an excel sheet or a sas file to R...im not succeeding. Apparently the function read.xport for reading a SAS file doesnt exist. What do i have to type in EXACTLY to read from an excel sheet(i guess i would be using read.table?)? - read.xport() is in package foreign, so use library(foreign) before using the function. Please read the manual R Data Import / Export. You cannot read from Excel with read.table() directly, but there are at least three other ways, in particular by using RODBC or exporting / importing through in ASCII format. Uwe Ligges Thanks in advance for an answer Dassy __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] think i found it, problems with lda ,
Your problem is in the use of the underscore character. Replace it with something else. In your version of R, it is synonymous with the - operator. On Wed, 6 Aug 2003 18:04:56 +0200 amazing electrons exploded from the fingers of Nicolaas Busscher [EMAIL PROTECTED]: i think i found my problem, when i define the function: nb_select_scale-function(blue,bla) { print(bla) } then the lda function results in an error in the scale function.. hm.. did i overload an existing function? thanks for your FAST help Dr.Nicolaas Busscher Universität GH Kassel Nordbahnhofstrasse: 1a, D-37213 Witzenhausen Phone: 0049-(0)5542-98-1715, Fax: 0049-(0)5542-98-1713 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Dr. Marc Feldesman Professor and Chair Emeritus Anthropology Department Portland State University email: [EMAIL PROTECTED] web: http:/web.pdx.edu/~h1mf Beyond every credibility gap lies a gullibility fill Laurence Peter Powered by Titanochoerus the G4 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Marginal (type II) SS for powers of continuous variablesin a linear model?
I'm confused. Consider the following example: Df - data.frame(x=1:9, y=rep(c(-1,1), length=9)) anova(lm(y~x, Df)) Analysis of Variance Table Response: y DfSum Sq Mean Sq F value Pr(F) x 1 2.861e-34 2.861e-34 2.253e-34 1 Residuals 78.88891.2698 anova(lm(y~x+I(x^2), Df)) Analysis of Variance Table Response: y DfSum Sq Mean Sq F value Pr(F) x 1 2.861e-34 2.861e-34 2.065e-34 1. I(x^2) 10.57720.57720.4167 0.5425 Residuals 68.31171.3853 Df - data.frame(x=1:9, y=rep(c(-1,1), length=9)) anova(lm(y~x, Df)) Analysis of Variance Table Response: y DfSum Sq Mean Sq F value Pr(F) x 1 2.861e-34 2.861e-34 2.253e-34 1 Residuals 78.88891.2698 anova(lm(y~x+I(x^2), Df)) Analysis of Variance Table Response: y DfSum Sq Mean Sq F value Pr(F) x 1 2.861e-34 2.861e-34 2.065e-34 1. I(x^2) 10.57720.57720.4167 0.5425 Residuals 68.31171.3853 anova(lm(y~I(x^2)+x, Df)) Analysis of Variance Table Response: y Df Sum Sq Mean Sq F value Pr(F) I(x^2) 1 0.0282 0.0282 0.0203 0.8912 x 1 0.5490 0.5490 0.3963 0.5522 Residuals 6 8.3117 1.3853 In S-Plus 6.1, the ANOVA table is preceeded by a statement, Terms added sequentially (first to last). From these examples, it certainly looks like this is what it is doing. Apart from round off error, the sum of squares and mean squares are identical for the models without and with I(x^2). In an example with a nonzero sum of squares for x, the F value would be different, because the mean square for residuals would be different, and the Pr(F) would also be affected by differing degrees of freedom. The third example here puts I(x^2) before x in the model statement and gets a clearly different anova. (The coefficients should be not change when the order of the terms is modified, though they could change if other terms are addeed. I didn't check that for this example, but I've done this before and would be surprised if they were different.) Best Wishes, Spencer Bjørn-Helge Mevik wrote: I've used Anova() from the car package to get marginal (aka type II) sum-of-squares and tests for linear models with categorical variables. Is it possible to get marginal SSs also for continuous variables, when the model includes powers of the continuous variables? For instance, if A and B are categorical (factors) and x is continuous (numeric), Anova (lm (y ~ A*B + x, ...)) will produce marginal SSs for all terms (A, B, A:B and x). However, with Anova (lm (y ~ A*B + x + I(x^2), ...)) the SS for 'x' is calculated with I(x^2) present in the model, i.e. it is no longer marginal. Using poly (x, 2) instead of x + I(x^2), one gets a marginal SS for the total effect of x, but not for the linear and quadratic effects separately. (summary.aov() has a 'split' argument that can be used to get separate SSs, but these are not marginal.) __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Comprehesive Package/Library list?
Al Piszcz [EMAIL PROTECTED] writes: Is there a list of all contributed R libraries available through CRAN? Ideally it would include a one or two line description. I am looking for a packages() command similar to library() but that would access the CRAN repository and provide a listing of the current libraries, and version. example: http://www.cpan.org/modules/01modules.index.html Assuming that you have the tools (html2text), a truly awful and ugly hack is: CRAN.packages - function(tempfile=tempfile(cranpack)) { packages - readLines(http://cran.r-project.org/src/contrib/PACKAGES.html;) write(packages,file=tempfile) system(paste(html2text,tempfile)) } I won't claim authorship of such a hack. Don't blame me. There is a cleaner way. best, -tony -- A.J. Rossini [EMAIL PROTECTED]http://www.analytics.washington.edu/ Biomedical and Health Informatics University of Washington Biostatistics, SCHARP/HVTN Fred Hutchinson Cancer Research Center UW : FAX=206-543-3461 | moving soon to a permanent office FHCRC: 206-667-7025 FAX=206-667-4812 | Voicemail is pretty sketchy/use Email CONFIDENTIALITY NOTICE: This e-mail message and any attachme...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] new version of Rcmdr package
Dear list members, I've uploaded a new version of the Rcmdr package to CRAN. There are many additions and (I hope) improvements, as indicated in the relevant portion of the CHANGES file, reproduced below. As usual, comments, suggestions, and bug reports are appreciated. John --- Version 0.8-4 o Minor bug fixes and additional input-error checks (many suggested by Tony Christensen). o Documentation for Recode, Compute, linearModel, and generalizedLinearModel dialogs. More extensive documentation for the Commander. o Changes to list*() utility functions to ensure that all objects of a given class are found, and not masked by local variables or objects in the base package. o Many small changes to ensure that objects in the global environment are not masked by objects in the base package. o Added Graphs - Line graph. Version 0.9-0 o More flexible customization. All config files are now in the etc subdirectory, including: - Rcmdr-menus.txt: defines the Rcmdr menus - log-exceptions.txt: a list of functions that are prevented from printing output when executed from the log window. - compareModels.demo: contains a demonstration of how to add a dialog to Rcmdr. Rename this file to compareModels.R and uncomment the corresponding menu-definition line in Rcmdr-menus.txt. o Some more functions in the package are exported to support writing extensions. o Made active-data-set and active-model information fields into buttons that can be used to select the active data set and model. o Added Subset active data set, Remove cases with missing data, and Set case names to Data - Active data set menu. o Added many error checks for adequate variables in the active data set. o Ensured that focus returns to the proper window after an error. o Commands generated by View and Edit Data Set buttons now appear in the log and sessions windows. o As an option, bound double-left-mouse-click to default button in all dialogs. o Added more sophisticated interface for linearModel and generalizedLinearModel dialogs (suggested by Bob Stine). o Where appropriate, previous field-values are retained in linearModel and generalizedLinearModel dialogs (suggested by Sandy Weisberg). Models are numbered. o Generalized-linear models dialog now only shows appropriate links for the currently selected family. o Added Data - New data set menu, which opens data editor with empty data frame. o Much improved stem-and-leaf display using stem.leaf function (courtesy of Peter Wolf). o Added grab.focus option to allow disabling focus grabs on systems where this causes problem. o Added File - Options menu to set options and restart the Commander. o On exit, the Commander cleans up global variables used for program control (from correspondence with Kjetil Brinchmann Halvorsen). o Added distribution plots to the Distributions menu (suggested by Yan Wong). o Small interface changes and bug fixes. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Alignment when rotating text and symbols
Dear Prof Ripley, Many thanks for this response. I do not understand how your example addresses my problem. Basically what concerns me is the relationship between pos=1 and pos=3 upon rotation, if I take your example and modify it slightly to be at srt=180 I would expect to get an inverted view of srt=0. This is not the case, the spacing between the two lines of text becomes so different that at 180 degrees the text now fits within the non rotated text. At intermediate values the text remains aligned to the vertical of the plot rather than to the angle of rotation and so becomes offset. What I had hoped for was what I get with srt=0, rotated as whole so it looked the same but was just rotated to the specified angle. plot(1:10, type=n) text(5,5, a bit of text, pos=1) text(5,5, a bit of text, pos=3) text(5,5, a bit of text, pos=1, srt=180) text(5,5, a bit of text, pos=3, srt=180) Paul On Tuesday, July 29, 2003, at 11:26 am, Prof Brian Ripley wrote: On Tue, 29 Jul 2003, p.b.pynsent wrote: I wanted to annotate some points on lines, above and below the lines. I thought the easiest way would be to use text() and two pos values. However I found when the text was rotated the space and alignment between the point and the text did not remain constant. The following code illustrates the problem: You are rotating the text about its centre, but pos is not in the rotated frame, as I read it, so why should this be rotation-invariant? Try plot(1:10, type=n) text(5,5, a bit of text) text(5,5, a bit of text, pos=1) text(5,5, a bit of text, pos=1, srt=45) to see the effect of pos and srt. You go down then rotate, not rotate and then go down. x - c(0,10.) y - c(0,10.) offset - 3 centre - 5 plot(x,y, xlim=range(x), ylim=range(y),type=n, xlab=,ylab=, main=,xaxt=n,yaxt=n) for (i in (seq(0, 340, by=45)) ) { px - centre + cos((i*pi)/180) * offset py - centre + sin((i*pi)/180) * offset text(px, py, labels=substitute(that%-%phantom(1),list(that=i)), pos=1, col=blue, cex=0.7, srt=i) text(px, py, labels=substitute(that%-%phantom(1),list(that=i)), pos=3, col=blue,cex=0.7,srt=i) lines(px, py, type=p, col=black) #just for reference } What have I done wrong? In addition, on my screen, the arrow symbols do not rotate at all although they do on the pdf image. (R version 1.71, MacOS X 10.2.6) *WHICH* Mac port of R? There are two! The lack of rotation is a limitation of the (unspecified) graphics device of your (unspecified) port, whichever it is: it works on Linux and Windows, for example, so I would expect this to work on an X11 device on the Darwin port. Yes this is ambiguous,sorry. Not the Darwin port. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] high memory allocation
Dear Georg, You may prefer to try clara() which uses less memory than the other cluster routines (and stands for clustering large applications). The documentation for clara() says that all variables must be numeric, which could be a problem if you have nominal or ordinal variables. Regards, Andrew C. Ward CAPE Centre Department of Chemical Engineering The University of Queensland Brisbane Qld 4072 Australia [EMAIL PROTECTED] Quoting gowuban [EMAIL PROTECTED]: Hello, I have trouble with my cluster analysis using package cluster. diana and agnes both seem to try to allocate memory directly, so I can not use virtual memory of my Windows2000 operation system. I do have 320 MB of memory. But they claim about 600 MB. Do I have a chance to do the analysis with my amount of memory. Thanks for all comments, I did not find a way yet. Regards Georg [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Regexpr with .
Thompson, Trevor wrote: I'm trying to use the regexpr function to locate the decimal in a character string. Regardless of the position of the decimal, the function returns 1. For example, regexpr(., Female.Alabama) You probably want backslashes to indicate that . should not be treated as a metacharacter; it should be taken literally. regexpr(\\., Female.Alabama) [1] 7 attr(,match.length) [1] 1 hope this helps, Chuck Cleland __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] gregmisc
Thank you, Marc; I installed car, R commander and Bioconductor. I am using R 1.7.1, on MAC OSX 10.2.6 library() Packages in library '/usr/local/lib/R/library': AnnBuilder Bioconductor annotation data package builder Biobase Biobase: Base functions for Bioconductor DynDoc Dynamic document tools RBGLTest interface to boost C++ graph lib ROC utilities for ROC, with uarray focus Rcmdr R Commander Ruuid Ruuid: Provides Universally Unique ID values SAGElyzer A package that deals with SAGE libraries affyMethods for Affymetrix Oligonucleotide Arrays affycompGraphics Toolbox for Assessment of Affymetrix Expression Measures affydataAffymetrix Data for Demonstration Purpose annotateAnnotation for microarrays baseThe R base package car Companion to Applied Regression ctest Classical Tests eda Exploratory Data Analysis edd expression density diagnostics genefilter Genefilter: filter genes geneplotter Geneplotter: plot microarray data golubEsets exprSets for golub leukemia data graph graph: A package to handle graph data structures gregmiscGreg's Miscellaneous Functions gridThe Grid Graphics Package lattice Lattice Graphics limma Linear Models for Microarray Data lqs Resistant Regression and Covariance Estimation makecdfenv CDF Environment Maker marrayClasses Classes and methods for cDNA microarray data marrayInput Data input for cDNA microarrays marrayNorm Location and scale normalization for cDNA microarray data marrayPlots Diagnostic plots for cDNA microarray data Packages in library '/usr/local/lib/R/library': AnnBuilder Bioconductor annotation data package builder Biobase Biobase: Base functions for Bioconductor DynDoc Dynamic document tools RBGLTest interface to boost C++ graph lib ROC utilities for ROC, with uarray focus Rcmdr R Commander Ruuid Ruuid: Provides Universally Unique ID values SAGElyzer A package that deals with SAGE libraries affyMethods for Affymetrix Oligonucleotide Arrays affycompGraphics Toolbox for Assessment of Affymetrix Expression Measures affydataAffymetrix Data for Demonstration Purpose annotateAnnotation for microarrays baseThe R base package car Companion to Applied Regression ctest Classical Tests eda Exploratory Data Analysis edd expression density diagnostics genefilter Genefilter: filter genes geneplotter Geneplotter: plot microarray data golubEsets exprSets for golub leukemia data graph graph: A package to handle graph data structures gregmiscGreg's Miscellaneous Functions gridThe Grid Graphics Package lattice Lattice Graphics limma Linear Models for Microarray Data lqs Resistant Regression and Covariance Estimation makecdfenv CDF Environment Maker marrayClasses Classes and methods for cDNA microarray data marrayInput Data input for cDNA microarrays marrayNorm Location and scale normalization for cDNA microarray data marrayPlots Diagnostic plots for cDNA microarray data marrayTools Miscellaneous functions for cDNA microarrays methods Formal Methods and Classes modreg Modern Regression: Smoothing and Local Methods multtestMultiple Testing Procedures mva Classical Multivariate Analysis nlmeLinear and nonlinear mixed effects models nls Nonlinear regression reposTools Repository tools for R sma Statistical Microarray Analysis splines Regression Spline Functions and Classes stepfun Step Functions, including Empirical Distributions survivalSurvival analysis, including penalised likelihood. tcltk Tcl/Tk Interface tkWidgets R based tk widgets tools Tools for package development ts Time series functions vsn Variance
Re: [R] L10N and i18n of R
Shigeru Mase wrote: Nakama's patches can also handle other languages than Japanese. He kindly built Korean and Russian version of R (1.7.1) as rpm binaries (although he can understand neither Korean nor Russian). It is interesting, but with Russian R works fine as is (can say nothing about Korean and Japanese). Using russian words as names for objects and functions as well as text annotations in graphic devices does not cause any troubles. I use R-1.7.0 under Linux with koi8-r Russian system locale installed. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] gnls - Step halving....
Hi all, I'm working with a dataset from 10 treatments, each treatment with 30 subjects, each subject measured 5 times. The plot of the dataset suggests that a 3-parameter logistic could be a reasonable function to describe the data. When I try to fit the model using gnls I got the message 'Step halving factor reduced below minimum in NLS step'. I´m using as the initial values of the parameters those obtained from the nls fit. Is a problem of the initial estimates of the parameters that I get the error or could be something else? The code for the nls fit was: options(contrasts=c(contr.helmert,contr.poly)) VA1.lis-nlsList(DRAM~SSlogis(MED,phi1,phi2,phi3)|TRAT, data=VA1,na.action=na.omit) The code for the gnls fit was (using a 'difference parameterization' like SAS): options(contrasts=c(contr.SAS,contr.poly)) VA1.gnls-gnls(DRAM~SSlogis(MED,phi1,phi2,phi3), data=VA1,params=list(phi1~TRAT,phi2~TRAT,phi3~TRAT), start=c( 23.36209, avg of phi1 for the 10 trts * -0.8549794, * diff. between avg and nls estimate of TRAT#2 ** .and so on I´d appreciate any comment Thanks CM __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] problems with lda , data included, can somebody test withthe new version
On Wed, 6 Aug 2003, Nicolaas Busscher wrote: enclosed a simple R script (and a data file, and the output) , with calls lda similar to the example with the iris data in the documentation. it is not working and i dont understand the error message. can anybody help me? i am using R 1.5.1 (2002.06.17) on debian woody stable. I would like to avoid updating now, because i want to keep the system in stable. can somebody test, if the newer version didnt have this problem ? thanks z-lda(assignment ~ .,actaData,prior=prio,tol=1.0e-08) Using the latest version, R 1.7.1, I get: z Call: lda.formula(assignment ~ ., data = actaData, prior = prio, tol = 1e-08) Prior probabilities of groups: 5 6 0.5 0.5 Group means: diagonal.moment cluster.shade histogram.kurtosis 584.94982 -11989.17 -0.1116342 6 138.31495 -18892.15 -0.1205776 Coefficients of linear discriminants: LD1 diagonal.moment-1.575854e-03 cluster.shade -1.209398e-04 histogram.kurtosis -2.028278e+02 -- Cheers, Kevin -- On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question. -- Charles Babbage (1791-1871) From Computer Stupidities: http://rinkworks.com/stupid/ -- Ko-Kang Kevin Wang Master of Science (MSc) Student SLC Tutor and Lab Demonstrator Department of Statistics University of Auckland New Zealand Homepage: http://www.stat.auckland.ac.nz/~kwan022 Ph: 373-7599 x88475 (City) x88480 (Tamaki) __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] size of a pixmap image
On 7 Aug 2003, Tito de Morais Luis wrote: Dear listers, I loaded a pixmap image with: brobo - read.pnm(brobo.pnm) I can have the characteristics of the image with: brobo Pixmap image Type : pixmapRGB Size : 609x682 Resolution: 1x1 Bounding box : 0 0 682 609 How can I retrieve the image size ? nrow(brobo) and ncol(brobo) give NULL getClass(pixmap) Slots: Name: size cellresbbox bbcent Class: integer numeric numeric logical Known Subclasses: pixmapChannels, pixmapIndexed, pixmapGrey, pixmapRGB [EMAIL PROTECTED], to get the equivalent of dim(), nrow is [EMAIL PROTECTED], ncol [EMAIL PROTECTED], or: setGeneric(nrow, function(x) standardGeneric(nrow)) setMethod(nrow, pixmap, function(x) { [EMAIL PROTECTED] }) gets you there. Roger I succeeded using: nrow(getChannels(brobo)) [1] 609 ncol(getChannels(brobo)) [1] 682 It looks a bit tricky, is there another way ? Thanks in advance, Tito Running Mandrake 9.1 version _ platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major1 minor7.1 year 2003 month06 day 16 language R -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Breiviksveien 40, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 93 93 e-mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Plot ticks and tick labels: thickness, colour?
Dirk - You can certainly make tickmarks thinner than the axis line by multiple calls to axis() with different values for lwd. MAYBE you can overwrite an earlier call by setting col.axis=white (and no tickmarks) but I've never tried this. mtext() allows building custom tick labels. In R-1.7.1, help(axis) seems to disagree with help(par) on whether the arguments to axis() are called col and font (as in help(axis)) or col.axis, col.lab and font.lab (as in help(par)). In my experience, help(par) rules. But, do you REALLY want to get into this ! - tom blackwell - u michigan medical school - ann arbor - On Wed, 6 Aug 2003, Dirk Eddelbuettel wrote: I am displaying several series in one plot, and would like to make them distinct without having to employ a legend. I managed to color tickmarks, but have been unsuccessful with either one of a) making tickmarks thicker (without increasing the axis at the same time). From reading ?axis: lty, lwd: line type, width for the axis line and the tick marks. in would appear that I cannot obtain the one _without_ the other; or b) displaying the tick label in a different colour. Again, ?axis reads col: color for the axis line and the tick marks. [..] indicates that I can only set the tick mark, not the annotation. Thanks in advance, Dirk __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] subscripts in lists
I am tying myself in knots over subscripts when applied to lists I have a list along the lines of: lis-list(c(a,b,next,want1,c),c(d, next, want2, a)) From which I want to extract the values following next in each member of the list, i.e. something along the lines of answer-c( want1, want2). Is this possible without using loops? The elements of lis are of different lengths and next occurs once per element somewhere in the middle. The thought process behind this is: It's easy enough to do it for an individual element of the list: lis[[1]][match(next,lis[[1]])+1] but how to do that to all elements of the list? I can get their indices e.g. as a list using lapply: lapply(lapply(lis,match,x=next),+,y=1) or return a particular subscript using: lapply(lis,[, i=3) but don't see how one could combine the two to get answer-c(want1, want2) without resorting to: answer-character for(s in 1:length(lis)){ answer-c(answer,lis[[s]][match(next,lis[[s]])+1]) } Am I missing something obvious (or non-obvious)? I suppose the secondary question is 'should I care?'. I am intending to use this on hundreds of lists sometimes with tens of thousands of elements, with more than one version of next in each, so felt that the lower efficiency of looping was likely to matter. Any help much appreciated, Chris -- ~ Dr. Christopher G. Knight Tel:+44 (0)1865 275 111 Department of Plant Sciences +44 (0)1865 275 790 South Parks Road Oxford OX1 3RB UK ` · . , ,(((º ~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] gls function
Prodromos Zanis [EMAIL PROTECTED] writes: I use the gls function but in contrast to the lm function in which when I type summary(lm(...))$coef I receive all the coefficients (estimate, Std. Error, t-value and pvalue), with gls when I type summary(gls(...))$coef I only receive the estimate of the reg. coefficient without std. error and t- and p-values. Do you have any suggestion how to solve my problem? Look at the structure of the value returned by summary applied to a gls object. library(nlme) example(gls) str(summary(fm1)) You will find that you want to extract summary(fm1)$tTable __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Newbie
I just installed R's RPM on a Linux box using red hat 8.0. I would like to use some graphical interface (e.g. gnome) but I have not managed to do it. Marcos [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] R like SPSS
On 08/06/03 13:02, Gerhard Prade wrote: Hello all, (Sorry, my bad english) i am searching a alternativ for spss that i can use with linux. I studied sociology in germany and work sometimes for some hours in the marketresearch. There they use statistics like anova and crosstabs. I see that r can make anova or regressions but the most work in the marketresearch is making crosstabs. These companys use something like spss tables or gess to make tables for the customers. I read that r can make with latex tables with xtabs or ftable and so on. But i dont understand the use of all that. My question is: Is R a good alternativ to make tables? The goal is to make something like that: What you sent looks like a total mess on my terminal window. But, yes, R can make tables of all sorts. Usually xtab is quite good, but there are other table making functions, such as those in the Hmisc and gregmisc packages. Almost 3 years ago I was keeping Windows on my computer because I was using Systat - similar to SPSS - for data analysis. Then I discovered R and soon got rid of Windows forever. The beginning section of Notes on R for psychology..., in my page below (and which we plan to revise soon) is written for people who are making the particular sort of transition I made. Jon -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page:http://www.sas.upenn.edu/~baron R page: http://finzi.psych.upenn.edu/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] code speed help? -- example and results provided
I have the following piece of code that combines lists comprised of components of varying length into a list with components of constant length. I have found 2 ways to do it, and the faster of the two is posted below along with sample results. Do you have any suggestions on how to decrease the calculation time by modifying the code? Function### replacement2.idx-function(life=w.life,N=years,n=samples){ + + yrs-rep(N,n) + ind-yrs-life + + x1-mapply(rep,times=life,x=0) + x2-mapply(rep,times=ind,x=1) + + x3-data.frame(c(x1[[1]],x2[[1]])) + + for(i in 2:n) x3-data.frame(x3, append(x1[[i]],x2[[i]])) + + x3-t(x3) + } ###Sample Output### samples-5 years-10 w.life-round(rnorm(samples,5,1),digits=0) system.time(abc-replacement2.idx()) [1] 0.04 0.00 0.07 0.00 0.00 abc 1 2 3 4 5 6 7 8 9 10 c.x1..1x2..1... 0 0 0 0 0 0 1 1 1 1 append.x1..ix2..i... 0 0 0 0 0 0 1 1 1 1 append.x1..ix2..i... 0 0 0 0 0 0 1 1 1 1 append.x1..ix2..i... 0 0 0 0 1 1 1 1 1 1 append.x1..ix2..i... 0 0 0 0 0 1 1 1 1 1 ###1000 samples samples-1000 w.life-round(rnorm(samples,5,.5),digits=0) system.time(method2-replacement2.idx()) [1] 12.79 0.00 14.04 0.00 0.00 ###5000 samples samples-5000 w.life-round(rnorm(samples,5,.5),digits=0) system.time(method2-replacement2.idx()) [1] 544.82 0.00 593.98 0.00 0.00 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Levene test of homogeneity of variance
Has the Levene test of homogeneity of variance been implemented in any library in R? Thanks, Maurice Haynes National Institute of Child Health and Human Development Child and Family Research Section 6705 Rockledge Drive Bethesda, MD 20892 Voice: 301-496-8180 Fax: 301-496-2766 E-Mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] problem with download.packages
On Wed, 6 Aug 2003, David Parkhurst wrote: R Version 1.7.0, under windows XP pro The help page for update.packages says that { `download.packages' takes a list of package names and a ^^^ destination directory, downloads the newest versions of the package sources and saves them in `destdir'. If the list of available packages is not given as argument, it is also directly ^^ Not a `list of package names'! obtained from CRAN. If CRAN is local, i.e., the URL starts with `file:', then the packages are not downloaded but used directly. }. I tried this (while connected to the internet): download.packages(destdir=\\aq\\R\\updates) with this result: trying URL `http://cran.r-project.org/bin/windows/contrib/1.7/PACKAGES' Content type `text/plain; charset=iso-8859-1' length 12447 bytes opened URL downloaded 12Kb Error in unique(pkgs) : Argument pkgs is missing, with no default Is there not an inconsistency here? How can I get this to work? Yes! *You* failed to supply a `list of package names'! I don't suppose you meant an inconsistency in your message, but there appears to be a gaping one. -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] problems with lda , data included,can somebody test with the new version
Nicolaas Busscher [EMAIL PROTECTED] wrote: enclosed a simple R script (and a data file, and the output) , with calls lda similar to the example with the iris data in the documentation. it is not working and i dont understand the error message. I tested your data and commands without any error message on a linux debian distribution: [...] z-lda(assignment ~ .,actaData,prior=prio,tol=1.0e-08) z Call: lda.formula(assignment ~ ., data = actaData, prior = prio, tol = 1e-08) Prior probabilities of groups: 5 6 0.5 0.5 Group means: diagonal.moment cluster.shade histogram.kurtosis 584.94982 -11989.17 -0.1116342 6 138.31495 -18892.15 -0.1205776 Coefficients of linear discriminants: LD1 diagonal.moment-1.575854e-03 cluster.shade -1.209398e-04 histogram.kurtosis -2.028278e+02 can anybody help me? i am using R 1.5.1 (2002.06.17) on debian woody stable. I would like to avoid updating now, because i want to keep the system in stable. You can upgrade your old R while keeping the system in stable. You may download the 1.7.1 deb packages from CRAN, and install them with dpkg. Or even better, you can create your own debs from the sources, all the required files are the package. tar xvzf R-1.7.1.tgz cd R-1.7.1 dpkg-buildpackage -rfakeroot And a few coffees later, you will find a fairly large number of deb files in the parent directory. -- Philippe __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] problem with download.packages
R Version 1.7.0, under windows XP pro The help page for update.packages says that { `download.packages' takes a list of package names and a destination directory, downloads the newest versions of the package sources and saves them in `destdir'. If the list of available packages is not given as argument, it is also directly obtained from CRAN. If CRAN is local, i.e., the URL starts with `file:', then the packages are not downloaded but used directly. }. I tried this (while connected to the internet): download.packages(destdir=\\aq\\R\\updates) with this result: trying URL `http://cran.r-project.org/bin/windows/contrib/1.7/PACKAGES' Content type `text/plain; charset=iso-8859-1' length 12447 bytes opened URL downloaded 12Kb Error in unique(pkgs) : Argument pkgs is missing, with no default Is there not an inconsistency here? How can I get this to work? Thanks. Dave Parkhurst __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] na.action in randomForest --- Summary
To make it clear: Version 3.3 and older of Breiman's code do not handle NAs at all: you need to exclude them before running random forest. One can easily do so by using na.action=na.omit (which, despite the default, seemed to be what's used). The airquality data used in the examples in the randomForest help page has many NAs, for example. The na.roughfix implements the idea that Breiman added to V4.0 of his code (only for classification). For fancier imputation by nearest neighbors, measured by proximities from random forest, there's the rfImpute function (linked from the help page of na.roughfix). The advantage is that it works for both regression and classification. I have not yet implemented all the new features that Leo introduced in V4, so the version for the randomForest is currently at 3.9-x. Adding the new features is more involved than one may think, as I'm adding the features to the existing code, rather than modifying Leo's new code and put in the package. The reason: I've fixed a few bugs and added a few features in the package, and I don't want to loose those. Just so you know, I believe Leo is making some changes to the way imputation is done in V5... HTH, Andy -Original Message- From: David Parkhurst [mailto:[EMAIL PROTECTED] Sent: Tuesday, August 05, 2003 3:31 PM To: [EMAIL PROTECTED] Subject: Re: [R] na.action in randomForest --- Summary A few days ago I asked whether there were options other than na.action=na.fail for the R port of Breiman's randomForest; the function's help page did not say anything about other options. I have since discovered that a pdf document called The randomForest Package and made available by Andy Liaw (who made the tool available in R---thank you) does discuss an option. It is an implementation of Breiman's suggestion to replace each missing value by the median of its column and each missing categorical by the most frequent value in that categorical. My impression is that because of the randomness and the many trees grown, filling in missing values with a sensible values does not effect accuracy much. (from his report, Manual On Setting Up, Using, And Understanding Random Forests V3.1). I now plan to try the na.roughfix option from Liaw's package. Thanks to Uwe Ligges and Brian Ripley for their replies to my posting. Dave Parkhurst __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo /r-help -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] ginv vs. solve
Angel [EMAIL PROTECTED] writes: Why do x-b%*%ginv(A) and x-solve(A,b) give different results?. It seems that I am missing some basic feature of matrix indexing. e.g.: A-matrix(c(0,-4,4,0),nrow=2,ncol=2) b-c(-16,0) x-b%*%ginv(A);x x-solve(A,b);x [ginv() is from MASS, please remember to tell us] Your b is on the wrong side, try ginv(A)%*%b (possibly put it within drop() to convert it to vector). -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Startup for RExcel
Hi When I start an instance of an R stats server using the R(D)COM RExcel Addin by Thomas Baier, it appears to start the server in a temporary directory. Is there any way I can change the directory in which the server starts in so that I can, for example, take advantage of Rprofile or Renviron files I may have in a particular directory? Thanks David __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Weighted SUR, 2SLS regressions
An (the?) early reference for SUR is: * Arnold Zellner (1962). An efficient method for estimating seemingly unrelated regressions, and tests for aggregation bias, Journal of the American Statistical Association, Vol 57, pp348--68. * For a discusssion, generalization and related references see, p. 306---, Ch 9. of Russell Davidson and James MacKinnon (1993). Estimation and Inference in Econometrics. * See, William Greene. Econometric Analysis. (Nth edition) for recepies, applications and references. In a message dated 8/11/03 2:43:27 PM Eastern Daylight Time, [EMAIL PROTECTED] writes: On Wednesday 16 July 2003 11:04:58 +0300, Yonathan (Jon) Anson [EMAIL PROTECTED] wrote: Is there an option for running SUR and 2SLS regressions with weighting (I am analysing mortality in towns, hence want to weight by population size) Many thanks Jon Anson The systemfit package can run SUR and 2SLS regressions. However, systemfit does not (yet) offer the user to provide weights for the regression. I did not hear anything about these regression methods so far. Can you tell me an article or textbook that explains how this should work? If this is not too much work, these methods might be implement in a new version of the systemfit package. (Jeff (the author and maintainer of systemfit) and I are just preparing a new version of the systemfit package that has several additional features (e.g. cross-equation restrictions.) Best wishes, Arne [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] subscripts in lists
sapply(lis, function(x) x[which(x == next) + 1]) [1] want1 want2 HTH, Andy From: Chris Knight I am tying myself in knots over subscripts when applied to lists I have a list along the lines of: lis-list(c(a,b,next,want1,c),c(d, next, want2, a)) From which I want to extract the values following next in each member of the list, i.e. something along the lines of answer-c( want1, want2). Is this possible without using loops? The elements of lis are of different lengths and next occurs once per element somewhere in the middle. The thought process behind this is: It's easy enough to do it for an individual element of the list: lis[[1]][match(next,lis[[1]])+1] but how to do that to all elements of the list? I can get their indices e.g. as a list using lapply: lapply(lapply(lis,match,x=next),+,y=1) or return a particular subscript using: lapply(lis,[, i=3) but don't see how one could combine the two to get answer-c(want1, want2) without resorting to: answer-character for(s in 1:length(lis)){ answer-c(answer,lis[[s]][match(next,lis[[s]])+1]) } Am I missing something obvious (or non-obvious)? I suppose the secondary question is 'should I care?'. I am intending to use this on hundreds of lists sometimes with tens of thousands of elements, with more than one version of next in each, so felt that the lower efficiency of looping was likely to matter. Any help much appreciated, Chris -- ~ Dr. Christopher G. Knight Tel:+44 (0)1865 275 111 Department of Plant Sciences +44 (0)1865 275 790 South Parks Road Oxford OX1 3RB UK ` · . , ,(((º ~ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo /r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] X11 not configured on linux RedHat 9
On Wed, 2003-08-13 at 12:53, Justin Fay wrote: I'm using Linux version 2.4.20-8smp (gcc version 3.2.2, RedHat 9). I installed R-1.7.1-1.src.rpm following INSTALL. However, no X11 device is found when I run R. X11() Error in X11() : X11 is not available In the configuration, I found checking for X... no How do I configure so that X11 device capability is installed? Justin, Apologies for the delay in replying as I have been away from my computer for a few hours. In an effort to better assist (presuming someone else has not already begun offline), can you provide some additional information about your system. You are using the 'smp' Linux kernel, which suggests the possibility of a multi-processor system. Is this correct? FWIW, the latest official RH kernel series is version 2.4.20-19.9. You have used the source RPM for R. Can you provide the exact rpmbuild command that you used to compile the source rpm? Also, please provide the rpm installation command that you used. Finally, please confirm the Linux GUI that you are using, which would by default be GNOME, but of course could be KDE or another UI. I am presuming that you are not running Linux purely in text console mode? I ask because of the possibility that an SMP box might be used as a network server as opposed to a workstation configuration and of course servers would be typically run in console mode to remove the GUI overhead. This question is the equivalent of a hardware tech asking Did you plug it in? ;-) Let me know on the above and I will do my best to assist. I have compiled both the raw source tarball and the srpm on my (non-SMP) RH 9 system without problem (as have others) using the same gcc version. Best regards, Marc Schwartz __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Manipulating text
Uwe Ligges [EMAIL PROTECTED] writes: Dennis Fisher wrote: In labeling axes, I want to combine symbols and text/superscripts. Examples include: m2 (m, followed by a superscripted 2) * µg (micrograms) How can I accomplish this in R? See ?plotmath, e.g.: plot(1:10, xlab=expression(m[2]), ylab=expression(mu*g)) Heatwave in Dortmund too, Uwe? ;-) plot(1:10, xlab=expression(m^2), ylab=expression(mu*g)) -- O__ Peter Dalgaard Blegdamsvej 3 c/ /'_ --- Dept. of Biostatistics 2200 Cph. N (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Princomp function in R
It is in package mva. On Tue, 12 Aug 2003, dai wrote: Date: Tue, 12 Aug 2003 13:51:10 -0700 From: dai [EMAIL PROTECTED] To: [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Subject: [R] Princomp function in R Hi, I want to use Princomp function in R, but com up an error as Error: couldn't find function princomp , can you help me resolve this problem? Thanks, Jixin Dai, Ph.D __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help -- Cheers, Kevin -- On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question. -- Charles Babbage (1791-1871) From Computer Stupidities: http://rinkworks.com/stupid/ -- Ko-Kang Kevin Wang Master of Science (MSc) Student SLC Tutor and Lab Demonstrator Department of Statistics University of Auckland New Zealand Homepage: http://www.stat.auckland.ac.nz/~kwan022 Ph: 373-7599 x88475 (City) x88480 (Tamaki) __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] tsdiag and tsStructure for np,ns,nt and nl determination
Hi R-Helpers, I'm dealing with the STL procedure and trying to apply the tsdiag and StructTS onto the ts object to analyse the different parameters which need to be set. How can I use the tsStructure tsdiag to create a seasonal, trend and cycle subseries plot so that I can select analyse the correct np,ns, nt and nl? The problem is that too much signal goes into the seasonal variation and that the trend is not followed as it should. I tried already several values for all the parameters following the article guidelines of Cleveland but the results don't differ a lot from each other. Is the period (n(p)) that is needed for the STL derived from the 'frequency' set by the time series object? Should I define the time series so that the frequency follows the growth season (dry and wet cycle) and not the years? Thanks a lot in advance, Jan (...Decomposing) __ Jan Verbesselt Research Associate Lab of Geomatics and Forest Engineering K.U. Leuven Vital Decosterstraat 102. B-3000 Leuven Belgium Tel:+32-16-329750 Fax: +32-16-329760 http://perswww.kuleuven.ac.be/~u0027178/VCard/mycard.php?name=janv http://gloveg.kuleuven.ac.be/ __ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Problems with addition in big POSIX dates
Whit == Whit Armstrong [EMAIL PROTECTED] on Wed, 13 Aug 2003 15:23:58 -0400 writes: Whit Have you noticed any problems with big dates (=1/1/2040) in R? Whit Here is the bit of code that I'm having trouble with: test.date - strptime(1/1/2040,format=%m/%d/%Y) unlist(test.date) Whit sec min hour mday mon year wday yday isdst Whit 0 0 0 1 0 140 0 0 0 date.plus.one - as.POSIXct(test.date) + 24*60*60 date.plus.one.lt - as.POSIXlt(date.plus.one) unlist(date.plus.one.lt) Whit sec min hour mday mon year wday yday isdst Whit 0 0 0 2 0 140 0 1 0 Whit Notice that wday (the weekday, 0=Sunday, 7=Saturday) doesn't change. Whit Am I missing something? Probably the C library millenium bug (not official name). The C library standard type for timedates, time_t, is usually encoded using 32-bit integers, measuring seconds since the beginning of 1970. It has been well-known for years that this will lead to integer overflow from 19 Jan 2038 : as.POSIXct(strptime(1/1/1970,format=%m/%d/%Y))+ .Machine$integer.max [1] 2038-01-19 03:14:07 CET I had thought that the R implementation carefully used doubles instead of integers everywhere, but I guess we somewhere rely on system-internal things even here. For me, on Intel- Linux (RH 7.3, newer gcc) it's even worse: unlist(date.plus.one.lt) sec min hour mday mon year wday yday isdst 0 0 0 2 0 140 6 0 0 ~ i.e. `wday' has been counted backwards, and `yday' has remained at 0. - I guess we have to wait for 64-bit implementations of time_t or write our own code that works around the many C-library-bugs we (the R community) have encountered concerning POSIX-time implementations. Prof Brian Ripley will know more on this.. Martin Maechler [EMAIL PROTECTED] http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO C16Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] error message in sem
Dear Remko, Can you supply the input that produced this error message? John At 04:50 PM 8/11/2003 -0700, Remko Duursma wrote: Dear R-helpers, i get a mysterious error message when using sem, it reads: Error in tapply(grad.P[arrows.2.free], ram[ram[, 1] == 2 ram[, 4] != : arguments must have same length what does this mean? remko - John Fox Department of Sociology McMaster University Hamilton, Ontario, Canada L8S 4M4 email: [EMAIL PROTECTED] phone: 905-525-9140x23604 web: www.socsci.mcmaster.ca/jfox __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Changing default browser in options()
so I have to type every single R session: options(browser='dillo') Is there anyway I can change this globally? If you put the line options(browser='dillo') in the .Rprofile of your home directory, it will fire up dillo the next time. HTH, Tobias __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Startup for RExcel
Hi When I start an instance of an R stats server using the R(D)COM RExcel Addin by Thomas Baier, it appears to start the server in a temporary directory. Is there any way I can change the directory in which the server starts in so that I can, for example, take advantage of Rprofile or Renviron files I may have in a particular directory? Thanks David __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] ^-operation exponentiation problem
Hi, There seems to be a problem with the power-operation of the form c(..., -a, ...)^x.yyy Four code examples for the same calculation, which perform differently: -3^3.2 Result: [1] -33.63474 c(-3,6)^3.2 Result: [1] NaN 309.0893 But: c(-3.62,3)^3 Result: [1] -47.43793 27.0 I can reproduce NaN even in the following calculation: c(-3,6)[1]^3.2 Result: [1] NaN but c(-3,6)[2]^3.2 Result: [1] 309.0893 Does anybody know this problem and a solution to it? We have tested the calculation under Windows XP for R version 1.6.0 and 1.7.1 Greetings Alex __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] default directory RGui for windows NT
Hello, Can anyone tell me how to change the default directory in RGui for windows NT? Thanx, Roy __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Re: www.acd.ucar.edu mailing list memberships reminder
Daniel Bayard [EMAIL PROTECTED] wrote: how do you add x and y error bars on a plot. Have queried the search engine? help.search(error bar) -- Philippe Glaziou Pasteur Institute of Cambodia __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] placing labels in polygon center ?
Richard A. O'Keefe wrote: I wrote: I found myself wishing for a function to rotate a vector. Is there one? I know about ?lag, but help.search(rotate) didn't find anything to the point. Here I was regarding a vector as a _sequence_. The (one-step) rotation of c(u,v,w,x,y,z) is c(v,w,x,y,z,u). This is pretty much the way APL uses the word rotate (the vertical-bar-overstruck-with-a-circle operator). Do you want: c(x[-1],x[1]) for a one-step 'rotation'? You could write a function: function(x,n){ c(x[-(1:n)],x[1:n]) } rotVec(1:10,5) [1] 6 7 8 9 10 1 2 3 4 5 except this fails for n=0 or nlength(x). Ah. function(x,n){ n - 1+(n-1)%%length(x) c(x[-(1:n)],x[1:n])} } seems to work. Even for negative n: rotVec(1:10,-1) [1] 10 1 2 3 4 5 6 7 8 9 Baz __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] What does m$... mean?
On Tue, 12 Aug 2003, Spencer Graves wrote: a$b = a[['b']] = attribute b of list a. (Not quite always. First, it is `component' not `attribute' and second $ and [[ ]] do behave differently, e.g. for data frames in 1.7.x.) A basic object in R is a list, and the $ operator provides one means of accessing named attributes of a list. Beginning with R 1.7, objects can also have slots, which are accessed as [EMAIL PROTECTED]. I have yet to understand why slots were introduced; perhaps someone else will explain this. Slots are part of objects which have formal (S4) classes, made using the `methods' package (so have been around since at least R 1.4.0). They are an implementation of the ideas of Chambers (1998). Formally classed objects are not just lists: they have rules for the number, names and types of the slots. (Currently they are lists, but that's an implementation detail.) -- Brian D. Ripley, [EMAIL PROTECTED] Professor of Applied Statistics, http://www.stats.ox.ac.uk/~ripley/ University of Oxford, Tel: +44 1865 272861 (self) 1 South Parks Road, +44 1865 272866 (PA) Oxford OX1 3TG, UKFax: +44 1865 272595 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Comprehesive Package/Library list?
Is there a list of all contributed R libraries available through CRAN? Ideally it would include a one or two line description. I am looking for a packages() command similar to library() but that would access the CRAN repository and provide a listing of the current libraries, and version. example: http://www.cpan.org/modules/01modules.index.html __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] function lme
Hadassa Brunschwig wrote: Thanks to everyone who replied to my first problem. Here is the second one: Is the function lme (Mixed Model) also in a foreign library yes. When you encounter this sort of problem, try help.search(lme) This will tell you which installed library has the function. (shouldnt, as this is a basic statistical function)? What's basic for some is extraneous for others. Which is why R was made to be extensible. It's a Good Thing, not an inconvenience. It makes R feature-rich, without being bloated. Users can specify what level of features they want to include. Cheers Jason -- Indigo Industrial Controls Ltd. 64-21-343-545 [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] default directory RGui for windows NT
On Mon, 11 Aug 2003, Roy Werkman wrote: Can anyone tell me how to change the default directory in RGui for windows NT? I take it you mean the working directory? At least two ways: 1) Right click on the Rgui shortcut, click on Properties. Enter the path into the Starting Location (or something like that, I'm using Chinese Windows and I'm translating the words). 2) In Rgui, File - Change dir... -- Cheers, Kevin -- On two occasions, I have been asked [by members of Parliament], 'Pray, Mr. Babbage, if you put into the machine wrong figures, will the right answers come out?' I am not able to rightly apprehend the kind of confusion of ideas that could provoke such a question. -- Charles Babbage (1791-1871) From Computer Stupidities: http://rinkworks.com/stupid/ -- Ko-Kang Kevin Wang Master of Science (MSc) Student SLC Tutor and Lab Demonstrator Department of Statistics University of Auckland New Zealand Homepage: http://www.stat.auckland.ac.nz/~kwan022 Ph: 373-7599 x88475 (City) x88480 (Tamaki) __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] error message in fitdistr
On 05-Aug-03 [EMAIL PROTECTED] wrote: Here is a numerical vector test test [1] 206 53 124 112 92 77 118 75 48 176 90 74 107 126 99 84 ... 89 94 69 74 99 97 91 92 Assuming it follows a lognormal distribution I'd like to determine the mean and the sd thanks to maximum likelihood estimation fitdistr(test,lognormal,start=list(200,10)) Error in print.fitdistr(structure(list(estimate = c(4.54666263736726, : more elements supplied than there are to replace I chose the parameter start randomly I don't understand the error message. Has anybody ever encountered such one? Hmmm. Not being practised with fitdist, this took me a moment to track down. However, the clues are: 1. In ?fitdist :: fitdistr(x, densfun, start, ...) start: A named list giving the parameters to be optimized with initial values. This can be omitted for some of the named distributions (see Details) [not lognormal]. 2. Hence start must be a _named_ list, i.e. its components must have names. So the question is: what to call them? For this you need to know what the names are for the parameters in your designated distribution. So: 3. help.search(lognormal) - Lognormal(base) 4. ?Lognormal :: dlnorm(x, meanlog = 0, sdlog = 1, log = FALSE) So it looks as though you need names meanlog and sdlog, so now try fitdistr(test,lognormal,start=list(meanlog=4,sdlog=0.4)) with results meanlog sdlog 4.55316203 0.38990402 (0.02866631) (0.02026545) and it works! The starting values 4 and 0.4 were chosen because mean(log(test)) [1] 4.553205 sd(log(test)) [1] 0.3910148 and of course it works if you start elsewhere; but this also shows that the naive estimate, in this case, was very good. Best wishes, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 167 1972 Date: 05-Aug-03 Time: 13:00:07 -- XFMail -- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Marginal (type II) SS for powers of continuous variables ina linear model?
Prof Brian Ripley [EMAIL PROTECTED] writes: drop1 is the part of R that does type II sum of squares, and it works in your example. So does Anova in the current car: I'm sorry, I should have included an example to clarify what I meant (or point out my misunderstandings :-). I'll do that below, but first a comment: And in summary.aov() those *are* marginal SS, as balance is assumed for aov models. (That is not to say the software does not work otherwise, but the interpretability depends on balance.) Maybe I've misunderstood, but in the documentation for aov, it says (under Details): This provides a wrapper to `lm' for fitting linear models to balanced or unbalanced experimental designs. Also, is this example (lm(y~x+I(x^2), Df)) really balanced? I think of balance as the property that there is an equal number of observations for every combination of the factors. With x and x^2, this doesn't happen. For instance, x=1 and x^2=1 occurs once, but x=1 and x^2=4 never occurs (naturally). Or have I misunderstood something? Now, the example: Df2 - expand.grid (A=factor(1:2), B=factor(1:2), x=1:5) Df2$y - codes(Df2$A) + 2*codes(Df2$B) + 0.05*codes(Df2$A)*codes(Df2$B) + + Df2$x + 0.1*Df2$x^2 + 0.1*(0:4) Df2 - Df2[-1,]# Remove one observation to make it unbalanced ABx2.lm - lm(y~A*B + x + I(x^2), data=Df2) The SSs I call marginal are R(A | B, x, x^2), R(B | A, x, x^2), R(A:B | A, B, x, x^2), R(x | A, B, A:B) and R(x^2 | A, B, A:B, x). (Here, for instance, R(x | A, B, A:B) means the reduction of SSE due to including x in a model when A, B and A:B (and the mean) are already in the model. I've omitted the mean from the notation.) anova(ABx2.lm) Analysis of Variance Table Response: y Df Sum Sq Mean Sq F valuePr(F) A 1 1.737 1.737 66.5700 1.801e-06 *** B 1 13.647 13.647 523.0292 6.953e-12 *** x 1 93.677 93.677 3590.1703 2.2e-16 *** I(x^2) 1 0.583 0.583 22.3302 0.0003966 *** A:B1 0.011 0.0110.4238 0.5263772 Residuals 13 0.339 0.026 --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 This gives SSs on the form R(A), R(B | A), R(x | A, B) etc. (If the design had been balanced (in A, B and x), this would have been the same as the marginal SSs above.) drop1(ABx2.lm) Single term deletions Model: y ~ A * B + x + I(x^2) Df Sum of Sq RSS AIC none0.339 -64.486 x 1 1.188 1.527 -37.901 I(x^2) 1 0.592 0.931 -47.294 A:B 1 0.011 0.350 -65.877 This gives the SSs R(x | A, B, A:B, x^2), R(x^2 | A, B, A:B, x) and R(A:B | A, B, x, x^2). The SS for x is not marginal as defined above. library (car) Anova(ABx2.lm) Anova Table (Type II tests) Response: y Sum Sq Df F valuePr(F) A 5.1806 1 198.5470 2.979e-09 *** B 19.6610 1 753.5074 6.778e-13 *** x 1.1879 1 45.5245 1.368e-05 *** I(x^2) 0.5922 1 22.6970 0.0003699 *** A:B0.0111 1 0.4238 0.5263772 Residuals 0.3392 13 --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 This gives marginal SSs for A, B, x^2 and A:B, but as with drop1, the SS for x is R(x | A, B, A:B, x^2). The only way I've figured out to give the `correct' SS for x, i.e., R(x | A, B, A:B), is: AB.lm - lm(y~A*B, data=Df2) ABx.lm - lm(y~A*B + x, data=Df2) anova (AB.lm, ABx.lm, ABx2.lm) Analysis of Variance Table Model 1: y ~ A * B Model 2: y ~ A * B + x Model 3: y ~ A * B + x + I(x^2) Res.DfRSS Df Sum of SqFPr(F) 1 15 93.760 2 14 0.931 192.829 3557.651 2.2e-16 *** 3 13 0.339 1 0.592 22.697 0.0003699 *** --- Signif. codes: 0 `***' 0.001 `**' 0.01 `*' 0.05 `.' 0.1 ` ' 1 (The ABx2.lm is included to give the same error term to test against as in the ANOVAs above.) The baseline of all this is that I think it would be nice if a function like Anova in the car package returned R(x | A, B, A:B) instead of R(x | A, B, A:B, x^2) as SS for x in a model such as the above. (I hope I've made myself clearer, and not insulted anyone by oversimplifying. :-) -- Bjørn-Helge Mevik __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] How to get the pseudo left inverse of a singular squarematrix?
As already pointed out ZZ' is not invertible. That is, it is not one-to-one and onto. What we can do is restrict the domain and range of ZZ' to the range of ZZ' or equivalently to the range of Z. In operational terms this means if y = ZZ'x then we only consider y's expressable as y = Zu for some u and x's expressable as x = Zw for some w. 1. With this restriction ZZ' is one-to-one and onto and the generalized inverse as given by the R function ginv is its inverse, as already mentioned. 2. A second way to get the generalized if Z has full column rank, i.e. its columns are linearly independent, is to note that H, the inverse of Z'Z exists and ZHHZ' is the required inverse. This is because, if y = ZZ'x then ZHHZ'y = ZHHZ'ZZ'x = ZHHZ'ZZ'Zw = Zw = x --- Feng Zhang [EMAIL PROTECTED] wrote: Thank, Jerome The question is if this generalized inverse can make their product to be identity matrix? - Original Message - From: Jerome Asselin [EMAIL PROTECTED] To: Feng Zhang [EMAIL PROTECTED]; R-Help [EMAIL PROTECTED] Sent: Thursday, August 14, 2003 11:52 AM Subject: Re: [R] How to get the pseudo left inverse of a singular square matrix? Singular matrices are not invertible. However you can calculate the generalized inverse with the function ginv() from package MASS. HTH, Jerome On August 14, 2003 09:24 am, Feng Zhang wrote: Dear R-listers, I have a dxr matrix Z, where d r. And the product Z*Z' is a singular square matrix. The problem is how to get the left inverse U of this singular matrix Z*Z', such that U*(Z*Z') = I? Is there any to figure it out using matrix decomposition method? Thanks a lot for your help. Fred __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] economic woes?
hiya! check this: it's very special.only the banks know about it.. I personally couldnt have got out of the mess I was in without this site --- http://btrack.iwon.com/r.pl?redir=http://[EMAIL PROTECTED]/index.asp?RefID=198478 --- dont want any more? http://srd.yahoo.com/drst/97576/*http://onlinesaleew.com/auto/index.htm __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] code speed help? -- example and results provided
It doesn't seem that you need data frame to do this since x1 and x2 are always numeric. I think your final data frame object has N rows. This should be much faster. n - 5 N - 10 life - c(3,2,7,8,10) ind - N-life matrix(rep(rep(0:1,n),c(rbind(life,ind))),ncol=N,byrow=T) BTW, it would have been easier to help if you had put your executable example ready to cut and paste. All the and + make it tedious to reproduce your example. HTH, Jerome On August 5, 2003 11:28 am, Debruicker, Paul Andrew wrote: I have the following piece of code that combines lists comprised of components of varying length into a list with components of constant length. I have found 2 ways to do it, and the faster of the two is posted below along with sample results. Do you have any suggestions on how to decrease the calculation time by modifying the code? Function### replacement2.idx-function(life=w.life,N=years,n=samples){ + + yrs-rep(N,n) + ind-yrs-life + + x1-mapply(rep,times=life,x=0) + x2-mapply(rep,times=ind,x=1) + + x3-data.frame(c(x1[[1]],x2[[1]])) + + for(i in 2:n) x3-data.frame(x3, append(x1[[i]],x2[[i]])) + + x3-t(x3) + } ###Sample Output### samples-5 years-10 w.life-round(rnorm(samples,5,1),digits=0) system.time(abc-replacement2.idx()) [1] 0.04 0.00 0.07 0.00 0.00 abc 1 2 3 4 5 6 7 8 9 10 c.x1..1x2..1... 0 0 0 0 0 0 1 1 1 1 append.x1..ix2..i... 0 0 0 0 0 0 1 1 1 1 append.x1..ix2..i... 0 0 0 0 0 0 1 1 1 1 append.x1..ix2..i... 0 0 0 0 1 1 1 1 1 1 append.x1..ix2..i... 0 0 0 0 0 1 1 1 1 1 ###1000 samples samples-1000 w.life-round(rnorm(samples,5,.5),digits=0) system.time(method2-replacement2.idx()) [1] 12.79 0.00 14.04 0.00 0.00 ###5000 samples samples-5000 w.life-round(rnorm(samples,5,.5),digits=0) system.time(method2-replacement2.idx()) [1] 544.82 0.00 593.98 0.00 0.00 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] evaluating and walking in names
On 06-Aug-03 Cezar Augusto de Freitas Anselmo wrote: Hi, all. Suppose I have an object with names (like a data.frame) and I want to walk in a loop with your names. How can I do this? The idea is like this: my.data-data.frame(matrix(runif(6),ncol=2)) names(my.data) [1] X1 X2 for(i in names(my.data)){ my.variable - cat(paste(my.data$, i, \n, sep=)) print(mean(my.variable)) } #it doesn't work. Hi Cezar, First of all, you should get rid of those \n -- they intrude: for(i in names(my.data)){ print(paste(my.data$, i, \n, sep=))} [1] my.data$X1\n [1] my.data$X2\n for(i in names(my.data)){ print(paste(my.data$, i, sep=))} [1] my.data$X1 [1] my.data$X2 Second, you don't need to do the above anyway: the simplest way to refer to the variable with the name name is simply to index the column by name: for(i in names(my.data)){ my.variable-my.data[,i];print(mean(my.variable))} [1] 0.3302733 [1] 0.6119088 To see this, have a look at my.data[,X1] my.data[,X2] I hope this breaks the block! QUESTION TO EXPERTS: While (a construction I've often used successfully): for(Z in c(X1,X2,X3)){ Z-eval(as.name(Z)) do.something.with(Z) } works, going through the variables named X1, X2, X3 in turn, when I was trying to clean up Cezar's example above I found that if you construct the name Z by pasting so that it comes to my.data$X1 then the object my.data$X1 is not found. Presumably this is because the $ operator is not functional in this context, but I can't locate an explanation of this. Can anyone elucidate? Best wishes, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 167 1972 Date: 06-Aug-03 Time: 22:41:45 -- XFMail -- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] The desire for prettier and cheaper images ...
ChRi == Ritter, Christian C MCIL-CTGAS [EMAIL PROTECTED] on Wed, 13 Aug 2003 11:49:03 +0200 writes: ChRi This might be easy (but I didn't find an answer in the archives). ChRi I'm trying to make nice looking images (using image()). ChRi To make them look nice (not jagged), it usually takes ChRi me at least 100x100 points. This can be slow for ChRi frequent redraws. and also for (postscript) printing. For true image data, it would be nice to have true pixel-map graphics as part of the basic graphic engine, but I'm not really competent here ChRi Is there a smarter (less point intensive) way? ChRi I was thinking in terms of hexabins, for example, ChRi which for much less jagged looking regions, or of an ChRi option to image ( or a variation) which internally ChRi increases the grid. ChRi Any help welcome. Thanks in advance. There's the hexbin package from Bioconductor for hexagonal bin plots -- which really does help for some of the problems you mention. Martin Maechler [EMAIL PROTECTED] http://stat.ethz.ch/~maechler/ Seminar fuer Statistik, ETH-Zentrum LEO C16Leonhardstr. 27 ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND phone: x-41-1-632-3408 fax: ...-1228 __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] (no subject)
Hi everybody, Hope your are not all on holyday because I've got a problem that is going to drive me crazy... I would like to remove some rows from a dataframe. The rows correspond to some specific indexes which I can get by looking at the name in the first column of my dataset. But I manage to get only the opposite of what I really want (function #1) #Function#1: remove.func-function(data){ Name-as.character(data[,1]) indexZZ-grep(ZZ,Name,value=FALSE) data-data[indexZZ,] # give me what I don't want print(slide) } #Function#2: remove.func-function(data,Name){ Name-as.character(data[,1]) indexZZ-grep(ZZ,Name,value=FALSE) data-data[!indexZZ,] #doesn't work, give an empty dataframe print(slide) } Thanks :| Nolwenn Le Meur Nolwenn Le Meur INSERM U533 Faculté de médecine 1, rue Gaston Veil 44035 Nantes Cedex 1 France Tel: (+33)-2-40-41-29-86 (office) (+33)-2-40-41-28-44 (secretary) Fax: (+33)-2-40-41-29-50 mail: [EMAIL PROTECTED] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Problems with addition in big POSIX dates
Have you noticed any problems with big dates (=1/1/2040) in R? Here is the bit of code that I'm having trouble with: test.date - strptime(1/1/2040,format=%m/%d/%Y) unlist(test.date) sec min hour mday mon year wday yday isdst 0 0 0 1 0 140 0 0 0 date.plus.one - as.POSIXct(test.date) + 24*60*60 date.plus.one.lt - as.POSIXlt(date.plus.one) unlist(date.plus.one.lt) sec min hour mday mon year wday yday isdst 0 0 0 2 0 140 0 1 0 Notice that wday (the weekday, 0=Sunday, 7=Saturday) doesn't change. Am I missing something? Thanks, Whit Armstrong platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major1 minor6.2 year 2003 month01 day 10 language R [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] Replacing underscore character in Windows GUI
On 12 Aug 2003 at 17:38, nels.tomlinson.1 wrote: I thought one of the reasons for removing the underscore as synonym to - was that at some later point it could be reintroduced in the grammar, for example as a valid part of variable names. If this is the case, this suggestion is a bad idea. Better to forget the habvit of using _ for assignment! Maybe this reemplacement of _ with - will be removed from ess too? Kjetil Halvorsen Hello, all, I'd like to propose that now that the underscore-as-assignment-operator is to be removed from R (good thing, too), that the Windows GUI should replace the underscore ``_'' with the proper assignment operator ``-'' when you type in the underscore character. This is the current default behaviour in the ESS mode in emacs, and seems to me to be a generally good idea. If no one can come up with a good reason not to do this, I hope that the maintainers of the GUI will put it on their to-do list. Thanks, Nels __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] pb of importation data: truncation...
Dear all, I'm importing some data (with read.table, file .txt) but I have some problem: R truncates my numeric data at 2 digits during the importation... It's the first time that I see that. Thanks for an answer. David __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] newbie question: fitting power law
Thomas Hoffmann [EMAIL PROTECTED] writes: Dear R-helpers, dear Andrew Andrew C. Ward schrieb: Dear Thomas, I wonder if you have any NAs in xy$x or xy$y. The Dataframe looks like the following: xy x y 1 3.0 121.50951 2 2.0 30.61258 3 4.0 323.14837 4 8.2 3709.92471 For testing reasons I calculated y by: y - 2.9 x^3.4 Did you read the help page for nls that emphasizes *Do not use 'nls' on artificial zero-residual data.* and explains why? In any case, the best way to fit such a model to these data is to use the plinear algorithm for partially linear models. Either nls(y ~ x^exp(logpow), data=xy, start = c(logpow=0.1), alg='plinear',trace = TRUE) 2661838 : 0.1000 281.0589 87270.38 : 0.9550582 15.4392528 1573.086 : 1.181199 3.903272 1.645442 : 1.222351 2.929585 2.301169e-06 : 1.223774 2.900035 1.483770e-11 : 1.223775 2.90 1.483769e-11 : 1.223775 2.90 Nonlinear regression model model: y ~ x^exp(logpow) data: xy logpow .lin 1.223775 2.90 residual sum-of-squares: 1.483769e-11 or nls(y ~ exp(log(x) * pow), data=xy, start = c(pow=1.1), alg = 'plinear', trace = TRUE) 2684530 : 1.1000 283.5010 408828.2 : 2.045211 47.930710 3.73 : 2.848788 9.185464 857.465 : 3.293871 3.622750 1.307911 : 3.395685 2.926367 3.723389e-06 : 3.33 2.900044 1.483772e-11 : 3.4 2.9 1.483769e-11 : 3.4 2.9 Nonlinear regression model model: y ~ exp(log(x) * pow) data: xy pow .lin 3.4 2.9 residual sum-of-squares: 1.483769e-11 Also, I think you could take logs of your equation and end up with a linear expression? if I use: plot (x,y) abline lm ( log(y)~log(x),xy) the line does not seem to fit the plotted datapoints at all. While the fitted exponent seems to be okay, the obtained intercept value is wrong. That's because your plot is in the x,y scale and the line is in the log(x), log(y) scale. You need to convert back to the original scale to put the line on the plot. -- Douglas Bates[EMAIL PROTECTED] Statistics Department608/262-2598 University of Wisconsin - Madisonhttp://www.stat.wisc.edu/~bates/ __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] capturing output from Win 98 shell
Why should it take months to get these installed ? Both R and emacs are simple and free to install. If high speed internet access is a problem, you can always download these from some Internet Café or a friend, burn it into CD and install onto the machines. If you have red tapes on installing softwares, then good luck. I suppose they would not be so happy purchasing SPLUS than installing free softwares for you. -Original Message- From: Bashir Saghir (Aztek Global) [mailto:[EMAIL PROTECTED] Sent: Wednesday, August 13, 2003 6:02 PM To: 'Simon Fear'; Prof Brian Ripley; Uwe Ligges Cc: [EMAIL PROTECTED] Subject: RE: [R] capturing output from Win 98 shell Believe me, using Win98 is NOT my choice. I would only ever use Unix/Linux. Are there other statisticians similarly limited? Like Simon I am very often limited with choice of software and OS when working for clients. I've been waiting for about 5 months to get an editor installed on my machine. I have requested emacs but will settle for anything but the current choice - MS Notepad (I'm serious). The first time we requested an R installation we waited about 3 or 4 months (thanks to constant pressure from our statistical guru). To get the latest version of R we had another 3 or 4 months wait! Then when we finally got it (version 1.6.2) then next version had been released a week earlier (1.7.0 - I think)! Very frustrating! As you can imagine every time I read Please upgrade to version 1.7.x - I just wish it was so simple! Best regards, Saghir - Legal Notice: This electronic mail and its attachments are i...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
RE: [R] capturing output from Win 98 shell
Peter, thanks for quick reply, but I can't drop it: system(dir /b, intern=T, show.output.on.console=T) Error in system(dir /b, intern = T, show.output.on.console = T) : dir not found From: Peter Dalgaard BSA [mailto:[EMAIL PROTECTED] snip Does it help if you drop the COMMAND.COM /c bit?? Simon Fear Senior Statistician Syne qua non Ltd Tel: +44 (0) 1379 69 Fax: +44 (0) 1379 65 email: [EMAIL PROTECTED] web: http://www.synequanon.com Number of attachments included with this message: 0 This message (and any associated files) is confidential and\...{{dropped}} __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Regexpr with .
I'm trying to use the regexpr function to locate the decimal in a character string. Regardless of the position of the decimal, the function returns 1. For example, regexpr(., Female.Alabama) [1] 1 attr(,match.length) [1] 1 In trying to figure out what was going on here, I tried the below command: gsub(., ,, Female.Alabama) [1] ,, It looks like R is treating every character in the string as if it were decimal. I didn't see anything in the help file about . being some kind of special character. Any idea why R is treating a decimal this way in these functions? Any suggestions how to get around this? Thanks for any suggestions. -Trevor [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] Integer precision etc.
Hi Folks, With a bit of experimentation I have determined (I think) that on my R implementation the largest positive integer that is exactly represented is (2^53 - 1), based on (((2^53)-1)+1) - ((2^53)-1) [1] 1 ((2^53)+1) - (2^53) [1] 0 System: platform i686-pc-linux-gnu arch i686 os linux-gnu system i686, linux-gnu status major1 minor6.1 year 2002 month11 day 01 language R Is there any other way to determine this sort of information? With thanks, Ted. E-Mail: (Ted Harding) [EMAIL PROTECTED] Fax-to-email: +44 (0)870 167 1972 Date: 13-Aug-03 Time: 13:55:25 -- XFMail -- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
[R] converting GLM from SAS to R
Dear List members, I am in the process of translating a number of SAS programs into R scripts. The translation is surprisingly straight-forward. However, I want to convert some PROC GLM code to glm in R. Unfortunately my understanding of the procedure has become rust through the years. The SAS code I want to translate is: proc glm data=combined(where=(auc not in(0 .) and trial=i)); class id occ seq; model tmax cmax auc lauc lcmax ratio= seq id occ id(seq) ; test h = seq e = id(seq)/htype=3 etype=3; estimate '0 vs 1' occ 1-1; * 1 trt 2 ref; lsmeans occ; run; Any guidance would be greatly appreciated. Harvey __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help
Re: [R] re: two dimentional hierarchical clustering algorithm
Dear Dr. Liaw Andy: I have a few more questions about your heatmap function. actually heatmap is what I am looking for. heatmap(x, Rowv, Colv, distfun = dist, hclustfun = hclust, add.expr, scale=c(row, column, none), na.rm = TRUE, ...) my data is a XNEW, dim(XNEW) [1] 554 335 554 genes, 335 samples. now I want to use 1-CORR as a distance measure and hclust(method=ward) as hclustfun. is there any way for me to define these two in heatmap options? thanks. lp - Original Message - From: Liaw, Andy [EMAIL PROTECTED] To: 'liping' [EMAIL PROTECTED] Sent: Monday, August 11, 2003 10:35 AM Subject: RE: [R] re: two dimentional hierarchical clustering algorithm Check out the heatmap() function in the 'mva' package (came with R) and see if that does what you want. Andy -Original Message- From: liping [mailto:[EMAIL PROTECTED] Sent: Monday, August 11, 2003 10:12 AM To: [EMAIL PROTECTED] Subject: [R] re: two dimentional hierarchical clustering algorithm Dear R users: do you know if R or SPLUS has a package for two dimentional hierarchical clustering algorithm??? I am trying to use that algorithm to cluster samples and genes at the same.thanks LP [[alternative HTML version deleted]] __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo /r-help -- Notice: This e-mail message, together with any attachments, contains information of Merck Co., Inc. (Whitehouse Station, New Jersey, USA), and/or its affiliates (which may be known outside the United States as Merck Frosst, Merck Sharp Dohme or MSD) that may be confidential, proprietary copyrighted and/or legally privileged, and is intended solely for the use of the individual or entity named on this message. If you are not the intended recipient, and have received this message in error, please immediately return this by e-mail and then delete it. -- __ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help