ropensci / git2rdata

An R package for storing and retrieving data.frames in git repositories.

Home Page:https://ropensci.github.io/git2rdata/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

write_vc() & relabel() get stuck when rewriting factor with an empty-string level

florisvdh opened this issue · comments

It is what the title says: in the odd case where one factor level is an empty string, strange things happen (see html-notebook).

with write_vc():

  1. writing the dataframe for the first time, and reading it back in poses no problem: the same dataframe is returned. Also, existing NA-values for the factor are handled well, and distinguished from the empty-string level.
  2. however writing it (unchanged) for the second time gives the error:
Error: new factor labels for var
new indices labels for var
  1. when adding strict = FALSE (which shouldn't be needed), it appears that the empty string is replaced by NA values, resulting in potentially large diffs (which, in my real case, is my problem at hand)

When relabelling the level with relabel(), an extra label is added in the yml file; the old label remains and indices remain unchanged.

Thanks for reporting this bug. I'll look into this.

Thanks for fixing this!