I plot it this way
plot(data[,1], ylim=c(0,3))
for (i in 2:5)
points(data[,i])
Using sapply
.
plot(data[,1], ylim=c(0, 3), type="n")
sapply(1:ncol(data), function(i) points(data[,i], col=i + 1))
For the coordinates we use lapply
res <- lapply(data, function(y) data.frame(y, x=1:nrow(dat)))
Showing first six rows of each data frame in resulting list res
.
lapply(res, head)
# $V1
# y x
# 1 0.058135563 1
# 2 -0.009665337 2
# 3 0.014075270 3
# 4 0.034267595 4
# 5 -0.061601287 5
# 6 -0.081303717 6
#
# $V2
# y x
# 1 -0.005269706 1
# 2 0.060910832 2
# 3 -0.049985918 3
# 4 -0.053514340 4
# 5 0.003423078 5
# 6 0.186405064 6
#
# $V3
# y x
# 1 -0.51240745 1
# 2 0.51121542 2
# 3 0.21721315 3
# 4 0.07649472 4
# 5 0.08493078 5
# 6 -0.02512500 6
#
# $V4
# y x
# 1 0.51607075 1
# 2 -0.50610489 2
# 3 0.06721055 3
# 4 -0.50259299 4
# 5 -0.46883039 5
# 6 0.09391697 6
#
# $V5
# y x
# 1 -3.1344787 1
# 2 -3.1379467 2
# 3 0.6593348 3
# 4 0.5191027 4
# 5 0.5181473 5
# 6 0.6609265 6