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, duration hours minute second in high quality that is uploaded to the channel Statistics Globe 27 March 2020. Share the link to the video on social media so that your subscribers and friends will also watch this video. This video clip has been viewed 22,656 times and liked it 182 visitors.