how to get the number of points on a graph (points())

Hello,
I've plotted data on a graph and i used point() to plot points on the graph.
plot(dataframe21[2:200,], type="l")
points(dataframe21[2:200,])


Now i would like to count the points i've got. Like the total points.
Thank you.

Hello,

I might be missing something here, but the number of points on the graph is exactly the number you put into the points function (e.g. 2:200 or 199).

Please elaborate if this is not what you want.

PJ

Hello,
I was thinking the same but no If you notice, on the first part of the graph, points are not close and on the last part, they are many and very close
Thank you

I agree with PJ, you have 199 points. I believe what you are seeing is an optical illusion caused by the vertical differences between the points at the left of the plot.

1 Like

then i think i'm missing something on my tutorial. I will reproduce it and let you know. Thank you

Will this work?

x <- c(1,2,3,4,5,6,7,8,1,2)
y <- sum(duplicated(x)) # counts number of Trues
length(x) - y

Thank you. Yes it works but is most suitable when we have duplication

Thank you to all of you for your answers. As i said i was missing something but your answers were good.
Thanks

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.