diff --git a/docs/news/index.html b/docs/news/index.html index 6c1f904..2b106b1 100644 --- a/docs/news/index.html +++ b/docs/news/index.html @@ -144,6 +144,7 @@

%>% is now imported from dplyr
  • a cheatsheet has been added (#47)
  • +
  • internal documentation is now using roxygen2 markdown support
  • diff --git a/docs/pkgdown.yml b/docs/pkgdown.yml index 20c9d6d..b0c8445 100644 --- a/docs/pkgdown.yml +++ b/docs/pkgdown.yml @@ -3,5 +3,5 @@ pkgdown: 1.5.1 pkgdown_sha: ~ articles: intro_labelled: intro_labelled.html -last_built: 2020-06-11T10:59Z +last_built: 2020-06-17T11:47Z diff --git a/docs/reference/copy_labels.html b/docs/reference/copy_labels.html index e015718..e7df85f 100644 --- a/docs/reference/copy_labels.html +++ b/docs/reference/copy_labels.html @@ -157,10 +157,10 @@

    Arg

    Details

    -

    Some base R functions like subset drop variable and +

    Some base R functions like base::subset() drop variable and value labels attached to a variable. copy_labels coud be used to restore these attributes.

    -

    copy_labels_from is intended to be used with dplyr syntax, +

    copy_labels_from is intended to be used with dplyr syntax, see examples.

    Examples

    diff --git a/docs/reference/look_for.html b/docs/reference/look_for.html index a4b1e4a..ca2b58f 100644 --- a/docs/reference/look_for.html +++ b/docs/reference/look_for.html @@ -132,8 +132,8 @@

    Look for keywords variable names and descriptions

    -

    look_for emulates the lookfor Stata command in R. It supports -searching into the variable names of regular R data frames as well as into +

    look_for emulates the lookfor Stata command in R. It supports +searching into the variable names of regular R data frames as well as into variable labels descriptions. The command is meant to help users finding variables in large datasets.

    @@ -151,7 +151,9 @@

    Arg ... -

    list of keywords, a character string (or several character strings), which can be formatted as a regular expression suitable for a grep pattern, or a vector of keywords; displays all variables if not specified

    +

    list of keywords, a character string (or several character strings), which can be +formatted as a regular expression suitable for a base::grep() pattern, or a vector of keywords; +displays all variables if not specified

    labels @@ -180,8 +182,8 @@

    Details

    The function looks into the variable names for matches to the keywords. If available, variable labels are included in the search scope. Variable labels of data.frame imported with foreign or -memisc packages will also be taken into account (see to_labelled).

    -

    look_for and lookfor are equivalent.

    +memisc packages will also be taken into account (see to_labelled()).

    +

    look_for() and lookfor() are equivalent.

    Examples

    look_for(iris)
    #> variable diff --git a/docs/reference/na_values.html b/docs/reference/na_values.html index 3dfc99b..19db38f 100644 --- a/docs/reference/na_values.html +++ b/docs/reference/na_values.html @@ -172,22 +172,22 @@

    Arg

    Value

    -

    na_values will return a vector of values that should also be considered as missing. - na_range will return a numeric vector of length two giving the (inclusive) - extents of the range.

    -

    set_na_values and set_na_range will return an updated - copy of .data.

    +

    na_values() will return a vector of values that should also be considered as missing. +na_range() will return a numeric vector of length two giving the (inclusive) +extents of the range.

    +

    set_na_values() and set_na_range() will return an updated +copy of .data.

    Details

    -

    See labelled_spss for a presentation of SPSS's user defined missing values. -Note that is.na will return TRUE for user defined misssing values. -You can use user_na_to_na to convert user defined missing values to NA.

    +

    See haven::labelled_spss() for a presentation of SPSS's user defined missing values. +Note that base::is.na() will return TRUE for user defined misssing values. +You can use user_na_to_na() to convert user defined missing values to NA.

    Note

    -

    set_na_values and set_na_range could be used with dplyr.

    +

    set_na_values() and set_na_range() could be used with dplyr syntax.

    See also

    -

    labelled_spss, user_na_to_na

    +

    haven::labelled_spss(), user_na_to_na()

    Examples

    v <- labelled(c(1,2,2,2,3,9,1,3,2,NA), c(yes = 1, no = 3, "don't know" = 9)) diff --git a/docs/reference/recode.haven_labelled.html b/docs/reference/recode.haven_labelled.html index 463ae1c..15aaf1e 100644 --- a/docs/reference/recode.haven_labelled.html +++ b/docs/reference/recode.haven_labelled.html @@ -40,7 +40,7 @@ - @@ -130,7 +130,7 @@

    Recode values

    -

    Extend recode method from haven to +

    Extend dplyr::recode() method from dplyr to works with labelled vectors.

    @@ -198,7 +198,7 @@

    Arg

    See also

    -

    recode (dplyr)

    +

    Examples

    x <- labelled(1:3, c(yes = 1, no = 2)) diff --git a/docs/reference/reexports.html b/docs/reference/reexports.html index b2f15b0..cb81f74 100644 --- a/docs/reference/reexports.html +++ b/docs/reference/reexports.html @@ -139,7 +139,7 @@

    Objects exported from other packages

    These objects are imported from other packages. Follow the links below to see their documentation.

    -
    dplyr

    %>%

    +
    dplyr

    %>%

    haven

    format_tagged_na, is.labelled, is_tagged_na, labelled, labelled_spss, na_tag, print_tagged_na, tagged_na

    diff --git a/docs/reference/remove_labels.html b/docs/reference/remove_labels.html index 4d62008..b2d0acf 100644 --- a/docs/reference/remove_labels.html +++ b/docs/reference/remove_labels.html @@ -40,9 +40,9 @@ - + @@ -131,9 +131,9 @@

    Remove variable label, value labels and user defined missing values

    -

    Use remove_var_label to remove variable label, remove_val_labels -to remove value labels, remove_user_na to remove user defined missing values (na_values and na_range) -and remove_labels to remove all.

    +

    Use remove_var_label() to remove variable label, remove_val_labels() +to remove value labels, remove_user_na() to remove user defined missing values (na_values and na_range) +and remove_labels() to remove all.

    remove_labels(x, user_na_to_na = FALSE, keep_var_label = FALSE)
    @@ -163,12 +163,12 @@ 

    Arg

    Details

    -

    Be careful with remove_user_na and remove_labels, user defined missing values +

    Be careful with remove_user_na() and remove_labels(), user defined missing values will not be automatically converted to NA, except if you specify user_na_to_na = TRUE. user_na_to_na(x) is an equivalent of remove_user_na(x, user_na_to_na = TRUE).

    -

    If you prefer to convert variables with value labels into factors, use to_factor -or use unlabelled.

    +

    If you prefer to convert variables with value labels into factors, use to_factor() +or use unlabelled().

    Examples

    x1 <- labelled_spss(1:10, c(Good = 1, Bad = 8), na_values = c(9, 10)) diff --git a/docs/reference/to_character.html b/docs/reference/to_character.html index b6e1b53..e8dd49a 100644 --- a/docs/reference/to_character.html +++ b/docs/reference/to_character.html @@ -40,7 +40,7 @@ - @@ -131,7 +131,7 @@

    Convert input to a character vector

    -

    By default, to_character is a wrapper for base::as.character(). +

    By default, to_character() is a wrapper for base::as.character(). For labelled vector, to_character allows to specify if value, labels or labels prefixed with values should be used for conversion.

    @@ -164,7 +164,7 @@

    Arg nolabel_to_na -

    Should values with no label be converted to `NA`?

    +

    Should values with no label be converted to NA?

    user_na_to_na @@ -175,7 +175,7 @@

    Arg

    Details

    If some values doesn't have a label, automatic labels will be created, except if - nolabel_to_na is TRUE.

    +nolabel_to_na is TRUE.

    Examples

    v <- labelled(c(1,2,2,2,3,9,1,3,2,NA), c(yes = 1, no = 3, "don't know" = 9)) diff --git a/docs/reference/to_factor.html b/docs/reference/to_factor.html index aa64c20..89241aa 100644 --- a/docs/reference/to_factor.html +++ b/docs/reference/to_factor.html @@ -41,11 +41,10 @@ +unlabelled(x) is a shortcut for to_factor(x, strict = TRUE, unclass = TRUE, labelled_only = TRUE)." /> @@ -135,11 +134,10 @@

    Convert input to a factor.

    The base function base::as.factor() is not a generic, but this variant -is. By default, to_factor is a wrapper for base::as.factor(). -Please note that to_factor differs slightly from as_factor -method provided by haven package.

    -

    unlabelled(x) is a shortcut for -to_factor(x, strict = TRUE, unclass = TRUE, labelled_only = TRUE).

    +is. By default, to_factor() is a wrapper for base::as.factor(). +Please note that to_factor() differs slightly from haven::as_factor() +method provided by haven package.

    +

    unlabelled(x) is a shortcut for to_factor(x, strict = TRUE, unclass = TRUE, labelled_only = TRUE).

    to_factor(x, ...)
    @@ -197,7 +195,7 @@ 

    Arg nolabel_to_na -

    Should values with no label be converted to `NA`?

    +

    Should values with no label be converted to NA?

    sort_levels @@ -223,7 +221,7 @@

    Arg unclass

    If not converted to a factor (when strict = TRUE), -convert to a character or a numeric factor?

    +convert to a character or a numeric factor by applying base::unclass()?

    labelled_only @@ -234,20 +232,20 @@

    Arg

    Details

    If some values doesn't have a label, automatic labels will be created, except if - nolabel_to_na is TRUE.

    +nolabel_to_na is TRUE.

    If sort_levels == 'values', the levels will be sorted according to the values of x. - If sort_levels == 'labels', the levels will be sorted according to labels' names. - If sort_levels == 'none', the levels will be in the order the value labels are defined - in x. If some labels are automatically created, they will be added at the end. - If sort_levels == 'auto', sort_levels == 'none' will be used, except if some - values doesn't have a defined label. In such case, sort_levels == 'values' will - be applied.

    +If sort_levels == 'labels', the levels will be sorted according to labels' names. +If sort_levels == 'none', the levels will be in the order the value labels are defined +in x. If some labels are automatically created, they will be added at the end. +If sort_levels == 'auto', sort_levels == 'none' will be used, except if some +values doesn't have a defined label. In such case, sort_levels == 'values' will +be applied.

    When applied to a data.frame, only labelled vectors are converted by default to a - factor. Use labelled_only = FALSE to convert all variables to factors.

    +factor. Use labelled_only = FALSE to convert all variables to factors.

    unlabelled() is a shortcut for quickly removing value labels of a vector or of a data.frame. If all observed values have a value label, then the vector will be converted into a factor. Otherwise, the vector will be unclassed. -If you want to remove value labels in all cases, use remove_val_labels.

    +If you want to remove value labels in all cases, use remove_val_labels().

    Examples

    v <- labelled(c(1,2,2,2,3,9,1,3,2,NA), c(yes = 1, no = 3, "don't know" = 9)) diff --git a/docs/reference/to_labelled.html b/docs/reference/to_labelled.html index d1d4053..81892ef 100644 --- a/docs/reference/to_labelled.html +++ b/docs/reference/to_labelled.html @@ -177,26 +177,26 @@

    Value

    A tbl data frame or a labelled vector.

    Details

    -

    to_labelled is a general wrapper calling the appropriate sub-functions.

    -

    memisc_to_labelled converts a data.set object created with +

    to_labelled() is a general wrapper calling the appropriate sub-functions.

    +

    memisc_to_labelled() converts a memisc::data.set() object created with memisc package to a labelled data frame.

    -

    foreign_to_labelled converts data imported with read.spss -or read.dta from foreign package to a labelled data frame, -i.e. using labelled class. +

    foreign_to_labelled() converts data imported with foreign::read.spss() +or foreign::read.dta() from foreign package to a labelled data frame, +i.e. using haven::labelled(). Factors will not be converted. Therefore, you should use use.value.labels = FALSE -when importing with read.spss or convert.factors = FALSE when -importing with read.dta.

    -

    To convert correctly defined missing values imported with read.spss, you should +when importing with foreign::read.spss() or convert.factors = FALSE when +importing with foreign::read.dta().

    +

    To convert correctly defined missing values imported with foreign::read.spss(), you should have used to.data.frame = FALSE and use.missings = FALSE. If you used the option to.data.frame = TRUE, meta data describing missing values will not be attached to the import. If you used use.missings = TRUE, missing values would have been converted to NA.

    -

    So far, missing values defined in Stata are always imported as NA by -read.dta and could not be retrieved by foreign_to_labelled.

    +

    So far, missing values defined in Stata are always imported as NA by +foreign::read.dta() and could not be retrieved by foreign_to_labelled().

    See also

    -

    labelled (foreign), read.spss (foreign), - read.dta (foreign), data.set (memisc), - importer (memisc), to_factor.

    +

    Examples

    if (FALSE) { diff --git a/docs/reference/update_labelled.html b/docs/reference/update_labelled.html index 7aacd53..f19ca65 100644 --- a/docs/reference/update_labelled.html +++ b/docs/reference/update_labelled.html @@ -41,7 +41,7 @@ @@ -131,8 +131,8 @@

    Update labelled data to last version

    -

    Labelled data imported with haven version 1.1.2 or before or -created with labelled version 1.1.0 or before was using +

    Labelled data imported with haven version 1.1.2 or before or +created with haven::labelled() version 1.1.0 or before was using "labelled" and "labelled_spss" classes.

    @@ -165,9 +165,12 @@

    Details "haven_labelled_spss" are used instead.

    Since haven 2.3.0, "haven_labelled" class has been evolving using now vctrs package.

    -

    update_labelled convert labelled vectors +

    update_labelled() convert labelled vectors from the old to the new classes and to reconstruct all labelled vectors with the last version of the package.

    +

    See also

    + +