data_reduce | R Documentation |
The function
1. Uniformly selects points between the dataset and for the select indexes returns the X and Y values in a dataframe
2. The no. of selected points is reduced by an integer factor "fract"
data_reduce(X, Y, fract)
X |
X vector of the original dataset |
Y |
Y vector of the original dataset |
fract |
The factor by which the function needs to reduce the size of the data set. |
The returned value is always a 2-column dataframe with column names 'X' and 'Y'
If the no. of points in the new dataset are one or less, then the function throws an error.
Chitran Ghosal
t <- seq(0, 2*pi, by=0.0001)
Y <- sin(t)
df <- data_reduce(t,Y, fract = 1000)
par(mfrow = c(2,1))
plot(t,Y, main = 'original data')
plot(df$X, df$Y, main = 'reduced data')
par(mfrow = c(1,1))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.