Is it possible to dynamically sort my data by a specific column on-the-fly, during the export (write.csv()) function itself?
I export my data thus:
write.csv(level_names, "level_names.csv")
But want to know if it possible to achieve something like this:
write.csv(level_names, "level_names.csv", order(dataset$longname))
I know this doesn't work - this is merely for illustration purposes.
Is something to this effect possible?
It's not necessarily contained within that function, but you could easily do something like this using dplyr:
level_names %>% arrange(longname) %>% write_csv("level_names.csv")
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With