Database Reference
In-Depth Information
a two-dimensional digital image or to support more complex operations such as those
used in linear algebra.
Some data can't be easily expressed as a collection of similarly typed numbers. It
is obviously useful to have heterogeneous data in an easily addressable form. Tabular
data structures like this are so common that R provides a data structure known as a
data frame. Technically, a data frame is a list of vectors of the same length. Unlike a
matrix, the individual vectors that make up data frames can each contain a different
data type. Listing 11.2 presents examples of matrix and data frame structures in R.
Listing 11.2 Examples of matrix and data frame structures in R
# Create an R matrix with 3 rows and 6 columns
> example_matrix <- matrix(1:18, nrow=3, ncol=6)
> example_matrix
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 1 4 7 10 13 16
[2,] 2 5 8 11 14 17
[3,] 3 6 9 12 15 18
# Value of a single matrix coordinate
> example_matrix[2,5]
[1] 14
# List first 3 rows of the "mtcars" sample data frame
> head(mtcars, 3)
mpg cyl disp hp drat wt qsec vs am gear carb
Mazda RX4 21.0 6 160 110 3.90 2.620 16.46 0 1 4 4
Mazda RX4 Wag 21.0 6 160 110 3.90 2.875 17.02 0 1 4 4
Datsun 710 22.8 4 108 93 3.85 2.320 18.61 1 1 4 1
Strategies for Dealing with Large Datasets
The computational tools described throughout this topic are often concerned with
processing tasks involving large amounts of data. However, although these tools are
becoming more and more accessible, it should go without saying that it's not always
necessary, beneficial, or desirable to use an entire dataset.
In their paper “Critical Questions for Big Data,” 2 researchers danah boyd and
Kate Crawford describe myths that data scientists often subscribe to when work-
ing with large amounts of data. One of their assertions, that “Bigger Data are Not
2. boyd, danah, and Kate Crawford. “Critical questions for big data: Provocations for a cultural,
technological, and scholarly phenomenon.” Information, Communication & Society 15 no. 5
(2012): 662-679.
 
 
 
Search WWH ::




Custom Search