I have a data.frame of months in both English and Dutch:
library(stringr)
months.english <- month.name
months.dutch <- c("januari", "februari", "maart", "april", "mei", "juni","juli", "augustus", "september", "oktober", "november", "december")
months <- data.frame(months.english, months.dutch)
I also have a variable of dates, which somewhat unstructured and in both English and Dutch:
time <- (c("1 januari 2001", "12 december 2001", "December 9 2001", "2001 maart 13"))
time <- data.frame(time)
time$months <- NA
I want to do the following: in the time data.frame I want the months variable to be the month from the dates string, but for those months that are in Dutch, I want the English translation such that dates$months is equal to c("January", "December", "December", "March").
How can I do this the quickest, possibly preventing a for loop (since the actual data.frame has more than 100000 rows)?