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

Add support for Stata "data label" writing #449

Closed
aaronrudkin opened this issue May 28, 2019 · 3 comments
Closed

Add support for Stata "data label" writing #449

aaronrudkin opened this issue May 28, 2019 · 3 comments
Labels
feature a feature request or enhancement wip work in progress
Milestone

Comments

@aaronrudkin
Copy link

@aaronrudkin aaronrudkin commented May 28, 2019

Stata files have a "data label", which contains a file-level metadata summary of the data. When data is read via read_dta, this label is read; i.e. my_df <- read_dta("test.dta"); attributes(my_df) clearly shows the attribute "label".

However, when setting the attribute "label" to a tibble inside R and using write_dta, this attribute is not written. So, for example, my_df = tibble(X = 1:10, Y=1:10); attr(my_df, "label") = "Test label"; write_dta(my_df, "test_out.dta"); attributes(read_dta("test_out.dta")) will not work.

This functionality is supported by foreign.

@gorcha
Copy link
Member

@gorcha gorcha commented May 30, 2019

Hey Aaron,

Have submitted a pull request (#452) that implements this functionality using a label argument to write_dta(). This defaults to the label attribute of the input data frame consistent with read_dta().

Cheers,
Danny

@aaronrudkin
Copy link
Author

@aaronrudkin aaronrudkin commented May 30, 2019

Thanks for the very quick turnaround time, Danny! Feel free to close this issue on merge.

@hadley hadley added feature a feature request or enhancement wip work in progress labels Nov 6, 2019
@hadley hadley added this to the v2.2.0 milestone Nov 6, 2019
@hadley hadley closed this as completed in df18cc2 Nov 6, 2019
@lock
Copy link

@lock lock bot commented May 5, 2020

This old issue has been automatically locked. If you believe you have found a related problem, please file a new issue (with reprex) and link to this issue. https://reprex.tidyverse.org/

@lock lock bot locked and limited conversation to collaborators May 5, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature a feature request or enhancement wip work in progress
Projects
None yet
Development

No branches or pull requests

3 participants