Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
set.seed(100)
M <- matrix(round(runif(100*100), 2), nrow=100, ncol=100)
df <- as.data.frame(M)
df[1:5, 1:5]
# 1. Replace the diagonal of dataframe `df` to the respective row number
# using the set function.
# 2. Set the values of column V1 to values of column V2, for all rows where V2 is
# less than 0.5. using set function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment