[R] showing ticks for censored data in survfit() in the rms package

2012-09-05 Thread Andrew Yee
The answer to this may be obvious, but I was wondering in the rms package and the survfit(), how you can plot the censored time points as ticks. Take for example, library(survival) library(rms) foo <- data.frame(Time=c(1,2,3,4,5,6,10), Status=c(1,1,0,0,1,1,1)) answer <- survfit(Surv(foo$Time, fo

Re: [R] how to handle no lines in input with pipe()

2011-04-12 Thread Andrew Yee
Thank you very much for your suggestion...that works perfectly. Thanks, Andrew On Mon, Apr 4, 2011 at 5:46 PM, Prof Brian Ripley wrote: > On Mon, 4 Apr 2011, Andrew Yee wrote: > >> This has to do with using pipe() and grep and read.csv() >> >> I have a .csv file that

[R] how to handle no lines in input with pipe()

2011-04-04 Thread Andrew Yee
This has to do with using pipe() and grep and read.csv() I have a .csv file that I grep using pipe() and read.csv() as follows: read.csv(pipe('grep foo bar.csv')) However, is there a way to have this command run when for example, there is no "foo" text in the bar.csv file? I get an error messag

Re: [R] trouble installing R-patched (R-2.12.0) when TMPDIR is specified

2010-10-18 Thread Andrew Yee
I'm mortified to report that the location I set in TMPDIR was not a valid directory in the system I was using (I copied it from another system), so this is a mea culpa on my part! Andrew On Mon, Oct 18, 2010 at 7:46 AM, Prof Brian Ripley wrote: > > On Sun, 17 Oct 2010, Andrew Yee wr

[R] trouble installing R-patched (R-2.12.0) when TMPDIR is specified

2010-10-17 Thread Andrew Yee
I noticed that if I specify the location of TMPDIR in .bashrc as follows on a Linux 64 bit system: export TMPDIR=/store/home/ayee/.tmp I get the following error message when installing R make[3]: Entering directory `/home/ayee/R-patched/src/library/base' building package 'base' make[4]: Entering

Re: [R] as.Date() add a day to a date

2010-09-13 Thread Andrew Yee
Dallazuanna wrote: > Try this: > > format(dt, '%Y-%m-%d'), if you want Date class: > > as.Date(format(dt, '%Y-%m-%d')) > > > > > On Mon, Sep 13, 2010 at 2:24 PM, Andrew Yee wrote: > >> Thanks David, now I wonder how you can have as.Da

Re: [R] as.Date() add a day to a date

2010-09-13 Thread Andrew Yee
Thanks David, now I wonder how you can have as.Date() render the date using local time rather than UTC. Andrew On Mon, Sep 13, 2010 at 12:08 PM, David Winsemius wrote: > > On Sep 13, 2010, at 11:56 AM, Andrew Yee wrote: > > I'm trying to understand why as.Date() is converti

[R] as.Date() add a day to a date

2010-09-13 Thread Andrew Yee
I'm trying to understand why as.Date() is converting a the modified date of a file from August 22 to August 23. > foo <- file.info(file.to.process) > str(foo) 'data.frame': 1 obs. of 10 variables: $ size : num 5.37e+09 $ isdir : logi FALSE $ mode :Class 'octmode' int 436 $ mtime : POSIX

Re: [R] using as.numeric() without generating warning message

2010-04-09 Thread Andrew Yee
Thanks for the tip! Andrew On Fri, Apr 9, 2010 at 8:04 PM, Gabor Grothendieck wrote: > Try this: > > suppressWarnings(as.numeric("A")) > > On Fri, Apr 9, 2010 at 7:22 PM, Andrew Yee wrote: > > I'm interested in testing whether or not a character str

[R] using as.numeric() without generating warning message

2010-04-09 Thread Andrew Yee
I'm interested in testing whether or not a character string is numeric or not as follows: is.na(as.numeric('3')) # returns F is.na(as.numeric('A')) # I'd like this to return T without issuing a warning about NAs introduced by coercion. I guess you could suppress the warning with options(warn=-1),

[R] specifying header in sqldf() and RSQLite

2010-04-06 Thread Andrew Yee
I have a file that I'm planning on manipulating with sqldf(). The header for this file is malformed, and I was wondering if there's a way to specify the values of the header ahead of time. I can see there are T/F options for header in sqldf(... list(header=T, ...), but was wondering if there's a

Re: [R] converting multiple lines of text to a data frame

2010-03-06 Thread Andrew Yee
eley >                                         spec...@stat.berkeley.edu > > > > > On Fri, 5 Mar 2010, Andrew Yee wrote: > >> I'm trying to find a way for converting multiple lines of text into a >> table.  I'm not sure if there's a way where you ca

[R] converting multiple lines of text to a data frame

2010-03-05 Thread Andrew Yee
I'm trying to find a way for converting multiple lines of text into a table.  I'm not sure if there's a way where you can use read.delim() to read in multiple lines of text and create the following data frame with something akin to rehape()?. Apologies if there is an obvious way to do this. A: 1

Re: [R] tiff() and antialias option

2010-02-22 Thread Andrew Yee
Uwe, you're right, it turns out that cairo hadn't been previously installed on the system. Andrew 2010/2/19 Uwe Ligges > > > On 19.02.2010 17:44, Andrew Yee wrote: > >> I was wondering if someone could help with the antialias option in tiff(). >> I&#x

[R] tiff() and antialias option

2010-02-19 Thread Andrew Yee
I was wondering if someone could help with the antialias option in tiff(). I'm running R 2.9.2 on a Linux machine. I'm working on creating a tiff file and have tried different antialias parameters, e.g. default, none, gray, and subpixel, but don't seem to be seeing a difference in the output. Or

[R] pdf() and pagecentre option

2009-12-22 Thread Andrew Yee
Hi, I was wondering how you can create a pdf where the output is vertically justified with for example a one inch margin on top using pdf(). For example in pdf(file='test.pdf', paper='letter', pagecentre=F) ### code for plot ### dev.off() is there an option where it generate output that starts f

Re: [R] how do you know which functions are being debugged?

2009-10-23 Thread Andrew Yee
//yihui.name > Department of Statistics, Iowa State University > 3211 Snedecor Hall, Ames, IA > > > > On Fri, Oct 23, 2009 at 1:02 PM, Duncan Murdoch > wrote: > > On 10/23/2009 1:28 PM, Andrew Yee wrote: > >> > >> This is kind of a dumb question: I know

[R] how do you know which functions are being debugged?

2009-10-23 Thread Andrew Yee
This is kind of a dumb question: I know you can use isdebugged() to find out if a specific function is flagged for debugging, but is there a way to list all the functions that are flagged for debugging? Thanks, Andrew [[alternative HTML version deleted]] _

Re: [R] converting matrix of lists to a regular matrix

2009-10-03 Thread Andrew Yee
Thanks, as you suggested, do.call(rbind, lapply(foo, unlist)) does the trick. On Sat, Oct 3, 2009 at 8:30 PM, David Winsemius wrote: > > On Oct 3, 2009, at 7:51 PM, Andrew Yee wrote: > > Take the following code: >> foo <- list() >> >> foo[[1]] <- list(a=1,

Re: [R] converting matrix of lists to a regular matrix

2009-10-03 Thread Andrew Yee
unlist() Andrew On Sat, Oct 3, 2009 at 8:01 PM, Gabor Grothendieck wrote: > Try this: > > matrix(list(1, 11, 111, 2, 22, 222), nc = 2, dimnames = list(NULL, c("a", > "b"))) > > or > > out <- list(1, 11, 111, 2, 22, 222) > dim(out) <- c(3, 2) >

[R] converting matrix of lists to a regular matrix

2009-10-03 Thread Andrew Yee
Take the following code: foo <- list() foo[[1]] <- list(a=1, b=2) foo[[2]] <- list(a=11, b=22) foo[[3]] <- list(a=111, b=222) result <- do.call(rbind, foo) result[,'a'] In this case, result[,'a'] shows a list. Is there a more elegant way such that result is a "regular" matrix of vectors? I imag

Re: [R] treating a data symbol like a character

2009-07-09 Thread Andrew Yee
;, 'John') > PCH <- c('+','O','$') > > # Plotting > plot(x, pch = PCH) > legend('topright', pch = PCH, Text, ncol = 3) > > should be close to what you want. Note that the text() / points() > combination could be avoide

Re: [R] treating a data symbol like a character

2009-07-09 Thread Andrew Yee
1*x[2], expression(beta) ) > text(2.95,1.01*x[3], expression(gamma) ) > > should get you close. > > See ?text, ?expression and ?legend for more information. > > HTH, > > Jorge > > > On Thu, Jul 9, 2009 at 10:53 AM, Andrew Yee wrote: > >> Hi, is there

[R] treating a data symbol like a character

2009-07-09 Thread Andrew Yee
Hi, is there a way to treat a data symbol, e.g. one with pch = 16, as a character? Specifically, I'm interested in creating a line of text as follows using the text() function O alpha O beta O gamma where the "O" is pch 16 and filled with a specific color. Not sure if this is possible or not. T

Re: [R] what happened to the xlsReadWrite package

2009-06-26 Thread Andrew Yee
; On Fri, 26 Jun 2009, David Scott wrote: > > Andrew Yee wrote: >> >>> A naive question: what happened to the xlsReadWrite package? >>> http://cran.r-project.org/web/packages/xlsReadWrite/ >>> >>> It says that it was removed from the CRAN repository.

[R] what happened to the xlsReadWrite package

2009-06-25 Thread Andrew Yee
A naive question: what happened to the xlsReadWrite package? http://cran.r-project.org/web/packages/xlsReadWrite/ It says that it was removed from the CRAN repository. Are there any plans for it be available again? Thanks, Andrew [[alternative HTML version deleted]] __

Re: [R] stripchart and ordering of plot

2009-05-22 Thread Andrew Yee
Thanks, that works great. Andrew On Fri, May 22, 2009 at 5:42 PM, William Dunlap wrote: > > -Original Message- > > From: r-help-boun...@r-project.org > > [mailto:r-help-boun...@r-project.org] On Behalf Of Andrew Yee > > Sent: Friday, May 22, 2009 2:16 PM > >

[R] stripchart and ordering of plot

2009-05-22 Thread Andrew Yee
Take for example the following stripchart that's created: b <- 1:5 a <- 11:15 e <- 21:25 f <- -11:-15 foo <- rbind(b,a,e,f) stripchart(foo ~ rownames(foo)) In this case, I would like the bottom part of the plot to be the f vector, followed by the e vector, etc. However, R reorders the matrix a

[R] segfault when running heatmap()

2009-03-24 Thread Andrew Yee
Hi, I was wondering if someone in the mailing list has any insight into this segfault error that I consistently find when running a script containing heatmap() in R 2.8.1 and 2.8.0 on a Linux 64-bit machine. Some points: 1. This occurs when running heatmap(). 2. Interestingly, if I source() the s

[R] testing for bimodal distribution

2009-02-03 Thread Andrew Yee
I'm not sure where to begin with this, but I was wondering if someone could refer me to an R package that would test to see if a distribution fits a bimodal distribution better than a unimodal distribution. Thanks, Andrew [[alternative HTML version deleted]] __

Re: [R] with lapply() how can you retrieve the name of the object

2008-07-21 Thread Andrew Yee
>> > >> > a <- data.frame(var.1 = 1:5) >> > b <- data.frame(var.1 = 11:15) >> > test.list <- list(a=a, b=b) >> > res=do.call(rbind,test.list) >> > res$var.2=substr(rownames(res),1,1) >> > rownames(res)=NULL >> > res

[R] with lapply() how can you retrieve the name of the object

2008-07-18 Thread Andrew Yee
In the following code, I'd like to be able to create a new variable containing the value of the names of the list. a <- data.frame(var.1 = 1:5) b <- data.frame(var.1 = 11:15) test.list <- list(a=a, b=b) # in this case, names(test.list) is "a" and "b" # and I'd like to use lapply() so that # I

Re: [R] keeping original order in factor()

2008-06-17 Thread Andrew Yee
; Andrew > > levels(factor(foo, levels=c('b','a'))) > > should work. You can make foo an ordered factor too, but that is not > necessary. > > HTH ... > > Peter Alspach > > >> -Original Message----- >> From: [EMAIL PROTECTED] >

[R] keeping original order in factor()

2008-06-17 Thread Andrew Yee
Apologies for the naieveness of this question, but I'm having trouble figuring out to have factor() maintain original ordering. For example, foo <- c("b","b","a","a") levels(factor(foo, ordered=T)) #I'd like this to return as "b" "a" #not "a" "b" I thoug

Re: [R] in axis() suppressing axis line but keeping tick marks

2008-06-16 Thread Andrew Yee
Thanks for tracking this down. Andrew On Mon, Jun 16, 2008 at 4:49 PM, Peter Dalgaard <[EMAIL PROTECTED]> wrote: > Andrew Yee wrote: > >> I've been trying to figure out a parameter that will let you separately >> adjust the parameters for the axis line from the tick

[R] in axis() suppressing axis line but keeping tick marks

2008-06-16 Thread Andrew Yee
I've been trying to figure out a parameter that will let you separately adjust the parameters for the axis line from the tick mark. In the following example, I would like to suppress the axis line, but keep the tick marks. Thanks, Andrew foo <- data.frame(x=1:3, y=4:6) plot(foo$x, foo$y, type="

Re: [R] controlling location of labels in axis()

2008-06-12 Thread Andrew Yee
ot;Second inner y axis label",side=4) > mtext("First outer x axis label",side=1,outer=TRUE) > mtext("First outer y axis label",side=2,outer=TRUE) > mtext("Second outer x axis label",side=3,outer=TRUE) > mtext("Second outer y axis label",side

[R] controlling location of labels in axis()

2008-06-12 Thread Andrew Yee
Here's a naive question about axis() How do you control the location of the labels with the axis() command? In the following example: foo <- data.frame(plot.x=seq(1:3), plot.y=seq(4:6)) plot(foo$plot.x, foo$plot.y, type='n', axes=FALSE) points(foo$plot.x, foo$plot.y) axis(1, at=foo$plot.x, label

Re: [R] alternatives to RColorBrewer?

2008-04-24 Thread Andrew Yee
Great, thanks, that was helpful. Andrew On Thu, Apr 24, 2008 at 2:15 PM, Achim Zeileis <[EMAIL PROTECTED]> wrote: > On Thu, 24 Apr 2008, Andrew Yee wrote: > > > I've found RColorBrewer useful for its qualitative palettes, but wished > that > > it could generate m

[R] alternatives to RColorBrewer?

2008-04-24 Thread Andrew Yee
I've found RColorBrewer useful for its qualitative palettes, but wished that it could generate more than 12 qualitative palettes (e.g. with Set3). Any suggestions for alternative color palette generators that can handle e.g. 18 distinctive colors? (I'm aware of using rainbow(), but this doesn't g

Re: [R] using rbind() on multiple objects at once

2008-04-18 Thread Andrew Yee
Thanks! On 4/18/08, Katharine Mullen <[EMAIL PROTECTED]> wrote: > do.call(rbind, list.foo) > > On Fri, 18 Apr 2008, Andrew Yee wrote: > > > Is there an efficient way to use rbind() with the five dataframes > described > > in the following example: > > &

[R] using rbind() on multiple objects at once

2008-04-18 Thread Andrew Yee
Is there an efficient way to use rbind() with the five dataframes described in the following example: a <- c(1:5) list.foo <- lapply(a, function(x) data.frame(beta=a*rnorm(10), deta=a*rnorm(10))) big.data.frame <- rbind(list.foo[[1]], list.foo[[2]], list.foo[[3]], list.foo[[4]], list.foo[[5]]) #is

Re: [R] why is text being rasterized with text()

2008-04-03 Thread Andrew Yee
t; seeing is a viewer artifact of doing so -- the antialiasing isn't working > for you. > > > > On Thu, 3 Apr 2008, Andrew Yee wrote: > > > > > > > > > Here's a question: I noticed that when I tried to create this simple > > graph of rectang

[R] why is text being rasterized with text()

2008-04-02 Thread Andrew Yee
Here's a question: I noticed that when I tried to create this simple graph of rectangles and text, R appears to generate text that is rasterized (this is seen both on the monitor and when the output is directed to a pdf file). Any thoughts? value.seq <- c("<4",as.character(seq(from=4,to=10)),">1

[R] changing color scheme in R in UNIX

2008-01-20 Thread Andrew Yee
Hi, I've been using R in Windows but am now starting to use it more often in the UNIX environment. In Windows, I'm used to the text provided by the user appearing in red, and the output from R appearing in blue. Is there a way to achieve this in UNIX? Thanks, Andrew [[alternative HTML v