nmfs-ost / satf

R package that contains general tables and figures such as diagnostics plots, standard objects in an assessment report, and other important visualizaitons to interpret results of stock assessment models.
Other
2 stars 0 forks source link

example `dat` needed #8

Open kellijohnson-NOAA opened 3 weeks ago

kellijohnson-NOAA commented 3 weeks ago

It would be great if an example dat object were loaded to the package. This object would help developers contribute because I would not have to load my own data set and it would help facilitate testing because there would be a standard object to test that things work. The object could be created programmatically in an .R script in the dataraw folder, using {usethis}, and stored in the data folder.

kellijohnson-NOAA commented 2 weeks ago

From @Bai-Li-NOAA on PR #13

Here are some thoughts on the data: We can use data from the SS3 test models, which I’ve integrated with ASAR. You can modify the code here to add some SS3 data to the satf repository for examples and integration tests.

Schiano-NOAA commented 2 weeks ago

I converted the SS3 simple example output file, resulting in a 10mb file. Do we think it needs to be reduced further? My other thought is that we could subset the data frame to show 1990-2011 (~11 years) as the example. Would this work or are there other options you think would be better?

Here is the inital converted output from the simple example.

Bai-Li-NOAA commented 2 weeks ago

Maybe save the csv file as an .rda file in the /data folder? After loading the CSV into R and converting it to .rda format (see code below), the file size decreased from 10 MB to 221 KB.

data <- read.csv("C:\\Downloads\\simple_ss3_example_convert.csv")
save(asar, file = "C:\\Downloads\\data.rda")
Schiano-NOAA commented 2 weeks ago

Now that I am thinking about it, we can probably just upload it as a rdata object since we are changing the functions to read in an object rather than a csv, so this might solve the issue and we can use the simple example

kellijohnson-NOAA commented 2 weeks ago

Standard practice is to create an R script that creates the .rdata object by first reading in the raw data or performing functions and then using usethis::use_data() to save the data in the right format to the right place. 10 MB is the package size limit for the entire package if wanting to submit to CRAN, which is the standard that I try to adhere to even if I am not going to submit.

Schiano-NOAA commented 2 weeks ago

Oh that's good to know. I will see what the size ends up being when we provide 10 years of data. I might also be able to take out some of the unnecessary labels/data.

iantaylor-NOAA commented 1 week ago

If it's helpful, the SS3 "simple_small" model available in https://github.com/r4ss/r4ss/tree/main/inst/extdata/simple_small was modified from the original "simple" to reduce the number of years and ages in order to provide a smaller set of files to fit within CRAN limits (although the r4ss package was never subsequently submitted to CRAN).