Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想用两个词分割一个字符串:
s <- "PCB153 treated HepG2 cells at T18" strsplit(s, split = <treated><at>)
我应该写什么而不是<>?
我会得到:
"PCB153" "HepG2 cells" "T18"
strsplit(s, split="treated|at") #[[1]] #[1] "PCB153 " " HepG2 cells " " T18"
您必须将其作为字符串输入。拆分处理:
s <- "PCB153 treated HepG2 cells at T18" s2 <- strsplit(s,split="treated") unlist(s2)
拆分处理和在:
unlist(strsplit(unlist(s2),split="at"))