-2

plot

I plot it this way

plot(data[,1], ylim=c(0,3))
for (i in 2:5)
  points(data[,i])

data I use

jay.sf
  • 60,139
  • 8
  • 53
  • 110
  • 1
    Please read the post on [how to create a minimum reproducible example in R](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) - it will help you get an answer more quickly. Particularly, use ``dput()`` to show your data - nobody is going to download data from a random dropbox link. Thanks. – user438383 Oct 04 '20 at 10:17
  • My data is too big to add as text – Gor Danielyan Oct 04 '20 at 10:21
  • Then use ``dput(head(dat))`` like it says in the link I shared. – user438383 Oct 04 '20 at 10:22

1 Answers1

2

Using sapply.

plot(data[,1], ylim=c(0, 3), type="n")
sapply(1:ncol(data), function(i) points(data[,i], col=i + 1))

enter image description here

For the coordinates we use lapply

res <- lapply(data, function(y) data.frame(y, x=1:nrow(dat)))

Result

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
jay.sf
  • 60,139
  • 8
  • 53
  • 110