Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
strengejacke committed Aug 29, 2023
1 parent d92791e commit 5d20f0e
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,9 @@ CHANGES
* `recode_into()` gains an `overwrite` argument to skip overwriting already
recoded cases when multiple recode patterns apply to the same case.

* `data_read()` now passes the `encoding` argument to `data.table::fread()`.
This allows to read files with non-ASCII characters.

* `datawizard` moves from the GPL-3 license to the MIT license.

BUG FIXES
Expand Down
6 changes: 5 additions & 1 deletion R/data_read.R
Original file line number Diff line number Diff line change
Expand Up @@ -271,7 +271,11 @@ data_read <- function(path,

.read_text <- function(path, encoding, verbose, ...) {
if (insight::check_if_installed("data.table", quietly = TRUE)) {
out <- data.table::fread(input = path, ...)
# set proper default encoding-value for fread
if (is.null(encoding)) {
encoding <- "unknown"
}
out <- data.table::fread(input = path, encoding = encoding, ...)
class(out) <- "data.frame"
return(out)
}
Expand Down

0 comments on commit 5d20f0e

Please sign in to comment.