Re: [R] add names to data frame

From: Henrique Dallazuanna <wwwhsd_at_gmail.com>
Date: Thu, 14 Apr 2011 09:11:22 -0300

The matrix is generated by print.dist function ( getS3method("print", "dist") ).

You could try this:

d <- as.matrix(dist(matrix(rnorm(27), 9), diag = TRUE, upper = TRUE)) colnames(d) <- letters[1:9]

On Wed, Apr 13, 2011 at 1:29 PM, Radhouane Aniba <aradwen_at_gmail.com> wrote:
> Hi,
>
> I have a vector V of values I used to create a distance matrix using dist()
> function with diag=TRUE and upper=TRUE parameters.
>
> I would like to assign names in another vector on top of each column instead
> of 1 2 3 4 ...
>
> How can we do that ? is the distance matrix generated a data frame or a
> matrix ?
>
> Regards
> --
> *Radhouane *
>
>        [[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

______________________________________________
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 14 Apr 2011 - 12:13:48 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 14 Apr 2011 - 13:20:30 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