[R] read.dta error after OSX change in time zone

2007-12-30 Thread Danstan Bagenda
Hello all, I recently moved from the US to Africa & on changing my time zone in the OSX system preferences from EST to GMT+3 ( East Africa) on attempting to use read.dta using the foreign packagebegan getting an error of: "Error in fromchar(x) : character string is not in a standa

Re: [R] How to catch data from the different dataframes and lm problem?

2007-12-30 Thread Hsin-Ya Lee
Dear all: I used lm to perform a regression in R and and intercept is -0.01894 and X is 0.185758. This is my target. Y<-(c(0,4.95,9.95,0,2.5,20,0,1.1,2.85,0,2.5,5)) X<-(c(0.1,10,20,20,25,60,0.6,2.5,6,35,40,45)) lm(Y~X) anova(wnlm<-lm( Y~X)) summary(wnlm<-lm( Y~X)) I catch test (Y) values and

Re: [R] How to catch data from the different dataframes and lm problem?

2007-12-30 Thread Hsin-Ya Lee
Dear Richie: 1) I have a mistake in the code that “A.split[[1]][["time"]][i]” should replace with “A.split[[j]][["time"]][i]”. The “test” value is “auc” which is a cumulative rate of change of concentration with respect to time. for (j in 1:length(A.split)){ test <- 0 for(i in 2:length(A.spli

[R] the woes of NA

2007-12-30 Thread Galkowski, Jan
Joyful. I'm adapting a FORTRAN 77 package for use with R. Pretty straightforward. Except for a glitch it took me some time to figure out. This existing package has subroutines which have parameters called "NA". So, I called subroutines like bnodes <- function(n, lst, lptr, lend, nodes, nb, n

Re: [R] Survival analysis with no events in one treatment group

2007-12-30 Thread Daniel Malter
Hi John, to me it still seems that you have two "problems", given your first email. The first one, if I am correct, is that you have NO admissions in one of the groups. That is, you have Treat A, B, C, D and for one of these treatments there is not a single admission. Then you cannot estimate a su

Re: [R] plot multiple data sets on same axis

2007-12-30 Thread Scott Lamb
Scott Lamb wrote: > Scott Lamb wrote: >> I've tried replacing the for loop body with this: >> >> this_method <- split.df[[i]] >> boxplot(elapsed~inactive, data=this_method, >> add=TRUE, border=i, boxfill=i, outline=FALSE) >> >> but it has two problems: >> >> * it doesn't plot at

Re: [R] help with matrix

2007-12-30 Thread jim holtman
Does this give you want you want? I assume that you have to also ignore the first column in matrixC or else you don't have a reasonable comparison. Also your data for matrixA and matrixB did not have any spaces between the numbers, so I just took a guess at what they should be. > a.m <- scan(tex

[R] help with matrix

2007-12-30 Thread Yingchen Wang
Hi, dear all: I am a beginner. I appreciate any help or hint from you. I am trying to do calculation with matrices. I have 3 matrices. One is matrixA, 2nd is matrixB, and last is matrixC. Here is matrixA: 1.8511.40.0831.001 0.8771.30.1161.33 1.9021.21.1020.302 0.8640.1261.110.252

Re: [R] Survival analysis with no events in one treatment group

2007-12-30 Thread John Field
Hi Daniel, Sorry, it may have been clearer if I had used "subjects" instead of "patients". The treatments were administered to all subjects, and then in the succeeding 12 months, some were hospitalised and some were not. Hence only about 25% of the subjects were hospitalised. The start of t

Re: [R] Survival analysis with no events in one treatment group

2007-12-30 Thread Daniel Malter
Hi again, I meant some rows of sample data, rather than sample code. Sorry about that. Daniel - cuncta stricte discussurus - -Ursprüngliche Nachricht- Von: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] Im Auftrag von John Field Gesendet: S

Re: [R] Survival analysis with no events in one treatment group

2007-12-30 Thread Daniel Malter
Hi John, I am on the slow side - can you provide sample code. How can one treatment group have no admissions? Let's say there are treatments W, X, Y, Z. Do you mean that NONE of the patients who got admitted the first time and, say, received treatment X during the first admission, have ever had

[R] Survival analysis with no events in one treatment group

2007-12-30 Thread John Field
I'm trying to fit a Cox proportional hazards model to some hospital admission data. About 25% of the patients have had at least one admission, and of these, 40% have had two admissions within the 12 month period of the study. Each patients has had one of 4 treatments, and one of the treatment

Re: [R] plot multiple data sets on same axis

2007-12-30 Thread Scott Lamb
Scott Lamb wrote: > I've tried replacing the for loop body with this: > > this_method <- split.df[[i]] > boxplot(elapsed~inactive, data=this_method, > add=TRUE, border=i, boxfill=i, outline=FALSE) > > but it has two problems: > > * it doesn't plot at the correct x values. It

Re: [R] Symbolic substitution in parallel; use infinity symbol?

2007-12-30 Thread Peter Dalgaard
John Maindonald wrote: > I'd like to be able to modify axlab in (C) below so that 'Inf' > is replaced by the infinity symbol. > > y <- rnorm(40) > breaks <- c(-Inf, -1, 1, Inf) > x <- cut(y, breaks=breaks) > plot(unclass(x), y, xaxt="n", xlab="") > > ## A: The following gives the axis labels "(-Inf

Re: [R] plot multiple data sets on same axis

2007-12-30 Thread Scott Lamb
Thank you - that was exactly what I needed. I just discovered read.csv understands URLs, so here it is with my actual data and formatting: df <- read.csv("http://www.slamb.org/tmp/one-active.csv";) split.df <- split(df, df$method) plot(0, xlim=range(df$inactive), ylim=range(df$elapsed)

[R] Symbolic substitution in parallel; use infinity symbol?

2007-12-30 Thread John Maindonald
I'd like to be able to modify axlab in (C) below so that 'Inf' is replaced by the infinity symbol. y <- rnorm(40) breaks <- c(-Inf, -1, 1, Inf) x <- cut(y, breaks=breaks) plot(unclass(x), y, xaxt="n", xlab="") ## A: The following gives the axis labels "(-Inf, 1]", etc. axis(1, at=1:3, labels=exp

Re: [R] plot multiple data sets on same axis

2007-12-30 Thread jim holtman
Here is one way of doing it by splitting the data and plotting each set in a different color: # generate some test data mydf <- data.frame(x=runif(200), y=rnorm(200), dataset=sample(LETTERS[1:4], 200, TRUE)) # setup the plot are for the maximum of the data plot(0, xlim=range(mydf$x), ylim=range(my

[R] plot multiple data sets on same axis

2007-12-30 Thread Scott Lamb
I'm new to R and struggling to reproduce graphs I've made with gnuplot. Example here: http://www.slamb.org/tmp/one-active.png I have three different data sets plotted on the same axis. (I also have a number of samples for each X value which I displayed with quartiles rather than plotting ever

Re: [R] Trying to install rjags on Mac OS X 10.5

2007-12-30 Thread Rob Goedman
Hi Lindsay, Did have some difficulties as well, but got it to work using Xcode3.0, Apple's gcc4.2preview release and gfortran 4.2.1 from Simon's web site. This was on R-devel though, on a Mac Intel. Can it find the jags executable say from your home directory? Have you tried 'make check' in

Re: [R] Text over the plot and the margins

2007-12-30 Thread John Kane
Hi Miguel, Some sample code would help but I think xpd in ?par may be what you're looking for however it probably would be easier/better to set the xlim values to give more space on the right hand side of the graph or just modify the text( at=) value to keep the numbers inside the plot area. --

Re: [R] adding a function after package.skeleton()

2007-12-30 Thread baptiste Auguié
Hi, Thanks for this tip, I'm always amazed at the number of clever functions built-in in R –– just wish i could think of their name rather than reinventing the wheel. However, I'm still stupidly stuck with this basic question: how should a function access data in its own package? On 30 De

Re: [R] Bootstrap Confidence Intervals

2007-12-30 Thread Prof Brian Ripley
You need to call boot() to create an object to pass to boot.ci(). There are lots of examples in the help pages and in the book that package 'boot' supports. From the help: Usage: boot.ci(boot.out, conf = 0.95, type = "all", index = 1:min(2,length(boot.out$t0)), var.t0 = NULL

Re: [R] Installing Rgraphviz package on a windows vista pc

2007-12-30 Thread Martin Morgan
Hi Ravi -- this is a Bioconductor package, so please ask on the Bioconductor mailing list. There is a windows binary available http://bioconductor.org/packages/2.1/bioc/html/Rgraphviz.html The best way to install this and all Bioconductor packages is > source('http://bioconductor.org/biocLite.R

Re: [R] Installing Rgraphviz package on a windows vista pc

2007-12-30 Thread Prof Brian Ripley
On Sun, 30 Dec 2007, Ravi Vishnu wrote: > Hi, > I want to install Rgraphviz on a windows vista pc. The only source file > that I found in the bioconductor homepage is a tar file. I can't install > from this using the packages command in the R menu. I would like to get > some tips on how I can

[R] Text over the plot and the margins

2007-12-30 Thread Miguel Tremblay
Hi, I am having problem to display text that goes start inside the plot but should go over the margins of the plot. You can have an example of what I mean by looking at the graphs on this page: http://ptaff.ca/soleil/?l1pays=Canada&l1etat=Qu%C3%A9bec&l1ville=Montr%C3%A9al&year=2007&month=12&day

[R] Bootstrap Confidence Intervals

2007-12-30 Thread _Fede_
Hi all. This is my first post in this forum. Finally I find a forum in the web about R, although is not in my language. Now I'm working with Bootstrap CI. I'd like to know how I can calculate a Bootstrap CI for any statistic, in particular, for Kurtosis Coeficient. I have done the following co

Re: [R] Bayesian Integration (stat question)

2007-12-30 Thread francogrex
Yacas and Ryacas does exactly what I want. Actually I had asked previously a question about algebra (not integration precisely) and guys here have pointed out package Ryacas. Sorry to disturb. francogrex wrote: > > This may be far-fetched: > In Bayesian analysis to find the marginal posterior d

Re: [R] Date formats

2007-12-30 Thread Mikkel Grum
Thanks to both of you. I tried to work on it, but the closest I could get was: lifelse <- function (test, y, z) { iffy <- function(x) { if (x) {y} else {z} } lapply(test, iffy) } > lifelse(c(TRUE, FALSE), date -1, date) [[1]] [1] "2007-12-29" [[2]] [1] "2007-12-30" > > d <-

[R] updating R version and packages.

2007-12-30 Thread Milton Cezar Ribeiro
Dear All, Is there a way of I update automatically the R version and the respective packages which I have installed on my computer? Case not, how can I know about what packages I installed by my self on the computer? All have a nice new year. from miltinho, Brazil. para armazenamento!

Re: [R] adding a function after package.skeleton()

2007-12-30 Thread Gabor Grothendieck
On Dec 30, 2007 1:19 PM, baptiste Auguié <[EMAIL PROTECTED]> wrote: > These two functions use the dataframe "Constants", part of this package: > > > `L2eV` <- function(lambda) > > { > > data("Constants") > > Constants$h*Constants$cel/Constants$ee/lambda ->eV > > eV > > } >

Re: [R] refering to variable names in lm where the variable name is in another variable

2007-12-30 Thread Charilaos Skiadas
On Dec 30, 2007, at 12:49 PM, Daniel O'Shea wrote: > I am trying to refer to a variable name in a lm regression where > the variable name is in another variable, but it does seem to > work. Here is an example: > > y<-rnorm(10) > dat<-data.frame(x1=rnorm(10),x2=rnorm(10),x3=rnorm(10)) > nam<-c

[R] adding a function after package.skeleton()

2007-12-30 Thread baptiste Auguié
Dear R helpers, I've successfully created a package 'constants' using package.skeleton () with one dataframe and a few functions. However, now that I want to add some functions and data to the package, I run into a problem. I ran prompt(...) and moved + edited the resulting .Rd files as appr

Re: [R] Trying to install rjags on Mac OS X 10.5

2007-12-30 Thread Lindsay Stirton
Quoting Prof Brian Ripley <[EMAIL PROTECTED]>: > and on my Mac the pkg-config files are in /usr/local/lib/pkgconfig > and /usr/lib/pkgconfig. Most likely it would work if PKG_CONFIG_PATH > is not set, so try that first. Thanks--but this still doesn't seem to get me anywhere (see below). Macin

[R] Histogram with different colors for different portions

2007-12-30 Thread arnholtat
Dear Rusers, I would like to color different sections of a histogram different colors. I have an example that was done by "brute force" given below. Has anyone implemented something like this in general? If not, any suggestions/pointers on how to write a general function to do so would be most ap

[R] refering to variable names in lm where the variable name is in another variable

2007-12-30 Thread Daniel O'Shea
I am trying to refer to a variable name in a lm regression where the variable name is in another variable, but it does seem to work. Here is an example: y<-rnorm(10) dat<-data.frame(x1=rnorm(10),x2=rnorm(10),x3=rnorm(10)) nam<-c('x1','x2','x3') library(gtools) com<-combinations(3,2,1:3) mod<-lm(

[R] Installing Rgraphviz package on a windows vista pc

2007-12-30 Thread Ravi Vishnu
Hi, I want to install Rgraphviz on a windows vista pc. The only source file that I found in the bioconductor homepage is a tar file. I can't install from this using the packages command in the R menu. I would like to get some tips on how I can do the installation. Can I just place the extracted

[R] Bayesian Integration (stat question)

2007-12-30 Thread francogrex
This may be far-fetched: In Bayesian analysis to find the marginal posterior distribution of a parameter it requires integration out of the so-called nuisance parameters. Is there in R (like an equivalent to the deriv function) but to find the expression of the integration (or an anti-derivative)?

Re: [R] tcltk again

2007-12-30 Thread Charilaos Skiadas
On Dec 30, 2007, at 11:55 AM, Richard Müller wrote: > Oops, I just sent the wrong mail. It should be the following one. > Please > delete my mail from 30.Dez. 17:51 > > > Sorry, but I don't really understand the recommended method using > the tk-Box > "tkGetSaveFile". > I wrote the following c

Re: [R] tcltk again

2007-12-30 Thread Richard Müller
Oops, I just sent the wrong mail. It should be the following one. Please delete my mail from 30.Dez. 17:51 Sorry, but I don't really understand the recommended method using the tk-Box "tkGetSaveFile". I wrote the following code: X11() # some code to generate a plot on the screen omitted res <-

Re: [R] Trying to install rjags on Mac OS X 10.5

2007-12-30 Thread Prof Brian Ripley
> Macintosh:Desktop ljs$ echo $PKG_CONFIG_PATH > /usr/local/bin is unlikely to be correct. A typical Linux setting is PKG_CONFIG_PATH=/usr/local/lib64/pkgconfig:/usr/lib64/pkgconfig and on my Mac the pkg-config files are in /usr/local/lib/pkgconfig and /usr/lib/pkgconfig. Most likely it would

Re: [R] tcltk again

2007-12-30 Thread Richard Müller
> > ... > > I experimented with tkgetSaveFile(). But in the moment the user > > gives the > > filename the file is not yet generated! And I can't generate it in > > advance, > > because the filename is not yet specified. > > I don't see why this is a problem. In tkgetSaveFile(), the user can > just

[R] randomForest: Graph a Single Tree extracted from a random forest

2007-12-30 Thread Retzer Joe
I was wondering if anyone had created a graph of a single tree created by the randomForest call. Perhaps obtaining the tree information using "getTree" in the randomForest package. Many thanks for any advice, Joe Retzer __ R-help@r-project.org maili

[R] Trying to install rjags on Mac OS X 10.5

2007-12-30 Thread Lindsay Stirton
Greetings, I wonder if anyone can offer any help or advice--even direction to an appropriate source of advice. I am trying to install rjags 1.0.1 on Mac OS X 10.5 (see http://www-fis.iarc.fr/~martyn/software/jags/). I have R.app 2.6.1 installed. JAGS 1.0.1 is apparently successfully installed. I

Re: [R] apply in zoo

2007-12-30 Thread Gabor Grothendieck
1. Please read the last line on every message to r-help and in particular the part about providing reproducible code when you post. 2. Your third argument to apply is wrong. sharpe is a function but sharpe(...whatever...) is not. Suggest you carefully review the examples on the ?apply page if th

[R] apply in zoo

2007-12-30 Thread Bernd Dittmann
Hi R users, could anyone guide me in the right direction reg. the column-wise application of a function on a zoo dataframe. The tseries function sharpe() can only be applied to a univariate time series. Suppose you have merged the returns of two assets with get.hist.quote(), i.e. set <- merge

Re: [R] Date formats

2007-12-30 Thread hadley wickham
On Dec 30, 2007 10:47 AM, Peter Dalgaard <[EMAIL PROTECTED]> wrote: > Gabor Grothendieck wrote: > > Read the warning in ?ifelse > Yep. > > And, yes, it is annoying that ifelse() strips attributes, including > class, but it is one of those things that have been in the S languages > "forever", and no

Re: [R] non-ascii characters in TclTk

2007-12-30 Thread Charles Annis, P.E.
Thank you, Peter! The Unicode sequence "\u00e2" for "â" is the ticket. While it is true that I can just use â in my TclTk code, when I use package.skeleton(name="unicode test"), the R code changes my unacceptable â to to indicate an error. My code will still run, of course, but doesn't displa

Re: [R] Date formats

2007-12-30 Thread Peter Dalgaard
Gabor Grothendieck wrote: > Read the warning in ?ifelse Yep. And, yes, it is annoying that ifelse() strips attributes, including class, but it is one of those things that have been in the S languages "forever", and nobody really wants to mess with. The fundamental issue is that you need the re

Re: [R] non-ascii characters in TclTk

2007-12-30 Thread Peter Dalgaard
Charles Annis, P.E. wrote: > Greetings, R-Helpers: > > A year ago or so I was able to use the non-ascii character â in my TclTk. > (You can type it on Windows as 0226) I can use something like > expression(hat(a)) elsewhere in R, but I seem to be doing something wrong > when I try that syntax in T