This is easy: read in the data, reorder it using order
and write it to file using write.csv
.
f1 <- read.csv('file1.csv')
write.csv(f1[order(f1$user),],'file2.csv')
In the future, though, remember to show the code you've already tried so we know where you're starting from.