0

am pretty new to R.Have a data frame and need to relocate the last variable to the front but i can not figure out how to achieve this. Can somebody tell me quite easy but understandable how i can move the column newVariable to the front? enter image description here

  • 5
    Possible duplicate of [Move a column to first position in a data frame](https://stackoverflow.com/questions/22286419/move-a-column-to-first-position-in-a-data-frame) – Ritchie Sacramento Mar 13 '19 at 21:55

1 Answers1

1

Reorder the columns

n = ncol(datensatz11)
new.order = c(n, 1:(n-1))
datensatz11 = datensatz11[, new.order]
NM_
  • 1,887
  • 3
  • 12
  • 27