Re: [R] truncate row names

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Thu, 24 Apr 2008 13:53:32 -0300

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_at_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_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.
>

-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

	[[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.

Received on Thu 24 Apr 2008 - 17:56:27 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Thu 24 Apr 2008 - 18:30:31 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive