Drop column from data frame by number
authorOleksandr Gavenko <gavenkoa@gmail.com>
Sun, 06 Mar 2016 00:25:36 +0200
changeset 1940 7b82258d60a7
parent 1939 d56a295b48da
child 1941 486fcedecf72
Drop column from data frame by number
r.rst
--- a/r.rst	Sun Mar 06 00:04:35 2016 +0200
+++ b/r.rst	Sun Mar 06 00:25:36 2016 +0200
@@ -208,3 +208,18 @@
   library(plyr)
   newd <- rename(d, c("beta"="two", "gamma"="three"))
 
+Filtering raws and columns
+==========================
+::
+
+  TODO
+
+Droping raws and columns
+========================
+
+Drop column from data frame by number::
+
+  dfnew <- df[-1]         # first
+  dfnew <- df[-ncol(df)]  # last
+  dfnew <- df[-c(1, 3:4, 7)]  # range
+