Quantcast
Channel: Active questions tagged r - Stack Overflow
Viewing all articles
Browse latest Browse all 201867

Separating a column in multiple columns in R

$
0
0

Here is my data:

df1<-read.table(text= "Group
11Z-23456
12B-10000
22M-2000
12M-1100
33G-100",header=TRUE)

I want to get this data:

A   B   C   Code
1   1   Z   23456
1   2   B   10000
2   2   M   2000
1   2   M   1100
3   3   G   100

As you can see from my data, I want to separate the values in the Group This is just an small sample, but please consider for a large sample.


Viewing all articles
Browse latest Browse all 201867

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>