[R] Recurrent analysis survival analysis data format question

2014-06-09 Thread Bob Green
Hello, I'm hoping for advice regarding how to set up a recurrent event survival analysis data file. My data consists of people released from custody, with survival time being measured as days before re imprisonment or end of the study. In the example below, id 5155 is released 5 times and jai

Re: [R] rake() error message

2014-06-09 Thread Thomas Lumley
Anthony is right about the cause. The lack of partial=TRUE option in rake is deliberate, and there's really only such an option in postStratify() for debugging or simulation purposes. What partial=TRUE allows is the situation where an observation in your sample has a combination of values that doe

Re: [R] Map insets and par(usr) values

2014-06-09 Thread Greg Snow
Here is an example using the subplot function. library(TeachingDemos) map("state", region= "ohio", xlim=c(-85, -80), ylim=c(38, 42)) tmp <- subplot(map("state",add=TRUE), 'bottomright', type='fig', size=c(0.2,0.2), inset=0.1) op <- par(fig=tmp$fig) map("state", region="ohio", fill=T, add=T) par(op

Re: [R] how to get information of many stocks by using loop cycling in R

2014-06-09 Thread William Dunlap
Make 'S' either an environment or a list. E.g., SymList <- lapply(c("TIBX","X","IBM"), getSymbols, auto.assign=FALSE) # lapply returns a list or SymEnv <- new.env() # or SymList <- list() for(sym in c("TIBX", "X", "IBM")) SymEnv[[sym]] <- getSymbols(sym, auto.assign=FALSE) Use SymList[["T

[R] how to get information of many stocks by using loop cycling in R

2014-06-09 Thread 黄齐
Dear R-core : I am a user of R language from China. I have some problems when I use function ¡°getSymbols¡± which belongs to package ¡°quantmod¡±,and I hope I can get some help from you. I can get some information of one stock just by entering ¡°s1<-getSymbols("600016.ss",from = "2011-05-01",to =

Re: [R] Convert the column values to frequencies

2014-06-09 Thread arun
Hi, Please use ?dput() to show the data. Assuming that the data is: dat <- structure(list(X = c("ks", "ks", "tk", "tk", "tk", "ks", "eq", "eq", "ks"), Y = c("dr", "zw", "dr", "", "zw", "zw", "", "zw", "zw"), Z = c("tq", "tq", "tq", "", "tz", "", "tz", "tz", "tz" )), .Names = c("X", "Y", "Z"), cl

Re: [R] Split a string vector with '[ ]'

2014-06-09 Thread arun
Hi Alexsandro, Suppose if you have strings nw.str1 <- "[D][A|D]A:F[T|A:D]N[C|T]" nw.str2 <- "[D][A|D]A[T|A:D][C|T]NA{DG]P" you could use: library(qdap) as.vector(bracketXtract(nw.str1,"square",T)) #[1] "[D]" "[A|D]"   "[T|A:D]" "[C|T]"   as.vector(bracketXtract(nw.str2,"square",T)) #[1] "

Re: [R] NA/NaN values in bnlearn package R

2014-06-09 Thread Marco Scutari
Dear Alexsandro, On 9 June 2014 02:27, Alexsandro Cândido de Oliveira Silva wrote: > So, how could I deal with the data and get the conditional probability > distribution? As of the current release (3.5), all functions in bnlearn require complete data so that error message is expected. However,

Re: [R] Interval for rnorm command?

2014-06-09 Thread peter dalgaard
It's usually easier to use the inversion method on a truncated uniform: fun3 <- function(n, low, high, mean, sd) qnorm(runif(n, pnorm(low, mean, sd), pnorm(high, mean, sd)), mean, sd) res3 <- fun3(100,-3.7, 3.7, 1,2) hist(res3) On 08 Jun 2014, at 08:34 , arun wrot

Re: [R] Trellis devices and pointize

2014-06-09 Thread Prof Brian Ripley
The issue here is not trellis.device. You are using lattice plots (without mentioning lattice), which are based on package 'grid' and so using the grid sub-system of a device. That sub-system does not use the 'pointsize' of the device as its initial font size. So you need to use grid::gpar(