Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Printing also the type of labelled objects #188

Merged
merged 1 commit into from Jun 24, 2016
Merged

Printing also the type of labelled objects #188

merged 1 commit into from Jun 24, 2016

Conversation

larmarange
Copy link
Contributor

@larmarange larmarange commented Jun 22, 2016

Proposition to also display the type of a labelled object (as this information is "hidden" by the labelled class).

Example:

> s1 <- labelled(c("M", "M", "F"), c(Male = "M", Female = "F"))
> s1
<Labelled (character)>
[1] M M F

Labels:
 value  label
     M   Male
     F Female
> s2 <- labelled(c(1, 1, 2), c(Male = 1, Female = 2))
> s2
<Labelled (double)>
[1] 1 1 2

Labels:
 value  label
     1   Male
     2 Female

@larmarange
Copy link
Contributor Author

In addition, would it be appropriate to also display the variable label?

I.e. something like:

<Labelled (character)> Sex of the respondant
[1] M M F

Labels:
 value  label
     M   Male
     F Female

@hadley
Copy link
Member

hadley commented Jun 22, 2016

I don't think the parens are necessary here.

I'd rather not print the label, I think because it would be more inconsistent with print method for other columns. But I don't feel strongly about it.

@larmarange
Copy link
Contributor Author

The pull request has been updated accordindly

@hadley hadley merged commit aaa3f87 into tidyverse:master Jun 24, 2016
@hadley
Copy link
Member

hadley commented Jun 24, 2016

Thanks!

@lock lock bot locked and limited conversation to collaborators Jun 26, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants