[R] window closed

Liaw, Andy andy_liaw at merck.com
Wed Apr 20 20:23:00 CEST 2005


> From: Yoko Nakajima
> 
> Hello,
> 
> The editor of R will close after I enter the following 
> commands. I do not know the reason at all. When does this 
> happen? I would very appreciate it if you could let me know.
> 
> Sincerely.
> =====
> gam <- matrix(scan("C:/Documents and Settings/Yoko 
> N/Desktop/R/sas2.txt"), ncol = 29)
> Read 384132 items
> Warning message: 
> Replacement length not a multiple of the elements to replace 
> in matrix(...) 

scan() read 384132 items from the file.  Is that the correct number that
should be read in?  If so, you have a problem:  You've got 13245.93 rows of
data in 29 columns...

> > time<-gam["V4"]
> > status<-gam["V5"]

At this point "gam" is suppose to be a _matrix_, and I don't think you want
to subset a matrix like that.  Do you really mean to use "gam" as a data
frame?  If so, either read it in as a data frame, or convert to one
afterward.

> > fit<-survfit(Surv(time,status),data = as.data.frame(gam), 
> conf.type="none")

There's no survfit() in base R.  If you are using a contributed package,
please state it.

> PLEASE do read the posting guide! 
> http://www.R-project.org/posting-guide.html

Please do.

Andy




More information about the R-help mailing list