* `length(df)` returns the number of _columns_ (variables), not the overall element number
* `names(df)` also returns only column names
```{r}
length(df); names(df)
```
## Data frame indexing
Indexing works the same way as for matrix:
```{r}
df[3:4, -1]
```
```{r}
df[, 1]; df[, 1, drop = FALSE]
```
Or for lists:
```{r}
df$z
df[[3]]
df[["z"]]
```
## Subsetting using a condition
You can subset of rows/columns of a data frame by either using `subset` function or directly specifying the condition you want to be fulfilled for your subset:
```{r}
df[df$x > 2, ]
```
```{r}
subset(df, x > 2)
```
```{r}
subset(df, x > 2, select = c(x, z))
```
## Combining data frames
Functions `rbind`/`cbind` work the same way as for matrices:
```{r}
rbind(df, data.frame(x = 5:6, y = c("K", "Z"), z = TRUE, row.names = c("Kappa", "Zulu")))
* `skip` -- количество строк пропускаемых c начала файла
Functions `read.csv`, `read.csv2`, `read.delim` и `read.delim2` are essentially spans over `read.table` function with different defaults for parameters.
## Typical pre-processing workflow:
* Importing data into a data frame
* Cleaning the values, checking the types
* Working with strings: names, character variables, factors