Re: [R] Collinearity in Linear Multiple Regression

2009-07-21 Thread Tim Paysen
Actually, the CI index and VIF are just a start.  It is best to look at what they call a matrix of "variance proportions" (found in SAS and a few other places...)--which hardly anyone understands (including the SAS folks).  It is a matrix of estimates of what the variences of the regression coef

Re: [R] Subsample points for mclust

2009-07-21 Thread Mario Valle
Nothing is better than asking help to find the answer by myself... Page 47 of the technical report (tr504.pdf) deals exactly with the problem of big datasets. Also I found that mclust is too much for my problem, the optimum number of Gaussian suggested is way too high. For example for one dat

Re: [R] How to extract the upper xlim and ylim of my plot?

2009-07-21 Thread Greg Snow
?grconvertX -Original Message- From: "Mark Na" To: "r-help@r-project.org" Sent: 7/21/09 3:05 PM Subject: [R] How to extract the upper xlim and ylim of my plot? Dear R-helpers, I wish to place some text in a plot, at approx 10% of my upper xlim and approx 90% of my upper ylim, i.e. >

Re: [R] How do I delete a row from a data frame when varA == "TRUE"

2009-07-21 Thread Daniel Malter
XYZ=XYZ[XYZ$A==TRUE , ] should do. Note that this specific command overwrites your XYZ dataframe. If you want to keep XYZ, you will want to name the newly created frame differently. HTH, Daniel - cuncta stricte discussurus - -Ursprüngliche Nach

Re: [R] EM algorithm

2009-07-21 Thread Elena 5/12
l=∑_i∑_k log[ (Se(i))^(t_ik ) [1-Se(i) ]^(1-t_ik ) p+(Sp(i))^(1-t_ik) [1-Sp(i) ]^(t_ik ) (1-p)] This is my observed loglikelihood. It is a sum over i (there are I tests) and over k (K patients). t_ik is the result for the kth patient on the ith test. Se(i)= sensitivity, Sp (i)= specificity and

[R] How do I delete a row from a data frame when varA == "TRUE"

2009-07-21 Thread kxk
I want to delete a row from a data frame XYZ where A == "TRUE". Let's assume there are five variables in this data frame XYZ. My deletion is based on the TRUE vs. FALSE value under variable A. How do I do this? Thanks! My current code: for (i in 1:length(XYZ$A)) if (XYZ$A == "FALSE") XYZ<-XY

[R] R extract vertices for polygon

2009-07-21 Thread Angel Marley
Dear R users, I'm trying to extract from a given matrix (GROUP) the coordinates of the vertices of the different groups (i.e. 3, 7, 1 . . .) to plot the polygons to delineate the area in which each group "wins" and colour it diferentially. I can make a simple point plot, but I would like to ad

[R] EM algorithm

2009-07-21 Thread Elena 5/12
l=∑_i∑_k log[ (Se(i))^(t_ik ) [1-Se(i) ]^(1-t_ik ) p+(Sp(i))^(1-t_ik) [1-Sp(i) ]^(t_ik ) (1-p)] This is my observed loglikelihood. It is a sum over i (there are I tests) and over k (K patients). t_ik is the result for the kth patient on the ith test. Se(i)= sensitivity, Sp (i)= specificity and

Re: [R] Select set of variables with strongest correlation

2009-07-21 Thread nyk
Thanks, I did! This reply I also got helped a lot: r<-matrix(rnorm(30),ncol=3) r4 <-1+2*rnorm(10,r[,3], 0.5) r5 <-1-3*rnorm(10,r[,3], 0.5) data<-cbind(r,r4,r5) corr<-cor(data,use='na.or.complete') corrl<-(corr[col(corr)>row(corr)])^2 colms<-col(data)[col(col(data))>row(col(data))] rows<-row(data

Re: [R] Adjusting x/y text labels for a bwplot using cex.lab

2009-07-21 Thread mcobb_berkeley
Figured it out --- FYI: bwplot(hr~Herd, data=telemetry, notch=T, ylab=list("Home Range Area (ha)", cex=1.5), xlab=list("Herd", cex=1.5), par.settings = list(plot.symbol = list(col = "black"),box.umbrella = list(col ="black"), box.rectangle=list(col="black")),fill="light blue") mcobb_berkeley

Re: [R] dump() an object of type raw ?

2009-07-21 Thread David Winsemius
On Jul 21, 2009, at 10:21 PM, Benjamin Tyner wrote: Thank you David for taking the time to respond to my question. Perhaps I should clarify: the man page says "a 'dump' file can be 'source'd"; have I taken the documentation too literally in this case? I suppose that objects of type raw may

Re: [R] is a sequence of dates consecutive, without gaps?

2009-07-21 Thread Christopher W. Ryan
Thanks, Phil and Marc; exactly what I needed! I didn't know about the diff function. --Chris Christopher W. Ryan, MD SUNY Upstate Medical University Clinical Campus at Binghamton 40 Arch Street, Johnson City, NY 13790 cryanatbinghamtondotedu "If you want to build a ship, don't drum up the men to

Re: [R] dump() an object of type raw ?

2009-07-21 Thread Benjamin Tyner
Thank you David for taking the time to respond to my question. Perhaps I should clarify: the man page says "a 'dump' file can be 'source'd"; have I taken the documentation too literally in this case? David Winsemius wrote: On Jul 21, 2009, at 7:19 PM, Benjamin Tyner wrote: Is there a way to

Re: [R] dump() an object of type raw ?

2009-07-21 Thread David Winsemius
On Jul 21, 2009, at 7:19 PM, Benjamin Tyner wrote: Is there a way to do this? I tried x <- writeBin(pi, raw()) dump("x","x.R") source("x.R") but is seems x.R is not source()-able, as it contains an unexpected symbol. Yes, "2d".I get: > source("/Users/davidwinsemius/x.R") Error in sou

Re: [R] strange dlply behavior

2009-07-21 Thread hadley wickham
Hi Damien, This is because of a small bug. You can work around it by explicitly using the force function - dlply(d, "V1", force). The default will be fixed in the next version. Regards, Hadley On Tue, Jul 21, 2009 at 11:18 AM, Damien Moore wrote: > I'm running R 2.9.1 on winXP, using the libr

Re: [R] How to replace NAs in a vector of factors?

2009-07-21 Thread Rolf Turner
On 22/07/2009, at 1:21 PM, jim holtman wrote: Notice that three items are returned where you thought one was: [1] FALSE TRUE TRUE TRUE FALSE db1$olditems[db1$olditems==''] #wait, only one item is returned? [1] Levels: nuts soup db1[db1$olditems=='',] #somehow this works! olditems p

Re: [R] How to replace NAs in a vector of factors?

2009-07-21 Thread Bill.Venables
Couple of points: 1. if you are going to be replacing entries in factors with updated levels, it's probably easier if you start with your strings remaining as strings as they go into the data frames. So here is how I would start your example db1 <- data.frame( olditems = c('soup','','',''

Re: [R] How to replace NAs in a vector of factors?

2009-07-21 Thread jim holtman
Notice that three items are returned where you thought one was: [1] FALSE TRUE TRUE TRUE FALSE > db1$olditems[db1$olditems==''] #wait, only one item is returned? [1] Levels: nuts soup > db1[db1$olditems=='',] #somehow this works! olditems prices 23.25 34.42 4

Re: [R] How to replace NAs in a vector of factors?

2009-07-21 Thread hadley wickham
On Tue, Jul 21, 2009 at 7:39 PM, Gene Leynes wrote: > # Just when I thought I had the basic stuff mastered > # This has been quite perplexing, thanks for any help > > > ## Here's the example: > > db1=data.frame( >    olditems=c('soup','','','','nuts'), >    prices=c(4.45, 3.25, 4.42, 2.25, 3.98

Re: [R] dump() an object of type raw ?

2009-07-21 Thread David Winsemius
On Jul 21, 2009, at 7:19 PM, Benjamin Tyner wrote: Is there a way to do this? I tried Do what? > writeBin(pi, raw()) [1] 18 2d 44 54 fb 21 09 40 Why would you want to "source" _that_? source() is for parse-able and executable R code. x <- writeBin(pi, raw()) dump("x","x.R") source("x.

Re: [R] list of lm() results

2009-07-21 Thread Gene Leynes
I found that it was easiest to just pull out the parts I want with an "apply" loop. Here I am regressing a bunch of equity returns on some index returns and just keeping the coefficients: EqCoefQ1 = apply(retEqQ1,2, function(x) summary(lm(x~retIndexQ1))$coefficients) On Tue, Jul 21, 2009

[R] How to replace NAs in a vector of factors?

2009-07-21 Thread Gene Leynes
# Just when I thought I had the basic stuff mastered # This has been quite perplexing, thanks for any help ## Here's the example: db1=data.frame( olditems=c('soup','','','','nuts'), prices=c(4.45, 3.25, 4.42, 2.25, 3.98)) db2=data.frame( newitems=c('stew','crackers','tofu','goats

Re: [R] Adjusting x/y text labels for a bwplot using cex.lab

2009-07-21 Thread S Ellison
You probably missed the bit in the lattice documentation which says that few if any of the standard par() parameters work on lattice. lattice uses its own system. Look at the xyplot help page and seek out the scales argument. That tells you that scales is a list, optionally with x and y components

Re: [R] kaplan-meier error

2009-07-21 Thread Marc Schwartz
On Jul 21, 2009, at 7:23 PM, Joseph Magagnoli wrote: Hi all, I am getting an error in my code and I don't know what the problem is. I am using R 2.9 on ubuntu. my code is as follows: ## Libraries ## library(survival) library(foreign) ## reading data ## data<-read.dta("http://psfaculty.ucdav

[R] kaplan-meier error

2009-07-21 Thread Joseph Magagnoli
Hi all, I am getting an error in my code and I don't know what the problem is. I am using R 2.9 on ubuntu. my code is as follows: ## Libraries ## library(survival) library(foreign) ## reading data ## data<-read.dta("http://psfaculty.ucdavis.edu/bsjjones/cabinet.dta";) head(data) attach(data)

Re: [R] Checking on closed file connections

2009-07-21 Thread Duncan Murdoch
On 21/07/2009 8:13 PM, Jim Nemesh wrote: On Jul 21, 2009, at 6:40 PM, Duncan Murdoch wrote: On 21/07/2009 5:03 PM, Jim Nemesh wrote: Hi! I'm wondering if there's a smart way around this: fileName= (some valid file on your system) fileCon=file(fileName, open="rt") l<-readLines

Re: [R] Checking on closed file connections

2009-07-21 Thread Jim Nemesh
On Jul 21, 2009, at 6:40 PM, Duncan Murdoch wrote: > On 21/07/2009 5:03 PM, Jim Nemesh wrote: >> Hi! I'm wondering if there's a smart way around this: >> fileName= (some valid file on your system) >> >fileCon=file(fileName, open="rt") >> >l<-readLines (fileCon, n= 1) >> > >> > isOpen(fil

[R] dump() an object of type raw ?

2009-07-21 Thread Benjamin Tyner
Is there a way to do this? I tried x <- writeBin(pi, raw()) dump("x","x.R") source("x.R") but is seems x.R is not source()-able, as it contains an unexpected symbol. Thanks Ben __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/l

Re: [R] RODBC results from stored procedure

2009-07-21 Thread tradenet
Thanks Dieter. The stored proc drops and recreates a result table that contains a copy of the same result set that is returned by the query. If I pause after line 1, line 2 returns a valid result set and line 4 displays a table of data. If I do not pause the script after line 1 or 2, line 3 fail

Re: [R] Checking on closed file connections

2009-07-21 Thread Duncan Murdoch
On 21/07/2009 5:03 PM, Jim Nemesh wrote: Hi! I'm wondering if there's a smart way around this: fileName= (some valid file on your system) > fileCon=file(fileName, open="rt") > l<-readLines (fileCon, n= 1) > > isOpen(fileCon) [1] TRUE > close(fileCon) > isOpen(fileCon) Error in isOp

[R] Rcmdr GUI goes into loop via alt+backspace under Windows OS

2009-07-21 Thread tradenet
I'm using Rcmdr version 1.4-10 with R version 2.9.0 under Vista x64. A standard editing convention under Windows is that alt+backspace is a keyboard shortcut for "undo". I often find myself hitting the [alt] and [backspace] keys while editing scripts in Rcmdr. However, this causes the Rcmdr GUI

[R] EM algorithm

2009-07-21 Thread Elena 5/12
l=∑_i∑_k log [(Se(i))^(t_ik ) [1-Se(i) ]^(1-t_ik ) p+(Sp(i))^(1-t_ik ) [1-Sp(i) ]^(t_ik ) (1-p)] This is my loglikelihood. It is a sum over i (I tests) and over k (K patients). t_ik is the test results for the ithe test for the kth patient. Se(i)=sensitivity of test i, Sp(i)=specificity of test

[R] sampling randomly from general correlated multivariate PDFs

2009-07-21 Thread gnuman
(apologies if this looks like a re-post, I just sent a similar message to the r-help mail list. This version is via Nabble.) My intended application is error propagation using the ISO GUM Supplement 1 approach (propagation of distributions using Monte Carlo strategies). To automate uncertainty a

[R] Elementary Symmetric Polynomials

2009-07-21 Thread Austin H. Jones
We are interested in obtaining an efficient function that for a given vector of length t will output a vector of length t+1 that contains the associated values of the elementary symmetric polynomials in t variables. Below is what we have at the moment, but it is a little slow for our needs. Any

[R] sampling from general multivariate pdf

2009-07-21 Thread Blair Smith
Hi, Forgive me if I seem naive, I'm tackling multivariate stats for the first time! Q. I'd like to know if there are packages that can be used to simulate random draws from general multivariate (joint) PDF functions when ONLY the independent marginal PDFs are known (RV means and covariance or c

Re: [R] list of lm() results

2009-07-21 Thread Giovanni Petris
My guess is that you did not define the list correcly before making any assignments to it. Try something like > myResults <- vector("list", 16) and then your code > myResults[1] <- lm(...) > myResults[2] <- lm(...) > myResults[3] <- lm(...) ... > myResults[15] <- lm(...) > myResults[16] <- lm(

Re: [R] class export in package creation / setClass / namespace?

2009-07-21 Thread L L
Thanks to both Martins, your advice solved the confusion between S3 and S4 classes for the show method. br. Leo On Tue, Jul 21, 2009 at 9:58 AM, Martin Maechler wrote: > > "MartinMo" == Martin Morgan > > on Mon, 20 Jul 2009 18:57:33 -0700 writes: > >MartinMo> L L writes: >

[R] Adjusting x/y text labels for a bwplot using cex.lab

2009-07-21 Thread mcobb_berkeley
Searched for this and found some help, but I still can't figure it out. I have trying to enlarge the x and y labels on my box plot. I understand that you can do this using "cex.lab", but it does not seem to be working for me. I must be adding it in the wrong spot. Any help would be greatly ap

Re: [R] is a sequence of dates consecutive, without gaps?

2009-07-21 Thread Marc Schwartz
On Jul 21, 2009, at 4:58 PM, Christopher W. Ryan wrote: I have a long sequence of dates, about 6 years worth, as one column in a data frame. How can I test whether the sequence is consecutive, that is, without gaps? Thanks. --Chris Chris, Presuming that your data frame is called DF, t

Re: [R] How to extract the upper xlim and ylim of my plot?

2009-07-21 Thread Marc Schwartz
On Jul 21, 2009, at 4:03 PM, Mark Na wrote: Dear R-helpers, I wish to place some text in a plot, at approx 10% of my upper xlim and approx 90% of my upper ylim, i.e. plot(log(all$SR,10)~log(all$AREA,10)) text(.1*max(xlim),.9*max(ylim),"text to be placed") (I know how to give absolute coo

Re: [R] time attribute from a file

2009-07-21 Thread Erin Hodgess
Thanks to all! file.info is it. On Tue, Jul 21, 2009 at 4:06 PM, Erik Iverson wrote: > Peter, that is assigning the time of creation of the object name. > > I think Erin might be looking for the file.info function, see ?file.info . > > Erik > > -Original Message- > From: r-help-boun...@r

Re: [R] How to extract the upper xlim and ylim of my plot?

2009-07-21 Thread milton ruser
May be: text(.1*max(all$AREA),.9*max(all$SR),"text to be placed") ? bests milton On Tue, Jul 21, 2009 at 5:03 PM, Mark Na wrote: > Dear R-helpers, > > I wish to place some text in a plot, at approx 10% of my upper xlim and > approx 90% of my upper ylim, i.e. > > > plot(log(all$SR,10)~log(all

Re: [R] How to extract the upper xlim and ylim of my plot?

2009-07-21 Thread Peter Alspach
Tena koe Mark ?par in particular usr parameter, accessible by par()$usr HTH Peter Alspach > -Original Message- > From: r-help-boun...@r-project.org > [mailto:r-help-boun...@r-project.org] On Behalf Of Mark Na > Sent: Wednesday, 22 July 2009 9:04 a.m. > To: r-help@r-project.org >

Re: [R] time attribute from a file

2009-07-21 Thread Steve Lianoglou
Hi, On Jul 21, 2009, at 4:54 PM, Erin Hodgess wrote: Dear R People: I am reading in a file via read.table. Is there a way to bring in the time that the file was created, please? See: ?file.info and the mtime, ctime, atime attributes it returns. -steve -- Steve Lianoglou Graduate Student

Re: [R] time attribute from a file

2009-07-21 Thread Erik Iverson
Peter, that is assigning the time of creation of the object name. I think Erin might be looking for the file.info function, see ?file.info . Erik -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Peter Alspach Sent: Tuesday, July

Re: [R] thousands separator

2009-07-21 Thread Christophe Dutang
thanks, I test it on the following example 27 076 552 440.95,230 400.04,1 27 176 285 276.98,170 240.22,1 27 276 040 780.57,640 053.22,1 27 376 072 983.53,800 300.1,1 27 476 552 531.87,411 770.68,1 27 576 552 919.09,130 010.21,1 27 676 285 254.43,460 020.70,1 27 776 072 840.44,220 071.16,1 27 876

[R] Checking on closed file connections

2009-07-21 Thread Jim Nemesh
Hi! I'm wondering if there's a smart way around this: fileName= (some valid file on your system) >fileCon=file(fileName, open="rt") >l<-readLines (fileCon, n= 1) > > isOpen(fileCon) [1] TRUE >close(fileCon) > isOpen(fileCon) Error in isOpen(fileCon) : invalid connection How do you

Re: [R] S_alloc or Calloc for return value

2009-07-21 Thread Dan Kelley
Self-posting the solution, to help those who come across this thread with a similar interest -- My solution, arrived at with the generous help of those who have replied to my question, was to use .Call, as exemplified below. My task was to find indices in a "raw" buffer (input) that match a part

Re: [R] time attribute from a file

2009-07-21 Thread Tobias Verbeke
Erin Hodgess wrote: Dear R People: I am reading in a file via read.table. Is there a way to bring in the time that the file was created, please? Use file.info on the same file ? HTH, Tobias __ R-help@r-project.org mailing list https://stat.ethz.c

[R] How to extract the upper xlim and ylim of my plot?

2009-07-21 Thread Mark Na
Dear R-helpers, I wish to place some text in a plot, at approx 10% of my upper xlim and approx 90% of my upper ylim, i.e. > plot(log(all$SR,10)~log(all$AREA,10)) > text(.1*max(xlim),.9*max(ylim),"text to be placed") (I know how to give absolute coordinates for text location, but I wish to use re

Re: [R] EM algorithm

2009-07-21 Thread Andrej Kastrin
Hi, two useful references for beginning: www.stat.umn.edu/geyer/5931/mle/mle.pdf www.unc.edu/~monogan/computing/r/MLE_in_R.pdf Andrej Elena 5/12 wrote: Hi, I have the following problem: I am working on assessing the accuracy of diagnostic tests. I have a log likelihood and 3 unknown paramete

Re: [R] time attribute from a file

2009-07-21 Thread Peter Alspach
Tena koe Erin You could write a wee wrapper and give the file an attribute. For example, copy <- function (file = "clipboard", sep = "\t", na.strings = c("NA", "*"), as.is = T, ...) { myX <- read.table(file, sep = sep, na.strings = na.strings, as.is = as.is, ...) attr(myX,

[R] is a sequence of dates consecutive, without gaps?

2009-07-21 Thread Christopher W. Ryan
I have a long sequence of dates, about 6 years worth, as one column in a data frame. How can I test whether the sequence is consecutive, that is, without gaps? Thanks. --Chris -- Christopher W. Ryan, MD SUNY Upstate Medical University Clinical Campus at Binghamton 40 Arch Street, Johnson City, N

Re: [R] Searching for specific values in a matrix

2009-07-21 Thread Mehdi Khan
thank you VERY much, I have to run now, but I will look at this in the next few days (going on a field trip). I really appreciate it! Mehdi Khan On Tue, Jul 21, 2009 at 12:49 PM, Steve Lianoglou < mailinglist.honey...@gmail.com> wrote: > > On Jul 21, 2009, at 3:27 PM, Mehdi Khan wrote: > > I u

Re: [R] Searching for specific values in a matrix

2009-07-21 Thread Mehdi Khan
I understand your explanation about the test for even numbers. However I am still a bit confused as to how to go about finding a particular value. Here is an example data set col # attr1attr2 attr 3LONLAT 17209 DNANA -122.9409 38.27645 17210

[R] time attribute from a file

2009-07-21 Thread Erin Hodgess
Dear R People: I am reading in a file via read.table. Is there a way to bring in the time that the file was created, please? Thanks, Erin -- Erin Hodgess Associate Professor Department of Computer and Mathematical Sciences University of Houston - Downtown mailto: erinm.hodg...@gmail.com ___

Re: [R] Re gression using age and Duration of disease as a continous factors

2009-07-21 Thread Mehdi Khan
It was decent, I ended up not going to class and only going to discussions and reading the book, got an A-. On Tue, Jul 21, 2009 at 12:18 PM, Steve Lianoglou < mailinglist.honey...@gmail.com> wrote: > > On Jul 21, 2009, at 1:56 PM, Mehdi Khan wrote: > > >> http://www.amazon.com/gp/product/0073108

Re: [R] Searching for specific values in a matrix

2009-07-21 Thread Mehdi Khan
I am a bit confused as to what the following command does: evens <- df$nums %% 2 == 0 In my matrix example, let's say I am looking for the variable(s) BC and I want R to return all the rows with that value... or If I want a value such as 33.543. How would I get it to do that? Just a single valu

[R] EM algorithm

2009-07-21 Thread Elena 5/12
Hi, I have the following problem: I am working on assessing the accuracy of diagnostic tests. I have a log likelihood and 3 unknown parameters. Now I want to apply the EM algorithm to find the maximum likelihood estimates of these parameters. But I don't know anaything about how to code that in R

Re: [R] error when installing rjags

2009-07-21 Thread Tobias Verbeke
Hi Mark, What command did you use exactly to install the package ? The following blog post by Yu-Sung Su http://yusung.blogspot.com/2009/01/install-jags-and-rjags-in-fedora.html indicates that some configure.args might need to be set to succesfully install the package (at least on Fedora 10)

Re: [R] Customization options with .Renviron, R_LIBS, .Rprofile etc

2009-07-21 Thread Steve Lianoglou
Hi, On Jul 21, 2009, at 3:56 PM, ravi wrote: Hi, I am interested in customizing the installation of R. I have gone through the “R Installation and Administration” manual. But some of the stuff is not clear to me and I would like to get clarifications on the following points (for a Windows instal

[R] help for SSOAP

2009-07-21 Thread nermin sarlak
Hi, I am trying to learn how to from within R access web services. I am also interested in having R be a client and from within R access data on other web services. Specifically the web services I would like to access from within R are “http://water.sdsc.edu/waterOneFlow/NWIS/DailyValues.asm

Re: [R] Re gression using age and Duration of disease as a continous factors

2009-07-21 Thread Johannes Hüsing
Mehdi Khan schrieb: http://www.amazon.com/gp/product/007310874X/ref=pd_lpo_k2_dp_sr_1?pf_rd_p=304485901&pf_rd_s=lpo-top-stripe-1&pf_rd_t=201&pf_rd_i=0256117365&pf_rd_m=ATVPDKIKX0DER&pf_rd_r=155Y7AP1SHTSJESHM15M This is our textbook for regression analysis. Go through the first 8 or 9 chapters a

Re: [R] Split plot analysis problems

2009-07-21 Thread Kevin W
I don't think you are clear enough about the layout within each block. If the four treatments are randomized, I would choose the first model. KW On Tue, Jul 21, 2009 at 9:38 AM, Jean-Paul Maalouf < jean-paul.maal...@u-bordeaux1.fr> wrote: > Hello, > > I would be very grateful if someone could

[R] Customization options with .Renviron, R_LIBS, .Rprofile etc

2009-07-21 Thread ravi
Hi, I am interested in customizing the installation of R. I have gone through the “R Installation and Administration” manual. But some of the stuff is not clear to me and I would like to get clarifications on the following points (for a Windows installation with R_HOME=C:\\R\\R-2.9.1 ) : 1. I und

Re: [R] Searching for specific values in a matrix

2009-07-21 Thread Steve Lianoglou
On Jul 21, 2009, at 3:27 PM, Mehdi Khan wrote: I understand your explanation about the test for even numbers. However I am still a bit confused as to how to go about finding a particular value. Here is an example data set col # attr1attr2 attr 3LONLAT 17209

Re: [R] thousands separator

2009-07-21 Thread jim holtman
What I do is read the file in and then convert the various columns to numeric x <- read.table(..., as.is=TRUE) col2cvt <- c('V1', 'V3','V6') # columns for conversion for (i in col2cvt){ x[[i]] <- as.numeric(gsub(",", "", x[[i]])) } Replace ',' with ' ' for blanks. On Tue, Jul 21, 2009 at 3:

Re: [R] Odd coefficent behavior

2009-07-21 Thread Peter Ehlers
Idgarad, I guess that all of your factor variables are indicators with levels "0" and "1". Try changing the levels to "NO", "YES" for one of the variables and see what you get. I think that the output will clarify the (actually not) "random" 1s. -Peter Idgarad wrote: Why are my coefficients g

[R] thousands separator

2009-07-21 Thread christophe dutang
Dear useRs, I was wondering how to deal with data where thousands separator is a space or a comma? with google, I thought I found the answer but the thread ( http://tolstoy.newcastle.edu.au/R/help/06/04/25524.html) just focuses on decimal separator. Is there any function to numbers written like t

Re: [R] Re gression using age and Duration of disease as a continous factors

2009-07-21 Thread Marc Schwartz
On Jul 21, 2009, at 11:29 AM, 1Rnwb wrote: Thanks Steve,Thanks for the explanation, I agree the question is too vague, I do not what a regression is I have switched to R a couple of months ago, after working in Excel for a long time. I also know the lm, glm functions in R. but due to my da

Re: [R] Re gression using age and Duration of disease as a continous factors

2009-07-21 Thread Steve Lianoglou
On Jul 21, 2009, at 1:56 PM, Mehdi Khan wrote: http://www.amazon.com/gp/product/007310874X/ref=pd_lpo_k2_dp_sr_1?pf_rd_p=304485901&pf_rd_s=lpo-top-stripe-1&pf_rd_t=201&pf_rd_i=0256117365&pf_rd_m=ATVPDKIKX0DER&pf_rd_r=155Y7AP1SHTSJESHM15M This is our textbook for regression analysis. Go throug

Re: [R] Odd coefficent behavior

2009-07-21 Thread David Winsemius
On Jul 21, 2009, at 2:42 PM, Idgarad wrote: Why are my coefficients getting appended with a 1? It borks a match I do later against the original list that doesn't have the random 1 added to the end. linearModel[[1]] The linearModel function that is easiest to find appears (on the basis of

Re: [R] Searching for specific values in a matrix

2009-07-21 Thread Steve Lianoglou
I am a bit confused as to what the following command does: evens <- df$nums %% 2 == 0 It returns a logical vector (I'm calling this an "indexing vector") that is TRUE where df$nums %% 2 == 0 (%% is modulo division, and 4 mod 2 == 0 -- so it's a test for "being even") In my matrix example,

[R] Odd coefficent behavior

2009-07-21 Thread Idgarad
Why are my coefficients getting appended with a 1? It borks a match I do later against the original list that doesn't have the random 1 added to the end. > linearModel[[1]] Call: lm(formula = modelSource ~ +UNITBUILD + UNITDB + ITBUILD + ITDB + UATBUILD + UATDB + HOGANCODE + RCF + ReleaseST1 + Re

Re: [R] Searching for specific values in a matrix

2009-07-21 Thread Steve Lianoglou
Hi, On Jul 21, 2009, at 1:47 PM, Mehdi Khan wrote: Hello all, I have a seemingly simple question which I have searched for an answer for for a few hours without luck. I have a matrix of both values and characters with thousands of rows. I would like to run a search of this matrix for c

Re: [R] Searching for specific values in a matrix

2009-07-21 Thread Steve Lianoglou
On Jul 21, 2009, at 1:47 PM, Mehdi Khan wrote: Hello all, I have a seemingly simple question which I have searched for an answer for for a few hours without luck. I have a matrix of both values and characters with thousands of rows. I would like to run a search of this matrix for certa

Re: [R] Re gression using age and Duration of disease as a continous factors

2009-07-21 Thread Steve Lianoglou
it looks like the experts individuals just come to poke fun at our expesense who has no background of statistics. This isn't really a fair statement ... I'd simply suggest to be mindful of what you ask. It was as if you couldn't be bothered to take the time to fully describe your problem

Re: [R] Re gression using age and Duration of disease as a continous factors

2009-07-21 Thread Mehdi Khan
http://www.amazon.com/gp/product/007310874X/ref=pd_lpo_k2_dp_sr_1?pf_rd_p=304485901&pf_rd_s=lpo-top-stripe-1&pf_rd_t=201&pf_rd_i=0256117365&pf_rd_m=ATVPDKIKX0DER&pf_rd_r=155Y7AP1SHTSJESHM15M This is our textbook for regression analysis. Go through the first 8 or 9 chapters and you're good. Mehdi

Re: [R] how to transform m/d/yyyy to yyyymmdd?

2009-07-21 Thread Gabor Grothendieck
Assuming that there are no duplicate dates, try this using zoo and chron: > Lines <- "12/9/2007 0 + 12/16/2007 1 + 1/1/2008 2 + 1/3/2008 3 + 1/12/2008 4" > > library(zoo) > library(chron) > z <- read.zoo(textConnection(Lines), FUN = chron) > z # is automatically sorted by times 12/09/07 12/16/07 0

Re: [R] how to transform m/d/yyyy to yyyymmdd?

2009-07-21 Thread John Kane
Why not convert them to dates? Assuming you are using that perverse Month/Day/Year format x <- c("12/9/2007" ,"12/16/2007","1/1/2008","1/3/2008","1/12/2008") xx <- as.Date(x, "%m/%d/%Y") xx --- On Tue, 7/21/09, liujb wrote: > From: liujb > Subject: [R] how to transform m/d/ to mmd

Re: [R] Re gression using age and Duration of disease as a continous factors

2009-07-21 Thread Ben Bolker
1Rnwb wrote: > > > [snip] > > The suggestion that consult the statistician is kind of funny as the > statistician in my center is my co-mentor and from past 5 years he is > sitting on the data without any output. > > I am not here to ask someone to do my data analysis, but to get an > und

[R] Searching for specific values in a matrix

2009-07-21 Thread Mehdi Khan
Hello all, I have a seemingly simple question which I have searched for an answer for for a few hours without luck. I have a matrix of both values and characters with thousands of rows. I would like to run a search of this matrix for certain values and would like the search to retrieve the entir

Re: [R] how to transform m/d/yyyy to yyyymmdd?

2009-07-21 Thread Chuck Cleland
On 7/21/2009 1:16 PM, liujb wrote: > Hello, > > I have a set of data that has a Date column looks like this: > 12/9/2007 > 12/16/2007 > 1/1/2008 > 1/3/2008 > 1/12/2008 > etc. > > I'd like the date to look something like the follow (so that I could sort by > date easily). > 20071209 > 20071216 > 2

Re: [R] how to transform m/d/yyyy to yyyymmdd?

2009-07-21 Thread Whit Armstrong
warmstr...@research:~$ R > strptime("12/9/2007","%m/%d/%Y") [1] "2007-12-09" > format(strptime("12/9/2007","%m/%d/%Y"),"%Y%m%d") [1] "20071209" > On Tue, Jul 21, 2009 at 1:16 PM, liujb wrote: > > Hello, > > I have a set of data that has a Date column looks like this: > 12/9/2007 > 12/16/2007 > 1

Re: [R] Re gression using age and Duration of disease as a continous factors

2009-07-21 Thread 1Rnwb
Thanks Steve,Thanks for the explanation, I agree the question is too vague, I do not what a regression is I have switched to R a couple of months ago, after working in Excel for a long time. I also know the lm, glm functions in R. but due to my data I am completely lost. it looks like the exper

[R] how to transform m/d/yyyy to yyyymmdd?

2009-07-21 Thread liujb
Hello, I have a set of data that has a Date column looks like this: 12/9/2007 12/16/2007 1/1/2008 1/3/2008 1/12/2008 etc. I'd like the date to look something like the follow (so that I could sort by date easily). 20071209 20071216 20080101 20080103 20080112 How to do it? Thank you very much Jul

Re: [R] Histograms on a log scale

2009-07-21 Thread Lorenzo Isella
John Kane wrote: How about using the ggplot2 package? Does this give you something along the lines of what you want? === library(ggplot2) r <- data.frame(rlnorm(1000)) names(r) <- "rr" ggplot(r, aes(rr)) + geom_histogram()+ sc

Re: [R] Re gression using age and Duration of disease as a continous factors

2009-07-21 Thread Greg Snow
If you truly did not understand anything in "An Introduction to R" section 11, then you are unlikely to understand anything that we would write in a post without getting some more background understanding (that is why I suggested that you take a class or hire a consultant). There are many peopl

Re: [R] Select value according two vectors...

2009-07-21 Thread Dieter Menne
Steve Lianoglou-6 wrote: > > > On Jul 21, 2009, at 11:28 AM, Dieter Menne wrote: > > Or, more simply: > > R> a <- c(0., 0.0909, 0.0909, 0.1818, 0.2727, 0.3636, 0.4545, > 0.6363, 0., 0., 0., 0.000) > R> b <- c(3, 5, 7, 18, 43, 85, 91, 98, 100, 130, 230, 487) > R> b[a > .5] >

Re: [R] animated grid graphics

2009-07-21 Thread hadley wickham
> Drawing grid graphics always takes long, I would write the images to png's > and make the animation. If you use Linux I can suggest some nice tools to do > this. This movie is also much more compatible with all kinds of machines. It > might be that you can get your grid animation working on your

Re: [R] list of lm() results

2009-07-21 Thread Greg Snow
First make sure that myResults is a list (you probably did this, but just to be sure): > myResults <- list() Then use doubled brackets [[]]: > myResults[[1]] <- lm(...) Etc. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org

Re: [R] subscript into matrix discards row/column names

2009-07-21 Thread Henrique Dallazuanna
Try this: x[1,, drop = FALSE] On Tue, Jul 21, 2009 at 1:46 PM, Vadim Ogranovich < vogranov...@jumptrading.com> wrote: > Dear R-help, > > When the result of a matrix subscription degenerates to a scalar the names > implied by the dimnames are discarded. > > > x <- matrix(0, 1, 1, dimnames=list('

Re: [R] list of lm() results

2009-07-21 Thread David Winsemius
On Jul 21, 2009, at 12:27 PM, Idgarad wrote: How can I get the results of lm() into a list so I can loop through the results? e.g. myResults[1] <- lm(...) myResults[2] <- lm(...) myResults[3] <- lm(...) ... myResults[15] <- lm(...) myResults[16] <- lm(...) so far every attempt I've tried d

[R] subscript into matrix discards row/column names

2009-07-21 Thread Vadim Ogranovich
Dear R-help, When the result of a matrix subscription degenerates to a scalar the names implied by the dimnames are discarded. > x <- matrix(0, 1, 1, dimnames=list('a', 'x')) ## below I expected result to have names='x', it's not > x[1,] [1] 0 ## below I expected result to have names='a', it's

Re: [R] list of lm() results

2009-07-21 Thread S Ellison
You could look at ?lmList in package lme ... >>> Idgarad 21/07/2009 17:27:52 >>> How can I get the results of lm() into a list so I can loop through the results? e.g. myResults[1] <- lm(...) myResults[2] <- lm(...) myResults[3] <- lm(...) ... myResults[15] <- lm(...) myResults[16] <- lm(...)

Re: [R] how to change the "quantile" method in bwplot

2009-07-21 Thread Matthias Kohl
for teaching purposes I wrote a corresponding function; cf. qbxp.stats (as well as qboxplot ...) in package MKmisc. hth, Matthias Deepayan Sarkar schrieb: On Tue, Jul 21, 2009 at 7:47 AM, Jun Shen wrote: Uwe, Thank you for your reply. I am still not very clear about the meanings of the ar

Re: [R] Background colour of axis

2009-07-21 Thread Greg Snow
Look at the xpd argument to the par function. -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Miguel Lacerda

[R] Calling R functions from multiple threads

2009-07-21 Thread David Haykazyan
Hi, I am embedding R into a C++ application. Is it possible to call R functions from different threads? If yes, should I call Rf_initEmbeddedR once or for each thread separately? I know that R is not thread safe and making sure that no simultaneous calls from different threads happen. Now I am

[R] list of lm() results

2009-07-21 Thread Idgarad
How can I get the results of lm() into a list so I can loop through the results? e.g. myResults[1] <- lm(...) myResults[2] <- lm(...) myResults[3] <- lm(...) ... myResults[15] <- lm(...) myResults[16] <- lm(...) so far every attempt I've tried doesn't work throwing a "number of items to replace

Re: [R] animated grid graphics

2009-07-21 Thread Greg Snow
Imagemagick and gimp work on windows, linux, and mac as well and have tools for creating animated gifs (and possibly other animation files). -- Gregory (Greg) L. Snow Ph.D. Statistical Data Center Intermountain Healthcare greg.s...@imail.org 801.408.8111 > -Original Message- > From: r-

  1   2   >