-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Note to self to revisit this and remove for loop.
Possibly a better name for function createSiteTypeVector() would be createSiteTypeMatrix() and have # Save site ID, # Get site type vectors and # Format type vector in this chunk executed within the function as the intermediate steps aren't of importance for code readability.
aquanet-mod/code/04_PrepareModelObjects.R
Lines 100 to 122 in ac43e42
| source('code/aquanet_functions/CreateSiteTypeVector.R') | |
| # Create list of all possible site types | |
| type_list <- c("smallhatch", "largehatch", | |
| "smallrestock", "mediumrestock", "largerestock", | |
| "smalltable", "mediumtable", "largetable", | |
| "smallongrow", "mediumongrow", "largeongrow", | |
| "smallfish", "mediumfish", "largefish") | |
| # Save site ID | |
| type_vector <- vertex_attr(graph_full, "siteID") | |
| type_vector <- as.numeric(type_vector) | |
| # Get site type vectors | |
| for(i in 1:length(type_list)){ | |
| t_vector <- createSiteTypeVector(graph_full, | |
| type_list[i]) | |
| type_vector <- rbind(type_vector, t_vector) | |
| } | |
| # Format type vector | |
| type_vector <- t(type_vector) | |
| colnames(type_vector) <- c("site_code", type_list) |
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels