rename_
works as expected for non-pathological column names
%>% rename_(foo = 'testcol')
But what if I'd like to rename a column which has a space?
%>% rename_(foo = 'test col')
I get an error that says:
Error in parse(text = x) (from #12) : <text>:1:6: unexpected symbol
I could use make.names
but is there no way to rename a column without that extra step?
You can try with
backquotes
Using a reproducible example
Or using
rename_
(though I am not sure if this is correct syntax as usually.dots
are needed.) Using similar syntax from OP's postdata