Mark Mark - 1 year ago 70
R Question

How to change text from specific cells in a dataframe?

I made a mistake in a dataframe I uploaded. In the image below I want to change the "MB" in the two cells outlined in red to "BT"

My dataframe in R

I already tried the

function, but I just want to change the text from these two cell to different text, not give values to names.

Answer Source

You can do this as follows:

foo[[6]][[50]] <- "BT"
foo[[6]][[51]] <- "BT"

where foo is the name of your data frame (your screenshot doesn't show that). Regardless of name values, you can always address individual cells in a data frame with the [[column]][[row]] syntax.