[R] print(cenfit object) to a data.frame

Rui Barradas ruipbarradas at sapo.pt
Thu Apr 10 19:00:10 CEST 2014


Hello,

Perhaps the easiest way is with ?capture.output:

dat <- read.table(text = capture.output(print(mycenfit)), 
stringsAsFactors = FALSE)

  str(dat)
'data.frame':   3 obs. of  5 variables:
  $ n     : int  3 3 3
  $ n.cen : int  1 1 2
  $ median: int  2 2 NA
  $ mean  : num  2.33 2.33 2
  $ sd    : num  0.667 0.667 NaN


Hope this helps,

Rui Barradas

Em 10-04-2014 17:40, Massimo Bressan escreveu:
> given this reproducible example:
>
> #start code
>
> df<-structure(list(lq = c(TRUE, FALSE, TRUE, FALSE, TRUE, FALSE, TRUE,
> FALSE, FALSE), value = c(1, 3, 1, 2, 0.5, 2, 1, 2, 3), group =
> structure(c(1L, 1L, 2L, 2L, 3L, 3L, 3L, 1L, 2L), .Label = c("A", "B",
> "C"), class = "factor")), .Names = c("lq", "value", "group"), row.names
> = c(NA, -9L), class = "data.frame")
>
> library(NADA)
>
> mycenfit<-with(df, cenfit(value,lq,group))
>
> print(mycenfit)
>
> #end code
>
> does anybody knows how to convert the print() of the cenfit object (S4)
> "mycenfit" to a data frame?
>
> sorry, this might be a trivial question but for some reasons I do not
> understand I got completely stuck on this...
> I've seen similar questions pointed out in the mailing list but for a
> "surfit" object which do not seem to properly apply in my specific case
>
> any help much appreciated, thank you
>
>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>




More information about the R-help mailing list