Re: [R] Comprehensive power analysis/sample size package in R?

2009-07-16 Thread ukoenig
Many thanks for your helpful suggestions and the detailed feedback! We will have a look at your suggestions before buying the (quite expensive) PASS software. -Udo Quoting Tobias Verbeke : Frank E Harrell Jr wrote: Greg Snow wrote: I don't know of a single package that is comparable to PASS

Re: [R] get a vector with filenames with a certain extension in a folder

2009-07-16 Thread Peter Dalgaard
milton ruser wrote: Hi there, try this: setwd("/home/mcr") dir(path=".", pattern=".txt$") OR dir(path="/home/mcr/.", pattern=".txt$") $ means finished with ".txt" A word of warning. The pattern is a regular expression, so the above means that the name ends with an arbitrary character foll

Re: [R] Calculating the trading days

2009-07-16 Thread Girish A.R.
Hi Ravi, See if the following helps: = Lines <- "Date1 Date2 29-Dec-06 25-Jan-07 29-Dec-06 25-Jan-07 29-Dec-06 25-Jan-07 2-Jan-07 25-Jan-07 2-Jan-07 25-Jan-07 2-Jan-07 25-Jan-07" DF <- read.table(con<- textConnection(Lines), skip = 1) close(con); names(DF) <- scan(textCo

[R] Solving two nonlinear equations with two knowns

2009-07-16 Thread yhsu6
Dear R users, I have two nonlinear equations, f1(x1,x2)=0 and f2(x1,x2)=0. I try to use optim command by minimize f1^2+f2^2 to find x1 and x2. I found the optimal solution changes when I change initial values. How to solve this? BTW, I also try to use grid searching. But I have no information

[R] Calculating the trading days

2009-07-16 Thread Ravi S. Shankar
Hi R, I have two columns of date in a CSV file in the below format 29-Dec-06 25-Jan-07 29-Dec-06 25-Jan-07 29-Dec-06 25-Jan-07 2-Jan-0725-Jan-07 2-Jan-0725-Jan-07 2-Jan-0725-Jan-07 I read in R using dat<-read.csv("Z:\\data.csv"). > class(dat[,1]) [1] "

Re: [R] get a vector with filenames with a certain extension in a folder

2009-07-16 Thread milton ruser
Hi there, try this: setwd("/home/mcr") dir(path=".", pattern=".txt$") OR dir(path="/home/mcr/.", pattern=".txt$") $ means finished with ".txt" good luck, milton brazil=toronto On Fri, Jul 17, 2009 at 12:08 AM, torpedo fisken wrote: > Hi > I got a script that works on file with the extensio

Re: [R] Getting the C-index for a dataset that was not used to generate the logistic model

2009-07-16 Thread Frank E Harrell Jr
Kyle Werner wrote: Does anyone know how to get the C-index from a logistic model - not using the dataset that was used to train the model, but instead using a fresh dataset on the same model? I have a dataset of 400 points that I've split into two halves, one for training the logistic model, and

[R] Getting the C-index for a dataset that was not used to generate the logistic model

2009-07-16 Thread Kyle Werner
Does anyone know how to get the C-index from a logistic model - not using the dataset that was used to train the model, but instead using a fresh dataset on the same model? I have a dataset of 400 points that I've split into two halves, one for training the logistic model, and the other for evalua

[R] get a vector with filenames with a certain extension in a folder

2009-07-16 Thread torpedo fisken
Hi I got a script that works on file with the extension ".qed" that are al located in a folder '~/works/' Is there are R function that will fetch all the filenames from the works subdir, similar to 'ls ~/works/*.qed' Thanks in advance __ R-help@r-proj

Re: [R] Count the number of occurences in ranges

2009-07-16 Thread torpedo fisken
Thanks, 'cut()' was indeed what I was looking for thanks 2009/7/16 : > Hi: I'm not sure if I understand what you want but below might help you ? > see cut for more details by doing ?cut. > > > probs<-c(0.001,0.5,0.02,.05,0.12,0.23,0.5,0.6,0.59,0.7) > probs > > temp <- cut(probs,breaks=seq(0,1,le

[R] Getting the C-index for a dataset that was not used to generate the logistic model

2009-07-16 Thread Kyle Werner
Does anyone know how to get the C-index from a logistic model - not using the dataset that was used to train the model, but instead using a fresh dataset on the same model? I have a dataset of 400 points that I've split into two halves, one for training the logistic model, and the other for evalua

Re: [R] Weibull Prediction?

2009-07-16 Thread David Winsemius
Wouldn't the "response" of a survival model be survival times? You may want to look at survfit and survest. -- DW On Jul 16, 2009, at 9:19 PM, Sean Brummel wrote: > With type="response" in the predict funtion, I was expecting an > expected survival time given covariates( in my dataset I h

Re: [R] Problems generating image from tiff file

2009-07-16 Thread Mehdi Khan
when you post this can you please remove the tiff file? my supervisor doesn't want me to let it out. sorry! On Thu, Jul 16, 2009 at 4:02 PM, Mehdi Khan wrote: > I imported the attached tiff file and converted the coordinate system to > long lat and graphed it: > > californiatiff<- readGDAL("cal

Re: [R] rnorm

2009-07-16 Thread Ben Bolker
Don MacQueen wrote: > > When I try this: > >> tmp <- randz<-matrix(rnorm(200),2000,1) >> dim(tmp) > [1] 2000 1 > > It gives a result in less than one second. Very quick. And the > resulting matrix is not alarmingly big. > > There must be some other problem. Perhaps your compu

Re: [R] Entire Organization Switching from SAS to R - Any experience?

2009-07-16 Thread David Winsemius
On Jul 16, 2009, at 10:17 PM, Kum-Hoe Hwang wrote: I work for a research institute. I have used R for several years. I think there are some good and bad sides followings: Good sides are: I can use new statistical methods from R. no license fee.. Bad sides are : physical memory in PC is an

Re: [R] Entire Organization Switching from SAS to R - Any experience?

2009-07-16 Thread Kum-Hoe Hwang
I work for a research institute. I have used R for several years. I think there are some good and bad sides followings: Good sides are: I can use new statistical methods from R. no license fee.. Bad sides are : physical memory in PC is an obstacle (max. 3GB), some package of R is still being deve

Re: [R] Entire Organization Switching from SAS to R - Any experience?

2009-07-16 Thread Frank E Harrell Jr
Kel Lam wrote: My institute has been heavily dependent on SAS for the past while, and SAS is starting to charge us a very deep amount for license renewal. Since we are a non-profit organization that is definitely not sustainable. The team is brainstorming possibility of switching to R, at least

Re: [R] Weibull Prediction?

2009-07-16 Thread Sean Brummel
With type="response" in the predict funtion, I was expecting an expected survival time given covariates( in my dataset I have a few covariates but not in the example)... a natural predictor. The prediction function is clearly not returning a probability of survival at a given time since my example

[R] How to prpare the input data to writeFASTA ? Examples of CharacterToFASTArecords ...

2009-07-16 Thread mauede
I realize function write FASTA expects a list with two items, respectively, description and sequence. However, just passing a list won't work (please, see code at the bottom of this message) I saw there is the helper function CharacterToFASTArecords(x) that presumably generates the right input

Re: [R] Weibull Prediction?

2009-07-16 Thread David Winsemius
On Jul 16, 2009, at 8:19 PM, Sean Brummel wrote: > Thanks for the help but... > > I did the required transformations at the end of the code. The > thing that I dont understand is: Why is the predicted value (from > the predict function) not either the mean or median. Sorry I was not > clea

Re: [R] Help with Conditional Logit

2009-07-16 Thread Noah Silverman
Thanks for the quick reply. I found that page and do have the survival package installed. My problem is that I don't understand a few things: 1) What do I input for the "formula" field? (In RapidMiner, the functions don't have this input.) 2) How do I indicate which field is the "grou

[R] Inequality constraints in GMM estimation?

2009-07-16 Thread David J. Moore, Ph.D.
I have a relatively simple finance application of GMM. Given the moment condition: E[m*R]=0 where m=m[theta] I would like to constrain m>0. Any ideas? [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.eth

Re: [R] Entire Organization Switching from SAS to R - Any experience?

2009-07-16 Thread milton ruser
*hum* How much of the "employes" of your institute use statistical softwares? 1-5? 5-20? 20-50? I think a brief description could help on the discussion. cheers milton On Thu, Jul 16, 2009 at 5:40 PM, Kel Lam wrote: > My institute has been heavily dependent on SAS for the past while, and > S

Re: [R] Weibull Prediction?

2009-07-16 Thread Sean Brummel
Thanks for the help but... I did the required transformations at the end of the code. The thing that I dont understand is: Why is the predicted value (from the predict function) not either the mean or median. Sorry I was not clear in my explanation. Thanks, Sean On 7/16/09, David Winsemius w

[R] running R-2.9.1 on westgrid

2009-07-16 Thread FaT_ALBeRT
just got my westgrid account, and finished downloading R-2.9.1 onto Glacier(.westgrid.ca). how do i run my files in R on westgrid? I have several ".r" and ".txt" files that run from a main driver program - so all i need to run is the driver file (which is .txt). Are their any good sites that ha

Re: [R] Weibull Prediction?

2009-07-16 Thread David Winsemius
On Jul 16, 2009, at 7:41 PM, Sean Brummel wrote: I am trying to generate predictions from a weibull survival curve but it seems that the predictions assume that the shape(scale for survfit) parameter is one(Exponential but with a strange rate estimate?). Here is an examle of the problem, th

Re: [R] Any package to produce QQplot for survival model checking?

2009-07-16 Thread popo UBC
Hi, Steve! Thanks for reply! Acutally, that's what I thought too. But I believe some special control terms are needed. Do you know how could I find some examples? Thanks again. Popo 2009/7/16 Steve Lianoglou > Hi, > > > On Jul 16, 2009, at 2:03 PM, popo UBC wrote: > > Hi there! >> >> S provi

[R] Weibull Prediction?

2009-07-16 Thread Sean Brummel
I am trying to generate predictions from a weibull survival curve but it seems that the predictions assume that the shape(scale for survfit) parameter is one(Exponential but with a strange rate estimate?). Here is an examle of the problem, the smaller the shape is the worse the discrepancy. ###

Re: [R] matrix subsetting assignment with logical mask

2009-07-16 Thread David Winsemius
On Jul 16, 2009, at 6:41 PM, Ross Boylan wrote: If m is a matrix and s is a logical matrix of the same dimensions, I'd like to be able to update m with m[s] <- 0 If m2 is another matrix, I'd also like to be able to do m[s] <- m2 where elements of m for which s is TRUE get the corresponding el

[R] Problems generating image from tiff file

2009-07-16 Thread Mehdi Khan
I imported the attached tiff file and converted the coordinate system to long lat and graphed it: californiatiff<- readGDAL("california1.tif") proj4string(californiatiff) > rasterprojection <- spTransform(californiatiff, CRS("+proj=longlat") however, when using the plot command for rasterprojecti

[R] Entire Organization Switching from SAS to R - Any experience?

2009-07-16 Thread Kel Lam
My institute has been heavily dependent on SAS for the past while, and SAS is starting to charge us a very deep amount for license renewal. Since we are a non-profit organization that is definitely not sustainable. The team is brainstorming possibility of switching to R, at least gradually. I am

Re: [R] quoting expressions in a list

2009-07-16 Thread Stavros Macrakis
On Thu, Jul 16, 2009 at 4:44 PM, Erik Iverson wrote: > I have a list of logical expressions, and I would really like it if the > "names" of the components of the list were identical to the corresponding > logical expression. > > So, as an example: > > df.example <- data.frame(a = 1:10, b = rnorm(

Re: [R] Theil test help

2009-07-16 Thread David Winsemius
On Jul 16, 2009, at 5:53 PM, KARSTEN G HOLMQUIST wrote: Hello, I have a series of questions that I hope will be simple to answer. Basically I would like a code to do the following so that I can compute the distribution free test for the slope of a postulated regression line (Theil test)

[R] matrix subsetting assignment with logical mask

2009-07-16 Thread Ross Boylan
If m is a matrix and s is a logical matrix of the same dimensions, I'd like to be able to update m with m[s] <- 0 If m2 is another matrix, I'd also like to be able to do m[s] <- m2 where elements of m for which s is TRUE get the corresponding element of m2. However, this doesn't work in R 2.7.1.

Re: [R] Renviron.in error when compiling R 2.9.1 under Debian.

2009-07-16 Thread milton ruser
Dear R-friends, I removed the directory, untarzed the source files and now I can compile the R. Thanks for those suggested it off-list. Bests milton On Thu, Jul 16, 2009 at 6:08 PM, milton ruser wrote: > Dear all, > > I'm trying to compile R 2.9.1 on my home directory under debian, > and as I

Re: [R] GGPLOT Clipping Regions

2009-07-16 Thread hadley wickham
Could you please give a reproducible example? Thanks, Hadley On Thu, Jul 16, 2009 at 5:41 PM, Alex Brown wrote: > Hi there, > >        I'm trying to find out the command to stop clipping to plot region in > ggplot. > >        I have a bar chart (axis flipped) with labels on the bars, but the > lab

Re: [R] Error with r2winbugs

2009-07-16 Thread Ben Bolker
cddesjar wrote: > > Hi, > I am trying to do run the following model saved in "C:/bugs/sus.bug" > > model { >for (i in 1:n){ > y[i] ~ dpois(lamdba[i]) > log(lambda[i]) <- mu+bmale[male[i]]+bschn[schn[i]]+epsilon[i] # > epsilon[i] ~ dnorm(0,tau.epsilon) >} >mu ~ dnorm(

[R] Renviron.in error when compiling R 2.9.1 under Debian.

2009-07-16 Thread milton ruser
Dear all, I'm trying to compile R 2.9.1 on my home directory under debian, and as I need to play with RPy, I tryed compile R using: ./configure --enable-R-shlib But, during the compilation, I get the error below: - using as R_SHELL for scripts ... /bin/sh conf

Re: [R] rnorm

2009-07-16 Thread Don MacQueen
When I try this: tmp <- randz<-matrix(rnorm(200),2000,1) dim(tmp) [1] 2000 1 It gives a result in less than one second. Very quick. And the resulting matrix is not alarmingly big. There must be some other problem. Perhaps your computer has only a very small amount of memory?

Re: [R] rnorm

2009-07-16 Thread Ben Bolker
Steve Lianoglou-6 wrote: > > Hi, > > On Jul 16, 2009, at 4:54 PM, Jose Narillos de Santos wrote: > >> Hi I want to simulate random numbers normal distributed with this size >> (2000,1). >> >> I tried this but my computer exhaust there is a fast way to make it? >> >> >> randz<-matrix(rnorm

Re: [R] Simple cat statement - output truncated

2009-07-16 Thread Don MacQueen
I suppose it's conceivable that your object named "object" has some non-standard character(s) in it that cause the code underlying cat() to do something weird. For example, cat('abcdef','\r','\n') bcdef Appears to truncate the first character. Basic debugging suggests breaking down the pr

[R] Theil test help

2009-07-16 Thread KARSTEN G HOLMQUIST
Hello, I have a series of questions that I hope will be simple to answer. Basically I would like a code to do the following so that I can compute the distribution free test for the slope of a postulated regression line (Theil test). As I am testing the null hypothesis that slope = 0 against t

Re: [R] DataFrame help

2009-07-16 Thread Don MacQueen
As others noted, you can use the built in function colSums, but you said you're writing your own. Given what you've got so far, that makes the issue one of structuring the output. Try csum <- function(m) { a = data.frame(m) s = lapply(a,sum) unlist(s) } lapply() return

Re: [R] Transformation of data!

2009-07-16 Thread John Kane
That is what you have. It just prints to screen that way. If you want you could put it into a one column data.frame, that is, mydata <- data.frame(myvector) which may give you the layout you want. --- On Thu, 7/16/09, Andriy Fetsun wrote: > From: Andriy Fetsun > Subject: [R] Transformation

[R] Too many open files

2009-07-16 Thread Marilyn & Rich Short
Hello, I'm having a problem in R. I'm getting an error message that reads, "Too many open files". I'm opening files and closing them (and unlinking them), but when I go through that process 509 times, the program halts and I get this error message: "cannot open the connection" with warning me

Re: [R] rnorm

2009-07-16 Thread Steve Lianoglou
Hi, On Jul 16, 2009, at 4:54 PM, Jose Narillos de Santos wrote: Hi I want to simulate random numbers normal distributed with this size (2000,1). I tried this but my computer exhaust there is a fast way to make it? randz<-matrix(rnorm(200),2000,1) I'll refrain from asking if yo

Re: [R] Transformation of data!

2009-07-16 Thread David Huffer
I'm guessing you want to perform some sort of transformation on all the elements in the matrix you've posted and that you've only presented those 3 elements as an example of how the transformation will affect those 3 elements. Is that right? -- David -Original Message- From: r-help-bo

Re: [R] Best way to replace :SS with :00

2009-07-16 Thread Jason Rupert
This is awesome! Total continue to be amazed. Thanks again! --- On Thu, 7/16/09, Gabor Grothendieck wrote: > From: Gabor Grothendieck > Subject: Re: [R] Best way to replace :SS with :00 > To: "Jason Rupert" > Cc: R-help@r-project.org > Date: Thursday, July 16, 2009, 3:45 PM > Try the follow

[R] rnorm

2009-07-16 Thread Jose Narillos de Santos
Hi I want to simulate random numbers normal distributed with this size (2000,1). I tried this but my computer exhaust there is a fast way to make it? randz<-matrix(rnorm(200),2000,1) [[alternative HTML version deleted]] __ R-help@

Re: [R] quoting expressions in a list

2009-07-16 Thread Gabor Grothendieck
Try this: > s <- c("df.example$a > 7", "df.example$b < 4") > sapply(s, function(x) eval(parse(text = x))) df.example$a > 7 df.example$b < 4 [1,]FALSE TRUE [2,]FALSE TRUE [3,]FALSEFALSE [4,]FALSE

Re: [R] Transformation of data!

2009-07-16 Thread Rolf Turner
On 17/07/2009, at 8:09 AM, Andriy Fetsun wrote: Hi Colleagues, Could you please help? I get as the output of my calculations following [1] 0.00e+00 1.89e-04 3.933000e-05 1.701501e-04 2.040456e-04 [6] 3.119242e-04 2.545665e-04 1.893930e-03 1.303112e-03 9.880183e-04

Re: [R] Best way to replace :SS with :00

2009-07-16 Thread Gabor Grothendieck
Try the following which replaces : followed by any two characters followed by space with the required string: > x <- c("HH:MM:SS AM", "HH:MM:SS PM") > sub(":.. ", ":00 ", x) [1] "HH:MM:00 AM" "HH:MM:00 PM" On Thu, Jul 16, 2009 at 4:20 PM, Jason Rupert wrote: > > Dang it.  I forgot to mention the

[R] quoting expressions in a list

2009-07-16 Thread Erik Iverson
Dear R-help, I am having quite a difficult time coming up with what I want to do involving named lists. I have a list of logical expressions, and I would really like it if the "names" of the components of the list were identical to the corresponding logical expression. So, as an example:

Re: [R] Transformation of data!

2009-07-16 Thread Michael Knudsen
On Thu, Jul 16, 2009 at 10:09 PM, Andriy Fetsun wrote: >   [1]  0.00e+00  1.89e-04  3.933000e-05  1.701501e-04  2.040456e-04 >   [6]  3.119242e-04  2.545665e-04  1.893930e-03  1.303112e-03  9.880183e-04 >  [11]  1.504378e-03  1.549246e-03  5.877690e-04  4.771359e-04  8.528219e-04 That it

[R] Transformation of data!

2009-07-16 Thread Andriy Fetsun
Hi Colleagues, Could you please help? I get as the output of my calculations following [1] 0.00e+00 1.89e-04 3.933000e-05 1.701501e-04 2.040456e-04 [6] 3.119242e-04 2.545665e-04 1.893930e-03 1.303112e-03 9.880183e-04 [11] 1.504378e-03 1.549246e-03 5.877690e-04 4.771

Re: [R] Extract pairs (rowname, columname) from a matrix where value is 0

2009-07-16 Thread Alberto Lora M
Dear sir, I have 2 questions: Question 1: suppose that we have the following: a<-matrix(c(0,2,0,4,0,6,5,8,0),nrow=3) colnames(a)<-c("F1","F2","F3") rownames(a)<-c("A1","A2","A3") a ind <- which(a == 0, arr = TRUE) mapply("[", dimnames(a), as.data.frame(ind)) I want to add a column to the resu

Re: [R] Best way to replace :SS with :00

2009-07-16 Thread Don McKenzie
You can still use my suggestion (sent offline) if you have a vector of strings, or just one > my.str <- "HH:MM:SS AM" > substr(my.str,7,8) <- "00" > my.str [1] "HH:MM:00 AM" Doesn't matter if it's AM or PM because the function is just acting on the 7th and 8th characters. On Jul 16, 2009,

Re: [R] Best way to replace :SS with :00

2009-07-16 Thread Jason Rupert
Dang it. I forgot to mention the actual format of the time is the following: "HH:MM:SS AM" or "HH:MM:SS PM" And I would still hope for them to end up with the following format: "HH:MM:00 AM" or "HH:MM:00 PM" How would you propose handling that condition? I tried to use strsplit with items to

[R] Best way to replace :SS with :00

2009-07-16 Thread Arun Kumar Saha
probably : a <- rep("HH:MM:SS", 5) substring(a, 7) = "00" a Not sure if there is an R way to do this or a regular express way, but here is what I am trying to do. I've got lots of data where the format is HH:MM:SS, but I need to format it like HH:MM:00, i.e. round the second down to zero. What

Re: [R] Nested ANOVA residuals error

2009-07-16 Thread Daniel Malter
It is because the nesting structure perfectly explains the data (i.e., there is only one observation and, therefore, no variation for each Ind in each Treatment). e=rnorm(90,0,1) x=rep(1:3,30) y=rep(1:30,each=3) z=x+y+e ano=aov(z~factor(y)/factor(x)) ano residuals(ano) Best, Daniel ---

[R] mice and Date-Time Classes

2009-07-16 Thread Andreas Wittmann
Dear R-Users, i want to use the function mice of the mice package with data, that contains dates, but this gives an error x <- Sys.time() dat <- data.frame(dates=(1:10)*60*60*24+x, size=rnorm(10)) dat$dates[c(3,7)]<-NA mice(dat) Fehler in check.imputationMethod(imputationMethod, defaultImpu

Re: [R] Nested ANOVA residuals error

2009-07-16 Thread Bert Gunter
Hint: You have 27 observations fit by 27 fixed effects (including the mean). You need to consult a statistician, as you seem not to have the basic statistical understanding required. Person should be a random effect. Was this a homework problem, perchance? Bert Gunter Genentech Nonclinical Biost

Re: [R] Best way to replace :SS with :00

2009-07-16 Thread John Kane
It your times are chron objects then trunc(tt, "minutes") where tt are your times may do what you want. It truncated but that seems to be what you want. --- On Thu, 7/16/09, Jason Rupert wrote: > From: Jason Rupert > Subject: [R] Best way to replace :SS with :00 > To: R-help@r-project.or

Re: [R] Best way to replace :SS with :00

2009-07-16 Thread Steve Lianoglou
Hi, Not sure if there is an R way to do this or a regular express way, but here is what I am trying to do. I've got lots of data where the format is HH:MM:SS, but I need to format it like HH:MM:00, i.e. round the second down to zero. What is the best way to do this? Probably not the be

Re: [R] Best way to replace :SS with :00

2009-07-16 Thread David Winsemius
Have you looked at the chron package? It has a trunc.times function: ??"times"# would have shown this to you And the help page appears to provide exactly what was requested. -puzzlement follows I did get somewhat unexpected results when I applied what seems to be the obvi

Re: [R] Help with Conditional Logit

2009-07-16 Thread Ted Harding
On 16-Jul-09 19:40:20, Noah Silverman wrote: > Hello, > I'm brand new to using R. (I've been using Rapid Miner, but would > like to move over to R since it gives me much more functionality.) > > I'm trying to learn how to do a conditional logit model. > > My data has one dependent variable, 2 in

[R] Help with Conditional Logit

2009-07-16 Thread Noah Silverman
Hello, I'm brand new to using R. (I've been using Rapid Miner, but would like to move over to R since it gives me much more functionality.) I'm trying to learn how to do a conditional logit model. My data has one dependent variable, 2 independent variables and a "group" variable. example: c

[R] Nested ANOVA residuals error

2009-07-16 Thread Jeff DaCosta
I am having trouble setting up a nested anova model. Here is a truncated version of my data: > data Ind Treatment PC1 1 PER14SC 1.14105282 2 PER14SH 1.45348615 3 PER14AC 2.45096904 4 PER25SC 1.23687887 5 PER25SH 4.54797450 6 PER2

[R] Best way to replace :SS with :00

2009-07-16 Thread Jason Rupert
Not sure if there is an R way to do this or a regular express way, but here is what I am trying to do. I've got lots of data where the format is HH:MM:SS, but I need to format it like HH:MM:00, i.e. round the second down to zero. What is the best way to do this? Thanks again. Jason _

Re: [R] Sample Function

2009-07-16 Thread John Kane
What is dataset? What is this supposed to be doing? newsample<-dataset[sample(m,replace=T),] --- On Thu, 7/16/09, MarcioRibeiro wrote: > From: MarcioRibeiro > Subject: [R] Sample Function > To: r-help@r-project.org > Received: Thursday, July 16, 2009, 11:55 AM > > Hi listers, > Suppose I

Re: [R] DataFrame help

2009-07-16 Thread Jorge Ivan Velez
Dear voidobscura, Try either: colSums(mdat) # or apply(mdat, 2, sum) See ?colSums and ?apply for more details. HTH, Jorge On Thu, Jul 16, 2009 at 2:25 PM, voidobscura wrote: > > Alright, so I am trying to write my own function to calculate column sums > in > a matrix. I want the result a

Re: [R] DataFrame help

2009-07-16 Thread David Huffer
The easiest way is to just do something like this: > mdat <- matrix(c(4,2,3, 11,12,13), nrow = 2, ncol=3) > mdat [,1] [,2] [,3] [1,]43 12 [2,]2 11 13 > as.vector ( colSums ( mdat ) ) [1] 6 14 25 > HTH -- David -Original Message- From: r-help-boun...@r-project.o

[R] DataFrame help

2009-07-16 Thread voidobscura
Alright, so I am trying to write my own function to calculate column sums in a matrix. I want the result as a single list with the values. So far I have: csum<-function(m) { a = data.frame(m) s = lapply(a,sum) return(s) } What is the easiest way to have it return in a f

Re: [R] putting circles/buffers arround points on a 2D graph/plot

2009-07-16 Thread Albyn Jones
It sounds like you might want to draw the convex hull for each group of points. There is a package called "chplot" which appears to do this, though I haven't used it... albyn On Thu, Jul 16, 2009 at 06:23:54PM +0100, Ahmed, Sadia wrote: > Hi, > > I'll try to keep my question brief and to the p

Re: [R] putting circles/buffers arround points on a 2D graph/plot

2009-07-16 Thread Greg Snow
Look at the chull function and its examples. -- 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 Ahmed, Sadia > S

Re: [R] Finding missing elements by comparing vectors

2009-07-16 Thread Jorge Ivan Velez
This is just a variation of David's solution below: intersect(X,Y) # [1] "red" "blue" "green" HTH, Jorge On Thu, Jul 16, 2009 at 12:07 PM, David Huffer wrote: > Or... > > > X = c ("red", "blue", "green", "black" ) ; Y = c("red", "blue", > "green", "magenta", "cyan") > > unique ( c ( X [X %

[R] putting circles/buffers arround points on a 2D graph/plot

2009-07-16 Thread Ahmed, Sadia
Hi, I'll try to keep my question brief and to the point, to anyone who helps 'THANK YOU!' I want to get a circle/ring/buffer or some other form of drawn line around certain points on a x,y plot, the points usually don't form a circle, often they form a 'wobbly' shape, so ideally I'd like some

Re: [R] Any package to produce QQplot for survival model checking?

2009-07-16 Thread Steve Lianoglou
Hi, On Jul 16, 2009, at 2:03 PM, popo UBC wrote: Hi there! S provide some functions, such as "qq.weibull", to produce various qqplot for model checking. But I can't find the corresponding version in R. Does any R package available to produce these qqplots? Many thanks in advance!! Per

[R] Any package to produce QQplot for survival model checking?

2009-07-16 Thread popo UBC
Hi there! S provide some functions, such as "qq.weibull", to produce various qqplot for model checking. But I can't find the corresponding version in R. Does any R package available to produce these qqplots? Many thanks in advance!! Cheers~~~ Popo [[alternative HTML version del

Re: [R] Sample Function

2009-07-16 Thread Nordlund, Dan (DSHS/RDA)
> -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On > Behalf Of MarcioRibeiro > Sent: Thursday, July 16, 2009 8:56 AM > To: r-help@r-project.org > Subject: [R] Sample Function > > > Hi listers, > Suppose I have a dataset with n=10 observation

Re: [R] Question regarding package submission to CRAN

2009-07-16 Thread Uwe Ligges
Kurt Hornik is currently out of office and will be back soon. Moreover, CRAN was also unmanned in repspect to all other issues since all other CRAN maintainers have been attending useR! and/or DSC conferences. Just a bit more patience, CRAN will be in regular duty soon. Best, Uwe Ligges J

[R] Error with r2winbugs

2009-07-16 Thread Christopher Desjardins
Hi, I am trying to do run the following model saved in "C:/bugs/sus.bug" model { for (i in 1:n){ y[i] ~ dpois(lamdba[i]) log(lambda[i]) <- mu+bmale[male[i]]+bschn[schn[i]]+epsilon[i] # epsilon[i] ~ dnorm(0,tau.epsilon) } mu ~ dnorm(0,.0001) bmale ~ dnorm(0,.0001) tau.epsilon

Re: [R] Problems with lists...

2009-07-16 Thread Dimitris Rizopoulos
have a look at the help page for ?"["; try also this a[[2]] a[[2]][2] a[[3]][3] Best, Dimitris voidobscura wrote: a [[1]] [1] 1 2 3 [[2]] [1] 4 5 6 [[3]] [1] 7 8 9 I need to access individual elements, such as the 5 or the 9. Can anyone please tell me the syntax to do this? tia -- Di

Re: [R] Problems with lists...

2009-07-16 Thread David Huffer
Like, > a = list (1:3,4:6,7:9) > a [[1]] [1] 1 2 3 [[2]] [1] 4 5 6 [[3]] [1] 7 8 9 > a [[2]] [2] [1] 5 > a [[3]] [3] [1] 9 > HTH -- David -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of voidobscura Sent: Thursday, July 16,

[R] Problems with lists...

2009-07-16 Thread voidobscura
> a [[1]] [1] 1 2 3 [[2]] [1] 4 5 6 [[3]] [1] 7 8 9 I need to access individual elements, such as the 5 or the 9. Can anyone please tell me the syntax to do this? tia -- View this message in context: http://www.nabble.com/Problems-with-lists...-tp24519517p24519517.html Sent from the R help

[R] Sample Function

2009-07-16 Thread MarcioRibeiro
Hi listers, Suppose I have a dataset with n=10 observations and I want to sample with replacement. My new sample is of size m=9. So, I am using the following code... newsample<-dataset[sample(m,replace=T),] The problem is that generates the new sample and the last observation of my data set is nev

[R] New links between R and SPSS

2009-07-16 Thread Bob Muenchen
Hi All, This week SPSS Inc. announced version 18, which has some very interesting enhancements regarding R. It will now ship with R on the DVD, along with the PASW Statistics-R Integration Package. Previously this required a download of R, and of the Integration Package. This may be the first time

[R] GGPLOT Clipping Regions

2009-07-16 Thread Alex Brown
Hi there, I'm trying to find out the command to stop clipping to plot region in ggplot. I have a bar chart (axis flipped) with labels on the bars, but the labels are clipped at the plot region box. I know it's possible to turn this off for base and lattice, but how about ggplot?

[R] Sample Function

2009-07-16 Thread MarcioRibeiro
Hi listers, I am -- View this message in context: http://www.nabble.com/Sample-Function-tp24519071p24519071.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-hel

[R] Sigpipe Signal Question

2009-07-16 Thread njlinesch
All, I've been using AQUAMACS Emacs to develop R code and run/test the code by clicking "eval line and step" from within the editor which opens R in a new tab and displays the output. This calls X11 when a display window opens up. This was all working fine weeks ago but now when I try to get a

Re: [R] Simple cat statement - output truncated

2009-07-16 Thread rkevinburton
It has to be related to 'cat' because the output of 'cat' is truncated. I am just tyring to find out some possible reasons as to why it is truncated. I have been unable to form an array like is in the test program. Do you think there is something else that is gobbling up the output from cat that

Re: [R] Finding missing elements by comparing vectors

2009-07-16 Thread David Huffer
Or... > X = c ("red", "blue", "green", "black" ) ; Y = c("red", "blue", "green", "magenta", "cyan") > unique ( c ( X [X %in% Y] , Y [Y %in% X] ) ) [1] "red" "blue" "green" > David -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf

Re: [R] axis label config mgp

2009-07-16 Thread Greg Snow
Leave the mgp setting alone and use xlab='' when you create the original plot. This will put the y-label in the usual place and not create the x-label. Then use the "title" or "mtext" function to place the x label where you want it. Hope this helps, -- Gregory (Greg) L. Snow Ph.D. Statistic

Re: [R] Finding missing elements by comparing vectors

2009-07-16 Thread Steve Lianoglou
Is there a function in R to do a-b where a and b are two non-numeric sets (or intersection complement of these two sets). I think you're looking for "setdiff" -steve -- Steve Lianoglou Graduate Student: Physiology, Biophysics and Systems Biology Weill Medical College of Cornell University C

[R] Finding missing elements by comparing vectors

2009-07-16 Thread Praveen Surendran
Hi, Is there a function in R to do a-b where a and b are two non-numeric sets (or intersection complement of these two sets). Kind Regards, Praveen. [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https:

Re: [R] Calculate Timeseries Interval

2009-07-16 Thread Gabor Grothendieck
Try this: > Lines <- "19:21:59.855 + 19:21:59.905 + 19:21:59.955 + 19:22:0.5 + 19:22:0.55 + 19:22:0.105 + 19:22:0.155 + 19:22:0.205 + 19:22:0.255 + 19:22:0.305 + 19:22:0.355 + 19:22:0.405" > > DF <- read.table(textConnection(Lines)) > library(chron) > tt <- times(DF[[1]]) > diff(tt) [1

[R] Calculate Timeseries Interval

2009-07-16 Thread Dave Deriso
Hello, I have been attempting to write a script that automatically calculates time intervals from a list of hh.mm.ss.ms timestamps. Should be easy, but I keep running into problems. Any help would be greatly appreciated!! Problems: 1. If I parse the timestamp, it doesn't always return the digits

Re: [R] Plotting hourly time-series data loaded from file using plot.ts

2009-07-16 Thread Gabor Grothendieck
By the way, note that read.zoo passes the ... arguments to read.table and so can use the same skip= and nrows= arguments that read.table uses. These can be used to read in a subset of the rows. On Thu, Jul 16, 2009 at 10:35 AM, Gabor Grothendieck wrote: > There is no such limitation.   There is l

[R] Rsocp

2009-07-16 Thread Shewcraft, Ryan
Hi, The following works fine: > f [1] 0.08 0.03 0.04 > A2 [,1] [,2] [,3] [1,] 0.00e+00 0.00 0.00e+00 [2,] 0.00e+00 0.00 0.00e+00 [3,] 2.999651e-03 0.0009094342 1.945708e-03 [4,] 4.124431e-05 0.0001360390 1.203345e-05 [5,] 3.027932e-04 0

Re: [R] Extract pairs (rowname, columname) from a matrix where value is 0

2009-07-16 Thread Alberto Lora M
Thxs to all of you Alberto On Thu, Jul 16, 2009 at 7:03 AM, Gabor Grothendieck wrote: > Here is a variation on the solution below (first line > is the same but second differs): > > > ind <- which(a == 0, arr = TRUE) > > mapply("[", dimnames(a), as.data.frame(ind)) > [,1] [,2] > [1,] "A1" "F1

  1   2   >