I have a data frame of the form
> geneRows[1:3,]
Probe/gene logFC CI.L CI.R AveExpr t P.Value adj.P.Val
17656 220307_at -0.09017596 -0.4395575 0.25920561 6.104288 -0.5992736 0.5662047 1
37517 220307_at 0.08704844 -0.2613434 0.43544028 6.104288 0.5801327 0.5784053 1
57376 220307_at -0.03501474 -0.1267764 0.05674688 6.152467 -0.7816350 0.4409881 1
B gene GSE Group1 Group2 shape color
17656 -5.639256 CD244 GSE2461 Male Female x-open black
37517 -5.978691 CD244 GSE2461 ulcerative colitis irritable bowel syndrome x-open black
57376 -5.141940 CD244 GSE27887 nonlesional skin lesional skin x-open black
I want to subset this so that I can get at the CI.R
column when the CI.L
column is a certain value. For example, I've tried
geneRows$CI.R[geneRows$CI.L == -0.4395575]
but I get back numeric(0)
, meaning an empty vector. However when I try it on a sample dataset, something like
mtcars$mpg[mtcars$carb==8]
it works just fine. They are the same data types and everything, so what's the issue here?
Background
I am creating lines to be added to a plotly
plot.
line <- list(
type = "line",
line = list(color = "grey"),
width = 0.2,
xref = "x",
yref = "y"
)
lines <- list()
for (i in geneRows$CI.L) {
line[["x0"]] <- i
line[["x1"]] <- #here
lines <- c(lines, list(line))
}
They need to be drawn from CI.L
to CI.R
for each line. I am trying to get the end point x1
from the table via the start point.