I would like to build the data in data.frame xy for each group (defined by ID ). If the year before 1946 is in a group, plot 2 must be completed. When the years between 1946 and 2014, plot1 must be executed.
My problem: this works fine without NA values, but since I have data gaps, I rely on NA to identify these data gaps. This is why I get the error message: error in plot.window(need finite 'ylim' values) . I tried putting finite=T in plot1 along the y axis, but this gives a subscript out of bounds error. Is there a way to solve this problem and that the graphics are correctly built?
Below is my code: it is long, but most of the code consists of plot() options, which I rely on.
# read in sample data and split it up by group (defined by ID) xy <- data.frame(NAME=c("NAME2","NAME2","NAME2","NAME2","NAME2","NAME3","NAME3","NAME3","NAME3","NAME5","NAME5","NAME5","NAME5"), ID=c(48,48,48,48,48,32,32,32,32,67,67,67,67),YEAR=c(1981,1983,1984,1988,1989,1984,1984,1988,1988,1899,1933,1948,1958),VALUE=c(0,205,-570,0,-310,-3680,-3680,NA,-3680,0,NA,13,-98)) ind <- split(x = xy,f = xy[,'ID'])