Created
March 1, 2020 04:44
-
-
Save selva86/29a8cf379c27fe9556c756624072c233 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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