# Create variables composed of random numbers
x <-rnorm(50)
y = rnorm(x)
# Plot the points in the plane
plot(x, y)
This chapter introduces the general principles for data programming or coding involving data. Data programming is a practice that works and evolves with data. Unlike the point-and-click approach, programming allows the user to manage most closely the data and process data in more effective manner. Programs are designed to be replicable, by user and collaborators. A data program can be developed and updated iteratively and incrementally. In other words, it is building on the culminated works without repeating the steps. It takes debugging, which is the process of identifying problems (bugs) but, in fact, updating the program in different situations or with different inputs when used in different contexts, including the programmer himself or herself working in future times.
Social scientists Gentzkow and Shapiro (2014) list out some principles for data programming.
Allow evolution and updated edition
Use Git and GitHub
A data program can provide or perform :
Sample R Programs:
R basics
# Create variables composed of random numbers
x <-rnorm(50)
y = rnorm(x)
# Plot the points in the plane
plot(x, y)
Using R packages
# Plot better, using the ggplot2 package
## Prerequisite: install and load the ggplot2 package
## install.packages("ggplot2")
library(ggplot2)
qplot(x,y)
More R Data Visualization
# Plot better better with ggplot2
library(ggplot2)
ggplot(,aes(x,y)) + theme_bw() + geom_point(col="blue")