Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion R/read.R
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ set_utf8 = function(x) {
#' @param promote_to_multi logical; in case of a mix of Point and MultiPoint, or
#' of LineString and MultiLineString, or of Polygon and MultiPolygon, convert
#' all to the Multi variety; defaults to \code{TRUE}
#' @param stringsAsFactors logical; logical: should character vectors be
#' @param stringsAsFactors logical; should character vectors be
#' converted to factors? Default for \code{read_sf} or R version >= 4.1.0 is
#' \code{FALSE}, for \code{st_read} and R version < 4.1.0 equal to
#' \code{default.stringsAsFactors()}
Expand Down
10 changes: 5 additions & 5 deletions vignettes/sf2.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -119,18 +119,18 @@ of the datasource, by trying them all in turn.

`st_read()` follows the conventions of base R, similar to how it
reads tabular data into `data.frame`s. This means that character
data are read, by default as `factor`s. For those who insist
on retrieving character data as character vectors, the argument
`stringsAsFactors` can be set to `FALSE`:
data are read as `character` vectors by default (since R 4.1.0).
For those who insist on retrieving character data as `factor`s,
the argument `stringsAsFactors` can be set to `TRUE`:

```{r eval=FALSE}
st_read(fname, stringsAsFactors = FALSE)
st_read(fname, stringsAsFactors = TRUE)
```

Alternatively, a user can set the global option `stringsAsFactors`, and this will have the same effect:

```{r}
options(stringsAsFactors = FALSE)
options(stringsAsFactors = TRUE)
st_read(fname)
```

Expand Down
Loading