Re: [R] R2WinBUGS and R-2.10.0: The school example not running
I have a fix in R2WinBUGS_2.1-15 which is on its way to CRAN and will appear there within 2 days, probably. Best wishes, Uwe Ligges Luwis Tapiwa Diya wrote: Dear R users I have been encountering an error (in the Winbugs window: Blackbox - index out of range . ). So to me it seems R2WinBUGS is not linking up well with the new R version since the same model runs well under r-2.9.2. So is my assumption correct or am I doing something wrong. The data I used and the code are in the help of R2WinBUGS (?bugs). Regards, __ R-help@r-project.org 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] R2WinBUGS not working?
I have a fix in R2WinBUGS_2.1-15 which is on its way to CRAN and will appear there within 2 days, probably. Best wishes, Uwe Ligges Paul Heinrich Dietrich wrote: This weekend I noticed that my R2WinBUGS connection was no longer working on my Windows computer at work AND my Ubuntu linux computer at home. As soon as WinBUGS opens, the message reads Index Out Of Range. I have un-installed and re-installed R on both computers and the problem remains the same. At first I thought it was the new version of R, but I was able to overcome the problem (on Windows only) with the use of program=openbugs in R2WinBUGS. But that doesn't work on Linux. PS The smallest WinBUGS program I have, essentially a t-test, still works. But anything larger than that gets the error. Help. Thanks. __ R-help@r-project.org 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] Build recommended packages from source under Windows
See the manual Writing R Extensions, Section 6.5.1: Printing from FORTRAN Best wishes, uwe Ligges rkevinbur...@charter.net wrote: Hello, From the date time stamps I see that not only do I have the results of the build in 'gnuwin32/front-ends' but I can also see the time stamps have changed in the main bin directory so I assume that the result of 'make all recommended' also copies the results there. Now on to the packages. I was interested in following the flow of 'stl' so I added the following lines to stl.f in src/library/stats/src. do i=1,n write(*, '(a,2f8.3)') 'stlfts1 ', x(i), trend(i) end do This is in the function stlfts. But when I execute the following 'R' code from the R console: d - stl(nottem, per) I don't see any output. Is there another version without the print statements that is getting executed? Thank you. Kevin __ R-help@r-project.org 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-project.org 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.envfit/move labels
Kim Vanselow wrote: Dear r-helpers! Jan Thiele asked r-help-list in february, but I could not find an answer to his question. I have the same problem: While preparing figures of 'envfit' plots with vegan for publication, I ran into a layout problem, that I found no solution for in the literature or the help archive: The labels of the vectors that indicate correlations of environental variables sometimes overlap with each other or with other content of the figure. Hence, I would like to rearrange them. Is there a possibility to specify where the vector labels are plotted or, alternatively, is it possible to plot vectors only, so that the labels can be placed with 'text' later? Thank you for any hints on how to overcome this layout problem. Thanks Kim I'm sure that Jari will have a better solution, but a quick look at plot.envfit() in pkg:vegan indicates three possibilities: 1. use cex=0.7 (e.g.) to reduce the size of the printed labels. 2. rename your variables to short one- or two-letter names. 3. comment out the following line in plot.envfit() text(vtext, rownames(x$vectors$arrows), col = col, ...) Of course you will have to know which arrow represents what when you place your text on the plot. For placing the text, I would use text(locator(1), your_label, cex=your_preferred_label_size) I only tested this with the varechem example in ?envfit. -Peter Ehlers __ R-help@r-project.org 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] Antw: Re: Density estimate with bounds
What is the problem that you see? (I think the trouble is that Laplace density is not smooth at x=0, while a kernel density estimate returns a smooth density) It would help to know what you are trying to achieve with this exercise... Giovanni Date: Thu, 05 Nov 2009 14:36:44 +0100 From: Justine Rochon justine.roc...@klinik.uni-regensburg.de Sender: r-help-boun...@r-project.org Cc: r-help@r-project.org Precedence: list Hi Duncan, Thank you for your e-mail. It works for the uniform distribution, but I have trouble with the exponential distribution: x - rexp(1) ex_x - c(-x, x) den - density(ex_x) plot(den$x, 2*den$y, xlim=c(0,5), type=l) Best regards, Justine Justine Rochon - Biostatistician - Center for Clinical Studies University Hospital Regensburg Franz-Josef-Strauß-Allee 11 D-93053 Regensburg Phone: ++49-(0)941-944-5626 Fax: ++49-(0)941-944-5632 Email: justine.roc...@klinik.uni-regensburg.de Duncan Murdoch murd...@stats.uwo.ca 05.11.2009 12:36 On 05/11/2009 4:35 AM, Justine Rochon wrote: Dear R users, I would like to show the estimated density of a (0, 1) uniformly distributed random variable. The density curve, however, goes beyond 0 and 1 because of the kernel smoothing. Example: x = runif(1) plot(density(x)) Is there a way to estimate the density curve strictly within (0, 1) and still use some sort of smoothing? Any help would be greatly appreciated. One way is to extend the data by reflection on each end. That is, x - runif(1) ex_x - c(-x, x, 2-x) den - density(ex_x) plot(den$x, 3*den$y, xlim=c(0,1), type=l) You need the rescaling to 3*den$y because you've tripled the range. Duncan Murdoch __ R-help@r-project.org 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. -- Giovanni Petris gpet...@uark.edu Associate Professor Department of Mathematical Sciences University of Arkansas - Fayetteville, AR 72701 Ph: (479) 575-6324, 575-8630 (fax) http://definetti.uark.edu/~gpetris/ __ R-help@r-project.org 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] variable selectin---reduce the numbers of initial variable
Hi Guys, Of course, a backward, forward, or other methods can be used directly. But concerning BMA, the model interpretation is far simple: Bayesian Model Averaging accounts for the model uncertainty inherent in the variable selection problem by averaging over the best models in the model class according to approximate posterior model probability. If you want to learn a few more before continue, that a look at the BMA homepage: http://www2.research.att.com/~volinsky/bma.html But of course, you must do what you think is better for your problem. By the way what is the dimension of your problem? HTH, Rick -- From: Frank E Harrell Jr f.harr...@vanderbilt.edu Sent: Thursday, November 05, 2009 4:12 PM To: Ricardo Gonçalves Silva ricard...@terra.com.br Cc: bbslover dlu...@yeah.net; r-help@r-project.org Subject: Re: [R] variable selectin---reduce the numbers of initial variable Ricardo Gonçalves Silva wrote: Yes, right. But I still prefer using BMA. Best, Rick If you are entertaining only one model family, them BMA is a long, tedious, complex way to obtain shrinkage and the resulting averaged model is very difficult to interpret. Consider a more direct approach. Frank -- From: bbslover dlu...@yeah.net Sent: Wednesday, November 04, 2009 11:28 PM To: r-help@r-project.org Subject: Re: [R] variable selectin---reduce the numbers of initial variable thank you . I can try bayesian. PCA method that I used to is can get some pcs, but I donot know how can i use the original variables in that equation, maybe I should select those have high weight ones,and delete that less weight ones. right? Ricardo Gonçalves Silva wrote: Hi, Nowdays there's a lot o new variable selection methods, specially using the Bayes Paradigm. For your problem, I think you could try the Bayesian Model Average BMA package. Or, you can reduce your data dimension by PCA, which also permits you see the weight of each variable in the PC. HTH Rick -- From: bbslover dlu...@yeah.net Sent: Wednesday, November 04, 2009 10:23 AM To: r-help@r-project.org Subject: [R] variable selectin---reduce the numbers of initial variable hello, my problem is like this: now after processing the varibles, the remaining 160 varibles(independent) and a dependent y. when I used PLS method, with 10 components, the good r2 can be obtained. but I donot know how can I express my equation with the less varibles and the y. It is better to use less indepent varibles. that is how can I select my indepent varibles. Maybe GA is good method, but now I donot gasp it. and can you give me more good varibles selection's methods. and In R, which method can be used to select the potent varibles . and using the selected varibles to model a equation with higher r2, q2,and less RMSP. thank you! -- View this message in context: http://old.nabble.com/variable-selectin---reduce-the-numbers-of-initial-variable-tp26195345p26195345.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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. No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.698 / Virus Database: 270.14.48/2479 - Release Date: 11/03/09 17:38:00 __ R-help@r-project.org 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. -- View this message in context: http://old.nabble.com/variable-selectin---reduce-the-numbers-of-initial-variable-tp26195345p26207750.html Sent from the R help mailing list archive at Nabble.com. __ -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.698 / Virus Database: 270.14.49/2480 - Release Date: 11/04/09 05:37:00 __ R-help@r-project.org 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] variable selectin---reduce the numbers of initial variable
There is also a sparse PLS model in the spls package. It uses lasso-like regularization to reduce the number of variables. I've had a lot of success with it. Max 2009/11/5 Ricardo Gonçalves Silva ricard...@terra.com.br: Hi Guys, Of course, a backward, forward, or other methods can be used directly. But concerning BMA, the model interpretation is far simple: Bayesian Model Averaging accounts for the model uncertainty inherent in the variable selection problem by averaging over the best models in the model class according to approximate posterior model probability. If you want to learn a few more before continue, that a look at the BMA homepage: http://www2.research.att.com/~volinsky/bma.html But of course, you must do what you think is better for your problem. By the way what is the dimension of your problem? HTH, Rick -- From: Frank E Harrell Jr f.harr...@vanderbilt.edu Sent: Thursday, November 05, 2009 4:12 PM To: Ricardo Gonçalves Silva ricard...@terra.com.br Cc: bbslover dlu...@yeah.net; r-help@r-project.org Subject: Re: [R] variable selectin---reduce the numbers of initial variable Ricardo Gonçalves Silva wrote: Yes, right. But I still prefer using BMA. Best, Rick If you are entertaining only one model family, them BMA is a long, tedious, complex way to obtain shrinkage and the resulting averaged model is very difficult to interpret. Consider a more direct approach. Frank -- From: bbslover dlu...@yeah.net Sent: Wednesday, November 04, 2009 11:28 PM To: r-help@r-project.org Subject: Re: [R] variable selectin---reduce the numbers of initial variable thank you . I can try bayesian. PCA method that I used to is can get some pcs, but I donot know how can i use the original variables in that equation, maybe I should select those have high weight ones,and delete that less weight ones. right? Ricardo Gonçalves Silva wrote: Hi, Nowdays there's a lot o new variable selection methods, specially using the Bayes Paradigm. For your problem, I think you could try the Bayesian Model Average BMA package. Or, you can reduce your data dimension by PCA, which also permits you see the weight of each variable in the PC. HTH Rick -- From: bbslover dlu...@yeah.net Sent: Wednesday, November 04, 2009 10:23 AM To: r-help@r-project.org Subject: [R] variable selectin---reduce the numbers of initial variable hello, my problem is like this: now after processing the varibles, the remaining 160 varibles(independent) and a dependent y. when I used PLS method, with 10 components, the good r2 can be obtained. but I donot know how can I express my equation with the less varibles and the y. It is better to use less indepent varibles. that is how can I select my indepent varibles. Maybe GA is good method, but now I donot gasp it. and can you give me more good varibles selection's methods. and In R, which method can be used to select the potent varibles . and using the selected varibles to model a equation with higher r2, q2,and less RMSP. thank you! -- View this message in context: http://old.nabble.com/variable-selectin---reduce-the-numbers-of-initial-variable-tp26195345p26195345.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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. No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.698 / Virus Database: 270.14.48/2479 - Release Date: 11/03/09 17:38:00 __ R-help@r-project.org 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. -- View this message in context: http://old.nabble.com/variable-selectin---reduce-the-numbers-of-initial-variable-tp26195345p26207750.html Sent from the R help mailing list archive at Nabble.com. __ -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University No virus found in this incoming message. Checked by AVG - www.avg.com Version: 9.0.698 / Virus Database: 270.14.49/2480 - Release Date: 11/04/09 05:37:00 __ R-help@r-project.org 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. -- Max
[R] help with ols and contrast functions in Design library
Dear All, I'm trying to use the ols function in the Design library (version 2.1.1) of R to estimate parameters of a linear model, and then use the contrast function in the same library to test various contrasts. As a simple example, suppose I have three factors: feature (3 levels), group (2 levels), and patient (3 levels). Patient is coded as a non-unique identifier and is therefore nested within group. response - rnorm(length(example$LOG_ABUNDANCE), mean = 12) feature - rep(c(1,2,3), 6) group - c(rep(c(1,2),each=9)) patient - rep(rep(c(1,2,3), each=3),2) myData - data.frame(patient=factor(patient), group=factor(group), feature=factor(feature), response=response) I use the ols command to fit the linear model, but I receive the following error. fit - ols(response ~ feature*group + group/patient, myData) fit - ols(response ~ feature*group + group/patient, myData) Error in if (!length(fname) || !any(fname == zname)) { : missing value where TRUE/FALSE needed Because of this, I tried using a unique identifier for patient using the following command. myData$group.patient - with(myData, group:patient)[drop=TRUE] Running the same model with this factor will correct the error, but leaves me with an 'NA' for one of the estimated model parameters. fit2 - ols(response ~ feature*group + group.patient, myData) fit2 Linear Regression Model ols(formula = response ~ feature * group + group.patient, data = myData) n Model L.R. d.f. R2 Sigma 18 4.659 10 0.2281 1.122 Residuals: Min 1Q Median 3Q Max -1.1466 -0.5854 -0.2545 0.6834 1.4900 Coefficients: Value Std. Error t Pr(|t|) Intercept 12.7116 9.442e-01 1.346e+01 2.928e-06 feature=2 -0.4795 1.370e+00 -3.500e-01 7.367e-01 feature=3 -0.0948 1.389e+00 -6.828e-02 9.475e-01 group=2 -0.7218 3.586e+15 -2.013e-16 1.000e+00 group.patient=1:2 -1.1455 1.120e+00 -1.023e+00 3.405e-01 group.patient=1:3 -0.5619 9.894e-01 -5.679e-01 5.879e-01 group.patient=2:1 -0.1402 3.586e+15 -3.909e-17 1.000e+00 group.patient=2:2 -0.1699 3.586e+15 -4.738e-17 1.000e+00 group.patient=2:3NA 1.438e+00 NANA feature=2 * group=2 0.1224 1.669e+00 7.330e-02 9.436e-01 feature=3 * group=2 -0.1970 3.586e+15 -5.494e-17 1.000e+00 When I try to test a contrast based on this fit, the 'NA' apparently prevents the estimation of the contrast. contrast(fit2, list(group='1', feature=levels(myData$feature), group.patient=levels(myData$group.patient)), list(group='2', feature=levels(myData$feature), group.patient=levels(myData $group.patient)), type=average) Contrast S.E. Lower Upper t Pr(|t|) 1 NA 2.390489e+15NANA NA NA Error d.f.= 8 Any suggestions? Sincerely, Tim Clough [[alternative HTML version deleted]] __ R-help@r-project.org 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 with ols and contrast functions in Design library
Timothy Clough wrote: Dear All, I'm trying to use the ols function in the Design library (version 2.1.1) of R to estimate parameters of a linear model, and then use the contrast function in the same library to test various contrasts. As a simple example, suppose I have three factors: feature (3 levels), group (2 levels), and patient (3 levels). Patient is coded as a non-unique identifier and is therefore nested within group. response - rnorm(length(example$LOG_ABUNDANCE), mean = 12) feature - rep(c(1,2,3), 6) group - c(rep(c(1,2),each=9)) patient - rep(rep(c(1,2,3), each=3),2) myData - data.frame(patient=factor(patient), group=factor(group), feature=factor(feature), response=response) I use the ols command to fit the linear model, but I receive the following error. fit - ols(response ~ feature*group + group/patient, myData) fit - ols(response ~ feature*group + group/patient, myData) Error in if (!length(fname) || !any(fname == zname)) { : missing value where TRUE/FALSE needed Sorry, Design, and its replacement rms, do not support nested effects. Also, any model that results in an NA as a parameter estimate will not work properly in Design/rms. Frank Because of this, I tried using a unique identifier for patient using the following command. myData$group.patient - with(myData, group:patient)[drop=TRUE] Running the same model with this factor will correct the error, but leaves me with an 'NA' for one of the estimated model parameters. fit2 - ols(response ~ feature*group + group.patient, myData) fit2 Linear Regression Model ols(formula = response ~ feature * group + group.patient, data = myData) n Model L.R. d.f. R2 Sigma 18 4.659 10 0.2281 1.122 Residuals: Min 1Q Median 3Q Max -1.1466 -0.5854 -0.2545 0.6834 1.4900 Coefficients: Value Std. Error t Pr(|t|) Intercept 12.7116 9.442e-01 1.346e+01 2.928e-06 feature=2 -0.4795 1.370e+00 -3.500e-01 7.367e-01 feature=3 -0.0948 1.389e+00 -6.828e-02 9.475e-01 group=2 -0.7218 3.586e+15 -2.013e-16 1.000e+00 group.patient=1:2 -1.1455 1.120e+00 -1.023e+00 3.405e-01 group.patient=1:3 -0.5619 9.894e-01 -5.679e-01 5.879e-01 group.patient=2:1 -0.1402 3.586e+15 -3.909e-17 1.000e+00 group.patient=2:2 -0.1699 3.586e+15 -4.738e-17 1.000e+00 group.patient=2:3NA 1.438e+00 NANA feature=2 * group=2 0.1224 1.669e+00 7.330e-02 9.436e-01 feature=3 * group=2 -0.1970 3.586e+15 -5.494e-17 1.000e+00 When I try to test a contrast based on this fit, the 'NA' apparently prevents the estimation of the contrast. contrast(fit2, list(group='1', feature=levels(myData$feature), group.patient=levels(myData$group.patient)), list(group='2', feature=levels(myData$feature), group.patient=levels(myData $group.patient)), type=average) Contrast S.E. Lower Upper t Pr(|t|) 1 NA 2.390489e+15NANA NA NA Error d.f.= 8 Any suggestions? Sincerely, Tim Clough [[alternative HTML version deleted]] __ R-help@r-project.org 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. -- Frank E Harrell Jr Professor and Chair School of Medicine Department of Biostatistics Vanderbilt University __ R-help@r-project.org 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] performing operations on a dataframe
try this: x - read.table(textConnection(Year SpA + 2000 0 + 2000 2 + 2000 1 + 2001 8 + 2001 2 + 2001 0 + 2001 0 + 2002 1 + 2002 2), header=TRUE) closeAllConnections() # convoluted if you want a 'function' for each year l.func - list('2000'=function(x) x / 146, +'2001'=function(x) x / 237, +'2002'=function(x) x/ 42) # split the data.frame and process result - lapply(split(x, x$Year), function(.yr){ + # call function based on year + cbind(.yr, func=l.func[[as.character(.yr$Year[1])]](.yr$SpA)) + }) do.call(rbind, result) Year SpAfunc 2000.1 2000 0 0.0 2000.2 2000 2 0.013698630 2000.3 2000 1 0.006849315 2001.4 2001 8 0.033755274 2001.5 2001 2 0.008438819 2001.6 2001 0 0.0 2001.7 2001 0 0.0 2002.8 2002 1 0.023809524 2002.9 2002 2 0.047619048 # a more reasonable way l.div - c('2000'=146, '2001'=237, '2002'=42) x$div - x$SpA / l.div[as.character(x$Year)] x Year SpA div 1 2000 0 0.0 2 2000 2 0.013698630 3 2000 1 0.006849315 4 2001 8 0.033755274 5 2001 2 0.008438819 6 2001 0 0.0 7 2001 0 0.0 8 2002 1 0.023809524 9 2002 2 0.047619048 On Thu, Nov 5, 2009 at 1:30 PM, Lanna Jin lanna...@gmail.com wrote: Hey all, I feel like the solution to this problem should be relatively simple, but for some reason I can't find answers or come up with my own solution. Given the dataframe: (SpA and SpB not important, want to look at distribution of cooccurance for each year) Year SpA SpB Coocc 2000 0 2000 2 2000 1 2001 8 2001 2 2001 0 2001 0 2002 1 2002 2 How can I apply different functions to the Coocc of each year? (Note: Different lengths for each year, ie, length(Year==2000)!=length(Year==2001)) For example, if Year==2000, function(x) x/146; if Year=2001, function(x) x/237; etc. I've figured out the long convoluted way, but since I plan to operate numerous transformations on the different years, is there some way to solve this in just a few steps? Thanks for your answer in advance! Lanna [[alternative HTML version deleted]] __ R-help@r-project.org 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org 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] new help pages in R 2.10.0
Dear R-users, I've just installed the last version of R (2.10.0) in Windows and found a completely new version of the help pages. Basically, they now appear as a simple (even if slightly embellished) text file. I tried to install it with a customized startup and realized that the old CHM files (the default for Windows up to 2.9.2) are not included anymore as a possible choice. I don't know if this is due to some mistake I've done, but otherwise would be a major drawback of the new version. The opportunity to navigate through different help pages using the links in the old R was really useful. At the moment I re-installed the old R 2.9.2, but I hope this will change in later versions. Or at least, that the user could have the opportunity to choose the help pages he deems more suitable for his purposes. I hope someone could give some details Regards, Antonio Gasparrini Public and Environmental Health Research Unit (PEHRU) London School of Hygiene Tropical Medicine Keppel Street, London WC1E 7HT, UK Office: 0044 (0)20 79272406 - Mobile: 0044 (0)79 64925523 __ R-help@r-project.org 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] collumn error when exporting to Excel
I took the subset of the data you send, did a 'write.csv' and then imported it to Excel and the columns seem fine (see the .png file attached). So exactly what problems are you having? On Thu, Nov 5, 2009 at 12:49 PM, Hayes, Daniel d.j.ha...@liverpool.ac.uk wrote: No luck with 'write.csv' either. Thanks for helping though. Cheers, Daniel -Original Message- From: jim holtman [mailto:jholt...@gmail.com] Sent: 05 November 2009 14:59 To: Hayes, Daniel Cc: r-h...@lists.r-project.org Subject: Re: [R] collumn error when exporting to Excel try using 'write.csv' to create the file you want to import to EXCEL On Thu, Nov 5, 2009 at 4:56 AM, Hayes, Daniel d.j.ha...@liverpool.ac.uk wrote: Dear all, I am attempting to export my results (data.frame) created with the help of a number of you to Excel. In the procedure my column structure is however lost and all results are placed together into the first Excel column. I have tried: write(), write.table(), write.matrix(), export() and have the same results. I Have checked the import/export FAQ and did a Google search to no avail. Any advice would be greatly appreciated. Kind greetings, Daniel dput(Bolivia.selected.ms.lat.m[1:10,]) structure(list(age = c(0, 0.0833, 0.167, 0.25, 0.333, 0.417, 0.5, 0.583, 0.667, 0.75), country = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c(Bolivia, Brazil, Colombia, Dominican Rep., El Salvador, Guatemala, Guyana, Haiti, Honduras, Nicaragua, Paraguay, Peru, Suriname), class = factor), mu = c(11.4216795790532, 11.336249852927, 11.2841715916567, 11.2112464680493, 11.1163747056146, 11.0042010015542, 10.881460044, 10.7555483953614, 10.6326412246687, 10.5168465177670), sigma = c(0.101487190832973, 0.105383747354763, 0.107059434066487, 0.108387198864101, 0.109530496229634, 0.110541869698550, 0.111444696116090, 0.112248590819971, 0.112951348056450, 0.113550216614654)), .Names = c(age, country, mu, sigma), row.names = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), class = data.frame) write.matrix(Bolivia.selected.ms.lat.m, file=C:\\Documents and Settings\\Dohyedan\\My Documents\\bolivia.selected.ms.lat.m, sep= ) [[alternative HTML version deleted]] __ R-help@r-project.org 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? attachment: jph.png__ R-help@r-project.org 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] Bhattacharyya distance metric
I need to use the Bhattacharyya distance metric to determine population separation. Has anyone written a Bhattacharyya distance metric function in R? -- View this message in context: http://old.nabble.com/Bhattacharyya-distance-metric-tp26221259p26221259.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] new help pages in R 2.10.0
See the NEWS and CHANGES files. You can choose html help, if you prefer that, or pdf. Support for compiled html help has been withdrawn. Uwe Ligges antonio.gasparr...@lshtm.ac.uk wrote: Dear R-users, I've just installed the last version of R (2.10.0) in Windows and found a completely new version of the help pages. Basically, they now appear as a simple (even if slightly embellished) text file. I tried to install it with a customized startup and realized that the old CHM files (the default for Windows up to 2.9.2) are not included anymore as a possible choice. I don't know if this is due to some mistake I've done, but otherwise would be a major drawback of the new version. The opportunity to navigate through different help pages using the links in the old R was really useful. At the moment I re-installed the old R 2.9.2, but I hope this will change in later versions. Or at least, that the user could have the opportunity to choose the help pages he deems more suitable for his purposes. I hope someone could give some details Regards, Antonio Gasparrini Public and Environmental Health Research Unit (PEHRU) London School of Hygiene Tropical Medicine Keppel Street, London WC1E 7HT, UK Office: 0044 (0)20 79272406 - Mobile: 0044 (0)79 64925523 __ R-help@r-project.org 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-project.org 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] rm(list-ls()) error
Dear R, Why rm(list-ls()) gives an error but rm(list=ls()) not? I remember the operator â-â can be used anywhere... Thanks! Feng -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li/ [[alternative HTML version deleted]] __ R-help@r-project.org 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] new help pages in R 2.10.0
Antonio, Starting from 2.10, R dropped its support for Windows CHM help. It has been replaced with the web browser HTML based one. To activate this add the following line to your Rprofile options(help_type=html) The pages come up in your browser. They all have the same links as before. It works quite well with Firefox as they come up in new tabs, so you can have several of them open at the same time. Hope this helps, Andy __ Andy Jaworski 518-1-01 Process Laboratory 3M Corporate Research Laboratory - E-mail: apjawor...@mmm.com Tel: (651) 733-6092 Fax: (651) 736-3122 From: antonio.gasparr...@lshtm.ac.uk To: r-help@r-project.org Date: 11/05/2009 02:17 PM Subject: [R] new help pages in R 2.10.0 Sent by: r-help-boun...@r-project.org Dear R-users, I've just installed the last version of R (2.10.0) in Windows and found a completely new version of the help pages. Basically, they now appear as a simple (even if slightly embellished) text file. I tried to install it with a customized startup and realized that the old CHM files (the default for Windows up to 2.9.2) are not included anymore as a possible choice. I don't know if this is due to some mistake I've done, but otherwise would be a major drawback of the new version. The opportunity to navigate through different help pages using the links in the old R was really useful. At the moment I re-installed the old R 2.9.2, but I hope this will change in later versions. Or at least, that the user could have the opportunity to choose the help pages he deems more suitable for his purposes. I hope someone could give some details Regards, Antonio Gasparrini Public and Environmental Health Research Unit (PEHRU) London School of Hygiene Tropical Medicine Keppel Street, London WC1E 7HT, UK Office: 0044 (0)20 79272406 - Mobile: 0044 (0)79 64925523 __ R-help@r-project.org 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@r-project.org 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] rm(list-ls()) error
- and = are not universally interchangable. args(rm) function (..., list = character(0L), pos = -1, envir = as.environment(pos), inherits = FALSE) The call rm(list - ls()) assigns the result of ls() to the variable 'list' and passes that value as an anonymous argument to rm() (Probably more than you want to know: or it would if rm() didn't have non-standard evaluation rules -- as it happens, list - ls() is recognized as an invalid argument before it is evaluated.) The call rm(list=ls()) calls rm() with the 'list' argument having the value of ls() Here's an example that doesn't confuse things by having non-standard evaluation rules: f - function(a=1, b=2) cat(a=, a, b=, b, \n) b Error: object 'b' not found f(b - 33) a= 33 b= 2 b [1] 33 f(b=33) a= 1 b= 33 -- Tony Plate Feng Li wrote: Dear R, Why rm(list-ls()) gives an error but rm(list=ls()) not? I remember the operator ‘-’ can be used anywhere... Thanks! Feng __ R-help@r-project.org 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-project.org 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] rm(list-ls()) error
Feng Li wrote: Dear R, Why rm(list-ls()) gives an error but rm(list=ls()) not? I remember the operator ‘-’ can be used anywhere... Yes, and it means that you make an assignment once passed to the first argument ... in rm() and evaluated. Well, it is just never evaluated since ... needs to be a name or a character vector (and is a language object in this case), hence an error in rm(). You can do: rm(list=(list - ls())) of course, which does what you are intending, I guess: assigns the ls() to list and removes all objects given in list, since list is passed to the argument list. Uwe Ligges Thanks! Feng __ R-help@r-project.org 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-project.org 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] new help pages in R 2.10.0
I haven't tried this yet, but I should note that my Site Search page: http://finzi.psych.upenn.edu, and the associated R function RSiteSearch and related functions, depend on compiled html help files. The idea is to be able to search the help page of functions that you don't have installed yet, to see if you want to install some package. There are other ways to do this, listed in my page. And perhaps my page is not necessary anymore. (I would love it if someone took it over, whether it is or not.) Or maybe I'm worrying too much about the new version. I do have a script that generates the html help pages only, and maybe it will still work, although it uses other scripts that come with R itself. Jon On 11/05/09 21:28, Uwe Ligges wrote: See the NEWS and CHANGES files. You can choose html help, if you prefer that, or pdf. Support for compiled html help has been withdrawn. Uwe Ligges -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page: http://www.sas.upenn.edu/~baron __ R-help@r-project.org 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] new help pages in R 2.10.0
Jonathan Baron wrote: I haven't tried this yet, but I should note that my Site Search page: http://finzi.psych.upenn.edu, and the associated R function RSiteSearch and related functions, depend on compiled html help files. On regular html, not compiled html, I believe. The idea is to be able to search the help page of functions that you don't have installed yet, to see if you want to install some package. There are other ways to do this, listed in my page. And perhaps my page is not necessary anymore. (I would love it if someone took it over, whether it is or not.) Or maybe I'm worrying too much about the new version. I do have a script that generates the html help pages only, and maybe it will still work, although it uses other scripts that come with R itself. You may need to install the packages including the option to generate static html files. That is still possible. Just compiled html support has been withdrawn (which is a proprietary Microsoft format Microsoft does not support actively anymore). Best wishes, Uwe Jon On 11/05/09 21:28, Uwe Ligges wrote: See the NEWS and CHANGES files. You can choose html help, if you prefer that, or pdf. Support for compiled html help has been withdrawn. Uwe Ligges __ R-help@r-project.org 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] 19900501 into 1990-05-01
I have a column of dates in this format.. 19900501 I want to change 19900501 into 1990 05 01 then append a new column on the end (right hand side of spreadsheet) :confused: -- View this message in context: http://old.nabble.com/19900501-into-1990-05-01-tp26217515p26217515.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Using a by() function to process several regression (lm()) functions
Hello, Thank you very much for looking at this. I have a seasonal user for R. I teach my undergrads and graduates students statistics using R and often find myself trying to solve problems to process student collected data in an efficient way. In this case, I have a data.frame with multiple observations. These are gas concentrations in a chamber and are used to measure into rates, usually (not not always), four or five observations per chamber. Data are from several sites and multiple dates. I'd like to run a regression to calculate the rate of emissions, for each date and site. The regression is using concentration ~ Sample_interval (which is in seconds). lm(Concentration ~ Sample_interval, data=df) The data.frame looks something like this: Date Time Site Sample_intervalConcentration 10/03/09 5:00 Site 1 0 334 10/03/09 5:00 Site 1 566 355 10/03/09 5:00 Site 1 1005 367 10/03/09 5:00 Site 1 1244 384 10/03/09 5:00 Site 2 0 434 10/03/09 5:00 Site 2 466 455 10/03/09 5:00 Site 2 1005 437 10/03/09 5:00 Site 2 1349 474 10/12/09 5:00 Site 1 0 354 10/12/09 5:00 Site 1 506 359 10/12/09 5:00 Site 1 1065 377 10/12/09 5:00 Site 1 1184 394 10/12/09 5:00 Site 2 0 424 10/12/09 5:00 Site 2 396 495 10/12/09 5:00 Site 2 1022 497 10/12/09 5:00 Site 2 1304 574 I tried this: bylist.lm - by(df, list(df$Date, df$Site), function(x) lm(Concentration~Sample_interval, data=x)) Then, I get a list of stuff...which seems hard very exact much... I tried this... rate - (sapply(bylist.lm, coef)[2,]) and got, the rates, but I can't figure out how to line them up with the by variables. So... In a perfect world, I would like to get a data frame with the intercept, slope, r.square, p.value for each date, site, so the question involves extracting from a by class, and mode list. Granted, I have been confused for a few years on how to think about classes and modes...so some insight there would also be quite appreciated... -- Marc Los Huertos Assistant Professor Science and Environmental Policy 100 Campus Drive Seaside CA, 93955 831-582-3209 [[alternative HTML version deleted]] __ R-help@r-project.org 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] Newbie question Multcomp
Hello, I'm a totally newbie to R and I'm taking a class using S+. In the class we use the multcomp command which takes a aov object and calculates confidence intervals for all pairwise differences by the Fisher least significant differences method. How can I do this in R. Thank you for taking the time with such a basic question. I've been looking on the net for a few days and I can't seem to find an answer clear enough for my level. -- View this message in context: http://old.nabble.com/Newbie-question-Multcomp-tp26221247p26221247.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Sorting NA's and Graphing a histogram
Hello all, Thank you for you help with the first part, it worked perfectly. I now have a dataset that is culled to only include rows with no NA's or only 1 NA. What I want to achieve with the graph is: Plot the new data matrix: Alpha Beta Gamma Delta A 12 34 B NA 2 45 D 8 9 10 11 E 5 NA 7 13 Such that (for this example) the x-axis has five points: Alpha, Beta, Gamma, Delta and the y-axis has a numerical axis representing the numbers in the matrix. I'm sorry, this example graph will look very crude. 4 X 3 X 2X 1 X Alpha Beta Gamma Delta (with a line connecting the dots) I would like to do this for all rows in the culled data matrix on a single window (using par(mfrow)) and for the NA's to be left blank. Thank you for your help so far! Koraelus Jorge Ivan Velez wrote: Hi Koraelus, Could you please explain us in more detail what would you like to do in the second part? HTH, Jorge -- View this message in context: http://old.nabble.com/Sorting-NA%27s-and-Graphing-a-histogram-tp26157779p26157779.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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@r-project.org 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. -- View this message in context: http://old.nabble.com/Sorting-NA%27s-and-Calling-Rownames-as-Variables-tp26157779p26219813.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] rm(list-ls()) error
Dear R, Why rm(list-ls()) gives an error but rm(list=ls()) not?. I remember the operator â-â can be used anywhere... Thanks! Feng -- Feng Li Department of Statistics Stockholm University 106 91 Stockholm, Sweden http://feng.li/ [[alternative HTML version deleted]] __ R-help@r-project.org 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] collumn error when exporting to Excel
Thank you all for your help. None of the suggestions worked but this is because I believe I was opening the created file into Excel the wrong way. I managed to open the file in Word and then do indeed get a cvs format. This I was then able to transform to a normal table. Will now try to install the write.XLS package fir I believe that this in the end will save me much work. Thanks to the community for so many prompt responses and plenty of new insight. Greetings, Daniel PS. For those moderators out there I have signed up to the help group and do have a login which works but somehow my emails our not recognized. Sorry for the inconvenience and if there are any suggestions how to fix this that would be great. Cheers -Original Message- From: Robert Baer [mailto:rb...@atsu.edu] Sent: 05 November 2009 15:58 To: Hayes, Daniel; 'r-h...@lists.r-project.org' Subject: Re: [R] collumn error when exporting to Excel ?write.csv usually works well for writing a dataframe to import into excel. Use a file name that ends in .csv. - Original Message - From: Hayes, Daniel d.j.ha...@liverpool.ac.uk To: 'r-h...@lists.r-project.org' r-help@r-project.org Sent: Thursday, November 05, 2009 3:56 AM Subject: [R] collumn error when exporting to Excel Dear all, I am attempting to export my results (data.frame) created with the help of a number of you to Excel. In the procedure my column structure is however lost and all results are placed together into the first Excel column. I have tried: write(), write.table(), write.matrix(), export() and have the same results. I Have checked the import/export FAQ and did a Google search to no avail. Any advice would be greatly appreciated. Kind greetings, Daniel dput(Bolivia.selected.ms.lat.m[1:10,]) structure(list(age = c(0, 0.0833, 0.167, 0.25, 0.333, 0.417, 0.5, 0.583, 0.667, 0.75), country = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c(Bolivia, Brazil, Colombia, Dominican Rep., El Salvador, Guatemala, Guyana, Haiti, Honduras, Nicaragua, Paraguay, Peru, Suriname), class = factor), mu = c(11.4216795790532, 11.336249852927, 11.2841715916567, 11.2112464680493, 11.1163747056146, 11.0042010015542, 10.881460044, 10.7555483953614, 10.6326412246687, 10.5168465177670), sigma = c(0.101487190832973, 0.105383747354763, 0.107059434066487, 0.108387198864101, 0.109530496229634, 0.110541869698550, 0.111444696116090, 0.112248590819971, 0.112951348056450, 0.113550216614654)), .Names = c(age, country, mu, sigma), row.names = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), class = data.frame) write.matrix(Bolivia.selected.ms.lat.m, file=C:\\Documents and Settings\\Dohyedan\\My Documents\\bolivia.selected.ms.lat.m, sep= ) [[alternative HTML version deleted]] __ R-help@r-project.org 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-project.org 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] collumn error when exporting to Excel
No luck with 'write.csv' either. Thanks for helping though. Cheers, Daniel -Original Message- From: jim holtman [mailto:jholt...@gmail.com] Sent: 05 November 2009 14:59 To: Hayes, Daniel Cc: r-h...@lists.r-project.org Subject: Re: [R] collumn error when exporting to Excel try using 'write.csv' to create the file you want to import to EXCEL On Thu, Nov 5, 2009 at 4:56 AM, Hayes, Daniel d.j.ha...@liverpool.ac.uk wrote: Dear all, I am attempting to export my results (data.frame) created with the help of a number of you to Excel. In the procedure my column structure is however lost and all results are placed together into the first Excel column. I have tried: write(), write.table(), write.matrix(), export() and have the same results. I Have checked the import/export FAQ and did a Google search to no avail. Any advice would be greatly appreciated. Kind greetings, Daniel dput(Bolivia.selected.ms.lat.m[1:10,]) structure(list(age = c(0, 0.0833, 0.167, 0.25, 0.333, 0.417, 0.5, 0.583, 0.667, 0.75), country = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c(Bolivia, Brazil, Colombia, Dominican Rep., El Salvador, Guatemala, Guyana, Haiti, Honduras, Nicaragua, Paraguay, Peru, Suriname), class = factor), mu = c(11.4216795790532, 11.336249852927, 11.2841715916567, 11.2112464680493, 11.1163747056146, 11.0042010015542, 10.881460044, 10.7555483953614, 10.6326412246687, 10.5168465177670), sigma = c(0.101487190832973, 0.105383747354763, 0.107059434066487, 0.108387198864101, 0.109530496229634, 0.110541869698550, 0.111444696116090, 0.112248590819971, 0.112951348056450, 0.113550216614654)), .Names = c(age, country, mu, sigma), row.names = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), class = data.frame) write.matrix(Bolivia.selected.ms.lat.m, file=C:\\Documents and Settings\\Dohyedan\\My Documents\\bolivia.selected.ms.lat.m, sep= ) [[alternative HTML version deleted]] __ R-help@r-project.org 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org 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] NLM OUTPUT
I am missing something fundamental. I ran the function nlm, but I don't understand how to extract the optimal solution as a numeric vector. The function produces it as one element of a list. I don't see anything in the R documentation about converting such a list element to the vector it displays. Thanks, Bob Robert Agnew | Discover Director Acquisition Analytics Marketing â Analysis Pricing 2500 Lake Cook Road Riverwoods, IL 60015 Tel 224-405-1425 Fax 224-405-4971 robertag...@discover.com Please consider the environment before printing this email. [[alternative HTML version deleted]] __ R-help@r-project.org 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] new help pages in R 2.10.0
Thanks. I misunderstood compiled. Sorry. I need static html. I cannot install all the packages (for several reasons). That is why I wrote my script to extract the html pages only. The parts of R that it uses are: /usr/share/R/perl/build-help.pl tools:::.writePkgIndices() make.packages.html() I will see how it works. But I may give up if it doesn't work. Jon On 11/05/09 21:59, Uwe Ligges wrote: Jonathan Baron wrote: I haven't tried this yet, but I should note that my Site Search page: http://finzi.psych.upenn.edu, and the associated R function RSiteSearch and related functions, depend on compiled html help files. On regular html, not compiled html, I believe. The idea is to be able to search the help page of functions that you don't have installed yet, to see if you want to install some package. There are other ways to do this, listed in my page. And perhaps my page is not necessary anymore. (I would love it if someone took it over, whether it is or not.) Or maybe I'm worrying too much about the new version. I do have a script that generates the html help pages only, and maybe it will still work, although it uses other scripts that come with R itself. You may need to install the packages including the option to generate static html files. That is still possible. Just compiled html support has been withdrawn (which is a proprietary Microsoft format Microsoft does not support actively anymore). Best wishes, Uwe -- Jonathan Baron, Professor of Psychology, University of Pennsylvania Home page: http://www.sas.upenn.edu/~baron __ R-help@r-project.org 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] Merge records in the same dataframe
Hi: Suppose that I have a data frame as below x1 x2 x3 ... x10 wk1 wk2 ... Wk208 (these are the column names) For each record, x1, x2, x3 ... x10 are attributes. and wk1, wk2, ..., wk208 are the sales recoreded for this attribute combination. Suppose that now, that I want to do the following 1. Merge the data frame so that I have a new data frame grouped by values of x2 and x3 (for example). That is, if two records have the same values of x2 and x3, they should be summed. I tried to look at merge, tapply etc. but did not see a fit with I want to do above. Thanks in advance. Satish __ R-help@r-project.org 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] Merge records in the same dataframe
Tena koe Satish I'm not entirely sure what you want, but did you check aggregate()? HTH Peter Alspach -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Vadlamani, Satish {FLNA} Sent: Friday, 6 November 2009 10:16 a.m. To: 'R-help@r-project.org' Subject: [R] Merge records in the same dataframe Hi: Suppose that I have a data frame as below x1 x2 x3 ... x10 wk1 wk2 ... Wk208 (these are the column names) For each record, x1, x2, x3 ... x10 are attributes. and wk1, wk2, ..., wk208 are the sales recoreded for this attribute combination. Suppose that now, that I want to do the following 1. Merge the data frame so that I have a new data frame grouped by values of x2 and x3 (for example). That is, if two records have the same values of x2 and x3, they should be summed. I tried to look at merge, tapply etc. but did not see a fit with I want to do above. Thanks in advance. Satish __ R-help@r-project.org 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-project.org 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] Newbie question Multcomp
qwe84 wrote: Hello, I'm a totally newbie to R and I'm taking a class using S+. In the class we use the multcomp command which takes a aov object and calculates confidence intervals for all pairwise differences by the Fisher least significant differences method. How can I do this in R. Thank you for taking the time with such a basic question. I've been looking on the net for a few days and I can't seem to find an answer clear enough for my level. In R, the package is multcomp. From ?glht ### multiple comparison procedures ### set up a one-way ANOVA amod - aov(breaks ~ tension, data = warpbreaks) ### set up all-pair comparisons for factor `tension' ### using a symbolic description (`type' argument ### to `contrMat()') glht(amod, linfct = mcp(tension = Tukey)) I usually use additional functions in the package amod.glht - glht(amod, linfct = mcp(tension = Tukey)) confint(amod.glht) plot(amod.glht) __ R-help@r-project.org 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] Merge records in the same dataframe
Try something like this: # get column numbers of 'wk' columns col.num - grep(^wk, names(yourDF)) # split out only the 'wk' columns result - lapply(split(yourDF[, col.num], paste(yourDF$x2, paste(yourDF$x3))), function(.mrg){ colSums(.mrg) }) On Thu, Nov 5, 2009 at 4:15 PM, Vadlamani, Satish {FLNA} satish.vadlam...@fritolay.com wrote: Hi: Suppose that I have a data frame as below x1 x2 x3 ... x10 wk1 wk2 ... Wk208 (these are the column names) For each record, x1, x2, x3 ... x10 are attributes. and wk1, wk2, ..., wk208 are the sales recoreded for this attribute combination. Suppose that now, that I want to do the following 1. Merge the data frame so that I have a new data frame grouped by values of x2 and x3 (for example). That is, if two records have the same values of x2 and x3, they should be summed. I tried to look at merge, tapply etc. but did not see a fit with I want to do above. Thanks in advance. Satish __ R-help@r-project.org 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org 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] 19900501 into 1990-05-01
Something like: format(as.Date(20090501,format=%Y%m%d), %Y %m %d) r - Remko Duursma Post-Doctoral Fellow Centre for Plants and the Environment University of Western Sydney Hawkesbury Campus Richmond NSW 2753 Dept of Biological Science Macquarie University North Ryde NSW 2109 Australia Mobile: +61 (0)422 096908 www.remkoduursma.com On Fri, Nov 6, 2009 at 6:04 AM, frenchcr frenc...@btinternet.com wrote: I have a column of dates in this format.. 19900501 I want to change 19900501 into 1990 05 01 then append a new column on the end (right hand side of spreadsheet) :confused: -- View this message in context: http://old.nabble.com/19900501-into-1990-05-01-tp26217515p26217515.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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-project.org 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] Biometric Summit - Feb. 22-25, 2010
Join your colleagues for the 20th highly acclaimed international forum to hear the latest implementations of biometrics... The Winter 2010 BIOMETRICS SUMMIT: Practical Implementation Strategies, Market Trends And Best Practices In Government And Business February 22-25, 2010 - Miami, FL http://www.aliconferences.com/conf/biometrics_summit_winter10/index.htm *** EARLY BIRD DISCOUNT: Register by DECEMBER 8th to save $400! *** *** Mention priority code E-BD to receive a $200 discount! *** Attend this leading industry forum to meet, question and hear the details behind several real-life implementations of a variety of biometric systems, including SPEAKERS from: 1. Children's Hospital Boston 2. ATT Consumer Product Division 3. Federal Bureau of Investigation 4. Cisco 5. State of Israel 6. International Biometric Group (IBG) 7. L-1 Identity Solutions, Inc. 8. Identification Technology Partners (IDTP) 9. Daon 10. National Supermarket 11. Omnicell, Inc. 12. National Biometric Security Project 13. Unisys 14. BIO-Key International 15. Delfigo Security 16. Identica 17. Cogent Systems, Inc. 18. Aware, Inc. 19. AllTrust Networks Featuring Keynote Presentation by Dr. Joseph Atick To register or for more information: -- CALL: Toll Free within the U.S. 888-362-7400, ext. 1 --or-- 773-695-9400, ext. 1 ONLINE: http://www.aliconferences.com/conf/biometrics_summit_winter10/index.htm EMAIL: meli...@aliconferences.com *** Please mention email code E-BD to receive a $200 discount. *** Exhibit and Sponsorship opportunities are also available, please contact amy.gerst...@aliconferences.com, or 773-695-9400, ext. 20, for more information. CONFERENCE DISCOUNTS: 1. TEAM Discount: Train 4 for the price of 3! 2. EARLY BIRD Discount: Register by December 8th to save $400! 3. BIOMETRIC DIGEST Discount: Mention E-BD to get $200 off! 4. PAST ATTENDEE Discount: Receive $200 off your next conference! KEY TAKE AWAYS: - - - - - - - Through several new and updated case studies from a variety of real-life applications of biometrics, you will learn strategies, approaches and systems for: 1. Understanding the key biometrics technologies - how they work, costs and benefits, strengths and weaknesses - through several real end-user applications and case study examples 2. Incorporating biometrics into an integrated solution for identity management 3. Testing and evaluating the performance of a biometrics system to ensure security 4. Making the business case for biometrics 5. Combining multiple biometric technologies in the same application 6. Applying the latest standards to your application 7. Overcoming common pitfalls during biometric deployment 8. Achieving cost savings, increased efficiency and/or improved security by implementing biometric applications 9. Overcoming ethical and privacy issues RAVE REVIEWS FROM PAST BIOMETRICS CONFERENCE ATTENDEES: - - - - - - - Very interesting topics presented - will definitely consider attending again! Nice mix of backgrounds/industries; the speakers were good at addressing all of them. K. Davis, IT Specialist, U.S. DEPARTMENT OF COMMERCE I really appreciate hearing about real world projects from both the user/customer and integrator/vendor perspectives. C. Tilton, VP, Standards Emerging Technology, DAON The conference provided information on biometrics that will now enable me and my colleagues to make an informed decision on the use of biometrics. G. Williams, Program Manager, U.S. DEPARTMENT OF HOMELAND SECURITY * * * * * * * * * * CONFERENCE AGENDA: * * * * * * * * * * The Winter 2010 BIOMETRICS SUMMIT: Practical Deployment Strategies, Market Trends Best Practices in Government, Healthcare And Business ** GENERAL SESSIONS February 23-24, 2010, Miami, FL http://www.aliconferences.com/conf/biometrics_summit_winter10/index.htm DAY ONE, Tuesday, February 23, 2010 8:30 Chairperson's Welcome Opening Remarks -- Samir Nanavati, Partner INTERNATIONAL BIOMETRIC GROUP (IBG) 8:40 Global And Mobile Identity Management: Business Processes And Technical Innovations To Ensure The Secure Flow Of Identities -- Dr. Joseph Atick, Executive Vice President, Chief Strategic Officer L-1 IDENTITY SOLUTIONS, INC. 9:40 Speed Networking: Become acquainted with your fellow attendees in this fun and fast-paced forum! 10:10 Morning Networking Break Exhibits 10:40 Deploying Biometrics Under Challenging Conditions And Cost Restrictions -- Andrew Chai, Engineering Manager OMNICELL, INC. -- -- Samir Nanavati, Partner INTERNATIONAL BIOMETRIC GROUP (IBG) 11:30 How A Major Retailer Streamlined The In-Store Experience And Enhanced Security Using Fingerprint Biometrics -- Carl Ceresoli, Manager, Information Technology Strategies Innovations ATT CONSUMER PRODUCT DIVISION -- -- Jim Sullivan, Director of Sales BIO-KEY
Re: [R] collumn error when exporting to Excel
No luck with: (col.names = NA and row.names = TRUE Will check the other responses and else try to install writeXLS Thanks for the help. Daniel -Original Message- From: Leandro Marino [mailto:lean...@cesgranrio.org.br] Sent: 05 November 2009 15:52 To: Hayes, Daniel; 'r-h...@lists.r-project.org' Subject: RES: [R] collumn error when exporting to Excel Try using write.table(col.names = NA and row.names = TRUE) I don’t know if it will help you. Another suggestion is to use the library writeXLS, is this library hava an function that exports your df into excel format. Atenciosamente, Leandro Lins Marino Centro de Avaliação Fundação CESGRANRIO Rua Santa Alexandrina, 1011 - 2º andar Rio de Janeiro, RJ - CEP: 20261-903 R (21) 2103-9600 R.:236 (21) 8777-7907 ( lean...@cesgranrio.org.br Aquele que suporta o peso da sociedade é precisamente aquele que obtém as menores vantagens. (SMITH, Adam) Antes de imprimir pense em sua responsabilidade e compromisso com o MEIO AMBIENTE Esta mensagem, incluindo seus anexos, pode conter informacoes privilegiadas e/ou de carater confidencial, nao podendo ser retransmitida sem autorizacao do remetente. Se voce nao e o destinatario ou pessoa autorizada a recebe-la, informamos que o seu uso, divulgacao, copia ou arquivamento sao proibidos. Portanto, se você recebeu esta mensagem por engano, por favor, nos informe respondendo imediatamente a este e-mail e em seguida apague-a. -Mensagem original- De: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] Em nome de Hayes, Daniel Enviada em: quinta-feira, 5 de novembro de 2009 06:56 Para: 'r-h...@lists.r-project.org' Assunto: [R] collumn error when exporting to Excel Dear all, I am attempting to export my results (data.frame) created with the help of a number of you to Excel. In the procedure my column structure is however lost and all results are placed together into the first Excel column. I have tried: write(), write.table(), write.matrix(), export() and have the same results. I Have checked the import/export FAQ and did a Google search to no avail. Any advice would be greatly appreciated. Kind greetings, Daniel dput(Bolivia.selected.ms.lat.m[1:10,]) structure(list(age = c(0, 0.0833, 0.167, 0.25, 0.333, 0.417, 0.5, 0.583, 0.667, 0.75), country = structure(c(1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L), .Label = c(Bolivia, Brazil, Colombia, Dominican Rep., El Salvador, Guatemala, Guyana, Haiti, Honduras, Nicaragua, Paraguay, Peru, Suriname), class = factor), mu = c(11.4216795790532, 11.336249852927, 11.2841715916567, 11.2112464680493, 11.1163747056146, 11.0042010015542, 10.881460044, 10.7555483953614, 10.6326412246687, 10.5168465177670), sigma = c(0.101487190832973, 0.105383747354763, 0.107059434066487, 0.108387198864101, 0.109530496229634, 0.110541869698550, 0.111444696116090, 0.112248590819971, 0.112951348056450, 0.113550216614654)), .Names = c(age, country, mu, sigma), row.names = c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10), class = data.frame) write.matrix(Bolivia.selected.ms.lat.m, file=C:\\Documents and Settings\\Dohyedan\\My Documents\\bolivia.selected.ms.lat.m, sep= ) [[alternative HTML version deleted]] __ R-help@r-project.org 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-project.org 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] Simulate data for spline/piecewise regression model
Dear All, I am trying to simulate data for a spline/piecewise regression model. I am missing something fundamental in my simulation procedure because when I try to fit my simulated data using the Gauss-Newton method in SAS, I am getting some wacky parameter estimates. Can anyone please check my simulation code and tell me what mistake I am making in generating data for spline model? Thank you very much for your help. Regards, Nidhi Here is my code: #Set the working directory # setwd(C:/SPLINE MODEL) #Data Simulation Routine# subjects = 30 #Sets the sample of subjects for whom the data is to be generated# knot = 8 #Specifies the value of knot/change point# beta0 = 3 #Specifies the value of intercept for x = knot# beta1 = 8 #Specifies the value of slope for x = knot# gamma0 = 6 #Specifies the value of intercept for x knot# gamma1 = 5 #Specifies the value of slope for x knot# #The following intializes empty (NA) vectors# X = rep(NA,subjects) Y = rep(NA, subjects) DATA = rep(NA, subjects) #The following sample x.values from uniform distribution# X = runif(subjects,1,20) # For loop for computing y-values by comparing each x-value to the knot# for (i in 1:30) { if (X[i] = knot) Y[i] = beta0+beta1*X[i] else Y[i] = gamma0+gamma1*X[i] } #Binding/combining the x- and y-values in one data set# DATA = cbind(X, Y) #This writes the DATA to a separate file# write.table(DATA, SplineData.dat) __ R-help@r-project.org 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] Incremental ReadLines
Gene, You might want to look at function read.csv.ffdf from package ff which can read large csv-files into a ffdf object. That's kind of data.frame which is stored on disk resp. in the file-system-cache. Once you subscript part of it, you get a regular data.frame. Jens Oehlschlägel -- Jetzt kostenlos herunterladen: Internet Explorer 8 und Mozilla Firefox 3.5 - sicherer, schneller und einfacher! http://portal.gmx.net/de/go/chbrowser __ R-help@r-project.org 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] Incremental ReadLines
If the headers all start with the same letter, A say, and the data only contain numbers on their lines then just use read.table(..., comment = A) On Mon, Nov 2, 2009 at 2:03 PM, Gene Leynes gleyne...@gmail.com wrote: I've been trying to figure out how to read in a large file for a few days now, and after extensive research I'm still not sure what to do. I have a large comma delimited text file that contains 59 fields in each record. There is also a header every 121 records This function works well for smallish records getcsv=function(fname){ ff=file(description = fname) x - readLines(ff) closeAllConnections() x - x[x != ] # REMOVE BLANKS x=x[grep(^[-0-9], x)] # REMOVE ALL TEXT spl=strsplit(x,',') # THIS PART IS SLOW, BUT MANAGABLE xx=t(sapply(1:length(spl),function(temp)as.vector(na.omit(as.numeric(spl[[temp]]) return(xx) } It's not elegant, but it works. For 121,000 records it completes in 2.3 seconds For 121,000*5 records it completes in 63 seconds For 121,000*10 records it doesn't complete When I try other methods to read the file in chunks (using scan), the process breaks down because I have to start at the beginning of the file on every iteration. For example: fnn=function(n,col){ a=122*(n-1)+2 xx=scan(fname,skip=a-1,nlines=121,sep=',',quiet=TRUE,what=character(0)) xx=xx[xx!=''] xx=matrix(xx,ncol=49,byrow=TRUE) xx[,col] } system.time(sapply(1:10,fnn,c=26)) # 0.31 Seconds system.time(sapply(91:90,fnn,c=26)) # 1.09 Seconds system.time(sapply(901:910,fnn,c=26)) # 5.78 Seconds Even though I'm only getting the 26th column for 10 sets of records, it takes a lot longer the further into the file I go. How can I tell scan to pick up where it left off, without it starting at the beginning?? There must be a good example somewhere. I have done a lot of research (in fact, thank you to Michael J. Crawley and others for your help thus far) Thanks, Gene [[alternative HTML version deleted]] __ R-help@r-project.org 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-project.org 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] NLM OUTPUT
Hi Bob, On Nov 5, 2009, at 3:04 PM, robertag...@discover.com robertag...@discover.com wrote: I am missing something fundamental. I ran the function nlm, but I don't understand how to extract the optimal solution as a numeric vector. The function produces it as one element of a list. I don't see anything in the R documentation about converting such a list element to the vector it displays. Are you just asking how to pull out the appropriate parts of the returned value from the nlm function call? Taking code from the Example section of ?nlm, run this: R f - function(x, a) sum((x-a)^2) R r - nlm(f, c(10,10), a=c(3,5)) Now look at r R r $minimum [1] 3.371781e-25 $estimate [1] 3 5 $gradient [1] 6.750156e-13 -9.450218e-13 $code [1] 1 $iterations [1] 2 To get the minimum, or estimate you just access it like: R r$minimum [1] 3.371781e-25 R r$estimate [1] 3 5 Is this what you're asking? -steve ps: r[['minimum']] and r[['estimate']] would also work, as would r[[1]] and r[[2]] -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact __ R-help@r-project.org 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 read numeric as text
Hi: If I want to read a file with read.table. I want x1 and x2 to be read as character and x3 as numeric. How to do this? Thanks. Satish x1 ,x2,x3 10,20,30 11 ,22,35 __ R-help@r-project.org 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] new help pages in R 2.10.0
Thanks to everyone who replied. I think the html based one works fine (even if I definitely preferred the old chtml). Only another comment: I chose html in my installation with Windows Vista, but still the help pages are opened in text files in the newly installed version. Of course, I can type options(help_type=html) as suggested every time I open a new session, but it would be easier if html was actually the default, especially for other un-experienced users. Thanks again Antonio apjawor...@mmm.com 05/11/2009 20:33 Antonio, Starting from 2.10, R dropped its support for Windows CHM help. It has been replaced with the web browser HTML based one. To activate this add the following line to your Rprofile options(help_type=html) The pages come up in your browser. They all have the same links as before. It works quite well with Firefox as they come up in new tabs, so you can have several of them open at the same time. Hope this helps, Andy __ Andy Jaworski 518-1-01 Process Laboratory 3M Corporate Research Laboratory - E-mail: apjawor...@mmm.com Tel: (651) 733-6092 Fax: (651) 736-3122 From: antonio.gasparr...@lshtm.ac.uk To: r-help@r-project.org Date: 11/05/2009 02:17 PM Subject: [R] new help pages in R 2.10.0 Sent by: r-help-boun...@r-project.org Dear R-users, I've just installed the last version of R (2.10.0) in Windows and found a completely new version of the help pages. Basically, they now appear as a simple (even if slightly embellished) text file. I tried to install it with a customized startup and realized that the old CHM files (the default for Windows up to 2.9.2) are not included anymore as a possible choice. I don't know if this is due to some mistake I've done, but otherwise would be a major drawback of the new version. The opportunity to navigate through different help pages using the links in the old R was really useful. At the moment I re-installed the old R 2.9.2, but I hope this will change in later versions. Or at least, that the user could have the opportunity to choose the help pages he deems more suitable for his purposes. I hope someone could give some details Regards, Antonio Gasparrini Public and Environmental Health Research Unit (PEHRU) London School of Hygiene Tropical Medicine Keppel Street, London WC1E 7HT, UK Office: 0044 (0)20 79272406 - Mobile: 0044 (0)79 64925523 __ R-help@r-project.org 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@r-project.org 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 read numeric as text
See ?read.csv and read the part about colClasses. X - read.csv(textConnection(x1 ,x2,x3 + 10,20,30 + 11 ,22,35), colClasses = c(character, character, numeric) + ) str(X) 'data.frame': 2 obs. of 3 variables: $ x1: chr 10 11 $ x2: chr 20 22 $ x3: num 30 35 -Ista On Thu, Nov 5, 2009 at 5:58 PM, Vadlamani, Satish {FLNA} satish.vadlam...@fritolay.com wrote: Hi: If I want to read a file with read.table. I want x1 and x2 to be read as character and x3 as numeric. How to do this? Thanks. Satish x1 ,x2,x3 10,20,30 11 ,22,35 __ R-help@r-project.org 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. -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org __ R-help@r-project.org 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 see any R package code?
On 11/06/2009 02:24 AM, Zhijiang Wang wrote: Dear All, I have modified a .R code (/usr/local/lib/R/site-library/brainwaver/R), but when I run it, why does it run the original code? Whatever I modified it, the results did not change. what happened? Hi Zhijiang, If you modify a source code file in an external editor, you must save the result, then use: source(usr/local/lib/R/site-library/brainwaver/R/mycode.R) where mycode.R is the name of the file that you have modified. The code that you source will replace the previous code. It looks like you are modifying the code of one or more functions in the brainwaver package, so when you have the function working as you wish, you will probably want to rebuild the package, perhaps renaming it to something like brainwaver2. See Writing R extensions (R-exts.html) for information on how to do this. You would then be able to use: library(brainwaver2) instead of the original library. Jim __ R-help@r-project.org 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 load a specific variable from an RData file?
I'm wondering if there is any option available in load() such that I can specify which variable I want to load from an RData file. I don't see such option in the help. __ R-help@r-project.org 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] Set colors in a PCA plot based on a gradient vector
On 11/06/2009 03:21 AM, Joel Fürstenberg-Hägg wrote: Hi all, I'm making a PCA plot with eight variables (columns taken from a larger data frame fieldTrial0809[idx,c(39:46)]). I then want the symbols in the plot to be colored as a gradient from red to blue, depending on the value of another column in fieldTrial0809[idx, c(48)] containg temperatures from -12.1 to -5.4. I don't want to use the heat.colors(n) function, because then I just get colors from red to yellow... I've created a vector colTemperature with 12 colors and I've also made a new vector tempACC, based on the values of fieldTrial0809[idx, c(48)] with 12 levels. What I don't know, is how to incorporate this vector in the text() function below: df=fieldTrial0809[idx,c(39:46)] PC=prcomp (df[,1:8]) hcl=hclust(dist(df)) plot(PC$x[,1],PC$x[,2], col=white, main=8 variables) text(PC$x[,1],PC$x[,2], labels=cutree(hcl,8), col=cutree(hcl,8)) # Change this, but how??? library(plotrix) text(...,col=color.scale(fieldTrial0809[idx,48], extremes=c(red,blue)) Finally, I've got another question, how do you decide how many components to use in text(... labels=cutree(hcl,8), ...)? Do you try with different values until i looks nice or what..? As in so many other areas of life, beauty is in the eye of the beholder. Jim __ R-help@r-project.org 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 load a specific variable from an RData file?
Create an environment, load the RData file into the environment, copy over the items of interest, delete the environment. e1 - new.env() load(gold.RData, e1) ls() [1] e1 ls(e1) [1] a.mark aisleRange allSlots balanced [5] baseSlotsbox.offset case2cube case2desc [9] caseupc2upc ClassifyCommoditycolToUse comm.gold [13] comm_map comm2desccommOrder createBay [17] D_slots.save DoubleCutoff f.assignDouble f.assignSingle [21] f.bayCheck f.checkForGrowthSlot f.getBay f.removeSlot [25] f.slotNumf.sortSlots firstSlot gold.comm [29] growthInciKLN2comm KLN2cpq [33] KLN2cube KLN2desc KLN2slot KLN2upc [37] missingQuads nfreenSlots r.size [41] rankComm realign report reslotAisles [45] s.lower s.matS_slots.save sa.m [49] save.opt save.slots setupSlots slotAssignments [53] slotsslotSize slotsUsed slotWork [57] topSlots totaltotal.split upc2comm [61] upc2crushupc2cube upc2desc upc2KLN [65] upc2slot upc2weight upcDesc vol.report [69] wh.reslotx.aisle x.m nfree - get('nfree', e1) ls() # now it is in the global workspace. [1] e1nfree On Thu, Nov 5, 2009 at 6:43 PM, Peng Yu pengyu...@gmail.com wrote: I'm wondering if there is any option available in load() such that I can specify which variable I want to load from an RData file. I don't see such option in the help. __ R-help@r-project.org 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org 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] 19900501 into 1990-05-01
If you just want it to remain as character data: sub(()(..)(..), \\1 \\2 \\3, 19000501) [1] 1900 05 01 On Thu, Nov 5, 2009 at 2:04 PM, frenchcr frenc...@btinternet.com wrote: I have a column of dates in this format.. 19900501 I want to change 19900501 into 1990 05 01 then append a new column on the end (right hand side of spreadsheet) :confused: -- View this message in context: http://old.nabble.com/19900501-into-1990-05-01-tp26217515p26217515.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org 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] wilcox.test returning 'NA' p-value
Hi folks, sorry for this beginner question but what means a p-value = NA on a menn-whitney test? v1 - c(0.022, 0.022, 0.022, 0.022, 0.022, 0.022) v2 - c(0.022, 0.022, 0.022, 0.022, 0.022) wilcox.test(v1, v2, PAIRED=FALSE) W = 15, p-value = NA I know that there's no statistical difference between v1 and v2, so why my p-value is not ONE ?? Can I consider p-value= NA as ONE ?? what i do when get this type of value on wilcox.test ??? PS: sorry for my bad english. [[alternative HTML version deleted]] __ R-help@r-project.org 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] wilcox.test returning 'NA' p-value
Hi Ambar, v1 and v2 are constants. they need to be variables. try e.g., v1 - c(0.021, 0.022, 0.022, 0.022, 0.022, 0.022) v2 - c(0.021, 0.022, 0.022, 0.022, 0.022) wilcox.test(v1, v2, PAIRED=FALSE) -Ista On Thu, Nov 5, 2009 at 7:23 PM, Ambar Amarelo ambar.amar...@gmail.com wrote: Hi folks, sorry for this beginner question but what means a p-value = NA on a menn-whitney test? v1 - c(0.022, 0.022, 0.022, 0.022, 0.022, 0.022) v2 - c(0.022, 0.022, 0.022, 0.022, 0.022) wilcox.test(v1, v2, PAIRED=FALSE) W = 15, p-value = NA I know that there's no statistical difference between v1 and v2, so why my p-value is not ONE ?? Can I consider p-value= NA as ONE ?? what i do when get this type of value on wilcox.test ??? PS: sorry for my bad english. [[alternative HTML version deleted]] __ R-help@r-project.org 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. -- Ista Zahn Graduate student University of Rochester Department of Clinical and Social Psychology http://yourpsyche.org __ R-help@r-project.org 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] wilcox.test returning 'NA' p-value
Ambar Amarelo wrote: Hi folks, sorry for this beginner question but what means a p-value = NA on a menn-whitney test? v1 - c(0.022, 0.022, 0.022, 0.022, 0.022, 0.022) v2 - c(0.022, 0.022, 0.022, 0.022, 0.022) wilcox.test(v1, v2, PAIRED=FALSE) W = 15, p-value = NA I know that there's no statistical difference between v1 and v2, so why my p-value is not ONE ?? Can I consider p-value= NA as ONE ?? what i do when get this type of value on wilcox.test ??? PS: sorry for my bad english. [[alternative HTML version deleted]] Did you read the help page? If there are ties, then a Normal approximation is used. So how would you do a Normal approximation? Try it by hand - you have a small enough amount of data. Try also a t.test() and see what message it gives you. BTW, there is no PAIRED argument to wilcox.test(). -- Peter Ehlers University of Calgary __ R-help@r-project.org 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 load a specific variable from an RData file?
Thank you. When the RData file is huge, it will take a long time to load it even though I may only need a small variable. Could somebody add an option to 'load()' to load only a few given variables? On Thu, Nov 5, 2009 at 5:58 PM, jim holtman jholt...@gmail.com wrote: Create an environment, load the RData file into the environment, copy over the items of interest, delete the environment. e1 - new.env() load(gold.RData, e1) ls() [1] e1 ls(e1) [1] a.mark aisleRange allSlots balanced [5] baseSlots box.offset case2cube case2desc [9] caseupc2upc ClassifyCommodity colToUse comm.gold [13] comm_map comm2desc commOrder createBay [17] D_slots.save DoubleCutoff f.assignDouble f.assignSingle [21] f.bayCheck f.checkForGrowthSlot f.getBay f.removeSlot [25] f.slotNum f.sortSlots firstSlot gold.comm [29] growthInc i KLN2comm KLN2cpq [33] KLN2cube KLN2desc KLN2slot KLN2upc [37] missingQuads nfree nSlots r.size [41] rankComm realign report reslotAisles [45] s.lower s.mat S_slots.save sa.m [49] save.opt save.slots setupSlots slotAssignments [53] slots slotSize slotsUsed slotWork [57] topSlots total total.split upc2comm [61] upc2crush upc2cube upc2desc upc2KLN [65] upc2slot upc2weight upcDesc vol.report [69] wh.reslot x.aisle x.m nfree - get('nfree', e1) ls() # now it is in the global workspace. [1] e1 nfree On Thu, Nov 5, 2009 at 6:43 PM, Peng Yu pengyu...@gmail.com wrote: I'm wondering if there is any option available in load() such that I can specify which variable I want to load from an RData file. I don't see such option in the help. __ R-help@r-project.org 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org 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 load a specific variable from an RData file?
Peng Yu wrote: Thank you. When the RData file is huge, it will take a long time to load it even though I may only need a small variable. Could somebody add an option to 'load()' to load only a few given variables? Check out the filehash package. It has an option that allows you to store variables in single-file databases just like RData files. However, with filehash data files, you can pick and choose which variables to load. Hope this helps! -Charlie - Charlie Sharpsteen Undergraduate Environmental Resources Engineering Humboldt State University -- View this message in context: http://old.nabble.com/How-to-load-a-specific-variable-from-an-RData-file--tp26224416p26225433.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Calculate Mean for each Treatment/Trial Interaction in DF
Hi, I am create a new DF that summarizes the mean angle per treatment/trial, of the original DF (see below). I have had some success using: (tapply(df$Angle, INDEX=interaction(df$State, df$Trial), FUN=mean)); however, this gives the answer as a list, which means I would have to split the name to get the categories back. Does anyone know a simple way to transform the Original DF into Summary DF? Thanks in advance, James Original DF df Angle TrialTreatment 143.1297 1 C 262.3613 1 C 388.2767 2 C 475.2431 2 C 591.3668 3 C 661.2800 3 C 755.5575 1 U 869.4661 1 U 967.5512 2 U 10 95.5528 2 U 11 75.8689 3 U 12 66.9070 3 U Summary DF sdf Angle TrialTreatment 152.7455 1 C 2... 2 C 3... 3 C 4... 1 U 5... 2 U 6... 3 U -- View this message in context: http://old.nabble.com/Calculate-Mean-for-each-Treatment-Trial-Interaction-in-DF-tp26225533p26225533.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] new help pages in R 2.10.0
I think the html based one works fine (even if I definitely preferred the old chtml). Only another comment: I chose html in my installation with Windows Vista, but still the help pages are opened in text files in the newly installed version. The nice thing about the chtml that is missing from html is the table of contents frame on the left. Oh well! Of course, I can type options(help_type=html) as suggested every time I open a new session, but it would be easier if html was actually the default, especially for other un-experienced users. I think if you open the file C:\Program Files\R\R-2.10.0\etc\Rprofile.site in a text editor and remove the # symbol before the line options(help_type=html) that html help will be your default help. As I think Duncan posted there was an install file error that causes this to not happen, and none of the beta testers caught it in time. HTH, Rob Starting from 2.10, R dropped its support for Windows CHM help. It has been replaced with the web browser HTML based one. To activate this add the following line to your Rprofile options(help_type=html) The pages come up in your browser. They all have the same links as before. It works quite well with Firefox as they come up in new tabs, so you can have several of them open at the same time. Hope this helps, Andy __ Andy Jaworski 518-1-01 Process Laboratory 3M Corporate Research Laboratory - E-mail: apjawor...@mmm.com Tel: (651) 733-6092 Fax: (651) 736-3122 From: antonio.gasparr...@lshtm.ac.uk To: r-help@r-project.org Date: 11/05/2009 02:17 PM Subject: [R] new help pages in R 2.10.0 Sent by: r-help-boun...@r-project.org Dear R-users, I've just installed the last version of R (2.10.0) in Windows and found a completely new version of the help pages. Basically, they now appear as a simple (even if slightly embellished) text file. I tried to install it with a customized startup and realized that the old CHM files (the default for Windows up to 2.9.2) are not included anymore as a possible choice. I don't know if this is due to some mistake I've done, but otherwise would be a major drawback of the new version. The opportunity to navigate through different help pages using the links in the old R was really useful. At the moment I re-installed the old R 2.9.2, but I hope this will change in later versions. Or at least, that the user could have the opportunity to choose the help pages he deems more suitable for his purposes. I hope someone could give some details Regards, Antonio Gasparrini Public and Environmental Health Research Unit (PEHRU) London School of Hygiene Tropical Medicine Keppel Street, London WC1E 7HT, UK Office: 0044 (0)20 79272406 - Mobile: 0044 (0)79 64925523 __ R-help@r-project.org 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@r-project.org 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-project.org 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] map of a country and its different geographical levels
Hi R users I need the map of France’s « communes » (towns) to build a map Is there a way to get it? More generally: How to do to get the map of a country and its different geographical levels? Best regards -- View this message in context: http://old.nabble.com/map-of-a-country-and-its-different-geographical-levels-tp26225645p26225645.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Bhattacharyya distance metric
On Thu, 2009-11-05 at 12:25 -0800, Diana Garrett wrote: I need to use the Bhattacharyya distance metric to determine population separation. Has anyone written a Bhattacharyya distance metric function in R? Something like this ( I think it's correct ): --%--- DBhat - function(X1,X2){ # define means mX1 - mean(X1) mX2 - mean(X2) # define difference of means mDiff - mX1 - mX2 # define cov cvX1 - cov(X1) cvX2 - cov(X2) # define halfsum of cv's p - (cvX1+cvX2)/2 # the equation 0.125 * t(mDiff) * p^(-1) * mDiff + 0.5 * log10( det(p) / sqrt( det(cvX1) * det(cvX2) )) --%--- A related thread (in grass-stats): http://www.mail-archive.com/grass-st...@lists.osgeo.org/msg00183.html Regards, Nikos __ R-help@r-project.org 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] issues with SSOAP when wsdl has ComplexTypes
I recently started trying R and SSOAP and was able to successfully try a hello world service. I am now trying to get a more complicated interface to work with SSOAP and so far failed miserably at that and so need any help I can get from here. The service I am attaching is a prototype for a full service that would take information to identify a data source and a query to run and return a tabular data (a sql query result or a dataframe in R). Note: If you are impatient to read the long email, you may skip to the description of Third attempt First attempt: I have a ServiceInfo type as part of the request, that has two components, a clientID that is an int and a serviceInfoType that is an enum. I was able to create the ServiceInfo class object and was able to make the function call, but I was getting an error in the toSOAP(). sinfo = c(clientId=1, serviceType='Engine') class(sinfo) - d...@classes$`soap/DataService`$ServiceInfo res = d...@functions$simplequery(sinfo, 'select 1 as One') Loading required package: bitops Error in toSOAP(argValues[[i]], methodCall, type = typedef, literal = .literal) : No code yet for the toSOAP method for any object and ClassDefinition pair with literal = FALSE Second attempt: I then flattened the ServiceInfo such that the clientId and sericeType are passed inline to bypass the above error. SSOAP went past that but complained about a missing elType (seems to not like the enum). res = d...@functions$simplequery(1, 'Engine', 'select 1 as One') Error in toSOAPArray(obj, con, type = type, literal = literal, ...) : no slot of name elType for this object of class RestrictedStringDefinition Third attmept: To bypass the above error as well, I then changed serviceType to string. SSOAP then actually made a successful call, and the webservice returned a response. However, now SSOAP failed to deserialize it with the below error res = d...@functions$simplequery(1, 'Engine', 'select 1 as One') Error in as(from, QueryResultRow) : no method or default for coercing XMLInternalElementNode to QueryResultRow I have since then created a standalone version of the service that only takes the query (no clientId and serviceType) and attached the code. The service is written in python using ZSI, and there is ZSI client code in the comments that shows how to use it from a python client (which btw, works as expected). The code doesn't actually execute the query, it simply fills in dummy data into the result, so all that you need to try the sample is python 2.6 and ZSI (http://pywebsvcs.sourceforge.net/). The comment also has sample R client code which I am paste below: library(SSOAP) dataService - processWSDL('C:/src/tmp/python/webserv/dataService/DataService.wsdl') def = genSOAPClientInterface(def = dataService, verbose = TRUE) res = d...@functions$simplequery('select 1 as One') At this point, my priority is to get the deserialization of the response working, as I am able to workaround the first two issues in sending request. I would really appreciate if anyone can help me in solving this problem. Here is some more information on getting the python sample to work. - Save the wsdl and py file in the same directory. - After installing python 2.6 and ZSI, run the below commands: $ wsdl2py --complexType --file DataService.wsdl $ wsdl2dispatch --file DataService.wsdl - Run the below command to start the service: $ python DataService.py - Start another python shell and run the below commands to see it in action: $ python import sys from DataService_services import * loc = DataServiceServiceLocator() service = loc.getDataServicePortType(tracefile=sys.stdout) req = DataServiceQueryRequest() req.Query = select 1 as One res = service.simpleQuery(req) print Field names: %s % [field.StringValue for field in ...res.Result.ResultHeading.QueryFields] print Rows: for i in xrange(0, len(res.Result.ResultRows)): print Row %d: %s % (i+1, [field.StringValue or ... field.LongValue or field.DoubleValue for field in ... res.Result.ResultRows[i].QueryFields]) Please let me know if you need any more information on the problem or getting the python sample to work. Thank you, Hari __ R-help@r-project.org 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] Calculate Mean for each Treatment/Trial Interaction in DF
Tena koe Jim ?aggregate HTH Peter Alspach -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of jimdare Sent: Friday, 6 November 2009 2:54 p.m. To: r-help@r-project.org Subject: [R] Calculate Mean for each Treatment/Trial Interaction in DF Hi, I am create a new DF that summarizes the mean angle per treatment/trial, of the original DF (see below). I have had some success using: (tapply(df$Angle, INDEX=interaction(df$State, df$Trial), FUN=mean)); however, this gives the answer as a list, which means I would have to split the name to get the categories back. Does anyone know a simple way to transform the Original DF into Summary DF? Thanks in advance, James Original DF df Angle TrialTreatment 143.1297 1 C 262.3613 1 C 388.2767 2 C 475.2431 2 C 591.3668 3 C 661.2800 3 C 755.5575 1 U 869.4661 1 U 967.5512 2 U 10 95.5528 2 U 11 75.8689 3 U 12 66.9070 3 U Summary DF sdf Angle TrialTreatment 152.7455 1 C 2... 2 C 3... 3 C 4... 1 U 5... 2 U 6... 3 U -- View this message in context: http://old.nabble.com/Calculate-Mean-for-each-Treatment-Trial- Interaction-in-DF-tp26225533p26225533.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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-project.org 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 load a specific variable from an RData file?
On Thu, Nov 5, 2009 at 5:58 PM, jim holtman jholt...@gmail.com wrote: Create an environment, load the RData file into the environment, copy over the items of interest, delete the environment. e1 - new.env() load(gold.RData, e1) ls() [1] e1 ls(e1) [1] a.mark aisleRange allSlots balanced [5] baseSlots box.offset case2cube case2desc [9] caseupc2upc ClassifyCommodity colToUse comm.gold [13] comm_map comm2desc commOrder createBay [17] D_slots.save DoubleCutoff f.assignDouble f.assignSingle [21] f.bayCheck f.checkForGrowthSlot f.getBay f.removeSlot [25] f.slotNum f.sortSlots firstSlot gold.comm [29] growthInc i KLN2comm KLN2cpq [33] KLN2cube KLN2desc KLN2slot KLN2upc [37] missingQuads nfree nSlots r.size [41] rankComm realign report reslotAisles [45] s.lower s.mat S_slots.save sa.m [49] save.opt save.slots setupSlots slotAssignments [53] slots slotSize slotsUsed slotWork [57] topSlots total total.split upc2comm [61] upc2crush upc2cube upc2desc upc2KLN [65] upc2slot upc2weight upcDesc vol.report [69] wh.reslot x.aisle x.m nfree - get('nfree', e1) ls() # now it is in the global workspace. [1] e1 nfree How to remove the environment 'e1' after I get 'nfree'? On Thu, Nov 5, 2009 at 6:43 PM, Peng Yu pengyu...@gmail.com wrote: I'm wondering if there is any option available in load() such that I can specify which variable I want to load from an RData file. I don't see such option in the help. __ R-help@r-project.org 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. -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? __ R-help@r-project.org 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] Sorting NA's and Graphing a histogram
Hi Koraleus, Here is a suggestion to (almost) do what you want: # data set x - read.table(textConnection(Alpha Beta Gamma Delta A 12 34 B NA 2 45 D 8 9 10 11 E 5 NA 7 13), header=TRUE) closeAllConnections() x # plot matplot(1:4, t(x), lty = 1, type = 'b', pch = 16, xaxt = 'n', las = 1, xlab = 'Component', ylab = 'Values') axis(1, 1:4, c(expression(alpha), expression(beta), expression(gamma), expression(delta))) legend('topleft', c('A','B','D','E'), lty = 1, pch = 16, col = 1:4, ncol = 4, title = Column) HTH, Jorge On Thu, Nov 5, 2009 at 2:47 PM, Koraelus wrote: Hello all, Thank you for you help with the first part, it worked perfectly. I now have a dataset that is culled to only include rows with no NA's or only 1 NA. What I want to achieve with the graph is: Plot the new data matrix: Alpha Beta Gamma Delta A 12 34 B NA 2 45 D 8 9 10 11 E 5 NA 7 13 Such that (for this example) the x-axis has five points: Alpha, Beta, Gamma, Delta and the y-axis has a numerical axis representing the numbers in the matrix. I'm sorry, this example graph will look very crude. 4 X 3 X 2X 1 X Alpha Beta Gamma Delta (with a line connecting the dots) I would like to do this for all rows in the culled data matrix on a single window (using par(mfrow)) and for the NA's to be left blank. Thank you for your help so far! Koraelus Jorge Ivan Velez wrote: Hi Koraelus, Could you please explain us in more detail what would you like to do in the second part? HTH, Jorge -- View this message in context: http://old.nabble.com/Sorting-NA%27s-and-Graphing-a-histogram-tp26157779p26157779.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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@r-project.org 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. -- View this message in context: http://old.nabble.com/Sorting-NA%27s-and-Calling-Rownames-as-Variables-tp26157779p26219813.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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@r-project.org 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] Calculate Mean for each Treatment/Trial Interaction in DF
On Nov 5, 2009, at 7:53 PM, jimdare wrote: I am create a new DF that summarizes the mean angle per treatment/ trial, of the original DF (see below). I have had some success using: (tapply(df$Angle, INDEX=interaction(df$State, df$Trial), FUN=mean)); That's rather difficult to accept, since State is not a column name of df. however, this gives the answer as a list, which means I would have to split the name to get the categories back. Does anyone know a simple way to transform the Original DF into Summary DF? Thanks in advance, James Original DF df Angle TrialTreatment 143.1297 1 C 262.3613 1 C 388.2767 2 C 475.2431 2 C 591.3668 3 C 661.2800 3 C 755.5575 1 U 869.4661 1 U 967.5512 2 U 10 95.5528 2 U 11 75.8689 3 U 12 66.9070 3 U Summary DF sdf Angle TrialTreatment 152.7455 1 C 2... 2 C snip Try: aggregate(df$Angle, list(df$Treatment, df$Trial), sum) Group.1 Group.2x 1 C 1 105.4910 2 U 1 125.0236 3 C 2 163.5198 4 U 2 163.1040 5 C 3 152.6468 6 U 3 142.7759 -- David Winsemius, MD Heritage Laboratories West Hartford, CT __ R-help@r-project.org 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 load a specific variable from an RData file?
Peng Yu wrote: How to remove the environment 'e1' after I get 'nfree'? Did you try rm( e1 ) ? - Charlie Sharpsteen Undergraduate Environmental Resources Engineering Humboldt State University -- View this message in context: http://old.nabble.com/How-to-load-a-specific-variable-from-an-RData-file--tp26224416p26226191.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Adjusting Yaxis (ylim) limits on a plotMeans(DV, IV1, IV2, error.bars=se)
Hello everyone, I have tried to look for this everywhere and so far have no luck. I have a plotMeans(DV, IV1, IV2, error.bars=se) graph that plots my data (DV-continuous, IVs are factors, IV1 - two levels, IV2-four levels). I am trying to increase a scale of my y-axis (to be consistent with my other graphs), but unfortunately nothing works with plotMeans function, which is the only one I see so fat to plot what I need. Could anyone provide any suggestions or advice? Thank you. Sergey (UNL, Behavioral Psychopharmacology Lab) [[alternative HTML version deleted]] __ R-help@r-project.org 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] probem on merge data
Hi there, data1-matrix(data=c(1,1.2,1.3,3/23/2004,1,1.5,2.3,3/22/2004,2,0.2,3.3,4/23/2004,3,1.5,1.3,5/22/2004),nrow=4,ncol=4,byrow=TRUE) data1-data.frame(data1) names(data1)-c(areaid,x,y,date) data1 areaid x y date 1 1 1.2 1.3 3/23/2004 2 1 1.5 2.3 3/22/2004 3 2 0.2 3.3 4/23/2004 4 3 1.5 1.3 5/22/2004 data2-matrix(data=c(1,1.22,1.32,1, 1.53, 2.34,1, 1.21, 1.37,1, 1.52, 2.35,2, 0.21, 3.33,2, 0.23, 3.35,3, 1.57, 1.31,3, 1.59, 1.33),nrow=8,ncol=3,byrow=TRUE) data2-data.frame(data2) names(data2)-c(areaid,x1,y1) data2 areaid x1 y1 1 1 1.22 1.32 2 1 1.53 2.34 3 1 1.21 1.37 4 1 1.52 2.35 5 2 0.21 3.33 6 2 0.23 3.35 7 3 1.57 1.31 8 3 1.59 1.33 Explains the two data. You can treat data1 as case dataset and data2 as control dataset,respectively.Note th number of recodes for data2 are 2 times as that of data1 for each records,something like 1:2 matched case-control study design. I hope to merge data1 and data2. Take areaid=1 as an example. From the two dataset, we can see that data1 has two points(x,y) in areaid=1, and data2 has four points (x1,y1) in areaid=1. Each record in data1 will have two matched records in data2.I want to randomly select 1/2 points of areaid=1 in data2 to link the one record of areaid=1 in the data1, and the other 1/2 points of areaid=1 in data2 to link the other record of areaid=1 in the data1.Actually,the number of records in the same areaid will be over 2 in the actual dataset. This is only an example to explain the problem. For the cases of areaid=2 or 3,they are a little easier than areaid=1 because there are only one value in data1. The final results are something like the following dataset. areaid x1 y1date x y 1 1.22 1.32 3/23/2004 1.2 1.3 1 1.53 2.34 3/22/2004 1.2 1.3 1 1.21 1.37 3/23/2004 1.5 2.3 1 1.52 2.35 3/22/2004 1.5 2.3 2 0.21 3.33 4/23/2004 0.2 3.3 2 0.23 3.35 4/23/2004 0.2 3.3 3 1.57 1.31 5/22/2004 1.5 1.3 3 1.59 1.33 5/22/2004 1.5 1.3 Any suggestions or help are greatly appreciated. Thanks a lot. [[alternative HTML version deleted]] __ R-help@r-project.org 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] Adjusting Yaxis (ylim) limits on a plotMeans(DV, IV1, IV2, error.bars=se)
Hi Sergey I've attached a script with a ylim argument added to plotMeans. If you are using Rcmdr, you can load this script via the Rcmdr File menu item File Open Script File so save this plotMeans.R script somewhere, and load it and run it in Rcmdr, then do your plot command plotMeans(DV, IV1, IV2, error.bars=se, ylim = c(27, 99)) or whatever your desired ylim values are. HTH Steven McKinney, Ph.D. Statistician Molecular Oncology and Breast Cancer Program British Columbia Cancer Research Centre email: smckinney +at+ bccrc +dot+ ca tel: 604-675-8000 x7561 BCCRC Molecular Oncology 675 West 10th Ave, Floor 4 Vancouver B.C. V5Z 1L3 Canada From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of Sergios (Sergey) Charntikov [sergios...@gmail.com] Sent: November 5, 2009 7:51 PM To: r-help@r-project.org Subject: [R] Adjusting Yaxis (ylim) limits on a plotMeans(DV, IV1, IV2, error.bars=se) Hello everyone, I have tried to look for this everywhere and so far have no luck. I have a plotMeans(DV, IV1, IV2, error.bars=se) graph that plots my data (DV-continuous, IVs are factors, IV1 - two levels, IV2-four levels). I am trying to increase a scale of my y-axis (to be consistent with my other graphs), but unfortunately nothing works with plotMeans function, which is the only one I see so fat to plot what I need. Could anyone provide any suggestions or advice? Thank you. Sergey (UNL, Behavioral Psychopharmacology Lab) [[alternative HTML version deleted]] __ R-help@r-project.org 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. plotMeans - function (response, factor1, factor2, error.bars = c(se, sd, conf.int, none), level = 0.95, xlab = deparse(substitute(factor1)), ylab = paste(mean of, deparse(substitute(response))), legend.lab = deparse(substitute(factor2)), main = Plot of Means, pch = 1:n.levs.2, lty = 1:n.levs.2, col = palette(), ylim = NULL) { if (!is.numeric(response)) stop(gettextRcmdr(Argument response must be numeric.)) xlab ylab legend.lab error.bars - match.arg(error.bars) if (missing(factor2)) { if (!is.factor(factor1)) stop(gettextRcmdr(Argument factor1 must be a factor.)) valid - complete.cases(factor1, response) factor1 - factor1[valid] response - response[valid] means - tapply(response, factor1, mean) sds - tapply(response, factor1, sd) ns - tapply(response, factor1, length) if (error.bars == se) sds - sds/sqrt(ns) if (error.bars == conf.int) sds - qt((1 - level)/2, df = ns - 1, lower.tail = FALSE) * sds/sqrt(ns) sds[is.na(sds)] - 0 yrange - if (error.bars != none) c(min(means - sds, na.rm = TRUE), max(means + sds, na.rm = TRUE)) else range(means, na.rm = TRUE) levs - levels(factor1) n.levs - length(levs) if ( is.null(ylim) ) { plot(c(1, n.levs), yrange, type = n, xlab = xlab, ylab = ylab, axes = FALSE, main = main) } else { plot(c(1, n.levs), yrange, type = n, xlab = xlab, ylab = ylab, axes = FALSE, main = main, ylim = ylim) } points(1:n.levs, means, type = b, pch = 16, cex = 2) box() axis(2) axis(1, at = 1:n.levs, labels = levs) if (error.bars != none) arrows(1:n.levs, means - sds, 1:n.levs, means + sds, angle = 90, lty = 2, code = 3, length = 0.125) } else { if (!(is.factor(factor1) | is.factor(factor2))) stop(gettextRcmdr(Arguments factor1 and factor2 must be factors.)) valid - complete.cases(factor1, factor2, response) factor1 - factor1[valid] factor2 - factor2[valid] response - response[valid] means - tapply(response, list(factor1, factor2), mean) sds - tapply(response, list(factor1, factor2), sd) ns - tapply(response, list(factor1, factor2), length) if (error.bars == se) sds - sds/sqrt(ns) if (error.bars == conf.int) sds - qt((1 - level)/2, df = ns - 1, lower.tail = FALSE) * sds/sqrt(ns) sds[is.na(sds)] - 0 yrange - if (error.bars != none) c(min(means - sds, na.rm = TRUE), max(means + sds, na.rm = TRUE)) else range(means, na.rm = TRUE) levs.1 - levels(factor1) levs.2 - levels(factor2) n.levs.1 - length(levs.1) n.levs.2 - length(levs.2) if (length(pch) == 1) pch - rep(pch, n.levs.2) if (length(col) == 1) col - rep(col, n.levs.2) if
Re: [R] How to see any R package code?
You have to use R CMD REMOVE Package NAME to uninstall the package(from Command line) . Then R CMD build brainwaver.tar.gz the R CMD INSTALL brainwaver.tar.gz to re install then the changes you made you be effective Zhijiang Wang wrote: Dear All, I have modified a .R code (/usr/local/lib/R/site-library/brainwaver/R), but when I run it, why does it run the original code? Whatever I modified it, the results did not change. what happened? Paul Hiemstra åé: Zhijiang Wang wrote: Dear All, I want to see a R package code, how can I do that? what file in the package? -- Best wishes, Zhijiang Wang PHD Student Room 212, Science buliding, The International WIC Institute, College of Computer Science and Technology, Beijing University of Technology, Beijing, China. __ [1]r-h...@r-project.org mailing list [2]https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide [3]http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Hi Zhijiang, When you want to look at the code of a particular function, pass the command without the brackets, e.g. for lm: lm Alternatively, you can download the source package and go to the subdirectory R/. All the R code is located there. cheers, Paul -- Best wishes, Zhijiang Wang PHD Student Room 212, Science buliding, The International WIC Institute, College of Computer Science and Technology, Beijing University of Technology, Beijing, China. References 1. mailto:R-help@r-project.org 2. https://stat.ethz.ch/mailman/listinfo/r-help 3. http://www.R-project.org/posting-guide.html __ R-help@r-project.org 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. -- View this message in context: http://old.nabble.com/Re%3A-How-to-see-any-R-package-code--tp26211013p26226551.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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 splits character fields in a csv file
I download a csv extract from a database and use read.csv to read it from R and when there are large character fields with embedded blanks, slashes etc. - R often sees one line as two lines (or more). I verfied with readLines that an embedded blank in a character field causes a spurious new line to be seen. I am sure this problem has beem seen before - and would appreciate any help in reading such files. __ R-help@r-project.org 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] qu: predict with lmer (lme4) or other ways to get classification accuracy
I had to deal with this issue yesterday, and I'm guessing many who use lme4 have this same issue because of the lack of a predict.lmer function. It seems to me that one would need to plug the X %*% b output from the predict.lmerBin function below into the logistic distribution to get the actual predicted probabilities. In other words: predict.lmerBin - function(object, X){ if(missing(X)) X - obj...@x b - fixef(object) plogis(X %*% b) } The example below demonstrates the equivalence between plogis(X %*% b) and predict.glm(...,type = response,...) : ldose - rep(0:5, 2) numdead - c(1, 4, 9, 13, 18, 20, 0, 2, 6, 10, 12, 16) sex - rep(c(1, 2), c(6, 6)) SF - cbind(numdead, numalive=20-numdead) budworm.lg - glm(SF ~ sex*ldose, family=binomial) summary(budworm.lg) ld - seq(0, 5, 0.1) preds = predict(budworm.lg, newdata= data.frame(sex=1, ldose=ld), type = response) X = as.matrix(data.frame(int=1,sex=1, ldose=ld, sex.ldose=1*ld))#, sex.ldose = 2*ld)) b=coef(budworm.lg) plogis(X%*%b) == preds If anyone can see a problem with the above approach, please let me know as I am using this for a paper. -Solomon Spencer Graves wrote: Checking 'help(lmer)' leads me also to 'help(lmer-class)', both of which are helpful. Unfortunately, I know of no general predict method that's available for an object of class 'lmer'. A preliminary function of that nature is as follows: predict.lmerBin - function(object, X){ # object has class lmer # X = model matrix with columns # matching obj...@x if(missing(X)) X - obj...@x # b - fixef(object) X %*% b } ## To use this, you need to know how to use # 'preduct.glm'. # Example using data(Contraception), discussed in (mlmR - vignette(MlmSoftRev)) # opens in Adobe Acrobat # To open a script file companion to vignette(MlmSoftRev) #edit(mlmR) # with Rgui #Stangle(mlmR$file) # with ESS fitBin - lmer(use ~ urban+age+livch+(1|district), Contraception, binomial) predict.lmerBin(fitBin) Does this answer your question? Spencer Graves p.s. If your example had been simple and self-contained, it would have been to reply, because I could copy a few lines of R code from your email into R, tested a few ideas, and craft a reply in a very few minutes, if not seconds. Without that, crafting a sensible reply takes more time, partly because it's less clear what you need to know to move to the next step, and partly because after I guess what you are really asking, I must next hunt for a suitable example. T. Florian Jaeger wrote: Hi, I am using lmer (from the package lme4) to predict a binary response variable (REL) from a bunch of fixed effects and two random effects (Speaker_ID and NPhead_lemma): fit - lmer(REL ~ SPEAKER_GENDER + log(SPEECHRATE) + SQSPEECHRATE + . + (1|Speaker_ID) + (1|NPhead_lemma), family=binomial, data=data.lmer, method=Laplace, model=T, x=T) I would like to get classification accuracies for the derived model, or even do some evaluation (cross-validation), but I cannot find a way to get to the predicted values. As far as I can tell no predict method has been implemented for lmer, right? I also was trying to figure out whether lmer stores the predicted values somewhere (I read the documentation and implementation summary, /library/lme4/doc/Implementation.pdf). Many thanks for your help and my apologies if I overlooked something really simple. Florian -- T. Florian Jaeger Ph.D. student Linguistics Department, P: +1 (650) 725 2323 F: +1 (650) 723 5666 U: http://www.stanford.edu/~tiflo/ __ r-h...@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html __ r-h...@stat.math.ethz.ch mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html -- View this message in context: http://old.nabble.com/qu%3A-predict-with-lmer-%28lme4%29-or-other-ways-to-get-classification-accuracy-tp4203433p26223153.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] partitioning chi-square statistic (g squared)
hi all - is there a package or library that contains a function for partitioning the chi-square statistic of an I X J contingency table into its respective independent parts? i looked around for this, but i didn't find anything. perhaps there's another name for this sort of analysis? i know it as g-squared. thanks, chris. [[alternative HTML version deleted]] __ R-help@r-project.org 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] NLM OUTPUT
Thanks, Steve. I believe that's all I needed. I couldn't find that r$estimate syntax anywhere in the manual. I'm new to R, having used SAS exclusively in the past. I was able to run the optimizing functions nlm and optim successfully, but I couldn't figure out how to access the estimates. I tried another function constroptim rather unsuccessfully; it ran but did very little so I took a different approach. Bob Robert Agnew | Discover Director Acquisition Analytics Marketing â Analysis Pricing 2500 Lake Cook Road Riverwoods, IL 60015 Tel 224-405-1425 Fax 224-405-4971 robertag...@discover.com Steve Lianoglou mailinglist.honey...@gmail.com 11/05/2009 04:56 PM To robertag...@discover.com robertag...@discover.com cc r-help@r-project.org Subject Re: [R] NLM OUTPUT Hi Bob, On Nov 5, 2009, at 3:04 PM, robertag...@discover.com robertag...@discover.com wrote: I am missing something fundamental. I ran the function nlm, but I don't understand how to extract the optimal solution as a numeric vector. The function produces it as one element of a list. I don't see anything in the R documentation about converting such a list element to the vector it displays. Are you just asking how to pull out the appropriate parts of the returned value from the nlm function call? Taking code from the Example section of ?nlm, run this: R f - function(x, a) sum((x-a)^2) R r - nlm(f, c(10,10), a=c(3,5)) Now look at r R r $minimum [1] 3.371781e-25 $estimate [1] 3 5 $gradient [1] 6.750156e-13 -9.450218e-13 $code [1] 1 $iterations [1] 2 To get the minimum, or estimate you just access it like: R r$minimum [1] 3.371781e-25 R r$estimate [1] 3 5 Is this what you're asking? -steve ps: r[['minimum']] and r[['estimate']] would also work, as would r[[1]] and r[[2]] -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact Please consider the environment before printing this email. [[alternative HTML version deleted]] __ R-help@r-project.org 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] variable selectin---reduce the numbers of initial variable
thank all friends to discuss this problem, my data is 54*160 matrix. PLS is a good method, can it give a equation with y~selected little vriables? for exmaple: y Sv Sp Ms nCIRnAB nC nN nO nX ZM1V 1 7.6231.45 33.44 2.372 12 18 6 2 0 2 8.3432.26 33.92 2.363 18 20 6 2 0 3 7.7930.97 32.89 2.412 12 18 5 3 0 4 7.8327.75 29.47 2.372 12 16 6 1 0 5 7.6329.35 31.23 2.332 12 17 6 1 0 6 7.4530.94 32.99 2.3 2 12 18 6 1 0 7 7.9733.35 35.23 2.293 18 21 6 1 0 8 8.9324.47 25.64 2.464 12 14 6 2 0 9 8.6724.95 26.19 2.414 12 14 7 1 0 10 9.3625.04 26.83 2.384 12 14 6 1 0 11 8.9324.47 25.64 2.464 12 14 6 2 0 12 7.4633.05 35.22.342 12 19 6 2 0 13 7.5434.05 36.22.293 12 20 6 2 0 14 8.3427.66 29.16 2.384 12 16 6 2 0 15 8.1 29.26 30.92 2.354 12 17 6 2 0 16 8.6927.06 28.42.355 12 16 6 2 0 17 7.3934.53 36.76 2.263 12 20 7 1 0 18 9.4821.15 22.58 2.352 12 12 5 0 1 19 8.3 20.35 22.12.361 6 10 5 0 1 20 9.2118.15 19.58 2.332 6 9 5 0 1 21 7.8524.54 26.63 2.162 6 13 5 0 1 22 9.0522.75 24.34 2.312 12 13 5 0 1 23 8.9 19.26 20.82.441 6 9 5 1 1 24 9.7522.66 24.03 2.542 12 13 5 1 1 25 8.3720.45 21.72 2.272 12 12 5 0 0 26 7.7723.64 25.24 2.2 2 12 14 5 0 0 27 7.5425.24 27.01 2.172 12 15 5 0 0 28 7.8824.64 26.24 2.133 12 15 5 0 0 29 10.59 21.85 23.44 2.422 12 12 5 0 2 30 9.2523.26 24.82.372 12 13 5 1 1 31 8.4 25.94 27.86 2.262 12 15 5 0 1 32 8.1427.54 29.63 2.242 12 16 5 0 1 33 12.02 22.23 23.93 2.352 12 12 5 0 2 34 10.27 22.57 23.73 2.742 12 12 6 2 1 35 9.9622.55 23.82 2.512 12 13 6 0 1 36 8.8930.45 32.32 2.263 18 19 5 1 1 37 9.1526.37 28.01 2.5 2 12 15 5 2 1 38 8.6425.34 27.11 2.292 12 14 6 0 1 39 8.6128.45 30.32 2.233 12 16 6 1 1 40 9.2325.25 26.82.5 2 12 14 6 1 1 41 9.3622.14 23.59 2.412 12 12 6 0 1 42 9.0432.96 34.78 2.4 3 18 20 6 2 1 43 9.0522.75 24.34 2.312 12 13 5 0 1 44 9.2523.26 24.82.372 12 13 5 1 1 45 9.0522.75 24.34 2.312 12 13 5 0 1 46 10.59 21.85 23.44 2.422 12 12 5 0 2 47 9.0725.37 27.01 2.392 12 14 5 2 1 48 11.722.55 24.32.482 12 12 5 0 3 49 11.722.55 24.32.482 12 12 5 0 3 50 9.4125.76 27.26 2.542 12 14 6 2 1 51 9.0727.36 29.02 2.5 2 12 15 6 2 1 52 8.5230.56 32.54 2.452 12 17 6 2 1 53 8.3637.75 40.06 2.333 18 23 6 2 1 54 8.3331.04 33.09 2.412 12 17 7 1 1 I want to obtain a equation with less varible. e.g. y~Sv+Sp+Ms+nCIR, wich method can give it like that, not only resut like r2 q2 rms etc. thank you! Max Kuhn wrote: There is also a sparse PLS model in the spls package. It uses lasso-like regularization to reduce the number of
Re: [R] NLM OUTPUT
I would appreciate your insights on the attached session. Bob Robert Agnew | Discover Director Acquisition Analytics Marketing – Analysis Pricing 2500 Lake Cook Road Riverwoods, IL 60015 Tel 224-405-1425 Fax 224-405-4971 robertag...@discover.com Steve Lianoglou mailinglist.honey...@gmail.com 11/05/2009 04:56 PM To robertag...@discover.com robertag...@discover.com cc r-help@r-project.org Subject Re: [R] NLM OUTPUT Hi Bob, On Nov 5, 2009, at 3:04 PM, robertag...@discover.com robertag...@discover.com wrote: I am missing something fundamental. I ran the function nlm, but I don't understand how to extract the optimal solution as a numeric vector. The function produces it as one element of a list. I don't see anything in the R documentation about converting such a list element to the vector it displays. Are you just asking how to pull out the appropriate parts of the returned value from the nlm function call? Taking code from the Example section of ?nlm, run this: R f - function(x, a) sum((x-a)^2) R r - nlm(f, c(10,10), a=c(3,5)) Now look at r R r $minimum [1] 3.371781e-25 $estimate [1] 3 5 $gradient [1] 6.750156e-13 -9.450218e-13 $code [1] 1 $iterations [1] 2 To get the minimum, or estimate you just access it like: R r$minimum [1] 3.371781e-25 R r$estimate [1] 3 5 Is this what you're asking? -steve ps: r[['minimum']] and r[['estimate']] would also work, as would r[[1]] and r[[2]] -- Steve Lianoglou Graduate Student: Computational Systems Biology | Memorial Sloan-Kettering Cancer Center | Weill Medical College of Cornell University Contact Info: http://cbio.mskcc.org/~lianos/contact Please consider the environment before printing this email. __ R-help@r-project.org 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 intervals
I'm using the plotmeans function to plot the means and 95% CI of my groups, however I also want to get the actual numbers of the CI, i.e. the upper and lower bounds. Is there anyway to get that information out of plotmeans? If not, is there an easy way to calculate the CIs? -- View this message in context: http://old.nabble.com/Confidence-intervals-tp26225647p26225647.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] Adjusting Yaxis (ylim) limits on a plotMeans(DV, IV1, IV2, error.bars=se)
Hello everyone, I have tried to look for this everywhere and so far have no luck. I have a plotMeans(DV, IV1, IV2, error.bars=se) graph that plots my data (DV-continuous, IVs are factors, IV1 - two levels, IV2-four levels). I am trying to increase a scale of my y-axis (to be consistent with my other graphs), but unfortunately nothing works with plotMeans function, which is the only one I see so fat to plot what I need. Could anyone provide any suggestions or advice? Thank you. Sergey (UNL, Behavioral Psychopharmacology Lab) -- View this message in context: http://old.nabble.com/Adjusting-Yaxis-%28ylim%29-limits-on-a-plotMeans%28DV%2C-IV1%2C-IV2%2C-error.bars%3D%22se%22%29-tp26226434p26226434.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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 see any R package code?
For a code .R file, I add a function in it. But I saw it was not modified in command window, while it was changed in /usr/local/lib/R/site-library/brainwaver/R by openning it by editor. So I doubt the two are different, but I just find one version this .R file, which was just in the above directory. David Winsemius 写道: On Nov 5, 2009, at 10:24 AM, Zhijiang Wang wrote: Dear All, I have modified a .R code (/usr/local/lib/R/site-library/brainwaver/R), What did you modify? How did you modify it? but when I run it, How did you run it? If the it is just a single function that you altered after it was loaded into the workspace, then you should show us what you entered at the command line. If you were attempting to change the contents of a package in an R library and recompile it, then you should be reading: [1]http://cran.r-project.org/doc/manuals/R-exts.html -- Best wishes, Zhijiang Wang PHD Student Room 212, Science buliding, The International WIC Institute, College of Computer Science and Technology, Beijing University of Technology, Beijing, China. References 1. http://cran.r-project.org/doc/manuals/R-exts.html __ R-help@r-project.org 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] Error with strucchange/breakpoints
Hi, I am trying to a strucutural change analysis on a certain data set. Attached here, with variable name xcd http://old.nabble.com/file/p26226190/xcd.rda xcd.rda Am using the following command: bp.inrz-breakpoints(INR~SPX+WPI,data=xcd,h=26) But keep on getting this error whatever variables i put in on the x side as regressors: Error in chol2inv(qr.R(qr(X))) : element (3, 3) is zero, so the inverse cannot be computed Any insights ?? Regards Anmol -- View this message in context: http://old.nabble.com/Error-with-strucchange-breakpoints-tp26226190p26226190.html Sent from the R help mailing list archive at Nabble.com. [[alternative HTML version deleted]] __ R-help@r-project.org 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 see any R package code?
You have to use R CMD REMOVE Package NAME to uninstall the package(from Command line) . Then R CMD build brainwaver.tar.gz the R CMD INSTALL brainwaver.tar.gz to re install then the changes you made you be effective Zhijiang Wang wrote: Dear All, I have modified a .R code (/usr/local/lib/R/site-library/brainwaver/R), but when I run it, why does it run the original code? Whatever I modified it, the results did not change. what happened? Paul Hiemstra åé: Zhijiang Wang wrote: Dear All, I want to see a R package code, how can I do that? what file in the package? -- Best wishes, Zhijiang Wang PHD Student Room 212, Science buliding, The International WIC Institute, College of Computer Science and Technology, Beijing University of Technology, Beijing, China. __ [1]r-h...@r-project.org mailing list [2]https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide [3]http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Hi Zhijiang, When you want to look at the code of a particular function, pass the command without the brackets, e.g. for lm: lm Alternatively, you can download the source package and go to the subdirectory R/. All the R code is located there. cheers, Paul -- Best wishes, Zhijiang Wang PHD Student Room 212, Science buliding, The International WIC Institute, College of Computer Science and Technology, Beijing University of Technology, Beijing, China. References 1. mailto:R-help@r-project.org 2. https://stat.ethz.ch/mailman/listinfo/r-help 3. http://www.R-project.org/posting-guide.html __ R-help@r-project.org 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. -- View this message in context: http://old.nabble.com/Re%3A-How-to-see-any-R-package-code--tp26211013p26226552.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org 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] R 2.10.0: Error in gsub/calloc
Bert, Thanks for the tip. Yes, strsplit works, and works fast! For me, white-space tokenization means splitting at the white spaces, so the ^ and the outermost square brackets should/can be omitted. Regards ... from Basel to South San Francisco, Richard On Nov 3, 2009, at 22:03 , Bert Gunter wrote: Try: tokens - strsplit(d,[^[:space:]]+) This splits each sentence in your vector into a vector of groups of whitespace characters that you can then play with as you described, I think (The results is a list of such vectors -- see strsplit()). ## example: x - xx xdfg; *^%kk strsplit(x,[^[:blank:]]+) [[1]] [1] You might have to use PERL = TRUE and \\w+ depending on your locale and what [:space:] does there. If this works, it should be way faster than strapply() and should not have any memory allocation issues either. HTH. Bert Gunter Genentech Nonclinical Biostatistics -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org ] On Behalf Of Richard R. Liu Sent: Tuesday, November 03, 2009 11:32 AM To: Uwe Ligges Cc: r-help@r-project.org Subject: Re: [R] R 2.10.0: Error in gsub/calloc I apologize for not being clear. d is a character vector of length 158908. Each element in the vector has been designated by sentDetect (package: openNLP) as a sentence. Some of these are really sentences. Others are merely groups of meaningless characters separated by white space. strapply is a function in the package gosubfn. It applies to each element of the first argument the regular expression (second argument). Every match is then sent to the designated function (third argument, in my case missing, hence the identity function). Thus, with strapply I am simply performing a white-space tokenization of each sentence. I am doing this in the hope of being able to distinguish true sentences from false ones on the basis of mean length of token, maximum length of token, or similar. Richard R. Liu Dittingerstr. 33 CH-4053 Basel Switzerland Tel.: +41 61 331 10 47 Email: richard@pueo-owl.ch On Nov 3, 2009, at 18:30 , Uwe Ligges wrote: richard@pueo-owl.ch wrote: I'm running R 2.10.0 under Mac OS X 10.5.8; however, I don't think this is a Mac-specific problem. I have a very large (158,908 possible sentences, ca. 58 MB) plain text document d which I am trying to tokenize: t - strapply(d, \\w+, perl = T). I am encountering the following error: What is strapply() and what is d? Uwe Ligges Error in base::gsub(pattern, rs, x, ...) : Calloc could not allocate (-1398215180 of 1) memory This happens regardless of whether I run in 32- or 64-bit mode. The machine has 8 GB of RAM, so I can hardly believe that RAM is a problem. Thanks, Richard __ R-help@r-project.org 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-project.org 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] Web implementation of R?
Hello, Can anyone recommend a good example of web implementation of R? Can't seem to find anything on my own. Thanks in advance! Sam [[alternative HTML version deleted]] __ R-help@r-project.org 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] new help pages in R 2.10.0
On Thu, Nov 5, 2009 at 11:03 PM, antonio.gasparr...@lshtm.ac.uk wrote: Thanks to everyone who replied. I think the html based one works fine (even if I definitely preferred the old chtml). Only another comment: I chose html in my installation with Windows Vista, but still the help pages are opened in text files in the newly installed version. Thanks for this report; few people pay attention to this and/or don't recall what they're installation options were and/or may not be bothered to report it. It turns out it is a known bug in the installer, cf. https://stat.ethz.ch/pipermail/r-devel/2009-November/055430.html and it has been fixed recently in R v2.10.0 patched: BUG FIXES o The installer did not properly record help type choices in R_HOME/etc/Rprofile.site. From http://cran.r-project.org/bin/windows/base/CHANGES.R-2.10.0pat You find updates on the latest patches (and the most recent developers version) via: http://cran.r-project.org/bin/windows/base/ Of course, I can type options(help_type=html) as suggested every time I open a new session, but it would be easier if html was actually the default, especially for other un-experienced users. You can also add that code to the .Rprofile file that you have/can create in your home directory, e.g. C:/Users/JohnDoe/.Rprofile. /Henrik Thanks again Antonio apjawor...@mmm.com 05/11/2009 20:33 Antonio, Starting from 2.10, R dropped its support for Windows CHM help. It has been replaced with the web browser HTML based one. To activate this add the following line to your Rprofile options(help_type=html) The pages come up in your browser. They all have the same links as before. It works quite well with Firefox as they come up in new tabs, so you can have several of them open at the same time. Hope this helps, Andy __ Andy Jaworski 518-1-01 Process Laboratory 3M Corporate Research Laboratory - E-mail: apjawor...@mmm.com Tel: (651) 733-6092 Fax: (651) 736-3122 From: antonio.gasparr...@lshtm.ac.uk To: r-help@r-project.org Date: 11/05/2009 02:17 PM Subject: [R] new help pages in R 2.10.0 Sent by: r-help-boun...@r-project.org Dear R-users, I've just installed the last version of R (2.10.0) in Windows and found a completely new version of the help pages. Basically, they now appear as a simple (even if slightly embellished) text file. I tried to install it with a customized startup and realized that the old CHM files (the default for Windows up to 2.9.2) are not included anymore as a possible choice. I don't know if this is due to some mistake I've done, but otherwise would be a major drawback of the new version. The opportunity to navigate through different help pages using the links in the old R was really useful. At the moment I re-installed the old R 2.9.2, but I hope this will change in later versions. Or at least, that the user could have the opportunity to choose the help pages he deems more suitable for his purposes. I hope someone could give some details Regards, Antonio Gasparrini Public and Environmental Health Research Unit (PEHRU) London School of Hygiene Tropical Medicine Keppel Street, London WC1E 7HT, UK Office: 0044 (0)20 79272406 - Mobile: 0044 (0)79 64925523 __ R-help@r-project.org 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@r-project.org 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-project.org 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] Web implementation of R?
On Thu, Nov 5, 2009 at 10:54 PM, Sam Albers tonightstheni...@gmail.com wrote: Hello, Can anyone recommend a good example of web implementation of R? Can't seem to find anything on my own. Thanks in advance! Sam What do you mean by web implementation? An interactive session? A server to submit jobs to? A website that presents results generated by R? The best web-based application I have seen that allows you to interact with R, is the version included in the Sage mathematics system. You can access it at: http://www.sagenb.org It requires that you sign up for a free account (to prevent abuse of the server) and cannot use R for graphics output (which is 90% of what makes R fun in my opinion), but it's the best online R-enabled notebook I have found. The Sage project it's self is pretty interesting, you can check them out at: http://www.sagemath.org If you were looking for something other than an interactive web-based R session, then you will have to provide some more clarification. Hope this helps! -Charlie __ R-help@r-project.org 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.