Overwrite all data from a column of a data frame in R

Asked

Viewed 55 times

1

Assuming I have the following data frame (just one example, as mine has almost 200,000 lines):

ae <- c(1,2,3,4,5,6,7,8,9,10)

be <- c(10,9,8,7,6,5,4,3,2,1)

pnadc1 <- data.frame(ae,be)

I need to replace all values of the rows in the column ae by number 200. Someone knows how to do it?

1 answer

0

Using this data

ae <- c(1,2,3,4,5,6,7,8,9,10)
be <- c(10,9,8,7,6,5,4,3,2,1)

pnadc1 <- data.frame(ae,be)

You can reassign values this way

pnadc1$ae <- 200

Exit

    ae be
1  200 10
2  200  9
3  200  8
4  200  7
5  200  6
6  200  5
7  200  4
8  200  3
9  200  2
10 200  1

Browser other questions tagged

You are not signed in. Login or sign up in order to post.