I'm relatively new to R and am having trouble processing my data into a more workable form. If I had a continuous x and y vector, some with with multiple x values for the same y value how would I go about writing a script which could automatically average those multiple x values and create a new data.set with the the average x values and y values of the same length. An example is included below.
X <- c(34.2, 35.3, 32.1, 33.0, 34.7, 34.2, 34.1, 34.0, 34.1)
Y <- c(90.1, 90.1, 72.5, 63.1, 45.1, 22.2, 22.2, 22.2, 5.6)