Join GitHub today
GitHub is home to over 40 million developers working together to host and review code, manage projects, and build software together.
Sign upOption to remove attributes while importing #250
Comments
This comment has been minimized.
This comment has been minimized.
Can you give me a quick example of this? You can use |
This comment has been minimized.
This comment has been minimized.
I didn't think about using I keep running into situations like following: ## load packages
library("rio")
library("tidyr")
## import and gather
df_auto <- import("http://www.stata-press.com/data/r13/auto.dta") %>%
gather(vals, vars, price:foreign)
## output
Warning message:
attributes are not identical across measure variables;
they will be dropped I was thinking about a feature like |
This comment has been minimized.
This comment has been minimized.
Do you know if this happens with the new tidyr functions? I think gather/spread are also deprecated. |
This comment has been minimized.
This comment has been minimized.
I don't think this is limited to deprecated functions, or to tidyr. Here is another example with ## load packages
library("rio")
library("dplyr")
## import and join
df_auto <- import("http://www.stata-press.com/data/r13/auto.dta") %>%
left_join(., data.frame(trunk = as.numeric(5:23), grade = LETTERS[5:23]),
by = "trunk")
## output
Warning message:
Column `trunk` has different attributes on LHS and RHS of join In this example, the variable "trunk" does not have a label in the new (RHS) data frame, but if it did, and if that label did not match the label in the LHS data frame, we would still get this warning. |
This comment has been minimized.
This comment has been minimized.
So, on further inspection, this behavior is basically correct. You'll want to After that you'll still see warnings on this example because |
resulumit commentedDec 20, 2019
•
edited
Please specify whether your issue is about:
While importing data stored with rich file formats (SPSS, Stata, etc.), rio imports variable attributes, such as labels, as well. These attributes can be useful in many instances, but they can also be an annoyance. For example, they lead to warnings messages (that attributes do not match) while merging data frames or gathering variables if attributes do not match.
Therefore, I believe it would enhance rio if importing attributes was an option.