strangely, I didn't come upon this while browsing online. Basically I am trying to apply the sub(...) function to a simple data frame. Please refer to the following example:
x <- data.frame(name=c("Hans", "Dieter", "Peter"), age=c(25,26,27))
data <- data.frame(sub("e", "a", x)) #subbing an e for an a
The output changes the data frame completely, the first row now contains:
c("Hans", "Diater", "Peter")
The second:
c(25, 26, 27)
Might anybody be so kind and help me out so that I can understand what is going on? Many thanks!
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…