View source: R/getTotalAltersByStatus.R View source: R/getAdjacencyMatrix.R
getTotalAltersByStatus | R Documentation |
This is a function that can be used to generates a data.frame that stores the number of alters with a given level of a factor an individual has.
getTotalAltersByStatus(individualID, status, alters)
individualID |
A data.frame which stores the IDs of the individuals that nominate alters. |
status |
A data.frame which stores the levels of a variable. |
alters |
A data.frame which stores the alters of a given individual. |
totalAltersByStatus |
The resultant data.frame. |
George Gerogiannis
individualID = data.frame(c(1, 2, 3, 4)) status = data.frame(c(10, 20, 30, 20)) alters = data.frame(c(4, 3, 2, 1), c(3, 4, 1, 2), c(2, 1, 4, 3)) totalAltersByStatus = getTotalAltersByStatus(individualID, status, alters) individualID = data.frame(c(1, 2, 3, 4)) status = data.frame(c("RegularSmoke", "Nonsmoker", "CasualSmoker", "Nonsmoker")) alters = data.frame(c(4, 3, 2, 1), c(3, 4, 1, 2), c(5, 1, 5, 3)) totalAltersByStatus = getTotalAltersByStatus(individualID, status, alters) individualID = data.frame(c(1, 2, 3, 4)) status = data.frame(c(NA, "Nonsmoker", "CasualSmoker", "Nonsmoker")) alters = data.frame(c(4, 3, 2, 1), c(3, 4, 1, 2), c(5, 1, 5, 3)) totalAltersByStatus = getTotalAltersByStatus(individualID, status, alters) individualID = data.frame(c(10, 20)) status = data.frame(c(NA, "Nonsmoker")) alters = data.frame(c(NA, 10), c(20, NA)) totalAltersByStatus = getTotalAltersByStatus(individualID, status, alters) individualID = data.frame(c(NA, 20)) status = data.frame(c("Smoker", "Nonsmoker")) alters = data.frame(c(NA, 10), c(20, NA)) totalAltersByStatus = getTotalAltersByStatus(individualID, status, alters)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.