Is there a way for replaced values not to show up in the table() function?
Problem is easily reproduceable under R-Studio Version 0.98.1062, R version 3.1.1
x <- c(1, 2, 3, 4, 5, 6, 7, 8, 9, 10)
y <- c("condition1", "condition2", "condition3", "condition1", "condition2", "condition3", "condition1", "condition2", "condition3", "condition1")
df <- data.frame(x, y)
Let's say I replace the name of "condition3" to "condition2"
df$y <- replace(df$y, df$y=="condition3","condition2")
table(df$y)
ouput =
condition1 condition2 condition3
4....................6......................0
Why does it print Condition3 in the table, when it has 0 values? I would like a function that replaces condition3, so that it is not there, not just in the dataframe, but also in any further analysis. Is there a better way to replace values?