Back
Close

Computing with Data

elgeish
118.6K views

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)
df
# You can change column names using the names function
names(df) = c("last.name", "age", "annual.income")
df
x = list(a = c(1, 2), b = c(3, 4), c = c(5, 6))
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Create your playground on Tech.io
This playground was created on Tech.io, our hands-on, knowledge-sharing platform for developers.
Go to tech.io
codingame x discord
Join the CodinGame community on Discord to chat about puzzle contributions, challenges, streams, blog articles - all that good stuff!
JOIN US ON DISCORD
Online Participants