Reputation:
I'm aware that df[order(df$name),]
will sort my column alphabetically, and this does work, however it is not accounting for characters that start with a lowercase letter. i.e Apple will be sorted but apple will not.
Is there a way to solve this problem?
Upvotes: 1
Views: 2059
Reputation: 23211
df[order(tolower(df$name)),]
should do the trick. tolower
and toupper
are generally useful whenever you have casing issues.
Upvotes: 4