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

Factor id levels get dropped #89

Closed
dcooley opened this issue Dec 9, 2020 · 1 comment
Closed

Factor id levels get dropped #89

dcooley opened this issue Dec 9, 2020 · 1 comment

Comments

@dcooley
Copy link
Owner

dcooley commented Dec 9, 2020

Originally reported here - SymbolixAU/mapdeck#337 (comment)

When using a factor column as an 'id', the levels get dropped

df <- data.frame(
  x = 1:5
  , y = 1:5
  , val = letters[1:5]
  , stringsAsFactors = TRUE
)


sf <- sfheaders::sf_linestring(
  obj = df
  , x = "x"
  , y = "y"
  # , linestring_id = "val"
  , keep = TRUE
)

str( sf$val )
# Factor w/ 5 levels "a","b","c","d",..: 1

sf <- sfheaders::sf_linestring(
    obj = df
    , x = "x"
    , y = "y"
    , linestring_id = "val"
    , keep = TRUE
)

str( sf$val )
# int [1:5] 1 2 3 4 5
@dcooley
Copy link
Owner Author

dcooley commented Jan 3, 2024

fixed by - dcooley/geometries@af296aa

needs {geometries} 0.2.4

@dcooley dcooley closed this as completed Jan 3, 2024
dcooley pushed a commit that referenced this issue Jan 3, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant