How about:
testdf<-data.frame(names=c("min","max","sum"),a=1:3,b=4:6,c=c(5,7,9))
which(tolower(as.matrix(testdf)) == "sum",arr.ind=TRUE)
row col
[1,] 3 1
as.matrix coerces all elements to the lowest (character) mode, no?
Does it unclass anything like the example below?
Jim
On 04/30/2
On 30/04/2014, 8:02 AM, Frede Aakmann Tøgersen wrote:
Try
> foo <- data.frame(oid = 1:3, functions = c("mean", "sum", "sd"), type =
c(TRUE, FALSE, TRUE))
foo
oid functions type
1 1 mean TRUE
2 2 sum FALSE
3 3sd TRUE
foo == "sum"
oid functions type
Try
> foo <- data.frame(oid = 1:3, functions = c("mean", "sum", "sd"), type =
> c(TRUE, FALSE, TRUE))
> foo
oid functions type
1 1 mean TRUE
2 2 sum FALSE
3 3sd TRUE
> foo == "sum"
oid functions type
[1,] FALSE FALSE FALSE
[2,] FALSE TRUE FALSE
[
3 matches
Mail list logo