【发布时间】:2021-03-15 04:22:41
【问题描述】:
最好,我正在寻找dplyr 解决方案。
我有
> str(p)
'data.frame': 25 obs. of 1 variable:
$ intram_size: chr "5" "4,7 x 6,6 mm" "4x6x7 mm" "5" ...
有
> head(p)
intram_size
1 5
2 4,7 x 6,6 mm
3 4x6x7 mm
4 5
5 4x11
6 1x4
p$intram_size 表示某个肿瘤的二维测量值。我需要提取最大的数字,即测量的最大直径。一个问题是, 已被使用。
Expected output
> head(p)
intram_size new
1 5 5
2 4,7 x 6,6 mm 6.6
3 4x6x7 mm 7
4 5 5
5 4x11 11
6 1x4 4
数据样本
p <- structure(list(intram_size = c("5", "4,7 x 6,6 mm", "4x6x7 mm",
"5", "4x11", "1x4", "7x10", "8", "3", "7", "7x4x3", "10x5", "8",
"7", "11", "7", "10", "5", "13", "5", "3,5", "10", "2,5", "7",
"11 x 6 x 4")), row.names = c(NA, 25L), class = "data.frame")
【问题讨论】:
标签: r string dataframe dplyr character