How to modify specific values in a data frame in the R programming language. More details: https://statisticsglobe.com/replace-p...
R code of this video:
data <- data.frame(x1 = 1:5,
x2 = LETTERS[1:5],
x3 = c("A", "C", "A", "A", "B"),
x4 = factor(c("f1", "f2", "f3", "f2", "f1")),
stringsAsFactors = FALSE)
data1 <- data # Replicate data
data1[data1 == "A"] <- "XXX"
data2 <- data # Replicate data
data2[data2 == "f2"] <- "YYY"
data2 <- data # Replicate data
data2$x4 <- as.character(data2$x4)
data2[data2 == "f2"] <- "YYY"
data2$x4 <- as.factor(data2$x4)
Watch video Replace Particular Value in Data Frame in R (2 Examples) | Change Certain Values in Variable/Column online without registration, duration hours minute second in high quality. This video was added by user Statistics Globe 27 March 2020, don't forget to share it with your friends and acquaintances, it has been viewed on our site 22,656 once and liked it 182 people.