index0 <- function(x) {
stats::setNames(data.frame(t(utils::combn(length(x), 2))), c("v1", "v2"))
}
quandrantCoordinates <- function(dat, h, theta) {
delta <- dat[2, ] - dat[1, ]
# Pseudo-Quadrant I
if (all(delta > 0)) {
post.x <- dat[2, "x"] - abs(h * cos(theta))
post.y <- dat[2, "y"] - abs(h * sin(theta))
# Pseudo-Quadrant II
} else if (delta[1] < 0 & delta[2] > 0) {
post.x <- dat[2, "x"] + abs(h * cos(theta))
post.y <- dat[2, "y"] - abs(h * sin(theta))
# Pseudo-Quadrant III
} else if (all(delta < 0)) {
post.x <- dat[2, "x"] + abs(h * cos(theta))
post.y <- dat[2, "y"] + abs(h * sin(theta))
# Pseudo-Quadrant IV
} else if (delta[1] > 0 & delta[2] < 0) {
post.x <- dat[2, "x"] - abs(h * cos(theta))
post.y <- dat[2, "y"] + abs(h * sin(theta))
# I:IV
} else if (delta[1] > 0 & delta[2] == 0) {
post.x <- dat[2, "x"] - abs(h * cos(theta))
post.y <- dat[2, "y"]
# I:II
} else if (delta[1] == 0 & delta[2] > 0) {
post.x <- dat[2, "x"]
post.y <- dat[2, "y"] - abs(h * sin(theta))
# II:III
} else if (delta[1] < 0 & delta[2] == 0) {
post.x <- dat[2, "x"] + abs(h * cos(theta))
post.y <- dat[2, "y"]
# III:IV
} else if (delta[1] == 0 & delta[2] < 0) {
post.x <- dat[2, "x"]
post.y <- dat[2, "y"] + abs(h * sin(theta))
}
data.frame(x = post.x, y = post.y)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.