Try:
cof <- full.t.ag$cov$coeff
gsub("t.ag.X", "", names(cof))
On Thu, Apr 24, 2008 at 1:47 PM, Summer Nitely <summer.nitely@gmail.com>
wrote:
> Hi,
>
> I would like to truncate row names. Is that possible?
>
> I ran a regression with the covariates in a matrix, and in the results the
> coefficients have the matrix name concatenated with the variable name:
>
>
> > full.t.ag <- Icens(lfirst_well, llast_well, lfirst_ill, formula=~
> t.ag.X,
> breaks=t.ag.int, data=t.ag)
> > full.t.ag$cov$coeff
>
> t.ag.Xnyearc t.ag.Xhorse t.ag.Xswine t.ag.Xpet t.ag.Xother
> t.ag.Xpoultry t.ag.Xyr.horse
> -0.29497437 0.77857817 -0.53315929 -1.02745065
> -0.17775268 -0.08237047 -0.36606818
>
>
> I want these coefficients to have the t.ag.X removed from the names. ie.
> nyearc horse swine
> pet other poultry yr.horse
> -0.29497437 0.77857817 -0.53315929 -1.02745065
> -0.17775268 -0.08237047 -0.36606818
>
>
> I have a lot of results, so going through and renaming every row is not a
> very appealing option. Is there another way? Is there a way to cut off
> the
> first 5 character positions in the row name? Or to force R to take the
> column names rather than concatenate the matrix and column names in the
> regression?
>
> Any help would be greatly appreciated.
> Thanks,
> Summer
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@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.
>
--
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O
[[alternative HTML version deleted]]