- Added
quiet
argument added to functions (defaults toFALSE
).
-
REMOVED
factorise_with_dictionary()
is removed and replaced withrecode_with_dictionary()
to support the introduction of converters (below). Since this package is not yet in wide usage, I have decided to make this a breaking change.
-
CHANGED
- The column name
factor_file
is now renamed torecode_with
to support the introduction of converters (below). Since this package is not yet in wide usage, I have decided to make this a breaking change. - 'Factor files' (i.e. the spreadsheets used to map values to factor levels) are now called 'mapping spreadsheets'.
- Columns
LOGICAL_CHAR
,LOGICAL_INT
, andyesno
added to the built-inpoker
dataset for unit testing.
- The column name
-
ADDED
- Converters! Pre-made converters so that you don't have to keep making factor files for routine jobs:
<truefalse>
- Strict conversion to Logical. Truthy values (1, y, yes, t, true) return LogicalTRUE
, falsey values (0, n, no, f, false) return FALSE, everything else (includingNA
) returnsNA
.<truefalse-lazy>
- Lazy conversion to Logical. Truthy values returnTRUE
, everything else returnsFALSE
,NA
returnsNA
.<yesno>
and<noyes>
- Like<truefalse>
, but returns Factor instead of Logical. The difference between the two is the order of the levels; you may want<noyes>
if you're planning to feed a variable to a model, for example, so that the first level ("No") is used as the reference level.<yesno-lazy>
and<noyes-lazy>
- Like<truefalse-lazy>
, but returns Factor instead of Logical.
- Functions now have a
up
argument that gives you optional control over the environment where the functions will be evaluated. recode_with_dictionary()
tells you if your mapping spreadsheet is missing the required columnslevels
andlabels
.recode_with_dictionary()
announces which mapping spreadsheet and columns it's currently working on. Good for large datasets so you know it isn't frozen. Closes #10.- Optional
exclude
column in mapping spreadsheets, which lets you exclude a level/label from the final factor (i.e. turn it intoNA
) by setting the value ofexclude
to (case-insensitive)true
,t
,yes
,y
, or1
. Previously,NA
ing levels was done by omitting them from the factor file entirely. This lets you keep the level in the dictionary for completeness and transparency. - Documentation demonstrates how unused factor levels can be dropped with
base::droplevels()
. Closes #9 - Unit tests.
- Converters! Pre-made converters so that you don't have to keep making factor files for routine jobs:
-
FIXED
.Globalenv
is no longer hard-coded. Closes #14.- Empty
recode_with
cells (e.g. spaces only) are handled correctly. Closes #11. - Files with multiple extensions (e.g. "index.tsv.txt") are accounted for.
- Mapping spreadsheets with mixed-case names are handled properly.
recode_with_dictionary()
trims trailing whitespace from factor levels and labels at all stages, including from the raw input vector.
-
FIXED
- Non-syntactic column names (e.g. column names with spaces) are now okay. Closes #2.
-
CHANGED
factor_file
andfactorise_with_dictionary()
are no longer picky about users giving filenames without extensions. It just chops off .tsv and .txt extensions if they're present infactor_file
.- Factor file columns now actually match the argument names of
factor()
. They used to belevel
andlabel
, and now they arelevels
andlabels
.
-
ADDED
- Add a column with a non-syntactic name (
COIN FLIP
) to the built-inpoker
dataset. - Add a list column (
LIST_COL
) to the built-inpoker
dataset. Closes #4. - Updated the
poker
dictionary to includeCOIN FLIP
but notLIST_COL
(so that the dictionary now has both a column that is in the dictionary but not in the data (not_exist
) as well as a column that is in the data but not in the dictionary).
- Add a column with a non-syntactic name (
- Initial commit and release