Thanks for the reprex. Would have been hard to debug without it.
suppressPackageStartupMessages(library(dplyr))
suppressPackageStartupMessages(library(stringr))
# created by filtering temps from rvest, to get some negatives
njal <- structure(list(country = c("Iceland", "Iceland", "Iceland", "Iceland",
"Iceland", "Iceland", "Iceland", "Iceland", "Iceland", "Iceland",
"Iceland", "Iceland"), city = c("Reykjavík", "Reykjavík", "Reykjavík",
"Reykjavík", "Reykjavík", "Reykjavík", "Reykjavík", "Reykjavík",
"Reykjavík", "Reykjavík", "Reykjavík", "Reykjavík"), month = c("jan",
"feb", "mar", "apr", "may", "jun", "jul", "aug", "sep", "oct",
"nov", "dec"), temp = c("-0.5(31.1)", "0.4(32.7)", "0.5(32.9)",
"2.9(37.2)", "6.3(43.3)", "9.0(48.2)", "10.6(51.1)", "10.3(50.5)",
"7.4(45.3)", "4.4(39.9)", "1.1(34.0)", "-0.2(31.6)")), class = c("tbl_df",
"tbl", "data.frame"), row.names = c(NA, -12L))
# simplify regex by discarding ºF, everything from ( to end of line
fahr <- "[(].*$"
ditch_fahr <- function(x) {str_remove(x,fahr)}
ditch_fahr(njal$temp) %>% as.numeric()
#> [1] -0.5 0.4 0.5 2.9 6.3 9.0 10.6 10.3 7.4 4.4 1.1 -0.2
Created on 2020-03-22 by the reprex package (v0.3.0)