[R] Measurement units inside a data frame
Tribo Laboy
tribolaboy at gmail.com
Thu Feb 7 12:02:45 CET 2008
On Thu, Feb 7, 2008 at 7:57 PM, Gavin Simpson <gavin.simpson at ucl.ac.uk> wrote:
>
> On Thu, 2008-02-07 at 19:32 +0900, Tribo Laboy wrote:
> > Hello,
> >
> > I was wondering if there was an easy way to put information about the
> > measurement units used for each column of a data frame ...
> >
> > Thanks for any pointers,
> >
> > TL
>
> You could add attributes:
>
> dummy <- data.frame(x = rnorm(10), y = rbeta(10, 2, 5), z = rlnorm(10))
> dummy
>
> attr(dummy, "units") <- c("m s-2", "Kg", "m")
> dummy
> attributes(dummy)
>
> G
> --
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
> Dr. Gavin Simpson [t] +44 (0)20 7679 0522
> ECRC, UCL Geography, [f] +44 (0)20 7679 0565
> Pearson Building, [e] gavin.simpsonATNOSPAMucl.ac.uk
> Gower Street, London [w] http://www.ucl.ac.uk/~ucfagls/
> UK. WC1E 6BT. [w] http://www.freshwaters.org.uk
> %~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
>
>
Hi Gavin,
Thanks. That works for me just great.
Regrads,
TL
More information about the R-help
mailing list