hold range in data.frame (or table)
I would like to do this
set.seed(667)
df <- data.frame(a = sample(c(c(4,7),11,NA), 10, rep = TRUE),
b = sample(c(1, 2, 3, NA, 5, 6), 10, rep=TRUE),
c = sample(c(11, 12, 13, 14, 15, 16), 10, rep=TRUE))
but instead of getting this,
df
a b c
1 4 NA 12
2 7 6 12
3 NA NA 14
4 11 1 16
5 NA 2 14
6 NA 3 13
7 11 NA 13
8 NA 6 15
9 7 3 16
10 7 5 16
I would like to get something this where I have a range at some points,
a b c
1 4-7 NA 12
2 4-7 6 12
3 NA NA 14
4 11 1 16
5 NA 2 14
6 NA 3 13
7 11 NA 13
8 NA 6 15
9 4-7 3 16
10 4-7 5 16
I'm confused and tired and asking for help.
No comments:
Post a Comment