#basic example: pop off 1 row from sample data
data.frame(ID=1:10,N=number(10)) #before
data_pop(data.frame(ID=1:10,N=number(10))) #after
#using data objects
data.01 <- mtcars[1:7,]
#task: remove 1 element from the end of the data and set it to the data name
data.01 #data.01 data before pop
data_pop(data.01) #does not return anything
data.01 #data.01 data updated after pop
#task: remove 3 columns from the end of the data and set it to the data name
data.01 #data.01 data before pop
data_pop(data.01, n = 3, which = "cols") #does not return anything, but updates data
data.01 #data.01 data updated after pop
#task: remove 5 elements from the end, but do not set it to the data name
data.01 #data.01 data before pop
data_pop(data.01,5, ret = TRUE) #return modified data
data.01 #data.01 data remains the same after pop
Run the code above in your browser using DataLab