[R] dependent column(s) in data frame

PQuery pierre.khoueiry at embl.de
Wed Feb 19 20:19:31 CET 2014


Dear all,

I have a data frame with a status column and some condition columns. (a dput
of part of it is listed below).
I would like to know if:

1) There are more chances to have a "status" of "1" when more than one
conditions have the value of "1" ?   

2) The "status" column is depending on any one or a combination of the
condition columns
Say, do I have a status of "1" whenever condition 2 & 3 (or only condition
2) are met ?

Do you know what type of analysis one can use to do that ?

Thanks in advance,
P


dput(df)
structure(list(status = c(0L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 0L,
0L, 0L, 0L, 1L, 0L, 1L, 0L, 0L, 0L, 1L, 1L, 0L, 0L, 0L, 1L, 1L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 0L, 1L, 0L,
0L, 0L, 1L, 1L, 0L, 0L, 1L, 0L, 0L), cond.1 = c(0L, 0L, 0L, 1L,
0L, 0L, 1L, 1L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 1L, 0L,
1L, 0L, 1L, 1L, 0L, 0L, 0L, 1L, 1L, 1L, 1L, 0L, 1L, 0L, 0L, 0L,
0L, 0L, 0L, 1L, 1L, 1L, 0L, 1L, 0L, 1L, 0L, 0L, 1L, 0L), cond.2 = c(1L,
0L, 0L, 1L, 0L, 1L, 0L, 1L, 1L, 1L, 0L, 1L, 1L, 0L, 0L, 0L, 1L,
1L, 1L, 0L, 1L, 0L, 1L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L,
0L, 0L, 0L, 1L, 1L, 0L, 1L, 1L, 1L, 1L, 1L, 1L, 0L, 0L, 0L, 0L,
1L), cond.3 = c(0L, 0L, 0L, 1L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 1L, 1L, 0L, 0L, 1L, 1L,
0L, 0L, 1L, 0L, 0L, 0L), cond.4 = c(0L, 0L, 0L, 1L, 0L, 1L, 0L,
1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 1L, 1L, 0L, 0L,
0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L,
0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 1L, 0L, 0L), cond.5 = c(0L, 0L,
0L, 1L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L,
0L, 1L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 1L, 0L,
0L, 0L, 1L, 0L, 0L, 0L, 0L, 1L, 0L, 0L, 0L, 0L, 0L, 0L, 0L, 0L
)), .Names = c("status", "cond.1", "cond.2", "cond.3", "cond.4",
"cond.5"), row.names = c(NA, -50L), class = "data.frame")



--
View this message in context: http://r.789695.n4.nabble.com/dependent-column-s-in-data-frame-tp4685561.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list