I looked in the internet and also in this website but I didn't found a solution, so sorry if my question has already been answered. I have a dataframe in which several rows have the same ID. Let's say for example
ID Value1 Value2
P1 12 3
P1 15 4
P22 9 12
P22 15 14
P22 13 9
P30 10 12
Is it possible to write a script that take the dataframe and plots in different pages Value1~Value2, for every different ID? In other words I'd have 3 plots, in which value1 is plotted versus value2 for P1, P22 and P30.
I try to write a script with a loop (but I'm a really newby of R):
for (i in levels(dataset$ID)) {
plot(dataset[i,2], dataset[i,2])
}
But I receive the errors:
Errore in plot.new() : figure margins too large
Warning messages:
1: In min(x) : no non-missing arguments to min; returning Inf
2: In max(x) : no non-missing arguments to max; returning -Inf

plot(dataset[i,2], dataset[i,2]must be a typo - you are printing data "against itself" so you would at best plot a straight line. Also you don't close the parenthesis of theplotcommand. Can you check and edit?