Changing column names of a data frame

Use the colnames() function: R> X <- data.frame(bad=1:3, worse=rnorm(3)) R> X bad worse 1 1 -2.440467 2 2 1.320113 3 3 -0.306639 R> colnames(X) <- c(“good”, “better”) R> X good better 1 1 -2.440467 2 2 1.320113 3 3 -0.306639 You can also subset: R> colnames(X)[2] <- “superduper”

Changing capitalization of filenames in Git

Starting Git 2.0.1 (June 25th, 2014), a git mv will just work on a case-insensitive OS. See commit baa37bf by David Turner (dturner-tw). mv: allow renaming to fix case on case-insensitive filesystems “git mv hello.txt Hello.txt” on a case-insensitive filesystem always triggers “destination already exists” error, because these two names refer to the same path … Read more

Rename a file using Java

Copied from http://exampledepot.8waytrips.com/egs/java.io/RenameFile.html // File (or directory) with old name File file = new File(“oldname”); // File (or directory) with new name File file2 = new File(“newname”); if (file2.exists()) throw new java.io.IOException(“file exists”); // Rename file (or directory) boolean success = file.renameTo(file2); if (!success) { // File was not successfully renamed } To append to … Read more