iris[(nrow(iris)-1): nrow(iris),(ncol(iris)-1):(ncol(iris))]
or a bit simplified version is
nR = nrow(iris)
nC = ncol(iris)
iris[nR-1): nR, nC-1):nC)]
Petal.Width Species
1 2.3 virginica
2 1.8 virginica
dplyr verison
tail(select(iris, Petal.Width, Species),2)
Petal.Width Species
1 2.3 virginica
2 1.8 virginica
No comments:
Post a Comment