This function removes value and variable label attributes from a vector or data frame. These attributes are typically added to variables when importing foreign data (see read_spss) or manually adding label attributes with set_labels.

remove_all_labels(x)

Arguments

x

Vector or data.frame with variable and/or value label attributes

Value

x with removed value and variable label attributes.

See also

See vignette Labelled Data and the sjlabelled-Package, and copy_labels for adding label attributes (subsetted) data frames.

Examples

data(efc)
str(efc)
#> 'data.frame':	908 obs. of  26 variables:
#>  $ c12hour : num  16 148 70 168 168 16 161 110 28 40 ...
#>   ..- attr(*, "label")= chr "average number of hours of care per week"
#>  $ e15relat: num  2 2 1 1 2 2 1 4 2 2 ...
#>   ..- attr(*, "label")= chr "relationship to elder"
#>   ..- attr(*, "labels")= Named num [1:8] 1 2 3 4 5 6 7 8
#>   .. ..- attr(*, "names")= chr [1:8] "spouse/partner" "child" "sibling" "daughter or son -in-law" ...
#>  $ e16sex  : num  2 2 2 2 2 2 1 2 2 2 ...
#>   ..- attr(*, "label")= chr "elder's gender"
#>   ..- attr(*, "labels")= Named num [1:2] 1 2
#>   .. ..- attr(*, "names")= chr [1:2] "male" "female"
#>  $ e17age  : num  83 88 82 67 84 85 74 87 79 83 ...
#>   ..- attr(*, "label")= chr "elder' age"
#>  $ e42dep  : num  3 3 3 4 4 4 4 4 4 4 ...
#>   ..- attr(*, "label")= chr "elder's dependency"
#>   ..- attr(*, "labels")= Named num [1:4] 1 2 3 4
#>   .. ..- attr(*, "names")= chr [1:4] "independent" "slightly dependent" "moderately dependent" "severely dependent"
#>  $ c82cop1 : num  3 3 2 4 3 2 4 3 3 3 ...
#>   ..- attr(*, "label")= chr "do you feel you cope well as caregiver?"
#>   ..- attr(*, "labels")= Named num [1:4] 1 2 3 4
#>   .. ..- attr(*, "names")= chr [1:4] "never" "sometimes" "often" "always"
#>  $ c83cop2 : num  2 3 2 1 2 2 2 2 2 2 ...
#>   ..- attr(*, "label")= chr "do you find caregiving too demanding?"
#>   ..- attr(*, "labels")= Named num [1:4] 1 2 3 4
#>   .. ..- attr(*, "names")= chr [1:4] "Never" "Sometimes" "Often" "Always"
#>  $ c84cop3 : num  2 3 1 3 1 3 4 2 3 1 ...
#>   ..- attr(*, "label")= chr "does caregiving cause difficulties in your relationship with your friends?"
#>   ..- attr(*, "labels")= Named num [1:4] 1 2 3 4
#>   .. ..- attr(*, "names")= chr [1:4] "Never" "Sometimes" "Often" "Always"
#>  $ c85cop4 : num  2 3 4 1 2 3 1 1 2 2 ...
#>   ..- attr(*, "label")= chr "does caregiving have negative effect on your physical health?"
#>   ..- attr(*, "labels")= Named num [1:4] 1 2 3 4
#>   .. ..- attr(*, "names")= chr [1:4] "Never" "Sometimes" "Often" "Always"
#>  $ c86cop5 : num  1 4 1 1 2 3 1 1 2 1 ...
#>   ..- attr(*, "label")= chr "does caregiving cause difficulties in your relationship with your family?"
#>   ..- attr(*, "labels")= Named num [1:4] 1 2 3 4
#>   .. ..- attr(*, "names")= chr [1:4] "Never" "Sometimes" "Often" "Always"
#>  $ c87cop6 : num  1 1 1 1 2 2 2 1 1 1 ...
#>   ..- attr(*, "label")= chr "does caregiving cause financial difficulties?"
#>   ..- attr(*, "labels")= Named num [1:4] 1 2 3 4
#>   .. ..- attr(*, "names")= chr [1:4] "Never" "Sometimes" "Often" "Always"
#>  $ c88cop7 : num  2 3 1 1 1 2 4 2 3 1 ...
#>   ..- attr(*, "label")= chr "do you feel trapped in your role as caregiver?"
#>   ..- attr(*, "labels")= Named num [1:4] 1 2 3 4
#>   .. ..- attr(*, "names")= chr [1:4] "Never" "Sometimes" "Often" "Always"
#>  $ c89cop8 : num  3 2 4 2 4 1 1 3 1 1 ...
#>   ..- attr(*, "label")= chr "do you feel supported by friends/neighbours?"
#>   ..- attr(*, "labels")= Named num [1:4] 1 2 3 4
#>   .. ..- attr(*, "names")= chr [1:4] "never" "sometimes" "often" "always"
#>  $ c90cop9 : num  3 2 3 4 4 1 4 3 3 3 ...
#>   ..- attr(*, "label")= chr "do you feel caregiving worthwhile?"
#>   ..- attr(*, "labels")= Named num [1:4] 1 2 3 4
#>   .. ..- attr(*, "names")= chr [1:4] "never" "sometimes" "often" "always"
#>  $ c160age : num  56 54 80 69 47 56 61 67 59 49 ...
#>   ..- attr(*, "label")= chr "carer' age"
#>  $ c161sex : num  2 2 1 1 2 1 2 2 2 2 ...
#>   ..- attr(*, "label")= chr "carer's gender"
#>   ..- attr(*, "labels")= Named num [1:2] 1 2
#>   .. ..- attr(*, "names")= chr [1:2] "Male" "Female"
#>  $ c172code: num  2 2 1 2 2 2 2 2 NA 2 ...
#>   ..- attr(*, "label")= chr "carer's level of education"
#>   ..- attr(*, "labels")= Named num [1:3] 1 2 3
#>   .. ..- attr(*, "names")= chr [1:3] "low level of education" "intermediate level of education" "high level of education"
#>  $ c175empl: num  1 1 0 0 0 1 0 0 0 0 ...
#>   ..- attr(*, "label")= chr "are you currently employed?"
#>   ..- attr(*, "labels")= Named num [1:2] 0 1
#>   .. ..- attr(*, "names")= chr [1:2] "no" "yes"
#>  $ barthtot: num  75 75 35 0 25 60 5 35 15 0 ...
#>   ..- attr(*, "label")= chr "Total score BARTHEL INDEX"
#>  $ neg_c_7 : num  12 20 11 10 12 19 15 11 15 10 ...
#>   ..- attr(*, "label")= chr "Negative impact with 7 items"
#>  $ pos_v_4 : num  12 11 13 15 15 9 13 14 13 13 ...
#>   ..- attr(*, "label")= chr "Positive value with 4 items"
#>  $ quol_5  : num  14 10 7 12 19 8 20 20 8 15 ...
#>   ..- attr(*, "label")= chr "Quality of life 5 items"
#>  $ resttotn: num  0 4 0 2 2 1 0 0 0 1 ...
#>   ..- attr(*, "label")= chr "Job restrictions"
#>  $ tot_sc_e: num  4 0 1 0 1 3 0 1 2 1 ...
#>   ..- attr(*, "label")= chr "Services for elderly"
#>  $ n4pstu  : num  0 0 2 3 2 2 3 1 3 3 ...
#>   ..- attr(*, "label")= chr "Care level"
#>   ..- attr(*, "labels")= Named chr [1:5] "0" "1" "2" "3" ...
#>   .. ..- attr(*, "names")= chr [1:5] "No Care Level" "Care Level 1" "Care Level 2" "Care Level 3" ...
#>  $ nur_pst : num  NA NA 2 3 2 2 3 1 3 3 ...
#>   ..- attr(*, "label")= chr "Care level"
#>   ..- attr(*, "labels")= Named chr [1:3] "1" "2" "3"
#>   .. ..- attr(*, "names")= chr [1:3] "Care Level 1" "Care Level 2" "Care Level 3/3+"
str(remove_all_labels(efc))
#> 'data.frame':	908 obs. of  26 variables:
#>  $ c12hour : num  16 148 70 168 168 16 161 110 28 40 ...
#>  $ e15relat: num  2 2 1 1 2 2 1 4 2 2 ...
#>  $ e16sex  : num  2 2 2 2 2 2 1 2 2 2 ...
#>  $ e17age  : num  83 88 82 67 84 85 74 87 79 83 ...
#>  $ e42dep  : num  3 3 3 4 4 4 4 4 4 4 ...
#>  $ c82cop1 : num  3 3 2 4 3 2 4 3 3 3 ...
#>  $ c83cop2 : num  2 3 2 1 2 2 2 2 2 2 ...
#>  $ c84cop3 : num  2 3 1 3 1 3 4 2 3 1 ...
#>  $ c85cop4 : num  2 3 4 1 2 3 1 1 2 2 ...
#>  $ c86cop5 : num  1 4 1 1 2 3 1 1 2 1 ...
#>  $ c87cop6 : num  1 1 1 1 2 2 2 1 1 1 ...
#>  $ c88cop7 : num  2 3 1 1 1 2 4 2 3 1 ...
#>  $ c89cop8 : num  3 2 4 2 4 1 1 3 1 1 ...
#>  $ c90cop9 : num  3 2 3 4 4 1 4 3 3 3 ...
#>  $ c160age : num  56 54 80 69 47 56 61 67 59 49 ...
#>  $ c161sex : num  2 2 1 1 2 1 2 2 2 2 ...
#>  $ c172code: num  2 2 1 2 2 2 2 2 NA 2 ...
#>  $ c175empl: num  1 1 0 0 0 1 0 0 0 0 ...
#>  $ barthtot: num  75 75 35 0 25 60 5 35 15 0 ...
#>  $ neg_c_7 : num  12 20 11 10 12 19 15 11 15 10 ...
#>  $ pos_v_4 : num  12 11 13 15 15 9 13 14 13 13 ...
#>  $ quol_5  : num  14 10 7 12 19 8 20 20 8 15 ...
#>  $ resttotn: num  0 4 0 2 2 1 0 0 0 1 ...
#>  $ tot_sc_e: num  4 0 1 0 1 3 0 1 2 1 ...
#>  $ n4pstu  : num  0 0 2 3 2 2 3 1 3 3 ...
#>  $ nur_pst : num  NA NA 2 3 2 2 3 1 3 3 ...