I'm looking for an easy way to loop through my data and print out certain columns based on a condition. This for-loop ought to find the column within the data that meets the if condition and then print out these columns. This is what I have tried.
for (var in names(df)) {
if(length (unique(df[var])) == 2) {
print (var)
}
}
Aucun commentaire:
Enregistrer un commentaire