Reputation:
I tried this code, but the result is that it shows me only the name of the country with the lowest corruption level, but I want to show a dataset with two columns: one with the name of the country and the other with the corruption score (trust government corruption). The last column is missing. Where did I go wrong?
lesscorruption <- df$Country[which.min(df$Trust..Government.Corruption.)]
View(lesscorruption)
Result:
V1
Indonesia
Column V2
with the indonesia Trust..Governement.Corruption
score is missing
Thank you so much!
Upvotes: 0
Views: 185
Reputation: 1382
With base R:
df[which.min(df$Trust..Government.Corruption.), c("V1", "V2")]
Upvotes: 1