I have the following scenario:
Data frame - Resources:
recursos <- as.data.frame(c("server01","server02","server03"));
colnames(recursos) <- "Server"
Data frame - Events:
eventos <- as.data.frame(c("falha no server01","erro no server01","falha no server02","erro no server03"));
colnames(eventos) <- "Eventos";
eventos <- dplyr::mutate(eventos, Server = "")
My object is popular in the Server column in the data frame events, based on the mapped servers in the data frame resource. In the solution below, I can fill in using a unique value. But it's not what I need yet.
eventos$Server <- ifelse(grepl("server01", eventos$Eventos), "server01", "")
I thought of running a for (server in $ Server resources) by changing in grep, by a variable. But I could not do it this way. Could someone help me?
Thank you in advance.