When using readr_0.1.1
to read in a .csv file with a missing field name, the name is automatically set to [EMPTY]
:
library("readr")
library("dplyr")
df <- read_csv(",foo\n1,bar")
> names(df)
[1] "[EMPTY]" "foo"
I am trying to rename "[EMPTY]"
using dplyr_0.4.2
but I cannot find the right solution.
I have tried:
> rename(df, baz = [EMPTY])
Error: unexpected '[' in "rename(df, baz = ["
> rename_(df, "baz" = "[EMPTY]")
Error in parse(text = x) : <text>:1:1: unexpected '['
1: [
^
What is the right way to do it?