Replacing spaces with periods


I have a data frame with the variable "weight_lb_oz" and the observations are recorded as 10 11, 12 13, 16 15 etc.) There is a space between lb and oz and I was wondering if there is any way to replace the space with a period instead.

Help appreciated!



Something like this?


df <- c("weight_lb_oz")
str_replace_all(df, "_", ".")
#> [1] ""

Created on 2020-10-18 by the reprex package (v0.3.0)

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.