Links
https://www.rstudio.com/resources/cheatsheets/ - A lot of Cheat Sheets
Data.Frame
library(tidyverse)
Import
Select
df <- data.frame(n = c(4 ,5, 6, 7),b = c(8, 9, 10, 11),c = c(12, 13, 14, 15))
Example | Info | Description |
---|---|---|
df[1,] | #
| 1st row |
df[-1,] | #
| Everything except 1st row |
df[1:3,] | #
| From 1st to 3rd row |
df[1] | #
| 1st column |
df[1:2] | #
| From 1st to 2nd column |
df[c("n","c")] | #
| Column ‘n’and ‘c’ |
df[1:3,c("n","c")] | #
| Combine column and row select. |
df$n | #
| Column “n”. Result is numeric vector. |