Created
May 1, 2017 15:35
-
-
Save mcdlee/14f8edac643ee3e8e7165b9d124384bb to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
x <- 1:15 | |
y <- x^2 | |
d <- data.frame(x, y) # 另外一種建立 data.frame 的方法 | |
d | |
dy <- diff(y) | |
dy <- c(NA, dy) #add a blank NA as the first element | |
d <- cbind(d, dy) | |
d | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment