UPDATE: 2.0.0 , "" "haven_labelled", Hmisc.
tl; dr: .
:
library(Hmisc)
#> Loading required package: lattice
#> Loading required package: survival
#> Loading required package: Formula
#> Loading required package: ggplot2
#>
#> Attaching package: 'Hmisc'
#> The following objects are masked from 'package:base':
#>
#> format.pval, units
library(tidyverse)
#> Warning: package 'forcats' was built under R version 3.4.4
summarise :
Hmisc::label(iris$Petal.Width) <- "Petal Width"
head(iris)
#> Error: 'x' and 'labels' must be same type
, , , :
traceback()
#> 8: stop("'x' and 'labels' must be same type", call. = FALSE)
#> 7: labelled(NextMethod(), attr(x, "labels"))
#> 6: '[.labelled'(xj, i)
#> 5: xj[i]
#> 4: '[.data.frame'(x, seq_len(n), , drop = FALSE)
#> 3: x[seq_len(n), , drop = FALSE]
#> 2: head.data.frame(iris)
#> 1: head(iris)
[.labelled . ?
lapply(iris, class)
#> $Sepal.Length
#> [1] "numeric"
#>
#> $Sepal.Width
#> [1] "numeric"
#>
#> $Petal.Length
#> [1] "numeric"
#>
#> $Petal.Width
#> [1] "labelled" "numeric"
#>
#> $Species
#> [1] "factor"
, Petal.Width Hmisc::label S3. , getAnywhere:
getAnywhere("[.labelled")
#> 2 differing objects matching '[.labelled' were found
#> in the following places
#> registered S3 method for [ from namespace haven
#> namespace:Hmisc
#> namespace:haven
#> Use [] to view one of them
, haven Hmisc . haven Hmisc, Hmisc , , , :
getAnywhere("[.labelled")[1]
#> function (x, ...)
#> {
#> labelled(NextMethod(), attr(x, "labels"))
#> }
#> <environment: namespace:haven>
haven , labelled labels, Hmisc::label :
attr(iris$Petal.Width, "labels")
#> NULL
.
: haven ?
library(tidyverse). ,
haven tidyverse, , (., ,
). , , S3: .
Hmisc tidyverse, . , , labelled S3.
2018-03-21 (v0.2.0).