Skip to content

Commit

Permalink
Merge pull request #47 from James-Thorson-NOAA/development
Browse files Browse the repository at this point in the history
Development
  • Loading branch information
James-Thorson-NOAA authored Apr 11, 2020
2 parents f749693 + 9efa66b commit f5b7f29
Show file tree
Hide file tree
Showing 97 changed files with 1,253 additions and 612 deletions.
21 changes: 15 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
Package: FishStatsUtils
Type: Package
Title: Utilities (shared code and data) for FishStats spatio-temporal modeling toolbox
Version: 2.5.0
Date: 2019-12-01
Authors@R: person("James","Thorson", email="[email protected]", role=c("aut","cre"))
Maintainer: James Thorson <[email protected]>
Version: 2.6.0
Date: 2020-04-11
Authors@R:
c(person(given = "James",
family = "Thorson",
role = c("aut", "cre"),
email = "[email protected]",
comment = c(ORCID = "0000-0001-7415-1010"))
)
Description: FishStatsUtils contains utilities (shared code and data) used by multiple
packages (VAST, SpatialDeltaGLMM, MIST, Spatial_FA, SpatialDFA, surplus_production, EOFR) that are designed
for spatio-temporal analysis of ecological data.
Expand All @@ -29,17 +34,21 @@ Imports:
MatrixModels,
rgdal,
ThorsonUtilities,
TMBhelper,
abind,
corpcor,
pander,
rnaturalearth,
formatR
rnaturalearthdata,
formatR,
splancs
Depends:
R (>= 3.1.0)
Suggests:
testthat
Remotes:
james-thorson/utilities
james-thorson/utilities,
kaskr/TMB_contrib_R/TMBhelper
License: GPL-3
LazyData: yes
BuildVignettes: yes
Expand Down
2 changes: 2 additions & 0 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ export(calc_cov)
export(calculate_proportion)
export(combine_extrapolation_info)
export(combine_lists)
export(convert_shapefile)
export(convert_version_name)
export(fit_model)
export(format_covariates)
Expand Down Expand Up @@ -70,4 +71,5 @@ export(plot_variable)
export(project_coordinates)
export(rotate_factors)
export(sample_variable)
export(simulate_data)
export(summarize_covariance)
285 changes: 0 additions & 285 deletions R/Geostat_Sim.R

This file was deleted.

13 changes: 0 additions & 13 deletions R/Heatmap_Legend.R

This file was deleted.

8 changes: 5 additions & 3 deletions R/Prepare_XXXX_Extrapolation_Data_Fn.R
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,7 @@ function( strata.limits=NULL, epu_to_use = c('All', 'Georges_Bank','Mid_Atlantic
}
message("Using strata ", strata.limits)

if(tolower(epu_to_use) == "all") {
if(any(tolower(epu_to_use) %in% "all")) {
epu_to_use <- c('Georges_Bank','Mid_Atlantic_Bight','Scotian_Shelf','Gulf_of_Maine','Other')
}

Expand All @@ -368,10 +368,12 @@ function( strata.limits=NULL, epu_to_use = c('All', 'Georges_Bank','Mid_Atlantic
if( length(strata.limits)==1 && strata.limits[1]=="EPU" ){
# Specify epu by 'epu_to_use'
Data_Extrap <- Data_Extrap[Data_Extrap$EPU %in% epu_to_use, ]
a_el = matrix(NA, nrow=nrow(Data_Extrap), ncol=length(unique(northwest_atlantic_grid[,'EPU'])), dimnames=list(NULL,unique(northwest_atlantic_grid[,'EPU'])) )
Data_Extrap$EPU <- droplevels(Data_Extrap$EPU)

a_el = matrix(NA, nrow=nrow(Data_Extrap), ncol=length(epu_to_use), dimnames=list(NULL, epu_to_use) )
Area_km2_x = Data_Extrap[, "Area_in_survey_km2"]
for(l in 1:ncol(a_el)){
a_el[,l] = ifelse( Data_Extrap[,'EPU']==unique(northwest_atlantic_grid[,'EPU'])[l], Area_km2_x, 0 )
a_el[,l] = ifelse( Data_Extrap[,'EPU'] %in% epu_to_use[[l]], Area_km2_x, 0 )
}
}else{
# Specify strata by 'stratum_number'
Expand Down
3 changes: 1 addition & 2 deletions R/calculate_proportion.R
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ calculate_proportion = function( TmbData, Index, Expansion_cz=NULL, Year_Set=NUL
interval_width=1, width=6, height=6, xlab="Category", ylab="Proportion", ... ){

# Warnings and errors
if( !all(TmbData[['FieldConfig']] %in% c(-2,-1)) ){
if( !all(TmbData[['FieldConfig']] %in% c(-3,-2,-1)) ){
message("Derivation only included for independent categories")
return( invisible("Not run") )
}
Expand All @@ -39,7 +39,6 @@ calculate_proportion = function( TmbData, Index, Expansion_cz=NULL, Year_Set=NUL
Index_tl = apply(Index_ctl,MARGIN=2:3,FUN=sum)
SE_Index_tl = sqrt(apply(SE_Index_ctl^2,MARGIN=2:3,FUN=sum,na.rm=TRUE))


# Approximate variance for proportions, and effective sample size
Neff_ctl = var_Prop_ctl = array(NA,dim=dim(Prop_ctl))
for( cI in 1:dim(var_Prop_ctl)[1]){
Expand Down
Loading

0 comments on commit f5b7f29

Please sign in to comment.