Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Any way to preserve spaces in names when calling transform()?

Tags:

r

Is there any way to preserve spaces in a data.frame's column names when calling transform()? Currently they get munged:

> transform(data.frame('a b'=1, check.names=F), `c d`=`a b`)
  a.b c.d
1   1   1
like image 680
Yang Avatar asked Dec 05 '25 08:12

Yang


1 Answers

Just feed check.names=F into transform:

> transform(data.frame('a b'=1, check.names=F), `c d`=`a b`,check.names=F)
  a b c d
1   1   1

However, I don't see this mentioned in the documentation for ?transform!

like image 58
mathematical.coffee Avatar answered Dec 07 '25 21:12

mathematical.coffee



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!