Good morning everyone, I have read several things about columns splitting with R but I could not find how to fix my case.
I would like to use the 'separate' function from tidyr R package to split columns of a dataframe in two columns each, according to a separator.
I have this data frame:
dat1
AIN5997 AIN7452 AIN8674 AIN9655
001 01/02 02/02 02/02 01/02
002 01/02 01/01 02/02 02/02
003 01/02 01/02 01/01 02/02
004 01/02 01/01 02/02 01/02
005 01/01 01/01 02/02 02/02
006 01/02 01/02 01/01 02/02
...
And I would like to separate each column into two according to "/", and if possible while keeping column names (e.g. : AIN5997 would become AIN5997.1 and AIN5997.2)
I think it is possible with 'separate' but I could not extend the procedure to each column of my frame when trying with an 'apply' (probably because separate works with dataframes and a single column at a time). This must be actually very easy but my R skills are quite bad!
There are many threads explaining how to split one column into two, like this one: Split a column of a data frame to multiple columns
but I cannot find how to expand the procedure for several columns simultaneously.
Thank you very much for your help,
All the best :)