Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content

Data Preparation

We emphasize in this book graphing data by first creating a dataframe with the appropriate data and informative column names; this approach is better than keeping the data in arrays. To create a dataframe, use the data.frame function, for example:

vec1 = c("foo", "bar")
vec2 = c(31, 42)
vec3 = c(1, 2)
df = data.frame(name = vec1, ages = vec2, salary = vec3)
# You can change column names using the names function
names(df) = c("", "age", "annual.income")
x = list(a = c(1, 2), b = c(3, 4), c = c(5, 6))
Open Source Your Knowledge: become a Contributor and help others learn. Create New Content