Skip to content

Update createSiteTypeVector() function #26

@BexMillard

Description

@BexMillard

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.

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions