I want to remove commas and every characters after commas in strings over all columns
from <- c("UK, port unspecified", "Nantes", "London", "America", "La Martinique, port unspecified")
to <- c("Benin", "Widha", "France, *", "America, Port unspecified", "London")
network <- data.frame(from, to)
My df :
from to
1 UK, port unspecified Benin
2 Nantes Widha
3 London France, *
4 America America, Port unspecified
5 La Martinique, port unspecified London
What I want :
from to
1 UK Benin
2 Nantes Widha
3 London France
4 America America
5 La Martinique London
Can I combine transmute_all
(or transmute_if
) (package dplyr) and split
(package tidyr) functions in dplyr pipe ?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…