codebook icon indicating copy to clipboard operation
codebook copied to clipboard

Bug with labelled_spss class?

Open beckerbenj opened this issue 4 years ago • 0 comments

Hi, thank you for the very helpful package!

Unfortunately, there seems to be an issue with the labelled_spss class (with "labelled" version 2.8.0), which is problematic for the use of codebook together with haven:

df1 <- df2 <- data.frame(v1 = 1:2,
                         v2 = 3:4)

df1$v1 <- labelled::labelled(df1$v1)
codebook::codebook(df1)
#> No missing values.

Metadata

Description

Dataset name: df1

The dataset has N=2 rows and 2 columns. 2 rows have no missing values on any column.

Metadata for search engines
  • Date published: 2021-10-05
x
v1
v2

Variables

v1

Distribution

Distribution of values for v1

0 missing values.

Summary statistics

name data_type n_missing complete_rate min median max mean sd n_value_labels hist label
v1 haven_labelled 0 1 1 1.5 2 1.5 0.7071068 0 <U+2587><U+2581><U+2581><U+2581><U+2581><U+2581><U+2581><U+2587> NA

v2

Distribution

Distribution of values for v2

0 missing values.

Summary statistics

name data_type n_missing complete_rate min median max mean sd hist label
v2 numeric 0 1 3 3.5 4 3.5 0.7071068 <U+2587><U+2581><U+2581><U+2581><U+2587> NA

Missingness report

Codebook table

name data_type n_missing complete_rate min median max mean sd n_value_labels hist label
v1 haven_labelled 0 1 1 1.5 2 1.5 0.7071068 0 <U+2587><U+2581><U+2581><U+2581><U+2581><U+2581><U+2581><U+2587> NA
v2 numeric 0 1 3 3.5 4 3.5 0.7071068 NA <U+2587><U+2581><U+2581><U+2581><U+2587> NA
JSON-LD metadata

The following JSON-LD can be found by search engines, if you share this codebook publicly on the web.

{
  "name": "df1",
  "datePublished": "2021-10-05",
  "description": "The dataset has N=2 rows and 2 columns.\n2 rows have no missing values on any column.\n\n\n## Table of variables\nThis table contains variable names, labels, and number of missing values.\nSee the complete codebook for more.\n\n|name |label | n_missing|\n|:----|:-----|---------:|\n|v1   |NA    |         0|\n|v2   |NA    |         0|\n\n### Note\nThis dataset was automatically described using the [codebook R package](https://rubenarslan.github.io/codebook/) (version 0.9.4.9000).",
  "keywords": ["v1", "v2"],
  "@context": "http://schema.org/",
  "@type": "Dataset",
  "variableMeasured": [
    {
      "name": "v1",
      "@type": "propertyValue"
    },
    {
      "name": "v2",
      "@type": "propertyValue"
    }
  ]
}`
df2$v1 <- labelled::labelled_spss(df2$v1)
codebook::codebook(df2)
#> No missing values.
#> Error: Can't combine `min` <integer> and `min` <character>.

Created on 2021-10-05 by the reprex package (v2.0.0)

beckerbenj avatar Oct 05 '21 14:10 beckerbenj