fork download
  1. library(magrittr)
  2. x <- c("土地1建物2車位3", "土地11建物22車位33")
  3. x %>%
  4. gsub("土地", "", .) %>% # 刪除 "土地"
  5. strsplit("建物|車位") %>% # 在 "建物" 或 "車位" 切開
  6. sapply(., as.numeric) %>% # 字𧮥轉成數字
  7. t
  8. # [,1] [,2] [,3]
  9. # [1,] 1 2 3
  10. # [2,] 11 22 33
  11.  
Success #stdin #stdout 0.24s 183936KB
stdin
Standard input is empty
stdout
     [,1] [,2] [,3]
[1,]    1    2    3
[2,]   11   22   33