Factor variable shown as character variable in data frame after recent R update from 3.5.2 to 4.0.1
From what I now, you have two options:
- Set
options(stringsAsFactors = TRUE)
at every start of your R scripts. - Set
options(stringsAsFactors = TRUE)
on your.Rprofile
Does converting character columns to factors save memory?
Converting to factor won't save space because characters are stored in a hash table. See section 1.10 The CHARSXP cache of R Internals.
Converting to factor may improve processing time if your code would need to convert to factor (running a regression, classification, etc.), but it won't improve processing time if you're doing string manipulation because it would have to convert the factor back to a character. So it really depends on what you're doing.
Comma separator ignored when reading in .csv files to R on a Spanish computer
In read.csv
, you need sep = ";"
to separate columns and dec = ","
to consider decimals with comma separator.
eg <- read.csv("D:/02_COVID-19/Analysis/eglonglat.csv", sep = ";", dec = ",")
These are default settings in read.csv2
eg <- read.csv2("D:/02_COVID-19/Analysis/eglonglat.csv")
Since you are on R 4.0.0, you don't need stringsAsFactors = FALSE
.
Debugging further it seems OP has "."
as decimal separator so this works :
eg <- read.csv("D:/02_COVID-19/Analysis/eglonglat.csv", sep = ";")
Related Topics
Delete "" from CSV Values and Change Column Names When Writing to a CSV
Fully Reproducible Parallel Models Using Caret
Is There a Way of Manipulating Ggplot Scale Breaks and Labels
Cumulative Count of Each Value
Ggplot2: Changing the Order of Stacks on a Bar Graph
Wide to Long Multiple Measures Each Time
Automatically Create Formulas for All Possible Linear Models
Plot One Numeric Variable Against N Numeric Variables in N Plots
Promise Already Under Evaluation: Recursive Default Argument Reference or Earlier Problems
Common Legend for Multiple Plots in R
Ggmap Error: Geomrasterann Was Built with an Incompatible Version of Ggproto
R Error "Sum Not Meaningful for Factors"
How to Define the "Mid" Range in Scale_Fill_Gradient2()