thinPoints | R Documentation |
Reduce the number of cluttered data points.
thinPoints(dat, value, n = 1000, nbins = 200, groupBy = NULL)
dat |
a data frame |
value |
column name of |
n |
number of points to sample for each partition |
nbins |
number of partitions |
groupBy |
column name of |
The result of Genome Wide Association Study can be very large, with the majority
of points being being clustered below significance threshold. This unnecessarily increases the time
to plot while making almost no difference. This function reduces the number of points by partitioning the points
by a numeric column value
into nbins
and sampling n
points.
a data.frame
dat <- data.frame(
A1 = c(1:20, 20, 20),
A2 = c(rep(1, 12), rep(1,5), rep(20, 3), 20, 20) ,
B = rep(c("a", "b", "c", "d"), times = c(5, 7, 8, 2))
)
# partition "A1" into 2 bins and then sample 6 data points
thinPoints(dat, value = "A1", n = 6, nbins = 2)
# partition "A2" into 2 bins and then sample 6 data points
thinPoints(dat, value = "A2", n = 6, nbins = 2)
# group by "B", partition "A2" into 2 bins and then sample 3 data points
thinPoints(dat, value = "A2", n = 3, nbins = 2, groupBy = "B")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.