Try to search your question here, if you can't find : Ask Any Question Now ?

using separate to divide column containing date format

HomeCategory: stackoverflowusing separate to divide column containing date format
Avatarcraig asked 1 month ago

I have a data set with columns containing a date and test-value

Dataset
CollumnA
03.01.19 3,0
02.02.18 2,0
01.03.17 1,0

I need them separated in a date-column and a value-column:

Dataset
date        value
03.01.19    3,0
02.02.18    2,0
01.03.17    1,0

separate(Dataset, "CollumnA", 
                  into = c("date","value"), 
                         )

but it gives me new columns like this and discards the rest of the information:

Dataset
date        value
03          01
02          02
01          03

How do I correct this?

I have tried tidyr:

separate(Dataset, "CollumnA", 
                  into = c("date","value")

I have also tried changing the space between date and value and specifying it
with the sep = "" argument.

CollumnA
03.01.19/3,0
02.02.18/2,0
01.03.17/1,0

separate(Dataset, "CollumnA", 
                  into = c("date","value"), 
                     sep= "/"    )
1 Answers
Best Answer
AvatarAmit answered 1 month ago
Your Answer

1 + 11 =

Popular Tags

WP Facebook Auto Publish Powered By : XYZScripts.com