put.first | R Documentation |
Returns a data.frame with specified columns put first, before the others.
put.first(x, fields)
x |
Required data.frame that will have its columns reordered |
fields |
required character vector of strings that are among the elements of names(x) |
Returns a transformed data.frame with cols in new order
change.fieldnames()
before <- data.frame(year=c(2,2,2), ID=3, numbers=4, last=1)
put.first(before, c('ID', 'numbers'))
after <- put.first(before, names(before)[length(before)] ) # put last column first
before; after
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.