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

aaronrudkin opened this issue May 28, 2019 · 2 comments


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.


This comment has been minimized.

Copy link

@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().



This comment has been minimized.

Copy link

@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 wip labels Nov 6, 2019
@hadley hadley added this to the v2.2.0 milestone Nov 6, 2019
@hadley hadley closed this in df18cc2 Nov 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
None yet
3 participants
You can’t perform that action at this time.