Re: [R] Unexpected behavior of predict and interval=confidence
On Sun, 2006-10-29 at 12:54 -0500, Kevin Middleton wrote: Based on some recent r-help discussions, I have been trying out plotting confidence intervals using predict and matplot. Matplot appeared to not be plotting the linear regression when using the default column names generated by read.table (V1, V2, etc). On further inspection, the error seemed to be with predict and vector names (V1, V2) rather than with matplot. I was using some textbook data sets that were read with read.table, so my data.frame columns were named by default. The problem seems to be related to the name of the vector only (though I may be wrong). The example below, based on that in ?predict.lm, better describes the problem. Using predict with V2~V1 y~x produces identical output (when x-V1 and y-V2). However, using predict with interval=confidence results in different output from the same data. That with y~x is correct, and V2~V1 is incorrect. This is because you have been caught out by the way newdata is handled in predict. This is your problem: new - data.frame(x = seq(min(V1), max(V1), length.out = length(V1))) names(new) You have created new, a 1 column data frame with the colname x. As x doesn't exist in the model formula (V2 ~ V1), what the predict line actually means, is to predict value for the observed data used to fit them model, i.e. the fitted values: pred.w.clim - predict(lm(V2 ~ V1), new, interval=confidence) fit - fitted(lm(V2 ~ V1)) all.equal(fit, pred.w.clim[, 1]) When you do predict(lm(y ~ x), new, interval=confidence), x is now in the model formula *and* in new so you get predictions for the x values in new. If you'd done this: new - data.frame(V1 = seq(min(V1), max(V1), length.out = length(V1))) predict(lm(V2 ~ V1), new, interval=confidence) Then you'd have gotten what you wanted. HTH G This may be related to a previous post on r-help: http://finzi.psych.upenn.edu/R/Rhelp02a/archive/56982.html I can't figure out why there would be a difference in predict when only the vector name seemingly changes. Granted, I could just read the data.frame is as x and y. Thanks Kevin ## set.seed(10) # For example purposes, plot side by side par(mfrow=c(1,2)) V1 - rnorm(15) V2 - V1 + rnorm(15) new - data.frame(x = seq(min(V1), max(V1), length.out = length(V1))) pred.w.clim - predict(lm(V2 ~ V1), new, interval=confidence) matplot(new$x, pred.w.clim, lty=c(1,2,2), type=l, col=c(black, red, red), ylab=predicted y) points(V1,V2) # Create x y equal to V1 V2 x - V1 y - V2 pred.w.clim2 - predict(lm(y ~ x), new, interval=confidence) matplot(new$x, pred.w.clim2, lty=c(1,2,2), type=l, col=c(black, red, red), ylab=predicted y) points(x,y) # Test if V1=x, V2=y all.equal(x,V1) all.equal(y,V2) # Same output with predict predict(lm(V2 ~ V1)) predict(lm(y ~ x)) all.equal(predict(lm(V2 ~ V1)), predict(lm(y ~ x))) # Different output with interval=confidence pred.w.clim pred.w.clim2 all.equal(pred.w.clim, pred.w.clim2) __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC [f] +44 (0)20 7679 0565 UCL Department of Geography Pearson Building [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street London, UK[w] http://www.ucl.ac.uk/~ucfagls/ WC1E 6BT [w] http://www.freshwaters.org.uk/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how to combine imputed data-sets from mice for classfication
Dear R users I want to combine multiply imputed data-sets generated from mice to do classfication. However, I have various questions regarding the use of mice library. For example suppose I want to predict the class in this data.frame: data(nhanes) mydf=nhanes mydf$class=pos mydf$class[sample(1:nrow(mydf), size=0.5*nrow(mydf))]=neg mydf$class=factor(mydf$class) First I impute: imp=mice(mydf) I want to use randomForest to do my analysis, not the inbuilt glm.mids functions. In a previous post it was suggested to substitute the call to (g)lm.mids for the analysis one needs to perform: (from http://tolstoy.newcastle.edu.au/R/help/06/03/22295.html) analyses - as.list(1:data$m) for (i in 1:data$m) { data.i - complete(data, i) analyses[[i]] - lm(formula, data = data.i, ...) } Is the idea that then I should just combine the results(predictions) of randomForest from all 5 data-sets? In that case what does the pool function do? Do I need to use it? Also, if I was to use glm.mids for my predictions I get an error: imp.fit=glm.mids(class ~., data=imp) Error: NA/NaN/Inf in foreign function call (arg 4) In addition: Warning messages: 1: - not meaningful for factors in: Ops.factor(y, mu) 2: - not meaningful for factors in: Ops.factor(eta, offset) 3: - not meaningful for factors in: Ops.factor(y, mu) But this works: imp.fit=glm.mids((class==pos) ~., data=imp) In this case I don't know how to interpret the result.. I would appreciate any suggestions on these. Many Thanks Eleni Rapsomaniki __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Composition like classes functions
Hello! I am working on breed composition of animals in my project. Say I have an animal 1 with parents 2 (father) and 3 (mother). If father is of breed A and mother of breed B, then their descendant is of breed AB or 50 % of A and 50 % of B. I would like to have a general way to represent this kind of data. I was thinking about list structure i.e. list(A=0.5, B=0.5) $A [1] 0.5 $B [1] 0.5 Additionally, it should accommodate for more than 2 classes. However, I would like to ask if there is anything like this already in R or contributed packages. Thanks! -- Lep pozdrav / With regards, Gregor Gorjanc -- University of Ljubljana PhD student Biotechnical Faculty Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan Groblje 3 mail: gregor.gorjanc at bfro.uni-lj.si SI-1230 Domzale tel: +386 (0)1 72 17 861 Slovenia, Europefax: +386 (0)1 72 17 888 -- One must learn by doing the thing; for though you think you know it, you have no certainty until you try. Sophocles ~ 450 B.C. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] for importing data
*I am a very new user of R. I've spent several hours trying to import data, so I feel okay asking the list for help. * *I had an Excel file, then I turned it into a tab-delimited file, as instructed by directions My filename is lahore.txt I amusing the following commands for read.delim but i am getting following mesages. Sir i am sending you my excel data file i request you to please write the right read.delim function for importing data file after transforming it into a tab-delimited form.* lahore-read.delim(lahore.txt) Error in file(file, r) : unable to open connection In addition: Warning message: cannot open file 'lahore.txt', reason 'No such file or directory' Regards AMINA SHAHZADI*.* Department of Statistics GC University Lahore, Pakistan. Email: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] for importing data
Move to the appropriate directory first (or else move your file to where you are now). For example, 1. if the file is in \ then setwd(/) 2. or getwd() which shows where you are now and then you can move your file to that spot. 3. Another possibility is: read.delim(file.choose()) which will bring up a file explorer window so you can traverse the file system to find it. On 10/30/06, amna khan [EMAIL PROTECTED] wrote: *I am a very new user of R. I've spent several hours trying to import data, so I feel okay asking the list for help. * *I had an Excel file, then I turned it into a tab-delimited file, as instructed by directions My filename is lahore.txt I amusing the following commands for read.delim but i am getting following mesages. Sir i am sending you my excel data file i request you to please write the right read.delim function for importing data file after transforming it into a tab-delimited form.* lahore-read.delim(lahore.txt) Error in file(file, r) : unable to open connection In addition: Warning message: cannot open file 'lahore.txt', reason 'No such file or directory' Regards AMINA SHAHZADI*.* Department of Statistics GC University Lahore, Pakistan. Email: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] for importing data
Most likely the file lahore.txt isn't in the current working directory, which is where R will be looking for it as you don't specify a path (I'm assuming that you are working in Windows). If so, you have three options. 1) Move lahore.txt to the current working directory (you can find with directory that is using the function getwd()). 2) Specify the full path in read.delim (e.g., read.delim(c:/my documents/data/lahore.txt). 3) Change the working directory to the one in which lahore.txt is located using the function setwd(). Hope this helps. David On 30/10/06, amna khan [EMAIL PROTECTED] wrote: *I am a very new user of R. I've spent several hours trying to import data, so I feel okay asking the list for help. * *I had an Excel file, then I turned it into a tab-delimited file, as instructed by directions My filename is lahore.txt I amusing the following commands for read.delim but i am getting following mesages. Sir i am sending you my excel data file i request you to please write the right read.delim function for importing data file after transforming it into a tab-delimited form.* lahore-read.delim(lahore.txt) Error in file(file, r) : unable to open connection In addition: Warning message: cannot open file 'lahore.txt', reason 'No such file or directory' Regards AMINA SHAHZADI*.* Department of Statistics GC University Lahore, Pakistan. Email: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Multivariate regression
Hello Ravi, have you considered the SUR method proposed by Zellner? An implementation of it is provided in CRAN-package 'systemfit' (see ?systemfit for more information). Best, Bernhard Suppose I have a multivariate response Y (n x k) obtained at a set of predictors X (n x p). I would like to perform a linear regression taking into consideration the covariance structure of Y within each unit - this would be represented by a specified matrix V (k x k), assumed to be the same across units. How do I use lm to do this? One approach that I was thinking of is as follows: Flatten Y to a vector, say, Yvec (n*k x 1). Create Xvec (n*k, p*k) such that it is made up of block matrices Bij (k x k), where Bij is a diagonal matrix with X_ij as the diagonal (i = 1,.n, and j = 1,.,p). Now I can use lm in a univariate mode to regress Yvec against Xvec, with covariance matrix Vvec (n*k x n*k). Vvec is a block-diagonal matrix with blocks of V along the diagonal. This seems like a valid approach, but I still don't know how to specify the covariance structure to do weighted least squares. Any help is appreciated. Best, Ravi. --- - --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html --- - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. * Confidentiality Note: The information contained in this mess...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Multivariate regression
Also you can take a look on Partial Least Squares (PLS) regression. http://www.statsoft.com/textbook/stpls.html R-package: http://mevik.net/work/software/pls.html Andris Jankevics On Sestdiena, 28. Oktobris 2006 06:04, Ritwik Sinha wrote: You can use gee ( http://finzi.psych.upenn.edu/R/library/geepack/html/00Index.html) or maybe the function gls in nlme. Ritwik. On 10/27/06, Ravi Varadhan [EMAIL PROTECTED] wrote: Hi, Suppose I have a multivariate response Y (n x k) obtained at a set of predictors X (n x p). I would like to perform a linear regression taking into consideration the covariance structure of Y within each unit - this would be represented by a specified matrix V (k x k), assumed to be the same across units. How do I use lm to do this? One approach that I was thinking of is as follows: Flatten Y to a vector, say, Yvec (n*k x 1). Create Xvec (n*k, p*k) such that it is made up of block matrices Bij (k x k), where Bij is a diagonal matrix with X_ij as the diagonal (i = 1,.n, and j = 1,.,p). Now I can use lm in a univariate mode to regress Yvec against Xvec, with covariance matrix Vvec (n*k x n*k). Vvec is a block-diagonal matrix with blocks of V along the diagonal. This seems like a valid approach, but I still don't know how to specify the covariance structure to do weighted least squares. Any help is appreciated. Best, Ravi. - --- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html - --- [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] for importing data
On Mon, 30 Oct 2006, amna khan wrote: *I am a very new user of R. I've spent several hours trying to import data, so I feel okay asking the list for help. * *I had an Excel file, then I turned it into a tab-delimited file, as instructed by directions My filename is lahore.txt I amusing the following commands for read.delim but i am getting following mesages. Sir i am sending you my excel data file i request you to please write the right read.delim function for importing data file after transforming it into a tab-delimited form.* lahore-read.delim(lahore.txt) Error in file(file, r) : unable to open connection In addition: Warning message: cannot open file 'lahore.txt', reason 'No such file or directory' I am sure that your experience is familiar to many of us, especially those using R with beginners. From the error messages, you can see that the file is not present where R is looking for it. R is looking in your working directory - use getwd() to see what that is. setwd() will let you move to the correct directory - please use / as the separator on the directory path. The function list.files() will show the files in the directory. If you are using Windows, it is further likely that the file is not actually called what you named it (Windows can add extra .* extensions which you do not see unless you have told Windows Explorer to show them). On Windows, you can use file.choose() to find the file visually, but it is usually better to learn the direct methods, because they are recorded in your session history, which you can save as documentation of your work - something that is extremely useful if you return to a project after some days, and (like me) cannot remember what you clicked. Hope this helps, Roger Regards AMINA SHAHZADI*.* Department of Statistics GC University Lahore, Pakistan. Email: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] How to best divide table by table
But *please* do learn from Peter Dalgaard's answer that this has nothing to do with tables (Petr, I agree you have helped Serguei, but...) Using vague language is not helpful in such contexts. And hence, calling data frames 'tab1' is probably not a good idea. {Calling them 'data' is not much better though: fortune(dog) Firstly, don't call your matrix 'matrix'. Would you call your dog 'dog'? Anyway, it might clash with the function 'matrix'. -- Barry Rowlingson R-help (October 2004) } Martin Maechler Petr == Petr Pikal [EMAIL PROTECTED] on Mon, 30 Oct 2006 08:12:57 +0100 writes: Petr Hi Assuming the same order in both tables divide only Petr columns you wont and then add column of names. You Petr need to work with data frame, as working with matrices Petr cannot use mixed types columns. Petr tab1-data.frame(letters[1:3], 1:3) Petr tab2-data.frame(letters[1:3], 10) Petr data.frame(tab1[,1],tab1[,-1]/tab2[,-1]) Petr tab1...1. tab11..tab21. 1 a 0.1 2 b 0.2 3 c Petr 0.3 Petr How to set appropriate column names you can find in Petr help page ?data.frame Petr HTH Petr Petr On 27 Oct 2006 at 18:42, Serguei Kaniovski wrote: Petr Date sent: Fri, 27 Oct 2006 18:42:36 +0200 (CEST) Petr From: Serguei Kaniovski [EMAIL PROTECTED] To: Petr r-help@stat.math.ethz.ch Organization: WIFO Subject: Petr [R] How to best divide table by table Hi all, how can I divide two tables of the same dimension so that all names are preserved, ie do not become NA? I have tab1 and tab2, each having names in the first column. I want tab3 with the same names and values tab1/tab2. Thanks, Serguei __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] [R-pkgs] adehabitat version 1.5
Dear all, I have just uploaded to CRAN the version 1.5 of the package 'adehabitat'. Significant changes are listed below: * the package now contains a new function allowing a factorial decomposition of the Mahalanobis distances in habitat selection studies, named madifa(). * The ENFA can now be performed using all kinds of variables (numeric, factors, fuzzy, mixing of several types, etc.) * Several methods allowing the analysis of animals movements have been added, including the first passage time (function fpt()), a rediscretization algorithm (redisltraj()), and an interactive graphic window for dynamic analysis (trajdyn()) * A function for interactive exploration of maps of class kasc has been added (explore.kasc) * Scott Fortmann-Roe (Univ. Berkeley) programmed a better algorithm for Nearest neighbour Convex hull home range estimation. * The function kasc2spixdf() have been updated Happy testing, Clément CALENGE -- Clément CALENGE Laboratoire de Biométrie et Biologie évolutive UMR CNRS 5558 43 Bd. 11 Nov. 1918 69622 Villeurbanne Cedex - France ___ R-packages mailing list R-packages@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Debugging R's code: boxplot.stats
Duncan == Duncan Murdoch [EMAIL PROTECTED] on Sat, 28 Oct 2006 08:03:33 -0400 writes: [...] Duncan Not sure why boxplot.stats is in grDevices rather Duncan than graphics, but that's not really relevant to Duncan your problems. because it does computation for Graphics (capitalized on purpose) which should not at all be limited to old-style S graphics which is the topic of the graphics package. E.g. grid and grid-based graphics should use boxplot.stats (for consistency). For the same reason, color computations are in 'grDevices', [[and we have acknowledged a while ago that 'grDevices' has become a slight misnomer Martin Maechler __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Multivariate regression
Hi I discovered the other day that lm() does some of the work for you: library(mvtnorm) X - matrix(rnorm(60),ncol=3) beta - matrix(1:6,ncol=2) sig - matrix(c(1,0.7,0.7,1),2,2) Y - X %*% beta + rmvnorm(n=20,sigma=sig) lm(Y ~ X-1) Call: lm(formula = Y ~ X - 1) Coefficients: [,1] [,2] X1 1.015 4.065 X2 2.483 5.366 X3 2.762 5.727 This gives an estimate for beta. But I don't know of a ready-made R solution for estimating the covariance of the elements of beta, or the sig matrix for the covariance matrix of the observation errors. Anyone? On 30 Oct 2006, at 09:01, Andris Jankevics wrote: Also you can take a look on Partial Least Squares (PLS) regression. http://www.statsoft.com/textbook/stpls.html R-package: http://mevik.net/work/software/pls.html Andris Jankevics On Sestdiena, 28. Oktobris 2006 06:04, Ritwik Sinha wrote: You can use gee ( http://finzi.psych.upenn.edu/R/library/geepack/html/00Index.html) or maybe the function gls in nlme. Ritwik. On 10/27/06, Ravi Varadhan [EMAIL PROTECTED] wrote: Hi, Suppose I have a multivariate response Y (n x k) obtained at a set of predictors X (n x p). I would like to perform a linear regression taking into consideration the covariance structure of Y within each unit - this would be represented by a specified matrix V (k x k), assumed to be the same across units. How do I use lm to do this? One approach that I was thinking of is as follows: Flatten Y to a vector, say, Yvec (n*k x 1). Create Xvec (n*k, p*k) such that it is made up of block matrices Bij (k x k), where Bij is a diagonal matrix with X_ij as the diagonal (i = 1,.n, and j = 1,.,p). Now I can use lm in a univariate mode to regress Yvec against Xvec, with covariance matrix Vvec (n*k x n*k). Vvec is a block-diagonal matrix with blocks of V along the diagonal. This seems like a valid approach, but I still don't know how to specify the covariance structure to do weighted least squares. Any help is appreciated. Best, Ravi. - --- --- Ravi Varadhan, Ph.D. Assistant Professor, The Center on Aging and Health Division of Geriatric Medicine and Gerontology Johns Hopkins University Ph: (410) 502-2619 Fax: (410) 614-9625 Email: [EMAIL PROTECTED] Webpage: http://www.jhsph.edu/agingandhealth/People/Faculty/Varadhan.html - --- [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. -- Robin Hankin Uncertainty Analyst National Oceanography Centre, Southampton European Way, Southampton SO14 3ZH, UK tel 023-8059-7743 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] reading only some columns from a table
Dear R users, Sometimes it is needed to read only some columns from a table, in particulare for high frequency data. How it is possible to read just some certain columns using read.table ( ). The reason could be keeping space in R and in particular accelerating in reading data when the number of rows are huge and some of them are not needed. Thank you very much, Amir - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] reading only some columns from a table
See the colClasses argument of read.table. e.g. read.table(myfile, header = TRUE, colClasses = c(person = NULL)) assuming you don't want the column labelled person in the header. On 10/30/06, Amir Safari [EMAIL PROTECTED] wrote: Dear R users, Sometimes it is needed to read only some columns from a table, in particulare for high frequency data. How it is possible to read just some certain columns using read.table ( ). The reason could be keeping space in R and in particular accelerating in reading data when the number of rows are huge and some of them are not needed. Thank you very much, Amir - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] for importing data
Hi, *I had an Excel file, then I turned it into a tab-delimited file, as ... lahore-read.delim(lahore.txt) I suppose you are on windows, hence you can use the package xlsReadWrite to read the Excelfile directly. It's on the CRAN and you can download it from the RGui under the menu: Packages - Install package(s)... (select a mirror, download). Example: lahore - read.xls( lahore.xls ) Gives back the data from the first sheet as a data.frame and assumes that there is a header row. Without header row set the colNames argument to FALSE. This is a user contributed package and doesn't belong to the core R environment, hence you shouldn't post in this group if need help with it (contact me or much better go to: http://groups.google.ch/group/supportR). xlsReadWrite is a bit non-standard and currently non-portable. So maybe not appropriate for a novice. On the other hand it is easy to use and no need for csv detours to get your data... Error in file(file, r) : unable to open connection In addition: Warning message: cannot open file 'lahore.txt', reason 'No such file or directory' Already answered: ?getwd ?setwd -- Regards, Hans-Peter __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] which duplicated rows to delete
Hi Say I've this vector with several duplicates x-c(1,2,3,4,2,6,2,8,2,3) which(duplicated(x)) [1] 5 7 9 10 11 But what I realy want is somthing like: List({2,5,7}, {3,10}, ...) Then from each sublist I can specify which of the duplicate items to drop res-NULL for(vec in myDuplicateList) res-rbind(res, subset(data[vec,], myCrit)) I'll get some of the way by sorting my original data appropriately, as it's the second and following rows that are 'marked' as duplicates, but that's not quite enough Hope for some hints Kind regards Søren __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] reading only some columns from a table
Thank you so much for reply. I tried to do your suggested idea. It did not work. what could be my mistake ? I got the same result with and without colClasses=c() arguement. What could be the reason? even using header=TRUE the result change slightly but not into desired one. Gabor Grothendieck [EMAIL PROTECTED] wrote: See the colClasses argument of read.table. e.g. read.table(myfile, header = TRUE, colClasses = c(person = NULL)) assuming you don't want the column labelled person in the header. On 10/30/06, Amir Safari wrote: Dear R users, Sometimes it is needed to read only some columns from a table, in particulare for high frequency data. How it is possible to read just some certain columns using read.table ( ). The reason could be keeping space in R and in particular accelerating in reading data when the number of rows are huge and some of them are not needed. Thank you very much, Amir - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] which duplicated rows to delete
Hi you can use apply(outer(( (1:10)[1:10%in%x]), x, ==), 1, which) to get list of duplicates. But then you will need to specify which duplicates you want to discard which can be problematic. HTH Petr On 30 Oct 2006 at 11:11, Sřren Merser wrote: From: Sřren Merser [EMAIL PROTECTED] To: R - help r-help@stat.math.ethz.ch Date sent: Mon, 30 Oct 2006 11:11:01 +0100 Subject:[R] which duplicated rows to delete Hi Say I've this vector with several duplicates x-c(1,2,3,4,2,6,2,8,2,3) which(duplicated(x)) [1] 5 7 9 10 11 But what I realy want is somthing like: List({2,5,7}, {3,10}, ...) Then from each sublist I can specify which of the duplicate items to drop res-NULL for(vec in myDuplicateList) res-rbind(res, subset(data[vec,], myCrit)) I'll get some of the way by sorting my original data appropriately, as it's the second and following rows that are 'marked' as duplicates, but that's not quite enough Hope for some hints Kind regards Sřren __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] reading only some columns from a table
Here is an example: Lines - conid person construct + 1 1 offence + 2 1 insight read.table(textConnection(Lines), header = TRUE, + colClasses = c(person = NULL)) conid person construct 1 1 1 offence 2 2 1 insight On 10/30/06, Amir Safari [EMAIL PROTECTED] wrote: Thank you so much for reply. I tried to do your suggested idea. It did not work. what could be my mistake ? I got the same result with and without colClasses=c() arguement. What could be the reason? even using header=TRUE the result change slightly but not into desired one. Gabor Grothendieck [EMAIL PROTECTED] wrote: See the colClasses argument of read.table. e.g. read.table(myfile, header = TRUE, colClasses = c(person = NULL)) assuming you don't want the column labelled person in the header. On 10/30/06, Amir Safari wrote: Dear R users, Sometimes it is needed to read only some columns from a table, in particulare for high frequency data. How it is possible to read just some certain columns using read.table ( ). The reason could be keeping space in R and in particular accelerating in reading data when the number of rows are huge and some of them are not needed. Thank you very much, Amir - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Everyone is raving about the all-new Yahoo! Mail. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] which duplicated rows to delete
Try this. The first line breaks it up into lists and the second line drops any list that is not greater than 1 in length: out - tapply(seq(x), x, function(x)x) out[sapply(out, length) 1] On 10/30/06, Søren Merser [EMAIL PROTECTED] wrote: Hi Say I've this vector with several duplicates x-c(1,2,3,4,2,6,2,8,2,3) which(duplicated(x)) [1] 5 7 9 10 11 But what I realy want is somthing like: List({2,5,7}, {3,10}, ...) Then from each sublist I can specify which of the duplicate items to drop res-NULL for(vec in myDuplicateList) res-rbind(res, subset(data[vec,], myCrit)) I'll get some of the way by sorting my original data appropriately, as it's the second and following rows that are 'marked' as duplicates, but that's not quite enough Hope for some hints Kind regards Søren __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] reading only some columns from a table
Sorry, here it is fixed up. The c should have been list: Lines - conid person construct 1 1 offence 2 1 insight read.table(textConnection(Lines), header = TRUE, colClasses = list(person = NULL)) On 10/30/06, Gabor Grothendieck [EMAIL PROTECTED] wrote: Here is an example: Lines - conid person construct + 1 1 offence + 2 1 insight read.table(textConnection(Lines), header = TRUE, + colClasses = c(person = NULL)) conid person construct 1 1 1 offence 2 2 1 insight On 10/30/06, Amir Safari [EMAIL PROTECTED] wrote: Thank you so much for reply. I tried to do your suggested idea. It did not work. what could be my mistake ? I got the same result with and without colClasses=c() arguement. What could be the reason? even using header=TRUE the result change slightly but not into desired one. Gabor Grothendieck [EMAIL PROTECTED] wrote: See the colClasses argument of read.table. e.g. read.table(myfile, header = TRUE, colClasses = c(person = NULL)) assuming you don't want the column labelled person in the header. On 10/30/06, Amir Safari wrote: Dear R users, Sometimes it is needed to read only some columns from a table, in particulare for high frequency data. How it is possible to read just some certain columns using read.table ( ). The reason could be keeping space in R and in particular accelerating in reading data when the number of rows are huge and some of them are not needed. Thank you very much, Amir - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Everyone is raving about the all-new Yahoo! Mail. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] [Fwd: Re: Organisation of medium/large projects with multiple analyses]
Daniel Elliott wrote: Mark, It sounds like your data/experiment storage and organization needs are more complicated than mine, but I'll share my methodology... Many thanks for this, and for the other replies received off-list. It is much appreciated, and confirms that with something as generically applicable as R, with as many widespread and heterogeneous uses, there is no universal solution. I'm still new to R, but have a fair experience with general programming. All of my data is stored in postgresql, and I have a number of R files that generate tables, results, graphs etc. These are then available to be imported into powerpoint/latex etc. I'm using version control (subversion), and as with most small projects, now have an ever increasing number of R scripts, each with fairly specific features. I only use version control for generic code. For me, generic code is not at the experiment level but at the algorithm level. It is only code that others would find useful - code that I hope to release to the R community. I use object-oriented programming to simplify the more specific, experiment-level scripts that I will describe later. These objects include plotting and data import/export among other things. Like you, many of my experiments are variations on the same theme. I have attempted general functions that can run many different experiments with changes only to parameters, but I have found this far too cumbersome. I am now resigned to storing all code and input and generated output data and graphs together in a single directory for each experiment with the exception of my general libraries. This typically consists of me copying the scripts that ran other experiments into a new directory where they are (hopefully only slightly) modified to fit the new experiment. I wish I had a cooler way to handle all of this, but this does make it very easy to rerun stuff. I even create new files, but not necessarily new directories, for scripts that differ only in the parameters they used when calling functions from my libraries. I suppose these can either be factored out into more generic functions (time consuming, and maybe not useful in the longer-term), or you should use version control to create branches, and then if you improve the copy of a function in one experiment, you have the potential of automatically merging back your changes to other branches. Do you go to the effort of creating a library that solves your particular problem, or only reserve that for more generic functionality? I only use libraries and classes for code that is generic enough to be usable by rest of the R community. Do people keep all of their R scripts for a specific project separate, or in one big file? Files for a particular project are kept in many different directories with little structure. Experiment logs (like informal lab reports) are used if I need to revisit or rerun an experiment. By the way, I back all of this stuff onto tape drive or DVD. I can see advantages (knowing it all works) and disadvantages (time for it all to run after minor changes) in both approaches, but it is unclear to me which is better. I do know that I've set-up a variety of analyses, moved on to other things, only to find later on that old scripts have stopped working because I've changed some interdependency. Does anyone go as far as to use test suites to check for sane output (apart from doing things manually)? Note I'm not asking about how to run R on all these scripts, as people have already suggested makefiles. I try really really really hard to never change my libraries. If I need to modify on the algorithms in a library I create a new method within the same library. Since you use version control (which is totally awesome, do you use it for your writing as well) hopefully you will be able to quickly figure out why an old script doesn't work (in theory should only be caused by function name changes). My whole project is stored in Subversion. Even my data collection forms (that are in MS Word format), as it lets me branch, and lets me rewind to see what has been sent. I'm afraid I even include my filemaker databases, as it means I have a rolling backup. Plus, a big advantage is that I can keep all my work files on two separate computers, and I keep the two in synchrony automatically by judicious updating and merging. My main writing is in LaTeX and clearly version control excels for these plain text documents. I really would recommend it! I've used TortoiseSVN on Windows, and it works superbly, although on my primary machine (Mac), I just use the command line. My scripts tend to break because I fiddle with the database schema to support some new analysis, and then when I revisit old scripts they tend to work. Based on all the advice, I shall have to factor out the
Re: [R] reading only some columns from a table
Thank you. That's the case. Gabor Grothendieck [EMAIL PROTECTED] wrote: Sorry, here it is fixed up. The c should have been list: Lines - conid person construct 1 1 offence 2 1 insight read.table(textConnection(Lines), header = TRUE, colClasses = list(person = NULL)) On 10/30/06, Gabor Grothendieck wrote: Here is an example: Lines - conid person construct + 1 1 offence + 2 1 insight read.table(textConnection(Lines), header = TRUE, + colClasses = c(person = NULL)) conid person construct 1 1 1 offence 2 2 1 insight On 10/30/06, Amir Safari wrote: Thank you so much for reply. I tried to do your suggested idea. It did not work. what could be my mistake ? I got the same result with and without colClasses=c() arguement. What could be the reason? even using header=TRUE the result change slightly but not into desired one. Gabor Grothendieck wrote: See the colClasses argument of read.table. e.g. read.table(myfile, header = TRUE, colClasses = c(person = NULL)) assuming you don't want the column labelled person in the header. On 10/30/06, Amir Safari wrote: Dear R users, Sometimes it is needed to read only some columns from a table, in particulare for high frequency data. How it is possible to read just some certain columns using read.table ( ). The reason could be keeping space in R and in particular accelerating in reading data when the number of rows are huge and some of them are not needed. Thank you very much, Amir - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] HELP:R for windows GUI front-end error
I use R for the first time. The install file is R-2.4.0-win32.exe, and my OS is windows XP SP2. I chose the full install, but when i open it , one Error occured:R for windows GUI front-end occurs error, You must end it Does anyone know how to solve this? Waiting for your reply. Thanks. -- Baohua Yang Email:[EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] HELP:R for windows GUI front-end error
On 10/30/2006 6:52 AM, yang baohua wrote: I use R for the first time. The install file is R-2.4.0-win32.exe, and my OS is windows XP SP2. I chose the full install, but when i open it , one Error occured:R for windows GUI front-end occurs error, You must end it Does anyone know how to solve this? Are you working with Chinese messages? If so, there's a known bug in the release that causes this problem. You should download the patched version, or choose to work in a different language if that's not possible. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] match lists
Dear list, I have this problem, please your advice. I have list A that contains two matrix elements: [[1]] a b [1,] 2 1 [2,] 3 2 [3,] 3 2 [[2]] c d [1,] 3 5 [2,] 3 1 [3,] 2 3 and list B, that also contains 2 matrices: [[1]] e f g [1,] 1 20 30 [2,] 2 40 50 [3,] 3 60 70 [4,] 4 80 90 [5,] 5 100 110 [[2]] h i j [1,] 1 10 20 [2,] 2 20 30 [3,] 3 30 40 [4,] 4 40 50 [5,] 5 50 60 Now I want to match each column of list A with each row of list B in such a way that element 1 of list A corresponds to element 1 of list B (and element 2 of A with 2 of B). So, in total there will be 4 new matrices, 1 for each column of list A. For example, for column a of list A the new matrix will be: 2 40 50 3 60 70 3 60 70 thanks, Martijn VUmc Amsterdam [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] nlme Error: Subscript out of bounds
Hello, I am new to non-linear growth modelling in R and I am trying to reproduce an analysis that was done (successfully) in S-Plus. I have a simple non-linear growth model, with no nesting. I have attempted to simplify the call as much as possible (by creating another grouped object, instead of using subset= and compacting the fixed and random expressions.) This is a what the grouped data object looks like: levelI.data[1:2,] Grouped Data: GMAE ~ AGE | STUDYID STUDYID TIMESCORE INCURVES MOST FIRST AGE 1910051 ACTUAL (unaided) in JAMA curves Level I Level I 49.11301 2010052 ACTUAL (unaided) in JAMA curves Level I Level I 56.53745 GMFM GMFCS GMAE YRS 19 91.03394 1 74.16 4.092751 20 95.35018 1 84.05 4.711454 Here is the nlme model: cp.grad-deriv(~ (100/(1+exp(-L)))*(1-exp(-exp(logR)*x)), c(L, logR), function(x=0:100,L,logR) NULL) levelI.nlme-nlme(GMAE~cp.grad(AGE,limit,lograte), data=levelI.data, fixed = limit+lograte~1, random = limit+lograte~1, start = c(2.0, -3.0)) I get a subscript out of bounds error - which I am not finding very helpful because I don't know where things are going wrong. Bill Shipley posted a similar problem with nlme called with a self-starting function - but here I don't use a self-starting function and I give the starting values explicitly so I assume that this is not the same problem he is having. What am I doing wrong? Any insights would be very much appreciated. Kind Regards, Lisa Avery [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] spreading activation
Hi, is there spreading activation function available for R? any suggestions appreiated... regards, Kaustubh - [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] gui for R
Hi, I met with many bugs when I used JGR and am looking for some other GUI's for Mac. I found SciViews-R by googling but it is only for windows to my best knowledge. Is there any other good gui like that, usable for Mac? Thanks, -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. Did you always know? No, I did not. But I believed... ---Matrix III __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] gui for R
On 10/30/2006 11:03 AM, Weiwei Shi wrote: Hi, I met with many bugs when I used JGR and am looking for some other GUI's for Mac. I found SciViews-R by googling but it is only for windows to my best knowledge. Is there any other good gui like that, usable for Mac? What do you find wrong with the standard one? I notice a few glitches, but generally prefer it to the Windows GUI. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Problem setting TMPDIR on the fly
Hi folks, I'm having a spot of bother with tempdir(). If I set the environment variable TMPDIR in my shell prior to invoking R it works as expected: Sys.getenv(TMPDIR) TMPDIR /eurotempest/tmp/R tempdir() [1] /eurotempest/tmp/R/Rtmp0xY4XD However if I don't set it prior to entry, but attempt to set it from within the current session, the change is not detected/respected: Sys.getenv(TMPDIR) TMPDIR Sys.putenv(TMPDIR = /eurotempest/tmp/R/) Sys.getenv(TMPDIR) TMPDIR /eurotempest/tmp/R/ tempdir() [1] /tmp/Rtmp9chsNX Any ideas? Cheers, Ben R.Version() $platform [1] i686-redhat-linux-gnu $arch [1] i686 $os [1] linux-gnu $system [1] i686, linux-gnu $status [1] $major [1] 2 $minor [1] 3.0 $year [1] 2006 $month [1] 04 $day [1] 24 $`svn rev` [1] 37909 $language [1] R $version.string [1] Version 2.3.0 (2006-04-24) -- This e-mail and its contents are intended for the use of the addressee(s) and may be confidential/privileged. No-one else may review, copy, disclose or otherwise use it or its contents. If you receive this e-mail in error, please contact the originator and delete it as soon as possible. Benfield Limited is authorised by the Financial Services Authority under the reference number 311884. Registered in England no 1170753. Registered office 55 Bishopsgate. Please refer to Benfield Limited's terms and conditions (www.benfieldgroup.com/terms) for a description of our services, duties and points of contact. Please review these terms and conditions at inception and renewal of all reinsurance and insurance contracts. Please note that our terms and conditions and interests in other companies may change over time and these changes will be reflected on the Benfield Limited website. The latest version of our terms and conditions supersedes all previous versions. == [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] installing package help with limited permissions
Hello, I administer a student (Windows based) computer lab, which has R installed. I want to permit students to install R packages, but of course they don't have write permission to R root folder. Following FAQ suggestion, I've set up a folder that they can write to, and set the R_LIB parameter on the shortcut to this folder. So far, so good - they can now install packages. However, I have not found any way to get the corresponding help files installed. FAQ says the help files require write permission to R installation folder. This seems pretty extreme. Is there some subfolder that would do the trick? Any way to have an alternate place to store help files, just as we are using an alternate location for packages? I tried giving users Modify permission to R/doc/html folder. With this, install package does NOT give any error for insufficient permission to install help; help(package='package_name') works; however help(function, package='package_name') still does not work. Is there any good way out of this dilemma, short of giving users free permission to the entire R installation? Thanks for any suggestions. -- Eva Goldwater email: [EMAIL PROTECTED] Biostatistics ConsultingPhone: (413) 545-2949 418 Arnold HouseFax: (413) 545-1645 715 North Pleasant Street University of Massachusetts Amherst, MA 01003-9304 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem setting TMPDIR on the fly
Benjamin Lloyd-Hughes [EMAIL PROTECTED] writes: Hi folks, I'm having a spot of bother with tempdir(). If I set the environment variable TMPDIR in my shell prior to invoking R it works as expected: Sys.getenv(TMPDIR) TMPDIR /eurotempest/tmp/R tempdir() [1] /eurotempest/tmp/R/Rtmp0xY4XD However if I don't set it prior to entry, but attempt to set it from within the current session, the change is not detected/respected: Sys.getenv(TMPDIR) TMPDIR Sys.putenv(TMPDIR = /eurotempest/tmp/R/) Sys.getenv(TMPDIR) TMPDIR /eurotempest/tmp/R/ tempdir() [1] /tmp/Rtmp9chsNX Any ideas? You're not supposed to do that. There is one and only one tempdir per R session. This is used for storing stuff which R expects to be able to find again later, so it would be a bad thing just to switch it out. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] memory management
Hi All, just a quick (?) question while I wait my code runs... I'm comparing the identity of the lines of a dataframe, doing all possible pairwise comparisons. In doing so I use identical(), but that's by the way. I'm doing a (not so) quick and dirty check, and subsetting the data as data[row.numb,] and data[a different row,] I suspect the problem there is that I load into memory the whole frame data[,] every time, making the biz quite slow and wasteful. As I'm idly waiting, I though, had I put every line of data[,] as the item of a list, then done my pairwise comparisons using the list, would I have had a better performance? (do I win the prize for the most convoluted sentence sent to the R-help?) For the pedants, yes, I know I could kill the process and try myself, but the spirit of the question is, is there a way of dealing with big data *efficiently*? Best, Fede -- Federico C. F. Calboli Department of Epidemiology and Public Health Imperial College, St Mary's Campus Norfolk Place, London W2 1PG Tel +44 (0)20 7594 1602 Fax (+44) 020 7594 3193 f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] (no subject)
Please, help me. I had a trouble in downloading from CRAN the package untb. Everything seems to work. I type install.packages(c(untb)) after selecting the CRAN mirror and I get a message of successful downloading. Indeed I have the package in the library and if I check with command library() I see untb among the various packages. But, when I type the command: library(untb) I cannot open the package getting the message below (which I translate under brackets): Carico il pacchetto richiesto: partitions (I'm loading requested package:partitions) Errore: pacchetto 'partitions' non caricato (Error: package partitions not loadad) Warning messages: 1: the package 'untb' has been created with R version 2.3.1 2: non c'è alcun pacchetto chiamato 'partitions' in: library(pkg, character.only = TRUE, logical = TRUE, lib.loc = lib.loc) (there's not a package named partitions in..) I have the version 2.3.0 What's wrong? By the way, I already successfully downloaded with the same procedure other packages such as ade4 or vegan. Vegan has been written within version 2.3.1 but I can open and use it. thank you. Tancredi Caruso [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] no possible to load a package correctly dowloaded by the R prompt
Please, help me. I had a trouble in downloading from CRAN the package untb. Everything seems to work. I type install.packages(c(untb)) after selecting the CRAN mirror and I get a message of successful downloading. Indeed I have the package in the library and if I check with command library() I see untb among the various packages. But, when I type the command: library(untb) I cannot open the package getting the message below (which I translate under brackets): Carico il pacchetto richiesto: partitions (I'm loading requested package:partitions) Errore: pacchetto 'partitions' non caricato (Error: package partitions not loadad) Warning messages: 1: the package 'untb' has been created with R version 2.3.1 2: non c'è alcun pacchetto chiamato 'partitions' in: library(pkg, character.only = TRUE, logical = TRUE, lib.loc = lib.loc) (there's not a package named partitions in..) I have the version 2.3.0 What's wrong? By the way, I already successfully downloaded with the same procedure other packages such as ade4 or vegan. Vegan has been written within version 2.3.1 but I can open and use it. thank you. Tancredi Caruso [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] memory management
This was asked before. Collapse the data frame into a vector, e.g. v - apply(DF,1,function(x) {paste(x,collapse=_)}) then work with the values of that vector (table, unique etc). If your data frame is really large run this in a DBMS. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Federico Calboli Sent: Monday, October 30, 2006 11:35 AM To: r-help Subject: [R] memory management Hi All, just a quick (?) question while I wait my code runs... I'm comparing the identity of the lines of a dataframe, doing all possible pairwise comparisons. In doing so I use identical(), but that's by the way. I'm doing a (not so) quick and dirty check, and subsetting the data as data[row.numb,] and data[a different row,] I suspect the problem there is that I load into memory the whole frame data[,] every time, making the biz quite slow and wasteful. As I'm idly waiting, I though, had I put every line of data[,] as the item of a list, then done my pairwise comparisons using the list, would I have had a better performance? (do I win the prize for the most convoluted sentence sent to the R-help?) For the pedants, yes, I know I could kill the process and try myself, but the spirit of the question is, is there a way of dealing with big data *efficiently*? Best, Fede -- Federico C. F. Calboli Department of Epidemiology and Public Health Imperial College, St Mary's Campus Norfolk Place, London W2 1PG Tel +44 (0)20 7594 1602 Fax (+44) 020 7594 3193 f.calboli [.a.t] imperial.ac.uk f.calboli [.a.t] gmail.com __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] POSIXct time zone and daylight savings issues
Hi again, A related issue I can't quite understand is: R tt - as.POSIXct(2006-05-24, tz=EEST) R tt [1] 2006-05-24 EEST R seq(tt, length=12, by=months) [1] 2006-05-24 EEST 2006-06-24 EEST 2006-07-24 EEST 2006-08-24 EEST [5] 2006-09-24 EEST 2006-10-24 EEST 2006-11-24 EEST 2006-12-24 EEST [9] 2007-01-24 EEST 2007-02-24 EEST 2007-03-24 EEST 2007-04-24 EEST R tt - as.POSIXct(2006-05-24, tz=EET) R seq(tt, length=12, by=months) [1] 2006-05-24 EEST 2006-06-24 EEST 2006-07-24 EEST 2006-08-24 EEST [5] 2006-09-24 EEST 2006-10-24 EEST 2006-11-24 EET 2006-12-24 EET [9] 2007-01-24 EET 2007-02-24 EET 2007-03-24 EET 2007-04-24 EEST R sessionInfo() R version 2.4.0 (2006-10-03) x86_64-pc-linux-gnu locale: LC_CTYPE=en_CA.UTF-8;LC_NUMERIC=C;LC_TIME=en_CA.UTF-8;LC_COLLATE=en_CA.UTF-8;LC_MONETARY=en_CA.UTF-8;LC_MESSAGES=en_CA.UTF-8;LC_PAPER=en_CA.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_CA.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] methods stats graphics grDevices utils datasets [7] base other attached packages: lattice 0.14-9 i.e. daylight savings 'tzone' attribute gets adjusted automatically when providing the standard time attribute, but not when providing the daylight savings time. Does this behaviour depend on the OS/locale? Should the 'tz' argument supplied when creating POSIXct objects always be the standard time version? Cheers, -- Seb __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] no possible to load a package correctly dowloaded by the R prompt
Hi, On Oct 30, 2006, at 11:43 AM, Tancredi Caruso wrote: install.packages(c(untb)) library(untb) Carico il pacchetto richiesto: partitions (I'm loading requested package:partitions) Errore: pacchetto 'partitions' non caricato (Error: package partitions not loadad) Warning messages: 1: the package 'untb' has been created with R version 2.3.1 2: non c'è alcun pacchetto chiamato 'partitions' in: library(pkg, character.only = TRUE, logical = TRUE, lib.loc = lib.loc) (there's not a package named partitions in..) This means that you need to also install.packages('partitions') You could have said install.packages('untb', dependencies = TRUE), and this would have done the job for you. _ Professor Michael Kubovy University of Virginia Department of Psychology USPS: P.O.Box 400400Charlottesville, VA 22904-4400 Parcels:Room 102Gilmer Hall McCormick RoadCharlottesville, VA 22903 Office:B011+1-434-982-4729 Lab:B019+1-434-982-4751 Fax:+1-434-982-4766 WWW:http://www.people.virginia.edu/~mk9y/ __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] correlation structure in lme without random effect
I was hoping to fit along the lines of g-gl(20,5) y-runif(100) fit-lme(fixed=y~g,correlation=corAR1(0,~1|g)) But I get the error Incompatible formulas for groups in random and correlation Any help would be greatly appreciated. Ben __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Random intercept-slope correlation (nlme)
Dear list members, I am working with a multilevel growth curve, that in its simplest form goes like follows: Yit = Ai + Bi t + eit (the error term is assumed to follow an AR(1) autorregressive process) One major topic in my research is the convergence in the values of Y over time. Thus, I am interested in the relationship between the random effects for the intercept and the slope, and I have a couple of questions about this: First, I have fitted the model using the nlme library in R, and the estimates for the random effects yield a correlation of -0.27. However, if I take values for random intercepts and slopes from the lme model, and run a correlation (or a regression) between them, I get a slightly positive relationship (R~ 0.02). How can this difference be explained? Second, I am also interested in the size of the relationship between intercept and slope. In other terms, in the rate of convergence. In order to analyze this, does it make any sense if use the values from my random-effects model and run an OLS regression using subject-specific intercepts as a covariate to explain subject-specific slopes? The results I mention above meake me suspicious about this, but I still do not know if it would be correct from a statistical standpoint. Thanks a lot, Antonio _ Moda para esta temporada. Ponte al día de todas las tendencias. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] correlation structure in lme without random effect
You haven't specified a random equation. Try: fit-lme(fixed=y~g,random=~1|g,correlation=corAR1(0,~1|g)) On 30/10/06, Benjamin Tyner [EMAIL PROTECTED] wrote: I was hoping to fit along the lines of g-gl(20,5) y-runif(100) fit-lme(fixed=y~g,correlation=corAR1(0,~1|g)) But I get the error Incompatible formulas for groups in random and correlation Any help would be greatly appreciated. Ben __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] correlation structure in lme without random effect
On 10/30/06, Benjamin Tyner [EMAIL PROTECTED] wrote: I was hoping to fit along the lines of g-gl(20,5) y-runif(100) fit-lme(fixed=y~g,correlation=corAR1(0,~1|g)) But I get the error Incompatible formulas for groups in random and correlation Use the gls function in the nlme package to fit a model with correlation but no random effects specification. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] correlation structure in lme without random effect
Thanks! Douglas Bates wrote: On 10/30/06, Benjamin Tyner [EMAIL PROTECTED] wrote: I was hoping to fit along the lines of g-gl(20,5) y-runif(100) fit-lme(fixed=y~g,correlation=corAR1(0,~1|g)) But I get the error Incompatible formulas for groups in random and correlation Use the gls function in the nlme package to fit a model with correlation but no random effects specification. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] POSIXct time zone and daylight savings issues
I don't know the answer to your question but if you are using dates with no times and don't need time zones (both of which appear to be the case here) then you could use Date class and avoid the issue altogether. See the help desk article in R News 4/1 where there is a discussion of how to choose the date time class. On 10/30/06, Sebastian P. Luque [EMAIL PROTECTED] wrote: Hi again, A related issue I can't quite understand is: R tt - as.POSIXct(2006-05-24, tz=EEST) R tt [1] 2006-05-24 EEST R seq(tt, length=12, by=months) [1] 2006-05-24 EEST 2006-06-24 EEST 2006-07-24 EEST 2006-08-24 EEST [5] 2006-09-24 EEST 2006-10-24 EEST 2006-11-24 EEST 2006-12-24 EEST [9] 2007-01-24 EEST 2007-02-24 EEST 2007-03-24 EEST 2007-04-24 EEST R tt - as.POSIXct(2006-05-24, tz=EET) R seq(tt, length=12, by=months) [1] 2006-05-24 EEST 2006-06-24 EEST 2006-07-24 EEST 2006-08-24 EEST [5] 2006-09-24 EEST 2006-10-24 EEST 2006-11-24 EET 2006-12-24 EET [9] 2007-01-24 EET 2007-02-24 EET 2007-03-24 EET 2007-04-24 EEST R sessionInfo() R version 2.4.0 (2006-10-03) x86_64-pc-linux-gnu locale: LC_CTYPE=en_CA.UTF-8;LC_NUMERIC=C;LC_TIME=en_CA.UTF-8;LC_COLLATE=en_CA.UTF-8;LC_MONETARY=en_CA.UTF-8;LC_MESSAGES=en_CA.UTF-8;LC_PAPER=en_CA.UTF-8;LC_NAME=C;LC_ADDRESS=C;LC_TELEPHONE=C;LC_MEASUREMENT=en_CA.UTF-8;LC_IDENTIFICATION=C attached base packages: [1] methods stats graphics grDevices utils datasets [7] base other attached packages: lattice 0.14-9 i.e. daylight savings 'tzone' attribute gets adjusted automatically when providing the standard time attribute, but not when providing the daylight savings time. Does this behaviour depend on the OS/locale? Should the 'tz' argument supplied when creating POSIXct objects always be the standard time version? Cheers, -- Seb __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Problem setting TMPDIR on the fly
On 10/30/2006 11:22 AM, Benjamin Lloyd-Hughes wrote: Hi folks, I'm having a spot of bother with tempdir(). If I set the environment variable TMPDIR in my shell prior to invoking R it works as expected: Sys.getenv(TMPDIR) TMPDIR /eurotempest/tmp/R tempdir() [1] /eurotempest/tmp/R/Rtmp0xY4XD However if I don't set it prior to entry, but attempt to set it from within the current session, the change is not detected/respected: Sys.getenv(TMPDIR) TMPDIR Sys.putenv(TMPDIR = /eurotempest/tmp/R/) Sys.getenv(TMPDIR) TMPDIR /eurotempest/tmp/R/ tempdir() [1] /tmp/Rtmp9chsNX Any ideas? It's behaving as designed. It reads the environment variable upon startup, and then uses that directory for the whole session. (This allows it to clean up at the end. If you changed directories midway through, what would happen to temp files in the old directory?) Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Is there any method to do spatial sampling?
What kind of spatial sampling do you want to do: systematic, stratified, simple random, etc.? What will you be sampling: points, lines, polygons, etc.? Marsh Feldman URI Center for Urban Studies and Research The University of Rhode Island -Original Message- From: ronggui [mailto:[EMAIL PROTECTED] Sent: Sunday, October 29, 2006 9:49 AM To: r-help@stat.math.ethz.ch Subject: [R] Is there any method to do spatial sampling? I have a map of a district (which is JPG format), and I want to do a sptial sampling based on the map. So is there any function to do spatial sampling of this type? Thanks! -- Ronggui Huang Department of Sociology Fudan University, Shanghai, China 黄荣贵 复旦大学社会学系 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how to set debug breaks
Hi, I am new in R and have some frustrations as how to set debug breaks during emacs R debug. I use debug () as where or which function to debug. But during the debug, e.g., I have a for loop at the beginning of the function code and want the code execution to jump through that for loop and set a break after that. How to do that? Is there a web site detailing the syntax of the debugging of R? Hopefully it would be similar to java or C syntax. Thanks. waverley [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] read.fwf and header
Hi! I have data (also in attached file) in the following form: num1 num2 num3 int1 fac1 fac2 cha1 cha2 Date POSIXt 11 f q 1900-01-01 1900-01-01 01:01:01 2 1.0 131.5 2 a g r z1900-01-01 01:01:01 3 1.5 1188830.5 3 b h s y 1900-01-01 1900-01-01 01:01:01 4 2.0 1271846.3 4 c i t x 1900-01-01 1900-01-01 01:01:01 5 2.5 829737.4d j u w 1900-01-01 6 3.0 1240967.3 5 e k v v 1900-01-01 1900-01-01 01:01:01 7 3.5 919684.4 6 f l w u 1900-01-01 1900-01-01 01:01:01 8 4.0 968214.6 7 g m x t 1900-01-01 1900-01-01 01:01:01 9 4.5 1232076.4 8 h n y s 1900-01-01 1900-01-01 01:01:01 10 5.0 1141273.4 9 i o z r 1900-01-01 1900-01-01 01:01:01 5.5 988481.4 10 j q 1900-01-01 1900-01-01 01:01:01 This is a FWF (fixed width format) file. I can not use read.table here, because of missing values. I have tried with the following read.fwf(file=test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 20), header=TRUE) Error in read.table(file = FILE, header = header, sep = sep, as.is = as.is, : more columns than column names I could use: read.fwf(file=test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 20), header=FALSE, skip=1) V1 V2V3 V4 V5 V6 V7 V8 V9 V10 1 1 NANA 1f q 1900-01-01 1900-01-01 01:01:01 2 2 1.0 131.5 2 a g r z 1900-01-01 01:01:01 3 3 1.5 1188830.5 3 b h s y 1900-01-01 1900-01-01 01:01:01 4 4 2.0 1271846.3 4 c i t x 1900-01-01 1900-01-01 01:01:01 5 5 2.5 829737.4 NA d j u w 1900-01-01 6 6 3.0 1240967.3 5 e k v v 1900-01-01 1900-01-01 01:01:01 7 7 3.5 919684.4 6 f l w u 1900-01-01 1900-01-01 01:01:01 8 8 4.0 968214.6 7 g m x t 1900-01-01 1900-01-01 01:01:01 9 9 4.5 1232076.4 8 h n y s 1900-01-01 1900-01-01 01:01:01 10 10 5.0 1141273.4 9 i o z r 1900-01-01 1900-01-01 01:01:01 11 NA 5.5 988481.4 10 jq 1900-01-01 1900-01-01 01:01:01 Does anyone have a clue, how to get above result with header? Thanks! -- Lep pozdrav / With regards, Gregor Gorjanc -- University of Ljubljana PhD student Biotechnical Faculty Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan Groblje 3 mail: gregor.gorjanc at bfro.uni-lj.si SI-1230 Domzale tel: +386 (0)1 72 17 861 Slovenia, Europefax: +386 (0)1 72 17 888 -- One must learn by doing the thing; for though you think you know it, you have no certainty until you try. Sophocles ~ 450 B.C. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Additional earnings
Reply to: [EMAIL PROTECTED] Denmark software company, Gricina Software Company is looking for employees in Australia and Iceland! Demands: 21-70 years old, male(female), smart, communicative. You will work for yourself, wage 1000 USD- 3000 USD per week, work at morning time 9.00 AM- 11.00 AM. After 11 you can be free! Send your CV and summary according this email: [EMAIL PROTECTED] Regards, Gerbert Maylor, Director of Gricina Software Company __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Which executable is associated with R CMD INSTALL?
I'm still having trouble installing the lme4 package on RHEL 3. I've asked this list and it seems my problem is not universal. Brian Ripley indicated that the problem was with recognising the Matrix package, even though I've taken care to get the most recent versions of Matrix and lme4. It seems to me that the problem arises because the computer has a site installation of R-2.3.1 and I'm trying to use R-2.4.0 from my home directory. I use a symbolic link (named R) to point to the 2.4.0 executable. The only problem I've encountered is installing the lme4 package, and I'm now guessing that R CMD INSTALL is not using my link, and defaults to the R-2.3.1. Does my theory have any credibility? I know it wouldn't explain why the other packages don't have a problem, but I'm scraping the bottom of the barrel now. TIA -- ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. ___Patrick Connolly {~._.~} Great minds discuss ideas _( Y )_Middle minds discuss events (:_~*~_:)Small minds discuss people (_)-(_) . Anon ~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~.~. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] read.fwf and header
On Mon, 2006-10-30 at 19:51 +0100, Gregor Gorjanc wrote: Hi! I have data (also in attached file) in the following form: num1 num2 num3 int1 fac1 fac2 cha1 cha2 Date POSIXt 11 f q 1900-01-01 1900-01-01 01:01:01 2 1.0 131.5 2 a g r z1900-01-01 01:01:01 3 1.5 1188830.5 3 b h s y 1900-01-01 1900-01-01 01:01:01 4 2.0 1271846.3 4 c i t x 1900-01-01 1900-01-01 01:01:01 5 2.5 829737.4d j u w 1900-01-01 6 3.0 1240967.3 5 e k v v 1900-01-01 1900-01-01 01:01:01 7 3.5 919684.4 6 f l w u 1900-01-01 1900-01-01 01:01:01 8 4.0 968214.6 7 g m x t 1900-01-01 1900-01-01 01:01:01 9 4.5 1232076.4 8 h n y s 1900-01-01 1900-01-01 01:01:01 10 5.0 1141273.4 9 i o z r 1900-01-01 1900-01-01 01:01:01 5.5 988481.4 10 j q 1900-01-01 1900-01-01 01:01:01 This is a FWF (fixed width format) file. I can not use read.table here, because of missing values. I have tried with the following read.fwf(file=test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 20), header=TRUE) Error in read.table(file = FILE, header = header, sep = sep, as.is = as.is, : more columns than column names I could use: read.fwf(file=test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 20), header=FALSE, skip=1) V1 V2V3 V4 V5 V6 V7 V8 V9 V10 1 1 NANA 1f q 1900-01-01 1900-01-01 01:01:01 2 2 1.0 131.5 2 a g r z 1900-01-01 01:01:01 3 3 1.5 1188830.5 3 b h s y 1900-01-01 1900-01-01 01:01:01 4 4 2.0 1271846.3 4 c i t x 1900-01-01 1900-01-01 01:01:01 5 5 2.5 829737.4 NA d j u w 1900-01-01 6 6 3.0 1240967.3 5 e k v v 1900-01-01 1900-01-01 01:01:01 7 7 3.5 919684.4 6 f l w u 1900-01-01 1900-01-01 01:01:01 8 8 4.0 968214.6 7 g m x t 1900-01-01 1900-01-01 01:01:01 9 9 4.5 1232076.4 8 h n y s 1900-01-01 1900-01-01 01:01:01 10 10 5.0 1141273.4 9 i o z r 1900-01-01 1900-01-01 01:01:01 11 NA 5.5 988481.4 10 jq 1900-01-01 1900-01-01 01:01:01 Does anyone have a clue, how to get above result with header? Thanks! The attachment did not come through. Perhaps it was too large? Not sure if this is the most efficient way, but how about this: DF - read.fwf(test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 20), skip = 1, strip.white = TRUE, col.names = read.table(test.txt, nrow = 1, as.is = TRUE)[1, ]) DF num1 num2 num3 int1 fac1 fac2 cha1 cha2 Date 1 1 NANA1 fq 1900-01-01 2 2 1.0 131.52agrz 3 3 1.5 1188830.53bhsy 1900-01-01 4 4 2.0 1271846.34citx 1900-01-01 5 5 2.5 829737.4 NAdjuw 1900-01-01 6 6 3.0 1240967.35ekvv 1900-01-01 7 7 3.5 919684.46flwu 1900-01-01 8 8 4.0 968214.67gmxt 1900-01-01 9 9 4.5 1232076.48hnys 1900-01-01 10 10 5.0 1141273.49iozr 1900-01-01 11 NA 5.5 988481.4 10j q 1900-01-01 POSIXt 1 1900-01-01 01:01:01 2 1900-01-01 01:01:01 3 1900-01-01 01:01:01 4 1900-01-01 01:01:01 5 NA 6 1900-01-01 01:01:01 7 1900-01-01 01:01:01 8 1900-01-01 01:01:01 9 1900-01-01 01:01:01 10 1900-01-01 01:01:01 11 1900-01-01 01:01:01 Of course, with the limited number of columns, you can always just set colnames(DF) - c(num1, num2, num3, int1, fac1, fac2, cha1, cha2, Date, POSIXt) as a post-import step. HTH, Marc Schwartz __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] psigamma derivative
Hello, I am trying to find a hessian matrix that involves log(gamma(1/p)) second derivative, p being one of the parameters of the function. I am using a function deriv with the hessian=TRUE option, but psigamma is not on the list of derivative functions. I know that it is possible to use 'psigamma(p,deriv)', but it doesn't work with 1/p. Does anybody can help with this? Thanks, Ana Maria __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] read.fwf and header
Gregor, According to the help for read.fwf, sep needs to be set to a value that occurs only in the header record. I changed the spaces to commas in the header record of your example and used the following syntax and was able to read the file just fine. new.data-read.fwf(file=test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 19), header=TRUE, sep=',') Hope this is helpful, Dan Daniel Nordlund Bothell, WA USA -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Gregor Gorjanc Sent: Monday, October 30, 2006 10:52 AM To: r-help@stat.math.ethz.ch Subject: [R] read.fwf and header Hi! I have data (also in attached file) in the following form: num1 num2 num3 int1 fac1 fac2 cha1 cha2 Date POSIXt 11 f q 1900-01-01 1900-01-01 01:01:01 2 1.0 131.5 2 a g r z1900-01-01 01:01:01 3 1.5 1188830.5 3 b h s y 1900-01-01 1900-01-01 01:01:01 4 2.0 1271846.3 4 c i t x 1900-01-01 1900-01-01 01:01:01 5 2.5 829737.4d j u w 1900-01-01 6 3.0 1240967.3 5 e k v v 1900-01-01 1900-01-01 01:01:01 7 3.5 919684.4 6 f l w u 1900-01-01 1900-01-01 01:01:01 8 4.0 968214.6 7 g m x t 1900-01-01 1900-01-01 01:01:01 9 4.5 1232076.4 8 h n y s 1900-01-01 1900-01-01 01:01:01 10 5.0 1141273.4 9 i o z r 1900-01-01 1900-01-01 01:01:01 5.5 988481.4 10 j q 1900-01-01 1900-01-01 01:01:01 This is a FWF (fixed width format) file. I can not use read.table here, because of missing values. I have tried with the following read.fwf(file=test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 20), header=TRUE) Error in read.table(file = FILE, header = header, sep = sep, as.is = as.is, : more columns than column names I could use: read.fwf(file=test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 20), header=FALSE, skip=1) V1 V2V3 V4 V5 V6 V7 V8 V9 V10 1 1 NANA 1f q 1900-01-01 1900-01-01 01:01:01 2 2 1.0 131.5 2 a g r z 1900-01-01 01:01:01 3 3 1.5 1188830.5 3 b h s y 1900-01-01 1900-01-01 01:01:01 4 4 2.0 1271846.3 4 c i t x 1900-01-01 1900-01-01 01:01:01 5 5 2.5 829737.4 NA d j u w 1900-01-01 6 6 3.0 1240967.3 5 e k v v 1900-01-01 1900-01-01 01:01:01 7 7 3.5 919684.4 6 f l w u 1900-01-01 1900-01-01 01:01:01 8 8 4.0 968214.6 7 g m x t 1900-01-01 1900-01-01 01:01:01 9 9 4.5 1232076.4 8 h n y s 1900-01-01 1900-01-01 01:01:01 10 10 5.0 1141273.4 9 i o z r 1900-01-01 1900-01-01 01:01:01 11 NA 5.5 988481.4 10 jq 1900-01-01 1900-01-01 01:01:01 Does anyone have a clue, how to get above result with header? Thanks! -- Lep pozdrav / With regards, Gregor Gorjanc -- University of Ljubljana PhD student Biotechnical Faculty Zootechnical Department URI: http://www.bfro.uni-lj.si/MR/ggorjan Groblje 3 mail: gregor.gorjanc at bfro.uni-lj.si SI-1230 Domzale tel: +386 (0)1 72 17 861 Slovenia, Europefax: +386 (0)1 72 17 888 -- One must learn by doing the thing; for though you think you know it, you have no certainty until you try. Sophocles ~ 450 B.C. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] psigamma derivative
Try ?Special For information on the special functions included in the base R distribution. Also, RSiteSearch(digamma) gives several hits on additional packages that might be useful. -Christos -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of [EMAIL PROTECTED] Sent: Monday, October 30, 2006 3:26 PM To: r-help@stat.math.ethz.ch Subject: [R] psigamma derivative Hello, I am trying to find a hessian matrix that involves log(gamma(1/p)) second derivative, p being one of the parameters of the function. I am using a function deriv with the hessian=TRUE option, but psigamma is not on the list of derivative functions. I know that it is possible to use 'psigamma(p,deriv)', but it doesn't work with 1/p. Does anybody can help with this? Thanks, Ana Maria __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Hmisc or Lattice plot with error bars, Depth (independent variable) on Y axis
I am trying to create some plots of concentration versus depth. I want Depth on the Y axis and the concentrations on the X axis. I also need to plot error bars. The xYplot function in Hmisc is very nearly ideal but I have to put depth on the x-axis to get it to work. When I transpose the X and Y axes in the xYplot command, the error bars disappear (no surprise given the help file). It there a way to get the plot command to flip the axes? That would be ideal as I could use the grouping functions in xYplot and save a bunch of work. If no such command exists any other ideas? I looked at the Dotplot command but the depths are not evenly spaced so I don't think that will work. Thanks in advance Mike Michael J Bock, PhD ENVIRON International Corp. This message contains information that may be confidential, ...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to set debug breaks
On Mon, 2006-10-30 at 10:37 -0800, waverley palo wrote: Hi, I am new in R and have some frustrations as how to set debug breaks during emacs R debug. I use debug () as where or which function to debug. But during the debug, e.g., I have a for loop at the beginning of the function code and want the code execution to jump through that for loop and set a break after that. How to do that? Is there a web site detailing the syntax of the debugging of R? Hopefully it would be similar to java or C syntax. See ?debug, in particular the use of c to run to the end of the current context. So you can debug as before, but use c to run through the loop. Alternatively, see ?browser, which drops you into the debugger wherever you insert the browser() command, e.g.: foo - function(n = 10) { for(i in 1:n) { cat(paste(Doing something #, i, \r)) Sys.sleep(0.5) } cat(\nFinished loop\n) browser() X - runif(100) sumX - sum(X) meanX - mean(X) list(sum = sumX, mean = meanX) } Will start debugging foo() after the loop has finished. You might also find Mark Bravington's debug package useful as it implements further functions for debugging in R HTH G Thanks. waverley -- %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% Gavin Simpson [t] +44 (0)20 7679 0522 ECRC ENSIS, UCL Geography, [f] +44 (0)20 7679 0565 Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/cv/ London, UK. WC1E 6BT. [w] http://www.ucl.ac.uk/~ucfagls/ %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~% __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Hmisc or Lattice plot with error bars, Depth (independent variable) on Y axis
Mike Bock wrote: I am trying to create some plots of concentration versus depth. I want Depth on the Y axis and the concentrations on the X axis. I also need to plot error bars. The xYplot function in Hmisc is very nearly ideal but I have to put depth on the x-axis to get it to work. When I transpose the X and Y axes in the xYplot command, the error bars disappear (no surprise given the help file). It there a way to get the plot command to flip the axes? That would be ideal as I could use the grouping functions in xYplot and save a bunch of work. If no such command exists any other ideas? I looked at the Dotplot command but the depths are not evenly spaced so I don't think that will work. Thanks in advance Mike Michael J Bock, PhD ENVIRON International Corp. xYplot only supports vertical error bars Frank -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] read.fwf and header
Marc Schwartz wrote: On Mon, 2006-10-30 at 19:51 +0100, Gregor Gorjanc wrote: Hi! I have data (also in attached file) in the following form: num1 num2 num3 int1 fac1 fac2 cha1 cha2 Date POSIXt 11 f q 1900-01-01 1900-01-01 01:01:01 2 1.0 131.5 2 a g r z1900-01-01 01:01:01 3 1.5 1188830.5 3 b h s y 1900-01-01 1900-01-01 01:01:01 4 2.0 1271846.3 4 c i t x 1900-01-01 1900-01-01 01:01:01 5 2.5 829737.4d j u w 1900-01-01 6 3.0 1240967.3 5 e k v v 1900-01-01 1900-01-01 01:01:01 7 3.5 919684.4 6 f l w u 1900-01-01 1900-01-01 01:01:01 8 4.0 968214.6 7 g m x t 1900-01-01 1900-01-01 01:01:01 9 4.5 1232076.4 8 h n y s 1900-01-01 1900-01-01 01:01:01 10 5.0 1141273.4 9 i o z r 1900-01-01 1900-01-01 01:01:01 5.5 988481.4 10 j q 1900-01-01 1900-01-01 01:01:01 This is a FWF (fixed width format) file. I can not use read.table here, because of missing values. I have tried with the following read.fwf(file=test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 20), header=TRUE) Error in read.table(file = FILE, header = header, sep = sep, as.is = as.is, : more columns than column names I could use: read.fwf(file=test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 20), header=FALSE, skip=1) V1 V2V3 V4 V5 V6 V7 V8 V9 V10 1 1 NANA 1f q 1900-01-01 1900-01-01 01:01:01 2 2 1.0 131.5 2 a g r z 1900-01-01 01:01:01 3 3 1.5 1188830.5 3 b h s y 1900-01-01 1900-01-01 01:01:01 4 4 2.0 1271846.3 4 c i t x 1900-01-01 1900-01-01 01:01:01 5 5 2.5 829737.4 NA d j u w 1900-01-01 6 6 3.0 1240967.3 5 e k v v 1900-01-01 1900-01-01 01:01:01 7 7 3.5 919684.4 6 f l w u 1900-01-01 1900-01-01 01:01:01 8 8 4.0 968214.6 7 g m x t 1900-01-01 1900-01-01 01:01:01 9 9 4.5 1232076.4 8 h n y s 1900-01-01 1900-01-01 01:01:01 10 10 5.0 1141273.4 9 i o z r 1900-01-01 1900-01-01 01:01:01 11 NA 5.5 988481.4 10 jq 1900-01-01 1900-01-01 01:01:01 Does anyone have a clue, how to get above result with header? Thanks! The attachment did not come through. Perhaps it was too large? Not sure if this is the most efficient way, but how about this: DF - read.fwf(test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 20), skip = 1, strip.white = TRUE, col.names = read.table(test.txt, nrow = 1, as.is = TRUE)[1, ]) Argh, my fault as I forgot to attach it :( Not sure if this is the most efficient way, but how about this: DF - read.fwf(test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 20), skip = 1, strip.white = TRUE, col.names = read.table(test.txt, nrow = 1, as.is = TRUE)[1, ]) That is a very nice compromise! No need for [1, ], due to nrow=1. Of course, with the limited number of columns, you can always just set colnames(DF) - c(num1, num2, num3, int1, fac1, fac2, cha1, cha2, Date, POSIXt) I fully agree here, but I kind of lack this directly in read.fwf. I hope that someone from R-core is also listening to this ;) Thank you! Gregor num1 num2 num3 int1 fac1 fac2 cha1 cha2 Date POSIXt 11 f q 1900-01-01 1900-01-01 01:01:01 2 1.0 131.5 2 a g r z1900-01-01 01:01:01 3 1.5 1188830.5 3 b h s y 1900-01-01 1900-01-01 01:01:01 4 2.0 1271846.3 4 c i t x 1900-01-01 1900-01-01 01:01:01 5 2.5 829737.4d j u w 1900-01-01 6 3.0 1240967.3 5 e k v v 1900-01-01 1900-01-01 01:01:01 7 3.5 919684.4 6 f l w u 1900-01-01 1900-01-01 01:01:01 8 4.0 968214.6 7 g m x t 1900-01-01 1900-01-01 01:01:01 9 4.5 1232076.4 8 h n y s 1900-01-01 1900-01-01 01:01:01 10 5.0 1141273.4 9 i o z r 1900-01-01 1900-01-01 01:01:01 5.5 988481.4 10 j q 1900-01-01 1900-01-01 01:01:01 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to set debug breaks
On 10/30/2006 1:37 PM, waverley palo wrote: Hi, I am new in R and have some frustrations as how to set debug breaks during emacs R debug. I use debug () as where or which function to debug. But during the debug, e.g., I have a for loop at the beginning of the function code and want the code execution to jump through that for loop and set a break after that. How to do that? Is there a web site detailing the syntax of the debugging of R? Hopefully it would be similar to java or C syntax. The debug() function doesn't support setting breakpoints except at function entry, but I believe the debug package does. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Which executable is associated with R CMD INSTALL?
On 10/30/2006 2:32 PM, Patrick Connolly wrote: I'm still having trouble installing the lme4 package on RHEL 3. I've asked this list and it seems my problem is not universal. Brian Ripley indicated that the problem was with recognising the Matrix package, even though I've taken care to get the most recent versions of Matrix and lme4. It seems to me that the problem arises because the computer has a site installation of R-2.3.1 and I'm trying to use R-2.4.0 from my home directory. I use a symbolic link (named R) to point to the 2.4.0 executable. The only problem I've encountered is installing the lme4 package, and I'm now guessing that R CMD INSTALL is not using my link, and defaults to the R-2.3.1. Does my theory have any credibility? I know it wouldn't explain why the other packages don't have a problem, but I'm scraping the bottom of the barrel now. Try R CMD printenv R_HOME and you'll find which R home directory it is using. You can see a lot more with R CMD printenv or various options to R CMD config. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] match lists
What is it that you don't know how to do? Loop over the matrices from the 2 lists and merge them two by two, for example AB - list() ; id - 1 for (i in 1:length(A)) for (j in 1:length(B)) { AB[[id]] - merge(A[[i]],B[[j]],...) id - id + 1 } To better keep track of who's who, you may want to set up A and B as named lists, and replace id with paste(names(A)[i],names(B)[j]). -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Heymans, MW Sent: Sunday, October 29, 2006 6:35 PM To: r-help@stat.math.ethz.ch Subject: [R] match lists Dear list, I have this problem, please your advice. I have list A that contains two matrix elements: [[1]] a b [1,] 2 1 [2,] 3 2 [3,] 3 2 [[2]] c d [1,] 3 5 [2,] 3 1 [3,] 2 3 and list B, that also contains 2 matrices: [[1]] e f g [1,] 1 20 30 [2,] 2 40 50 [3,] 3 60 70 [4,] 4 80 90 [5,] 5 100 110 [[2]] h i j [1,] 1 10 20 [2,] 2 20 30 [3,] 3 30 40 [4,] 4 40 50 [5,] 5 50 60 Now I want to match each column of list A with each row of list B in such a way that element 1 of list A corresponds to element 1 of list B (and element 2 of A with 2 of B). So, in total there will be 4 new matrices, 1 for each column of list A. For example, for column a of list A the new matrix will be: 2 40 50 3 60 70 3 60 70 thanks, Martijn VUmc Amsterdam [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] VGAM-vglm
Can somebody explain to me why I get different results using multinom(package nnet) and vglm(package VGAM)? I think I understand the result I get with multinom, but what has vglm done? How can I interpret the results? (paarer: nominal variable, classes for different jobs, K26A:number of children) library(nnet) erg-multinom(paarer~K26A) library(VGAM) erg-vglm(paarer~K26A,family=multinomial) erg2 Call: multinom(formula = paarer2 ~ K26A) Coefficients: (Intercept) K26A 31.036560 0.35340860 4 -0.801480 0.27423903 51.191205 0.05197307 Residual Deviance: 3358.351 AIC: 3370.351 erg Call: vglm(formula = paarer ~ K26A, family = multinomial) Coefficients: (Intercept):1 (Intercept):2 (Intercept):3K26A:1K26A:2 -1.1910394-0.1545859-1.9922876-0.0521119 0.3013985 K26A:3 0.2221076 Degrees of Freedom: 4524 Total; 4518 Residual Residual Deviance: 3358.351 Log-likelihood: -1679.175 -- View this message in context: http://www.nabble.com/VGAM-vglm-tf2542392.html#a7083843 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] installing package help with limited permissions
On 10/30/2006 11:25 AM, Eva Goldwater wrote: Hello, I administer a student (Windows based) computer lab, which has R installed. I want to permit students to install R packages, but of course they don't have write permission to R root folder. Following FAQ suggestion, I've set up a folder that they can write to, and set the R_LIB parameter on the shortcut to this folder. So far, so good - they can now install packages. However, I have not found any way to get the corresponding help files installed. FAQ says the help files require write permission to R installation folder. This seems pretty extreme. Is there some subfolder that would do the trick? Any way to have an alternate place to store help files, just as we are using an alternate location for packages? I tried giving users Modify permission to R/doc/html folder. With this, install package does NOT give any error for insufficient permission to install help; help(package='package_name') works; however help(function, package='package_name') still does not work. Is there any good way out of this dilemma, short of giving users free permission to the entire R installation? Thanks for any suggestions. I wouldn't play with the permissions. I think you can install help pages locally, and as long as you set the library locations properly (using R_LIBS and/or .libPaths()) help should be available. The one thing you can't do on Windows is link locally installed help in with global help. So I'd suggest settling on a particular location for each student to put his or her library, e.g. R_lib under their home directory. Then put R_LIBS=/path/to/R_lib on the command line. The tricky bit might be working out what /path/to/R_lib is if it varies from student to student and you want to set it for them. This setting for the target in the shortcut seems to work for me: C:\Program Files\R\R-2.4.0\bin\Rgui.exe R_LIBS=%HOMEDRIVE%%HOMEPATH%/R_libs You can run .libPaths() to check after you start, and Sys.getenv(R_LIBS) to see what you were asking for. If the R_libs directory doesn't exist, then you won't see it in .libPaths. Duncan Murdoch __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] plot history
___ Hi, When I create multiple graphs subsequent graphs overwrite previous graphs. How do I keep all my graphs in the current workspace (but not all on the same page) so I can scroll through them? thanks, Rohini Rohini Mulford Senior Research Analyst Technical Research Research Development Insurance Australia Group(IAG) ph (02) 9292 1560 fax (02) 9292 1509 email: [EMAIL PROTECTED] ___ The information transmitted in this message and its attachme...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Debugging R's code: boxplot.stats
Hi Martin, Sorry, I did intend to put some examples in but must have forgotten. This example is easy to understand: boxplot(c(1,Inf,Inf,Inf,Inf)) has lower bound: 1, lower quartile: Inf, median: Inf, upper quartile: Inf, upper bound: Inf. The command currently errors with the obscure message Error in if (any(out[nna])) stats[c(1, 5)] - range(x[!out], na.rm = TRUE) : missing value where TRUE/FALSE needed In this case I think boxplot should draw a (lower) whisker at 1 and nothing else. If my alteration is made, boxplot draws just that. The argument against this change is that the range argument (see ?boxplot) isn't able to be considered (but what is the value of the inter-quartile range anyway? Inf - Inf = NaN.) The smallest example to demonstrate this issue is: boxplot(c(1,Inf,Inf)) I hope that's helpful! Cheers, Matthew On Mon, 2006-10-30 at 15:53 +0100, Martin Maechler wrote: Hi Matthew, I'm considering to apply your proposed change to the R sources of boxplot.stats(). However, I'd like to see interesting examples where the new and old version exhibit differences. Since you've now spent so much time on this, you will have a reproducible-code small example, will you? Thanks in advance! Martin Martin [EMAIL PROTECTED] http://stat.ethz.ch/people/maechler Seminar für Statistik, ETH Zürich LEO C16Leonhardstr. 27 CH-8092 Zurich, SWITZERLAND phone: +41-44-632-3408 fax: ...-1228 Matthew == Matthew Walker [EMAIL PROTECTED] on Mon, 30 Oct 2006 19:32:25 +1300 writes: Matthew On Sun, 2006-10-29 at 20:18 -0500, Duncan Murdoch Matthew wrote: If you're sure your change is a good idea then post a patch here along with an explanation of why it's so good: and it might make it into the next release. Matthew Thank you to both Duncan and Gabor, your help was Matthew really appreciated. Matthew My 10 character alteration did what I hoped it Matthew would. So I'd like to offer it to you or whoever Matthew else might be interested. Matthew Boxplot does it's job well, it even mostly works Matthew with infinite values by not plotting certain lines. Matthew For example, if the upper bound is infinite, the Matthew upper whisker isn't plotted. Matthew However boxplot doesn't work if the upper bound, Matthew upper quartile, median, and lower quartile are all Matthew infinite. Although there is sufficient data to Matthew plot a lower bound, boxplot.stats errors instead. Matthew This error also occurs when the lower bound through Matthew to the upper quartile are negative infinity. Matthew This is not tricky to fix. All that needs to Matthew change is line 14 of boxplot.stats. It currently Matthew reads: if (any(out[nna])) Changing it to: if Matthew (any(out[nna],na.rm=TRUE)) fixes these issues. Matthew Cheers, Matthew Matthew Matthew __ Matthew R-help@stat.math.ethz.ch mailing list Matthew https://stat.ethz.ch/mailman/listinfo/r-help PLEASE Matthew do read the posting guide Matthew http://www.R-project.org/posting-guide.html and Matthew provide commented, minimal, self-contained, Matthew reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plot history
Are you working in Windows? If so, you can turn on recording either in the History menu on the active graphics device window, or by using windows(record=TRUE) to open a new device. On 30/10/06, Rohini Mulford [EMAIL PROTECTED] wrote: ___ Hi, When I create multiple graphs subsequent graphs overwrite previous graphs. How do I keep all my graphs in the current workspace (but not all on the same page) so I can scroll through them? thanks, Rohini Rohini Mulford Senior Research Analyst Technical Research Research Development Insurance Australia Group(IAG) ph (02) 9292 1560 fax (02) 9292 1509 email: [EMAIL PROTECTED] ___ The information transmitted in this message and its attachme...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- = David Barron Said Business School University of Oxford Park End Street Oxford OX1 1HP __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] read.fwf and header
Daniel Nordlund wrote: Gregor, According to the help for read.fwf, sep needs to be set to a value that occurs only in the header record. I changed the spaces to commas in the header record of your example and used the following syntax and was able to read the file just fine. new.data-read.fwf(file=test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 19), header=TRUE, sep=',') Hope this is helpful, Dan Thanks Dan! But I have to modfy file first. Not that much of work but still. Regards, Gregor __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plot history
I send them all to one postscript file and then bring it up in ghostview but maybe there is another way. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Rohini Mulford Sent: Monday, October 30, 2006 5:29 PM To: r-help@stat.math.ethz.ch Subject: [R] plot history ___ Hi, When I create multiple graphs subsequent graphs overwrite previous graphs. How do I keep all my graphs in the current workspace (but not all on the same page) so I can scroll through them? thanks, Rohini Rohini Mulford Senior Research Analyst Technical Research Research Development Insurance Australia Group(IAG) ph (02) 9292 1560 fax (02) 9292 1509 email: [EMAIL PROTECTED] ___ The information transmitted in this message and its attachme...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. This is not an offer (or solicitation of an offer) to buy/se...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] help_aov
Hi, I am trying to run an analysis of variance using R. in my data table x is a continuous variable lengthof 200 and p is a categorical variable also of length 200 and p is anyone of three categories 1,2 or ,3. if I run summary(aov(x~p,data=test)) I get Response: x Df Sum Sq Mean Sq F valuePr(F) p 1 3174.7 3174.7 42.749 5.175e-10 *** Residuals 198 14704.274.3 --- and if I run summary(aov(x~as.factor(p), data=test)) # I get Response: x Df Sum Sq Mean Sq F value Pr(F) as.factor(p) 2 3175.7 1587.8 21.275 4.31e-09 *** Residuals 197 14703.274.6 Can anyone kindly explain the difference. How will it affect -correct way to run - if it is a two-way anova where I have a second categorical variable sex - male or female. Many Thanks Yours sincerely, Bragadeesh __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plot history
Or maybe see ?win.graph. Before each graph use something like: win.graph(width=3,height=3, pointsize=8) You will get a sandwich of graphs. hth, Mihai Nica 170 East Griffith St. G5 Jackson, MS 39201 601-914-0361 - Original Message From: Rohini Mulford [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Sent: Monday, October 30, 2006 4:29:21 PM Subject: [R] plot history ___ Hi, When I create multiple graphs subsequent graphs overwrite previous graphs. How do I keep all my graphs in the current workspace (but not all on the same page) so I can scroll through them? thanks, Rohini Rohini Mulford Senior Research Analyst Technical Research Research Development Insurance Australia Group(IAG) ph (02) 9292 1560 fax (02) 9292 1509 email: [EMAIL PROTECTED] ___ The information transmitted in this message and its attachme...{{dropped}} __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] help_aov
Thanjavur Bragadeesh [EMAIL PROTECTED] writes: Hi, I am trying to run an analysis of variance using R. in my data table x is a continuous variable lengthof 200 and p is a categorical variable also of length 200 and p is anyone of three categories 1,2 or ,3. if I run summary(aov(x~p,data=test)) I get Response: x Df Sum Sq Mean Sq F valuePr(F) p 1 3174.7 3174.7 42.749 5.175e-10 *** Residuals 198 14704.274.3 If you get 1 DF for a variable with three different values, then it is not a categorical variable from R's point of view, but a quantitative one. So you need x~factor(p) here like you have below. Or convert p to a factor before the analysis. and if I run summary(aov(x~as.factor(p), data=test)) # I get Response: x Df Sum Sq Mean Sq F value Pr(F) as.factor(p) 2 3175.7 1587.8 21.275 4.31e-09 *** Residuals 197 14703.274.6 Can anyone kindly explain the difference. How will it affect -correct way to run - if it is a two-way anova where I have a second categorical variable sex - male or female. Many Thanks Yours sincerely, Bragadeesh __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- O__ Peter Dalgaard Øster Farimagsgade 5, Entr.B c/ /'_ --- Dept. of Biostatistics PO Box 2099, 1014 Cph. K (*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918 ~~ - ([EMAIL PROTECTED]) FAX: (+45) 35327907 __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Hmisc or Lattice plot with error bars, Depth (independent variable) on Y axis
On 10/30/06, Mike Bock [EMAIL PROTECTED] wrote: I am trying to create some plots of concentration versus depth. I want Depth on the Y axis and the concentrations on the X axis. I also need to plot error bars. The xYplot function in Hmisc is very nearly ideal but I have to put depth on the x-axis to get it to work. When I transpose the X and Y axes in the xYplot command, the error bars disappear (no surprise given the help file). It there a way to get the plot command to flip the axes? That would be ideal as I could use the grouping functions in xYplot and save a bunch of work. If no such command exists any other ideas? See demo(intervals) The untruncated code can be seen with file.show(system.file(demo/intervals.R, package = lattice)) There was a recent thread dealing with extensions (grouping and switching axes): [1] https://stat.ethz.ch/pipermail/r-help/2006-October/114883.html -Deepayan __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] as.zoo question
this is probably a question for gabor or achim but maybe someone else can answer it in case they are not around ? Ifr you paste the code below ( again you would need the zoo and chron libraries to be installed ), you should get the error Error in Ops.POSIXt(frequency, freq) : %% not defined for POSIXt objects. What I want to do is take the numeric vector, lt, and turn it into a zoo object using the index of bayesfactor ? but i think i am doing something wrong. maybe as.zoo expects something else other than a vector or maybe the elements of lt need to be unique ? it doesn't sound like lack of uniqueness is the problem form the error. thanks to anyone who would bother to paste the code or could tell me the problem. #--- bayesfactor-structure(c(0.133850433767341, 0.127505873914653, 0.097757994080402, 0.324562703639163, 0.114562946148566, 0.283795371391936, 0.9678194561964, 0.338586999584375, 0.135003441260579, 0.215395275848400, 0.327083442440481, 0.164810629677337, 0.144040559454059, 0.181455513072478, 0.129252354959480, 0.123264924228799, 0.325252571911978, 2.80852371783714, 0.809908249342204, 0.624384923054961, 0.216870224939086, 0.157696528982145, 0.166016564358535, 0.173687057125139, 0.150821633236067, 0.2430468137645, 0.854984063927109, 0.241767533140137, 0.163060042017201, 0.495942843741025, 29.5233864009281, 64.1263988614399, 80.5032273753947, 18.7433294450866, 2.37477344132821, 2.74811299975449, 8.6709767238735, 1.45810462283319, 0.641296294877387, 0.532305913663132, 0.506016009063049, 0.714235796507194, 0.877754321270327, 0.888167760154018, 0.908285299222526, 0.79698098937542, 0.573452272577509, 0.8159526626772, 0.996710951332215, 0.887917149684703, 0.951644190080987, 1.85771801589324, 3.49393985909198, 4.21174333281804, 3.81915573606739, 4.22536274298039, 4.18355088851037, 4.42599684236279, 3.83974932512314, 1.6996083496491, 1.01414288248082, 0.820775001454904, 0.76228386994647, 1.06157643535834, 1.41500363895303, 1.66238340719379, 1.66459194376001, 2.89941981293673, 3.12622131071540, 2.5453954903191, 2.28829891176501, 2.18799931254973, 1.53144708705511, 1.39950525087250, 1.28050833200472, 1.14952307627248, 1.14181384544291, 0.922409537373749, 0.935484555235005, 0.901665993356154, 0.890055544480275, 0.868401571267226, 0.8677885803414, 0.897604762926691, 0.841753954861793, 0.870938651757163, 0.81254996456992, 0.81499410166, 0.899730469158174, 0.93997787435783, 0.859961998580039, 0.86795417554376, 0.897246596004909, 1.13008276895139, 1.24862389046983, 1.24486010790566, 1.1178505048961, 1.22854262450414, 1.35879837119693, 1.7138940559014, 1.70018632820926, 1.42758456262715, 1.35841545310882, 1.10609206096155, 1.17877367462301, 1.26894809654439, 1.27141596311207, 1.27978970261800, 1.27354103448998, 1.31701136171458, 1.30050806806998, 1.28365731671798, 1.20664901565754), index = structure(c(1151904000, 1151904600, 1151905200, 1151905800, 1151906400, 1151907000, 1151907600, 1151908200, 1151908800, 1151909400, 115191, 1151910600, 1151911200, 1151911800, 1151912400, 1151913000, 1151913600, 1151914200, 1151914800, 1151915400, 1151916000, 1151916600, 1151917200, 1151917800, 1151918400, 1151919000, 1151919600, 1151920200, 1151920800, 1151921400, 1151922000, 1151922600, 1151923200, 1151923800, 1151924400, 1151925000, 1151925600, 1151926200, 1151926800, 1151927400, 1151928000, 1151928600, 1151929200, 1151929800, 1151930400, 1151931000, 1151931600, 1151932200, 1151932800, 1151933400, 1151934000, 1151934600, 1151935200, 1151935800, 1151936400, 1151937000, 1151937600, 1151938200, 1151938800, 1151939400, 115194, 1151940600, 1151941200, 1151941800, 1151942400, 1151943000, 1151943600, 1151944200, 1151944800, 1151945400, 1151946000, 1151946600, 1151947200, 1151947800, 1151948400, 1151949000, 1151949600, 1151950200, 1151950800, 1151951400, 1151952000, 1151952600, 1151953200, 1151953800, 1151954400, 1151955000, 1151955600, 1151956200, 1151956800, 1151957400, 1151958000, 1151958600, 1151959200, 1151959800, 1151960400, 1151961000, 1151961600, 1151962200, 1151962800, 1151963400, 1151964000, 1151964600, 1151965200, 1151965800, 1151966400, 1151967000, 1151967600, 1151968200, 1151968800, 1151969400, 115197, 1151970600, 1151971200), class = c(POSIXt, POSIXct)), class = zoo) lt-c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1) lt-as.zoo(lt,index(bayesfactor)) #---
Re: [R] as.zoo question
oops, for the pasting to work, You would have to get rid of the blank line that occurs during the bayesfactor construction. Thanks. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Leeds, Mark (IED) Sent: Monday, October 30, 2006 6:15 PM To: r-help@stat.math.ethz.ch Subject: [R] as.zoo question this is probably a question for gabor or achim but maybe someone else can answer it in case they are not around ? Ifr you paste the code below ( again you would need the zoo and chron libraries to be installed ), you should get the error Error in Ops.POSIXt(frequency, freq) : %% not defined for POSIXt objects. What I want to do is take the numeric vector, lt, and turn it into a zoo object using the index of bayesfactor ? but i think i am doing something wrong. maybe as.zoo expects something else other than a vector or maybe the elements of lt need to be unique ? it doesn't sound like lack of uniqueness is the problem form the error. thanks to anyone who would bother to paste the code or could tell me the problem. #--- bayesfactor-structure(c(0.133850433767341, 0.127505873914653, 0.097757994080402, 0.324562703639163, 0.114562946148566, 0.283795371391936, 0.9678194561964, 0.338586999584375, 0.135003441260579, 0.215395275848400, 0.327083442440481, 0.164810629677337, 0.144040559454059, 0.181455513072478, 0.129252354959480, 0.123264924228799, 0.325252571911978, 2.80852371783714, 0.809908249342204, 0.624384923054961, 0.216870224939086, 0.157696528982145, 0.166016564358535, 0.173687057125139, 0.150821633236067, 0.2430468137645, 0.854984063927109, 0.241767533140137, 0.163060042017201, 0.495942843741025, 29.5233864009281, 64.1263988614399, 80.5032273753947, 18.7433294450866, 2.37477344132821, 2.74811299975449, 8.6709767238735, 1.45810462283319, 0.641296294877387, 0.532305913663132, 0.506016009063049, 0.714235796507194, 0.877754321270327, 0.888167760154018, 0.908285299222526, 0.79698098937542, 0.573452272577509, 0.8159526626772, 0.996710951332215, 0.887917149684703, 0.951644190080987, 1.85771801589324, 3.49393985909198, 4.21174333281804, 3.81915573606739, 4.22536274298039, 4.18355088851037, 4.42599684236279, 3.83974932512314, 1.6996083496491, 1.01414288248082, 0.820775001454904, 0.76228386994647, 1.06157643535834, 1.41500363895303, 1.66238340719379, 1.66459194376001, 2.89941981293673, 3.12622131071540, 2.5453954903191, 2.28829891176501, 2.18799931254973, 1.53144708705511, 1.39950525087250, 1.28050833200472, 1.14952307627248, 1.14181384544291, 0.922409537373749, 0.935484555235005, 0.901665993356154, 0.890055544480275, 0.868401571267226, 0.8677885803414, 0.897604762926691, 0.841753954861793, 0.870938651757163, 0.81254996456992, 0.81499410166, 0.899730469158174, 0.93997787435783, 0.859961998580039, 0.86795417554376, 0.897246596004909, 1.13008276895139, 1.24862389046983, 1.24486010790566, 1.1178505048961, 1.22854262450414, 1.35879837119693, 1.7138940559014, 1.70018632820926, 1.42758456262715, 1.35841545310882, 1.10609206096155, 1.17877367462301, 1.26894809654439, 1.27141596311207, 1.27978970261800, 1.27354103448998, 1.31701136171458, 1.30050806806998, 1.28365731671798, 1.20664901565754), index = structure(c(1151904000, 1151904600, 1151905200, 1151905800, 1151906400, 1151907000, 1151907600, 1151908200, 1151908800, 1151909400, 115191, 1151910600, 1151911200, 1151911800, 1151912400, 1151913000, 1151913600, 1151914200, 1151914800, 1151915400, 1151916000, 1151916600, 1151917200, 1151917800, 1151918400, 1151919000, 1151919600, 1151920200, 1151920800, 1151921400, 1151922000, 1151922600, 1151923200, 1151923800, 1151924400, 1151925000, 1151925600, 1151926200, 1151926800, 1151927400, 1151928000, 1151928600, 1151929200, 1151929800, 1151930400, 1151931000, 1151931600, 1151932200, 1151932800, 1151933400, 1151934000, 1151934600, 1151935200, 1151935800, 1151936400, 1151937000, 1151937600, 1151938200, 1151938800, 1151939400, 115194, 1151940600, 1151941200, 1151941800, 1151942400, 1151943000, 1151943600, 1151944200, 1151944800, 1151945400, 1151946000, 1151946600, 1151947200, 1151947800, 1151948400, 1151949000, 1151949600, 1151950200, 1151950800, 1151951400, 1151952000, 1151952600, 1151953200, 1151953800, 1151954400, 1151955000, 1151955600, 1151956200, 1151956800, 1151957400, 1151958000, 1151958600, 1151959200, 1151959800, 1151960400, 1151961000, 1151961600, 1151962200, 1151962800, 1151963400, 1151964000, 1151964600, 1151965200, 1151965800, 1151966400, 1151967000, 1151967600, 1151968200, 1151968800, 1151969400, 115197, 1151970600, 1151971200), class = c(POSIXt, POSIXct)), class = zoo) lt-c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 3, 1, 1, 1, 1, 1, 1, 1, 1, 1,
[R] how to plot a data.frame?
hi, i have a data frame like this: 0.3 0.7 0.4 0.8 i am trying to plot this data frame and each cell is filled with different colors based on the value. Is there a function which can do this? thanks, -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. Did you always know? No, I did not. But I believed... ---Matrix III __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to plot a data.frame?
Yep: ?image Creates a grid of colored or gray-scale rectangles with colors corresponding to the values in z. This can be used to display three- dimensional or spatial data aka “images”. This is a generic function. Hope that helps, Jeff. On Oct 30, 2006, at 7:01 PM, Weiwei Shi wrote: hi, i have a data frame like this: 0.3 0.7 0.4 0.8 i am trying to plot this data frame and each cell is filled with different colors based on the value. Is there a function which can do this? thanks, -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. Did you always know? No, I did not. But I believed... ---Matrix III __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting- guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] how to plot a data.frame?
try heatmap function On 10/30/06, Weiwei Shi [EMAIL PROTECTED] wrote: hi, i have a data frame like this: 0.3 0.7 0.4 0.8 i am trying to plot this data frame and each cell is filled with different colors based on the value. Is there a function which can do this? thanks, -- Weiwei Shi, Ph.D Research Scientist GeneGO, Inc. Did you always know? No, I did not. But I believed... ---Matrix III __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. -- Waverley @ Palo Alto [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] as.zoo question
It should be zoo, not as.zoo. We are constructing a zoo object from scratch here, not converting a time series object of a different class to zoo. On 10/30/06, Leeds, Mark (IED) [EMAIL PROTECTED] wrote: oops, for the pasting to work, You would have to get rid of the blank line that occurs during the bayesfactor construction. Thanks. -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Leeds, Mark (IED) Sent: Monday, October 30, 2006 6:15 PM To: r-help@stat.math.ethz.ch Subject: [R] as.zoo question this is probably a question for gabor or achim but maybe someone else can answer it in case they are not around ? Ifr you paste the code below ( again you would need the zoo and chron libraries to be installed ), you should get the error Error in Ops.POSIXt(frequency, freq) : %% not defined for POSIXt objects. What I want to do is take the numeric vector, lt, and turn it into a zoo object using the index of bayesfactor ? but i think i am doing something wrong. maybe as.zoo expects something else other than a vector or maybe the elements of lt need to be unique ? it doesn't sound like lack of uniqueness is the problem form the error. thanks to anyone who would bother to paste the code or could tell me the problem. #--- bayesfactor-structure(c(0.133850433767341, 0.127505873914653, 0.097757994080402, 0.324562703639163, 0.114562946148566, 0.283795371391936, 0.9678194561964, 0.338586999584375, 0.135003441260579, 0.215395275848400, 0.327083442440481, 0.164810629677337, 0.144040559454059, 0.181455513072478, 0.129252354959480, 0.123264924228799, 0.325252571911978, 2.80852371783714, 0.809908249342204, 0.624384923054961, 0.216870224939086, 0.157696528982145, 0.166016564358535, 0.173687057125139, 0.150821633236067, 0.2430468137645, 0.854984063927109, 0.241767533140137, 0.163060042017201, 0.495942843741025, 29.5233864009281, 64.1263988614399, 80.5032273753947, 18.7433294450866, 2.37477344132821, 2.74811299975449, 8.6709767238735, 1.45810462283319, 0.641296294877387, 0.532305913663132, 0.506016009063049, 0.714235796507194, 0.877754321270327, 0.888167760154018, 0.908285299222526, 0.79698098937542, 0.573452272577509, 0.8159526626772, 0.996710951332215, 0.887917149684703, 0.951644190080987, 1.85771801589324, 3.49393985909198, 4.21174333281804, 3.81915573606739, 4.22536274298039, 4.18355088851037, 4.42599684236279, 3.83974932512314, 1.6996083496491, 1.01414288248082, 0.820775001454904, 0.76228386994647, 1.06157643535834, 1.41500363895303, 1.66238340719379, 1.66459194376001, 2.89941981293673, 3.12622131071540, 2.5453954903191, 2.28829891176501, 2.18799931254973, 1.53144708705511, 1.39950525087250, 1.28050833200472, 1.14952307627248, 1.14181384544291, 0.922409537373749, 0.935484555235005, 0.901665993356154, 0.890055544480275, 0.868401571267226, 0.8677885803414, 0.897604762926691, 0.841753954861793, 0.870938651757163, 0.81254996456992, 0.81499410166, 0.899730469158174, 0.93997787435783, 0.859961998580039, 0.86795417554376, 0.897246596004909, 1.13008276895139, 1.24862389046983, 1.24486010790566, 1.1178505048961, 1.22854262450414, 1.35879837119693, 1.7138940559014, 1.70018632820926, 1.42758456262715, 1.35841545310882, 1.10609206096155, 1.17877367462301, 1.26894809654439, 1.27141596311207, 1.27978970261800, 1.27354103448998, 1.31701136171458, 1.30050806806998, 1.28365731671798, 1.20664901565754), index = structure(c(1151904000, 1151904600, 1151905200, 1151905800, 1151906400, 1151907000, 1151907600, 1151908200, 1151908800, 1151909400, 115191, 1151910600, 1151911200, 1151911800, 1151912400, 1151913000, 1151913600, 1151914200, 1151914800, 1151915400, 1151916000, 1151916600, 1151917200, 1151917800, 1151918400, 1151919000, 1151919600, 1151920200, 1151920800, 1151921400, 1151922000, 1151922600, 1151923200, 1151923800, 1151924400, 1151925000, 1151925600, 1151926200, 1151926800, 1151927400, 1151928000, 1151928600, 1151929200, 1151929800, 1151930400, 1151931000, 1151931600, 1151932200, 1151932800, 1151933400, 1151934000, 1151934600, 1151935200, 1151935800, 1151936400, 1151937000, 1151937600, 1151938200, 1151938800, 1151939400, 115194, 1151940600, 1151941200, 1151941800, 1151942400, 1151943000, 1151943600, 1151944200, 1151944800, 1151945400, 1151946000, 1151946600, 1151947200, 1151947800, 1151948400, 1151949000, 1151949600, 1151950200, 1151950800, 1151951400, 1151952000, 1151952600, 1151953200, 1151953800, 1151954400, 1151955000, 1151955600, 1151956200, 1151956800, 1151957400, 1151958000, 1151958600, 1151959200, 1151959800, 1151960400, 1151961000, 1151961600, 1151962200, 1151962800, 1151963400, 1151964000, 1151964600, 1151965200, 1151965800, 1151966400, 1151967000, 1151967600, 1151968200, 1151968800, 1151969400, 115197, 1151970600, 1151971200), class =
[R] exteremely confused (simple question)
I thought I knew how to use data frames, but apparently not. I have created a data frame, and named the columns: df KSurv Growth Class 1 4808 0.86212 0.00669640 S 2 2430 0.98038 1.3054 S 3 2084 0.93579 0.44079000 S 4 2600 0.95394 2.0368 S 5 2143 0.96112 1.7833 S 6 4722 0.96682 6.3685 S 7 2639 0.94464 0.81887000 S 8 4906 0.96520 3.1004 S 9 1016 0.98993 1.6987 S 10 973 0.98137 1.4675 S ... etc. However, when I try to index a subset of this data frame, I get an error: df[Growth0.5] Error in [.data.frame(df, Growth 0.5) : object Growth not found Why on earth is it looking for a Growth object, when it is a column name in the data frame?? Extremely confused, -- Chris Fonnesbeck + Atlanta, GA + http://trichech.us __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] exteremely confused (simple question)
You need to tell R that you mean Growth, the column in your data.frame. Otherwise R is looking for an external criterion named Growth. Try this: df[df$Growth0.5,] That means choose all columns for which df$Growth has a row value 0.5 df[df$Growth0.5,] IDKSurvGrowth Class 1 1 4808 0.86212 0.0066964 S 3 3 2084 0.93579 0.4407900 S Charles Annis, P.E. [EMAIL PROTECTED] phone: 561-352-9699 eFax: 614-455-3265 http://www.StatisticalEngineering.com -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Chris Fonnesbeck Sent: Monday, October 30, 2006 7:48 PM To: r-help@stat.math.ethz.ch Subject: [R] exteremely confused (simple question) I thought I knew how to use data frames, but apparently not. I have created a data frame, and named the columns: df KSurv Growth Class 1 4808 0.86212 0.00669640 S 2 2430 0.98038 1.3054 S 3 2084 0.93579 0.44079000 S 4 2600 0.95394 2.0368 S 5 2143 0.96112 1.7833 S 6 4722 0.96682 6.3685 S 7 2639 0.94464 0.81887000 S 8 4906 0.96520 3.1004 S 9 1016 0.98993 1.6987 S 10 973 0.98137 1.4675 S ... etc. However, when I try to index a subset of this data frame, I get an error: df[Growth0.5] Error in [.data.frame(df, Growth 0.5) : object Growth not found Why on earth is it looking for a Growth object, when it is a column name in the data frame?? Extremely confused, -- Chris Fonnesbeck + Atlanta, GA + http://trichech.us __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Problem mit den Spracheinstellungen nach Installation von R
Hallo, ich habe ein Problem mit R. Ich hoffe hier auf die freundliche Hilfe der Community. Schilderung des Problems: Ich habe R 2.4.0 auf einem Rechner (1) installiert. - Am Anfang der Installation klickte ich auf Setup Deutsch. - Dann führte ich die Installation weiter mit den Grundeinstellungen fort. - Das Ergebnis: Nach der Installation hatte ich wie erhofft eine deutschsprachige Bedienoberfläche. Ich habe R 2.4.0. auf einem weiteren Rechner (2) installiert. - Am Anfang der Installation klickte ich auf Setup Deutsch. - Dann führte ich die Installation weiter mit den Grundeinstellungen fort. - Das Ergebnis: Nach der Installation hatte ich eine englischsprachige Bedienoberfläche. Ich hätte jetzt gerne auf Rechner (2) gerne eine deutschsprachige Bedienoberfläche. Wie kann ich das bewerkstelligen? Ich habe bisher für dieses Problem kein Lösung gefunden. Zusatz: Auf Rechner (2) war vorher R 2.3.0. mit englischer Bedienoberfläche installiert. Es wurde vor der Installation komplett deinstallier und auch der Programmordner gelöscht. Ich hoffe, dass mir irgendjemand helfen kann. Über hilfreiche Tipps per Mail würde ich mich sehr freuen. MfG DIRK __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Confidence interval calculation in prop.test
The confidence interval calculation in prop.test appears to be incorrect when alternative=greater. The upper limit is always set to 1.000. Am I missing something? total=c(250,250) success=c(55,31) prop.test(success,total,alternative=greater,correct=TRUE) 2-sample test for equality of proportions with continuity correction data: success out of total X-squared = 7.4289, df = 1, p-value = 0.003209 alternative hypothesis: greater 95 percent confidence interval: 0.03693065 1. sample estimates: prop 1 prop 2 0.220 0.124 [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] plotting multiple groups (newbie Q)
Hi Folks, After loading a data set, I run the following: kSum - orderBy(~group,(summaryBy(DP_Level~F2 +group,data=kdata,FUN=c(mean,sd),na.rm=T))) kSum looks like this: kSum F2 group DP_Level.mean DP_Level.sd 1 1.0 N -1.55186475 11.022245 4 2.0 N -2.48013300 10.624583 7 3.0 N -12.47671250 11.104792 10 4.0 N -13.72430950 12.000779 13 6.0 N -20.33209750 11.393002 16 8.0 N -26.091585006.851262 19 12.5 N -25.171460005.480260 22 14.0 N -26.113505006.012569 25 16.0 N -25.778386006.186600 2 1.0SN -4.89147932 14.141263 5 2.0SN -13.11899886 11.457917 8 3.0SN -20.306884298.037245 11 4.0SN -27.952031077.337336 14 6.0SN -23.295717509.499774 17 8.0SN -25.603171437.292301 20 12.5SN -29.484928578.008832 23 14.0SN -25.126810715.811917 26 16.0SN -26.629307145.108508 3 1.0 Y0.089770719.510582 6 2.0 Y -2.13214786 13.840692 9 3.0 Y -7.9971 10.245682 12 4.0 Y -6.42145271 17.000314 15 6.0 Y -2.10020521 16.730351 18 8.0 Y -7.88271257 19.726457 21 12.5 Y -24.26847.275585 24 14.0 Y -22.186285712.878094 27 16.0 Y -24.749492866.556951 Now I want to do some plotting: plot(kSum$F2[group==N],kSum$DP_Level.mean[group==N],type=l) # This works fine plot(kSum$F2[group==SN],kSum$DP_Level.mean[group==SN],type=l) # This plots both N and SN in one line sequentially plot(kSum$F2[group==Y],kSum$DP_Level.mean[group==Y],type=l) # This gives the following error messages. Error in plot.window(xlim, ylim, log, asp, ...) : need finite 'xlim' values In addition: Warning messages: 1: no non-missing arguments to min; returning Inf 2: no non-missing arguments to max; returning -Inf 3: no non-missing arguments to min; returning Inf 4: no non-missing arguments to max; returning -Inf What am I doing wrong? All suggestions are appreciated. Regards, Sumit __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] Saving a function
Hey, I'm a real novice... how do I go about saving a function that I created eg. If I created this function: Fun-function(x1,X2) {..}, how can I store it so that the next time I use R I can load it and not have to type it out again Cheers Matt -- View this message in context: http://www.nabble.com/Saving-a-function-tf2543540.html#a7087217 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] [Fwd: Re: Organisation of medium/large projects with multiple analyses]
It's good to see this sort of thing discussed. For my current approach, I keep a fairly static directory for function libraries, another one for large data sets, and others for projects. I try to define tasks (probably like your analyses) within projects. There is a project folder with a lot of task sub-folders. For data sets I usually write a special pre-processing program that generates a workspace to be read in by other programs. I embed dates in the names of my task folders. For Monte Carlo experiments, I rely on automated systems for naming workspaces. When the simulation parameters are changed, the file (a workspace) where simulation results are stored is renamed automatically. Otherwise, I really can't keep track of things acurately. Addtional programs are used for post-processing simulation output. My modifications of functions have for the most part involved addition of new arguments, with defaults, and so this has not caused me much problem in practice, although my functions do tend to evolve. One thing I find helpful is, after I write a report, I revise my file names for R programs so that the figure numbers from the report are embedded in the file names. That way it is easy to start from the report and find the code that generates particular figures. regards, Farrar Mark Wardle [EMAIL PROTECTED] wrote: Daniel Elliott wrote: Mark, It sounds like your data/experiment storage and organization needs are more complicated than mine, but I'll share my methodology... Many thanks for this, and for the other replies received off-list. It is much appreciated, and confirms that with something as generically applicable as R, with as many widespread and heterogeneous uses, there is no universal solution. I'm still new to R, but have a fair experience with general programming. All of my data is stored in postgresql, and I have a number of R files that generate tables, results, graphs etc. These are then available to be imported into powerpoint/latex etc. I'm using version control (subversion), and as with most small projects, now have an ever increasing number of R scripts, each with fairly specific features. I only use version control for generic code. For me, generic code is not at the experiment level but at the algorithm level. It is only code that others would find useful - code that I hope to release to the R community. I use object-oriented programming to simplify the more specific, experiment-level scripts that I will describe later. These objects include plotting and data import/export among other things. Like you, many of my experiments are variations on the same theme. I have attempted general functions that can run many different experiments with changes only to parameters, but I have found this far too cumbersome. I am now resigned to storing all code and input and generated output data and graphs together in a single directory for each experiment with the exception of my general libraries. This typically consists of me copying the scripts that ran other experiments into a new directory where they are (hopefully only slightly) modified to fit the new experiment. I wish I had a cooler way to handle all of this, but this does make it very easy to rerun stuff. I even create new files, but not necessarily new directories, for scripts that differ only in the parameters they used when calling functions from my libraries. I suppose these can either be factored out into more generic functions (time consuming, and maybe not useful in the longer-term), or you should use version control to create branches, and then if you improve the copy of a function in one experiment, you have the potential of automatically merging back your changes to other branches. Do you go to the effort of creating a library that solves your particular problem, or only reserve that for more generic functionality? I only use libraries and classes for code that is generic enough to be usable by rest of the R community. Do people keep all of their R scripts for a specific project separate, or in one big file? Files for a particular project are kept in many different directories with little structure. Experiment logs (like informal lab reports) are used if I need to revisit or rerun an experiment. By the way, I back all of this stuff onto tape drive or DVD. I can see advantages (knowing it all works) and disadvantages (time for it all to run after minor changes) in both approaches, but it is unclear to me which is better. I do know that I've set-up a variety of analyses, moved on to other things, only to find later on that old scripts have stopped working because I've changed some interdependency. Does anyone go as far as to use test suites to check for sane output (apart from doing things manually)? Note I'm not asking about how to run R on all these scripts, as people
[R] [R-pkgs] rcompletion: TAB completion for the R command line
CRAN now has a package called rcompletion that attempts to provide TAB completion for R using the GNU readline library, intended for R sessions run from a command line. From the package help page: Description: This package provides pseudo-intelligent TAB completion for a readline enabled instance of R when it is run from a terminal (or more specifically, an interface which uses readline to accept user input). It has no effect on the various GUI interfaces to R, including ESS and the standard Windows interface. The package does not compile on a standard Windows box, and there is no Windows binary available for it. For more usage details, install and load the package, then type package?rcompletion at the R prompt. The manual is also available online at http://cran.r-project.org/doc/packages/rcompletion.pdf Notes: To install and use the package successfully, you need: (1) R compiled with readline, and run with readline enabled (2) the rcompletion package compiled with readline The rcompletion package comes with a configure script that tries to detect readline on the system and aborts if it is unsuccessful in doing so. There have been no reports so far of false positives (i.e. detecting readline when it shouldn't). However, there are known cases of false negatives, i.e. installation failing when it shouldn't. If this happens to you, any information you can provide to help resolve the problem would be appreciated. If step (2) appears to be successful but (1) is not true (e.g. R is run with --no-readline), nothing bad (but nothing good either) should happen. -Deepayan ___ R-packages mailing list R-packages@stat.math.ethz.ch https://stat.ethz.ch/mailman/listinfo/r-packages __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] power.z.test
Does anyone have/know how to write the power function for z tests something like below? function(a,m0,m1,n,s){ t1 = -qnorm(1-a) num = abs(m0-m1) * sqrt(n) t2 = num/s pow = pnorm(t1 + t2) } thx much ej __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] problem in intallasation
Sir I have downloaded new release of R 2.4.0. But there is no R.2.4.0.exefile for installing it. I request you to please guid me. Regards -- AMINA SHAHZADI Department of Statistics GC University Lahore, Pakistan. Email: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
[R] how to make a data file
Sir after importing data from excel to R, I am not understanding how to make this data file. So that I can use it in extRemeToolkit and other packages. Thank you -- AMINA SHAHZADI Department of Statistics GC University Lahore, Pakistan. Email: [EMAIL PROTECTED] [EMAIL PROTECTED] [EMAIL PROTECTED] [[alternative HTML version deleted]] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] plotting multiple groups (newbie Q)
Hi I suspect that value in kSum$group is not exactly Y (some space like Y ) or maybe there is some other variable named group elsewhere but without value Y. try to look at kSum$group or do ls(). HTH Petr On 30 Oct 2006 at 20:13, Sumitrajit Dhar wrote: To: r-help@stat.math.ethz.ch From: Sumitrajit Dhar [EMAIL PROTECTED] Date sent: Mon, 30 Oct 2006 20:13:14 -0600 Subject:[R] plotting multiple groups (newbie Q) Hi Folks, After loading a data set, I run the following: kSum - orderBy(~group,(summaryBy(DP_Level~F2 +group,data=kdata,FUN=c(mean,sd),na.rm=T))) kSum looks like this: kSum F2 group DP_Level.mean DP_Level.sd 1 1.0 N -1.55186475 11.022245 4 2.0 N -2.48013300 10.624583 7 3.0 N -12.47671250 11.104792 10 4.0 N -13.72430950 12.000779 13 6.0 N -20.33209750 11.393002 16 8.0 N -26.091585006.851262 19 12.5 N -25.171460005.480260 22 14.0 N -26.113505006.012569 25 16.0 N -25.778386006.186600 2 1.0SN -4.89147932 14.141263 5 2.0SN -13.11899886 11.457917 8 3.0SN -20.306884298.037245 11 4.0SN -27.952031077.337336 14 6.0SN -23.295717509.499774 17 8.0SN -25.603171437.292301 20 12.5SN -29.484928578.008832 23 14.0SN -25.126810715.811917 26 16.0SN -26.629307145.108508 3 1.0 Y0.089770719.510582 6 2.0 Y -2.13214786 13.840692 9 3.0 Y -7.9971 10.245682 12 4.0 Y -6.42145271 17.000314 15 6.0 Y -2.10020521 16.730351 18 8.0 Y -7.88271257 19.726457 21 12.5 Y -24.26847.275585 24 14.0 Y -22.186285712.878094 27 16.0 Y -24.749492866.556951 Now I want to do some plotting: plot(kSum$F2[group==N],kSum$DP_Level.mean[group==N],type=l) # This works fine plot(kSum$F2[group==SN],kSum$DP_Level.mean[group==SN],type=l) # This plots both N and SN in one line sequentially plot(kSum$F2[group==Y],kSum$DP_Level.mean[group==Y],type=l) # This gives the following error messages. Error in plot.window(xlim, ylim, log, asp, ...) : need finite 'xlim' values In addition: Warning messages: 1: no non-missing arguments to min; returning Inf 2: no non-missing arguments to max; returning -Inf 3: no non-missing arguments to min; returning Inf 4: no non-missing arguments to max; returning -Inf What am I doing wrong? All suggestions are appreciated. Regards, Sumit __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] Saving a function
Hi 1. You can create your own package (set of functions) and load it each time you start R 2. When quitting R you can save workspace. It will create a file named .Rdata in which your function is defined. Then you can load this workspace and use your function 3. You can use some of dput, dget, source, save, load to write your function to a file and get it back to your R session 4. You can consult manuals and help pages (R-intro, R-exts) or go through some texts available on CRAN to learn how exactly to do such things. HTH Petr On 30 Oct 2006 at 18:26, patopatasfrias wrote: Date sent: Mon, 30 Oct 2006 18:26:51 -0800 (PST) From: patopatasfrias [EMAIL PROTECTED] To: r-help@stat.math.ethz.ch Subject:[R] Saving a function Hey, I'm a real novice... how do I go about saving a function that I created eg. If I created this function: Fun-function(x1,X2) {..}, how can I store it so that the next time I use R I can load it and not have to type it out again Cheers Matt -- View this message in context: http://www.nabble.com/Saving-a-function-tf2543540.html#a7087217 Sent from the R help mailing list archive at Nabble.com. __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Petr Pikal [EMAIL PROTECTED] __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.
Re: [R] read.fwf and header
Gregor == Gregor Gorjanc [EMAIL PROTECTED] on Mon, 30 Oct 2006 23:33:21 +0100 writes: Gregor Daniel Nordlund wrote: Gregor, According to the help for read.fwf, sep needs to be set to a value that occurs only in the header record. I changed the spaces to commas in the header record of your example and used the following syntax and was able to read the file just fine. new.data-read.fwf(file=test.txt, widths=c(3, 4, 10, 3, 2, 2, 2, 2, 11, 19), header=TRUE, sep=',') Hope this is helpful, Dan Gregor Thanks Dan! But I have to modfy file first. Not that Gregor much of work but still. Yes, but I think it shows read.fwf() should not be extended for even more special cases: In my (and probably R-core's) view, read.fwf() should only have to be used for ``legacy data files'' (those times when people used *no* separators in order to save disk space), since nowadays, such data files should automatically have correct separators. -- Fix the file producing process rather than make read.fwf() unnecessarily more complicated. Martin Maechler, ETH Zurich __ R-help@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.