Skip to content

Function calls to undefined vector and function #3

@cl-roberts

Description

@cl-roberts

Issue

When writing the numbers-at-age .csv files in plotting/plot_age_compositions.R, there is a cbind() function call to an undefined vector long.years and a matrix rounded with the undefined function round_df().

Solutions

I assume long.years is simply a vector of years in the numbers-at-age matrix. Changing long.years to years (defined in line 58) is sufficient if this is the case.

If round_df() is a specialized wrapper to round() numeric elements in a data frame I haven't come across it in the repo. If it comes from a package it's not loaded in the script. However for this particular task round() seems to work as intended (assuming the goal is to round all the elements in the matrix to 3 decimal places).

cat("# Numbers-at-age (millions): Median estimate\n")
write.table(
cbind(long.years, round_df(n.y.a.median.mat, 3)),
row.names=FALSE, col.names=c("# Year", 0:8, "9+"), sep=","
)
cat("\n# Numbers-at-age (millions): Lower 95% Credibility Interval\n")
write.table(
cbind(long.years, round_df(n.y.a.lower.mat, 3)),
row.names=FALSE, col.names=c("# Year", 0:8, "9+"), sep=","
)
cat("\n# Numbers-at-age (millions): Upper 95% Credibility Interval\n")
write.table(
cbind(long.years, round_df(n.y.a.upper.mat, 3)),
row.names=FALSE, col.names=c("# Year", 0:8, "9+"), sep=","
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions