hadley / reshape

An R package to flexible rearrange, reshape and aggregate data
http://had.co.nz/reshape
Other
210 stars 58 forks source link

dcast 'sep' argument? #88

Open biodavidjm opened 6 years ago

biodavidjm commented 6 years ago

As you well know, data.table also has a dcast function. There is one option that it is very helpful:

sep | Character vector of length 1, indicating the separating character in variable names generated during casting. Default is _ for backwards compatibility.

Is there a way to do the same thing with reshape2::dcast? I really like reshape2 and that option for dcast would be really useful.

cderv commented 6 years ago

Not a direct answer but for information, know that tidyr is replacing reshape2 and is part of the tidyverse. See tidyr's README

tidyr replaces reshape2 (2010-2014) and reshape (2005-2010). Somewhat counterintuitively each iteration of the package has done less. tidyr is designed specifically for tidying data, not general reshaping (reshape2), or the general aggregation (reshape).

I point to this because the tidyr 📦 has a spread function that act like dcast and have a sep argument to do what you are look for. See tidyr reference about spread