You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Factor data passed to excelTable is first coerced to a string and then the string is coerced back to a factor using default R behavior, which drops unused factor levels and potentially reorders factors.
To Reproduce
Run the code below and change the Name column to C, A. The expectation would be that there are still 3 levels, but only two exist.
Expected behavior
Factor levels and labels retained in the order given.
Desktop (please complete the following information):
OS: Windows 10
Browser Chrome
Version [e.g. 22] Version 84.0.4147.125 (Official Build) (64-bit)
Additional context
I believe the issue lies in the fact that when R data are converted to JSON (I think) they are passed as string type. Then when the JSON is passed back to R the excel_to_R function callsrbind.data.frame, which per default behavior converts character to factor (depending on environmental settings).
You may consider this a feature request, but I found it a bit unexpected and scary. I would guess that if this is a fix/change you are willing to incorporate you will have some design decisions to make and so I leave it up to you to pick a future direction. My first guess is that the data frame passed to columns argument of excelTable could be used to control the reordering, perhaps by attaching it to the input object with the data?
Thanks
The text was updated successfully, but these errors were encountered:
Factor data passed to excelTable is first coerced to a string and then the string is coerced back to a factor using default R behavior, which drops unused factor levels and potentially reorders factors.
To Reproduce
Run the code below and change the Name column to C, A. The expectation would be that there are still 3 levels, but only two exist.
Expected behavior
Factor levels and labels retained in the order given.
Desktop (please complete the following information):
Additional context
I believe the issue lies in the fact that when R data are converted to JSON (I think) they are passed as string type. Then when the JSON is passed back to R the excel_to_R function calls
rbind.data.frame
, which per default behavior converts character to factor (depending on environmental settings).You may consider this a feature request, but I found it a bit unexpected and scary. I would guess that if this is a fix/change you are willing to incorporate you will have some design decisions to make and so I leave it up to you to pick a future direction. My first guess is that the data frame passed to columns argument of
excelTable
could be used to control the reordering, perhaps by attaching it to the input object with the data?Thanks
The text was updated successfully, but these errors were encountered: