pkttta
pkttta

Reputation: 11

Replacing specific value in a column from a list

searched a bit throughout the forum, sorry, beginner question ...

I have a list called Data, with two columns, named "dates" and "countries" I'd like to replace a specific value in the column country, here is what I try

Data[Data$countries == "GE",]<-"DE"

It computes, but when I display Data, I still find the GE value...

Upvotes: 1

Views: 45

Answers (1)

akrun
akrun

Reputation: 887118

We need to assign it to the column (assuming that the column is character class) instead of the whole dataset

Data$countries[Data$countries == "GE"] <- "DE"

Upvotes: 1

Related Questions