Git Product home page Git Product logo

fishr-core-team / rfishbc Goto Github PK

View Code? Open in Web Editor NEW
13.0 3.0 1.0 166.46 MB

This package helps fisheries scientists collect growth data from calcified structures and back-calculate estimated lengths at previous ages. The package is intended to replace much of the functionality provided by the now out-dated fishBC software.

Home Page: https://fishr-core-team.github.io/RFishBC/

R 100.00%
fish fisheries stock-assessment population-dynamics fisheries-stock-assessment fisheries-management r

rfishbc's Introduction

Project Status: Active – The project has reached a stable, usable state and is being actively developed. DOI CRAN Status License R-CMD-check Codecov test coverage CRAN RStudio mirror downloads rate CRAN RSTudio mirror downloads total Rdoc

RFishBC

The RFishBC package helps fisheries scientists collect measurements from calcified structures and back-calculate estimated lengths at previous ages. RFishBC is intended to replace much of the functionality provided by the now out-date fishBC software.

Use

General desriptions for using RFishBC are under the Vignettes tab at the top of this page. I suggest at least quickly reading each vignette to get an overall feel for RFishBC and then following the workflow suggestions in the last vignette. Detailed descriptions for each function are under the Reference tab at the top of that page.

Installation

The most recent stable version (on CRAN) of RFishBC may be installed with

install.packages("RFishBC")

The most recent development version may be installed from GitHub with

if (!require('remotes')) install.packages('remotes'); require('remotes')
remotes::install_github('fishr-core-team/RFishBC')

You may need to have R Tools installed on your system to use the two lines above. See the instructions for (R Tools for Windows or R Tools for Mac OS X). Additionally, you may need the X11 graphics functionality if using Mac OS.

Questions / Comments / Problems or Contributions

Report questions, comments, or bug reports on the issues page.

We are always looking for others to contribute to RFishBC. Please feel free to make a pull request via GitHub or to contact the maintainers.

Please adhere to the Code of Conduct.

rfishbc's People

Contributors

droglenc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

qselmer

rfishbc's Issues

Open multiple images at once

A tester (B. Utrup and J-M Hessenauer) suggested that it would be nice if a user could "automatically" open several images at once so as not to have to go back to digitizeRadii() multiple times to supply a new image name. This suggestion stemmed from realizing that if this code is run

digitizeRadii("Scale_1.jpg",id=1,reading="DHO",edgeIsAnnulus=FALSE)
digitizeRadii("Scale_2.jpg",id=2,reading="DHO",edgeIsAnnulus=FALSE)

without completing the digitization after the first line of code, that the first image will appear and the second image will not appear until digitizing of the first image has been completed.

Snap to transect

Make an option that will "snap" a user's selected point to the selected transect.

Probably something like this ...

  1. find equation of transect
  2. find equation of a line through a selected point and perpendicular to the transect
  3. Find where the transect and this line intersect
  4. Move the selected point to that intersection.

Delete mis-selected points

Need to make a way to remove points that the user has inadvertently selected. I don't think that this is possible with locator(). One possibility is to make another function, like seeDigitizedImage() but where the user could select a point or points to delete.

Use saved object with combineData() and showDigitizedImage()

Currently, combineData() and showDigitizedImage() only work when given a string that indicates a filename with the pertinent data. These functions do not work if a single object saved from collectRadiiData() is given as an argument, though the pertinent information is available. Fix this.

Clear everything

Consider adding a "clear everything" command so that it would be like starting the image over again.

Error on Mac related to setGraphicsEventEnv

Running digitizeRadii() on a MAC produces this error ...

Error in setGraphicsEventEnv(which, as.environment(list(...))) : 
  this graphics device does not support event handling.  

The error is because the graphics event handlers only work in windows and X11 devices.

Use TIFF files

Incorporate a way to use TIFF files as this seems to be the default method to save images from several image capture programs.

[RELEASE PREP] Prepping v0.2.6 (per CRAN request)

Below are the steps used to prepare RFishBC for submission to CRAN. The steps should generally be followed in order (i.e., don't move to the next step without success at the current step). It is common to have to repeat some previous steps if an error/warning occurs at a subsequent step (in my experience, this most often happens after checking on the development version of R when using R-winbuilder).

It is worth noting that this whole process can take 2-3 hours (or more depending on internet speed) with significant "waiting time" for checks and builds.


0 - Preparatory Updates

  • Update to latest R version.
  • Update to latest RStudio version.
  • Update all packages, especially those that RFishBC depend on.

1 - dev branch (at local repo)

  • Ensure no outstanding issues in checks on CRAN
  • Ensure that all branches emanating from dev have been appropriately merged to dev via pull request.
  • Update Version field in DESCRIPTION (next number up without the .9000 on the end).
  • Update Date field in DESCRIPTION.
  • Update Version in top header of NEWS.md (next number up without the .9000 on the end).
  • Ensure that NEWS.md contains descriptions of all major changes (this is usually done in "real-time" as changes are being made).
  • Create new cran-comments-vX_X_X.md file in cran-comments folder. This will likely just be a copy of the same file from the previous version, but may include notes specific to inquiries from CRAN operators. [Note that this will be used in Section 5 below, so leave the file open).
  • Run pkgdown::build_site() in the console of RStudio.

2 - dev branch (at local repo)

  • Run Build..Check in RStudio. Address all errors, warnings, and notes and redo parts of the previous section as necessary. [There should generally be no errors, warnings, or notes as the package should have been checked with each major change to dev. At times I will get a note about a new author or not being able to verify current time.]
  • Build a "source package" in RStudio with More..Build Source Package.
  • Upload source package to all three "flavors" at R-winbuilder. Wait for an e-mail reply from R-winbuilder. Any errors, warnings, or notes for any flavor should be addressed (after which this step, and possibly relevant steps above, should be repeated).
  • Upload source package to both the "release" and "development" "flavors" at R-macbuilder. Monitor results (especially "Check Log") page (will be given a link upon submission). Any errors, warnings, or notes for any flavor should be addressed (after which this step, and possibly relevant steps above, should be repeated).
  • Push changes from above from local machine to dev branch on GitHub.

3 - dev branch (at remote GitHub repo)

  • Ensure that "R-CMD-check.yaml" GitHub action was successful for the dev branch (this should run automatically with the push to dev, but will take some time to finish (possibly >20 mins)). If not successful then address issues and repeat as much above as necessary.
  • Create a pull-request asking to merge the dev branch to the main branch. Ask someone from the RFishBC team to review the request. [Ensure that all checks were successfully completed.]

4 - main branch (at remote GitHub repo)

  • Merge approved (assumingly) pull request from dev branch.

5 - main branch (at local repo)

  • Fetch the remote main branch and pull the updates to local main branch so that the local and remote main branches are the same.
  • Build a "source package" in RStudio with More..Build Source Package.
  • Build a "binary package" in RStudio with More..Build Binary Package.
  • Goto the CRAN submission page. Enter your first and last names. Press Choose File and choose the source file (.tar.gz) created above. Copy the comments from the relevant cran-comments-vX_X_X.md and paste into the optional comments box. Press the Upload Package button.
  • Review the ensuing page (it is usually correct) and press Submit Package button at the bottom.
  • Wait for an e-mail from CRAN (this is usually pretty quick) and press the contained link to open a new webpage.
  • Check all three boxes (make sure that your answers are truthful) and press Upload the Package to CRAN. You should get a confirmation e-mail almost immediately (no need to respond to this).

6 - main branch (at remote GitHub repo)

  • Create a new release. Tag should relate to the version number and the Title should state that the version number is being released to CRAN (see past examples). Make sure that the Target is set to Main. Add an optional Description if desired. Drag and drop the source (.tar.gz) and binary (.zip) files created in the previous step on to the Attach binaries ... box. Press Publish Release.

7 - dev branch (at remote GitHub repo)

  • Create a pull-request asking to merge the main branch to the dev branch. This is needed after merging dev to main above so that the two branches are synced.
  • Merge pull request from main branch (OK to do this without getting approval from RFishBC team member). Note that the dev branch will say it is "1 commit ahead of main" after this step.

8 - dev branch (at local repo)

  • Fetch the remote dev branch and pull the updates to local dev branch so that the local and remote dev branches are the same.
  • Update Version field in DESCRIPTION by appending .9000 to the end.
  • Create a new section at the top of NEWS.md with the new version number (i.e., including the .9000 on the end).
  • Push these changes to the remote dev branch. This is the start of the next version.

[RELEASE PREP] v0.2.5

Below are the steps used to prepare FSAdata for submission to CRAN. The steps should generally be followed in order (i.e., don't move to the next step without success at the current step). It is common to have to repeat some previous steps if an error/warning occurs at a subsequent step (in my experience, this most often happens after checking on the development version of R when using R-winbuilder).

It is worth noting that this whole process can take 2-3 hours (or more depending on internet speed) with significant "waiting time" for checks and builds.


0 - Preparatory Updates

  • Update to latest R version.
  • Update to latest RStudio version.
  • Update all packages, especially those that RFishBC depend on.

1 - dev branch (at local repo)

  • Ensure no outstanding issues in checks on CRAN
  • Ensure that all branches emanating from dev have been appropriately merged to dev via pull request.
  • Update Version field in DESCRIPTION (next number up without the .9000 on the end).
  • Update Date field in DESCRIPTION.
  • Update Version in top header of NEWS.md (next number up without the .9000 on the end).
  • Ensure that NEWS.md contains descriptions of all major changes (this is usually done in "real-time" as changes are being made).
  • Create new cran-comments-vX_X_X.md file in cran-comments folder. This will likely just be a copy of the same file from the previous version, but may include notes specific to inquiries from CRAN operators. [Note that this will be used in Section 5 below, so leave the file open).
  • Run pkgdown::build_site() in the console of RStudio.

2 - dev branch (at local repo)

  • Run Build..Check in RStudio. Address all errors, warnings, and notes and redo parts of the previous section as necessary. [There should generally be no errors, warnings, or notes as the package should have been checked with each major change to dev. At times I will get a note about a new author or not being able to verify current time.]
  • Build a "source package" in RStudio with More..Build Source Package.
  • Upload source package to all three "flavors" at R-winbuilder. Wait for an e-mail reply from R-winbuilder. Any errors, warnings, or notes for any flavor should be addressed (after which this step, and possibly relevant steps above, should be repeated).
  • Upload source package to both the "release" and "development" "flavors" at R-macbuilder. Monitor results (especially "Check Log") page (will be given a link upon submission). Any errors, warnings, or notes for any flavor should be addressed (after which this step, and possibly relevant steps above, should be repeated).
  • Push changes from above from local machine to dev branch on GitHub.

3 - dev branch (at remote GitHub repo)

  • Ensure that "R-CMD-check.yaml" GitHub action was successful for the dev branch (this should run automatically with the push to dev, but will take some time to finish (possibly >20 mins)). If not successful then address issues and repeat as much above as necessary.
  • Create a pull-request asking to merge the dev branch to the main branch. Ask someone from the RFishBC team to review the request. [Ensure that all checks were successfully completed.]

4 - main branch (at remote GitHub repo)

  • Merge approved (assumingly) pull request from dev branch.

5 - main branch (at local repo)

  • Fetch the remote main branch and pull the updates to local main branch so that the local and remote main branches are the same.
  • Build a "source package" in RStudio with More..Build Source Package.
  • Build a "binary package" in RStudio with More..Build Binary Package.
  • Goto the CRAN submission page. Enter your first and last names. Press Choose File and choose the source file (.tar.gz) created above. Copy the comments from the relevant cran-comments-vX_X_X.md and paste into the optional comments box. Press the Upload Package button.
  • Review the ensuing page (it is usually correct) and press Submit Package button at the bottom.
  • Wait for an e-mail from CRAN (this is usually pretty quick) and press the contained link to open a new webpage.
  • Check all three boxes (make sure that your answers are truthful) and press Upload the Package to CRAN. You should get a confirmation e-mail almost immediately (no need to respond to this).

6 - main branch (at remote GitHub repo)

  • Create a new release. Tag should relate to the version number and the Title should state that the version number is being released to CRAN (see past examples). Make sure that the Target is set to Main. Add an optional Description if desired. Drag and drop the source (.tar.gz) and binary (.zip) files created in the previous step on to the Attach binaries ... box. Press Publish Release.

7 - dev branch (at remote GitHub repo)

  • Create a pull-request asking to merge the main branch to the dev branch. This is needed after merging dev to main above so that the two branches are synced.
  • Merge pull request from main branch (OK to do this without getting approval from RFishBC team member). Note that the dev branch will say it is "1 commit ahead of main" after this step.

8 - dev branch (at local repo)

  • Fetch the remote dev branch and pull the updates to local dev branch so that the local and remote dev branches are the same.
  • Update Version field in DESCRIPTION by appending .9000 to the end.
  • Create a new section at the top of NEWS.md with the new version number (i.e., including the .9000 on the end).
  • Push these changes to the remote dev branch. This is the start of the next version.

Quickly print all images

A user (Nathan Stewart) would like to create jpegs of all images on which he has digitized points. This can be accomplished with the following code (using a list of RDS files in a directory as an example).

setwd()
tmp <- listFiles(".rds")
for (i in tmp) {
  d <- showDigitizedImage(i)
  nm <- paste0(tools::file_path_sans_ext(i),"_graph.jpg")
  dev.copy(jpeg,nm,width=d$windowSize[1],height=d$windowSize[2],units="in",res=72)
  dev.off()
} 

This could be made into a function called printDigitizedImages().

Quit all images

When working in digitizeRadii() as a batch process, it would be useful to have the option to quit all in the queue, rather than have to quit them individually.

Unexpected results from BC

Describe the bug
Seems that results from BC are exactly backward

To Reproduce
Please run this script:

> 
> library(RFishBC)   # for bcFuns()
> library(FSA)       # for validn(), sumTable()
> library(dplyr)     # for %>%, inner_join(), arrange(), group_by, summarize()
> library(RJSONIO)
> 
> fishRadii <- read.csv("FishRadii.csv",stringsAsFactors=FALSE) %>% mutate(id=as.character(id))
> head(fishRadii)
  id reading agecap    radcap       rad1      rad2      rad3      rad4
1  1     HBO      4 0.4381053 0.12743160 0.2650279 0.3268283 0.3867132
2  2     HBO      2 0.5887905 0.17663490 0.3529062 0.5887905        NA
3  3     HBO      4 0.3104990 0.09473057 0.1743012 0.2300987 0.2707363
4  4     HBO      6 0.3049929 0.07608640 0.1324872 0.1847441 0.2236615
5  5     HBO      2 0.3128672 0.13736670 0.2303700 0.3128672        NA
6  6     HBO      2 0.2783109 0.09896087 0.1955856 0.2783109        NA
       rad5      rad6      rad7
1 0.4381053        NA        NA
2        NA        NA        NA
3 0.3104990        NA        NA
4 0.2562328 0.2829117 0.3049929
5        NA        NA        NA
6        NA        NA        NA
> 
> fishData <- read.csv("FishData.csv",stringsAsFactors=FALSE) %>% mutate(id=as.character(id))
> head(fishData)
  id species  lake           gear yearcap lencap
1  1     BLG VIK69 Electrofishing    2020    171
2  2     BLG VIK69 Electrofishing    2020    120
3  3     BLG VIK69 Electrofishing    2020    172
4  4     BLG VIK69 Electrofishing    2020    196
5  5     BLG VIK69 Electrofishing    2020    110
6  6     BLG VIK69 Electrofishing    2020    145
> 
> data <- inner_join(fishRadii,fishData,by="id")
> 
> result <- backCalc(data,lencap,BCM="FRALE",inFormat="wide",digits=0)
✔ Using the Fraser-Lee model with a=214.25871707143.
> 
> head(result)
  id reading agecap species  lake           gear yearcap lencap len1 len2 len3
1  1     HBO      4     BLG VIK69 Electrofishing    2020    171  202  188  182
2 10     HBO      2     BLG VIK69 Electrofishing    2020    118  175  147   NA
3 11     HBO      6     BLG VIK69 Electrofishing    2020    182  206  199  195
4 12     HBO      3     BLG VIK69 Electrofishing    2020    141  196  187  170
5 13     HBO      4     BLG VIK69 Electrofishing    2020    172  202  190  182
6 14     HBO      4     BLG VIK69 Electrofishing    2020    175  199  191  184
  len4 len5 len6
1  176   NA   NA
2   NA   NA   NA
3  191  188  185
4   NA   NA   NA
5  177   NA   NA
6  179   NA   NA

Expected behavior
I'm expecting that calculated length get larger when age increase. Take for example fish at id=1, len at capture is 171, radiis are 0.12743160 0.2650279 0.3268283 0.3867132 lengths should go from a lower value of 171 to exactly 171 but instead this is returned:
202 188 182 176

Desktop (please complete the following information):

  • OS: Windows 10
  • R Version 4.0.3

Am I missing something when generating the BC lengths? do you have any hint?

Thank you very much!

PS: I've attached the files required to run the script as a zip file
BC_Bug_Repro_Sample.zip

Use arrows for points in showDigitizedImage()

All for the use of arrows rather than pch symbols for points in showDigitizedImage().

Should be able to do this with text() using unicode characters inside of intToUtf8(), pos= as with the annuli labels, and offset=0. The unicode characters to use are below

intToUtf8(c(9650,9660,9658,9668))

Will probably need to create some sort of catch with pch.show= to catch if the user says "arrows." Or, set a useArrow= logical argument.

Handling no annuli

We have a bunch of age-1 fish that were captured in spring. In other words, we set the edge as an annulus and only click the focus and margin. After clicking the focus and margin, then pushing 'd', everything is fine. I don't know what to do after that, however. If I press 'd' again, the window closes and nothing is saved. It seems like the program requires at least one point after setting the focus, margin, and transect. This is problematic with spring captured age-1 fish when the edge is considered an annulus or age-0 fish in the first year either way

Unable to run digitizeRadii() from command line

Describe the bug
Using RScript.exe from the command line it's not possible to run digitizeRadii()

To Reproduce
Create an R file with this content:

setwd("C:\\Users\\adosp\\AppData\\Roaming\\IowaDnr.DesktopApp\\tmpBDCF")
library(RFishBC)
library(dplyr)
library(RJSONIO)
digitizeRadii("Scale_1.jpg",id="1",reading="HBO",edgeIsAnnulus=FALSE)

than run it with the command:
C:\Program Files\R\R-4.0.3\bin\x64> Rscript.exe "path-to-R-file"

it returns:
Error in eval(predvars, data, env) : object "y" not found
Calls: digitizeRadii ... lines.formula -> eval -> eval -> -> eval -> eval

Expected behavior
It should open the window with the image as it does in RGui

Desktop (please complete the following information):

  • OS: Windows
  • Browser [e.g. chrome, safari]
  • Version latest

Additional context
It may be somenthing with the default device that from the command line is "pdf" and not "windows"?

Thanks in advance for any hint!

Make a dialog box for the id argument

Make a dialog box for the id= argument in digitizeData() so that the user would not have to enter it as an argument. In other words, the user could leave off filename= and id= and receive a dialog box to enter both.

Note sure how to make platform-independent dialog boxes. Need to research this.

Preparing for v0.2.7 (updated for R 4.3)

Below are the steps used to prepare RFishBC for submission to CRAN. The steps should generally be followed in order (i.e., don't move to the next step without success at the current step). It is common to have to repeat some previous steps if an error/warning occurs at a subsequent step (in my experience, this most often happens after checking on the development version of R when using R-winbuilder).

It is worth noting that this whole process can take 2-3 hours (or more depending on internet speed) with significant "waiting time" for checks and builds.


0 - Preparatory Updates

  • Update to latest R version.
  • Update to latest RStudio version.
  • Update all packages, especially those that RFishBC depend on.

1 - dev branch (at local repo)

  • Ensure no outstanding issues in checks on CRAN
  • Ensure that all branches emanating from dev have been appropriately merged to dev via pull request.
  • Update Version field in DESCRIPTION (next number up without the .9000 on the end).
  • Update Date field in DESCRIPTION.
  • Update Version in top header of NEWS.md (next number up without the .9000 on the end).
  • Ensure that NEWS.md contains descriptions of all major changes (this is usually done in "real-time" as changes are being made).
  • Create new cran-comments-vX_X_X.md file in cran-comments folder. This will likely just be a copy of the same file from the previous version, but may include notes specific to inquiries from CRAN operators. [Note that this will be used in Section 5 below, so leave the file open).
  • Run pkgdown::build_site() in the console of RStudio.

2 - dev branch (at local repo)

  • Run Build..Check in RStudio. Address all errors, warnings, and notes and redo parts of the previous section as necessary. [There should generally be no errors, warnings, or notes as the package should have been checked with each major change to dev. At times I will get a note about a new author or not being able to verify current time.]
  • Build a "source package" in RStudio with More..Build Source Package.
  • Upload source package to all three "flavors" at R-winbuilder. Wait for an e-mail reply from R-winbuilder. Any errors, warnings, or notes for any flavor should be addressed (after which this step, and possibly relevant steps above, should be repeated).
  • Upload source package to both the "release" and "development" "flavors" at R-macbuilder. Monitor results (especially "Check Log") page (will be given a link upon submission). Any errors, warnings, or notes for any flavor should be addressed (after which this step, and possibly relevant steps above, should be repeated).
  • Push changes from above from local machine to dev branch on GitHub.

3 - dev branch (at remote GitHub repo)

  • Ensure that "R-CMD-check.yaml" GitHub action was successful for the dev branch (this should run automatically with the push to dev, but will take some time to finish (possibly >20 mins)). If not successful then address issues and repeat as much above as necessary.
  • Create a pull-request asking to merge the dev branch to the main branch. Ask someone from the RFishBC team to review the request. [Ensure that all checks were successfully completed.]

4 - main branch (at remote GitHub repo)

  • Merge approved (assumingly) pull request from dev branch.

5 - main branch (at local repo)

  • Fetch the remote main branch and pull the updates to local main branch so that the local and remote main branches are the same.
  • Build a "source package" in RStudio with More..Build Source Package.
  • Build a "binary package" in RStudio with More..Build Binary Package.
  • Goto the CRAN submission page. Enter your first and last names. Press Choose File and choose the source file (.tar.gz) created above. Copy the comments from the relevant cran-comments-vX_X_X.md and paste into the optional comments box. Press the Upload Package button.
  • Review the ensuing page (it is usually correct) and press Submit Package button at the bottom.
  • Wait for an e-mail from CRAN (this is usually pretty quick) and press the contained link to open a new webpage.
  • Check all three boxes (make sure that your answers are truthful) and press Upload the Package to CRAN. You should get a confirmation e-mail almost immediately (no need to respond to this).

6 - main branch (at remote GitHub repo)

  • Create a new release. Tag should relate to the version number and the Title should state that the version number is being released to CRAN (see past examples). Make sure that the Target is set to Main. Add an optional Description if desired. Drag and drop the source (.tar.gz) and binary (.zip) files created in the previous step on to the Attach binaries ... box. Press Publish Release.

7 - dev branch (at remote GitHub repo)

  • Create a pull-request asking to merge the main branch to the dev branch. This is needed after merging dev to main above so that the two branches are synced.
  • Merge pull request from main branch (OK to do this without getting approval from RFishBC team member). Note that the dev branch will say it is "1 commit ahead of main" after this step.

8 - dev branch (at local repo)

  • Fetch the remote dev branch and pull the updates to local dev branch so that the local and remote dev branches are the same.
  • Update Version field in DESCRIPTION by appending .9000 to the end.
  • Create a new section at the top of NEWS.md with the new version number (i.e., including the .9000 on the end).
  • Push these changes to the remote dev branch. This is the start of the next version.

Handling "curved" growth trajectories

Thanks for developing the RFishBC package. I was hoping to use it to back-calculate length at age for my annotated library of Bluefin tuna otoliths. One complication with these otoliths is that the transect does not follow the arm of the otolith. I thought that if the snap2transect argument was false I would have access to the x and y coordinates of the selected annuli and that I could sum the inter annular distances from origin to margin instead of using the transect distance for back calculating length at age.

Skip an image

Is it possible to include a 'skip' option if the image is no good? Presumably this would result in either no .rds file or an empty .rds file.

This would be useful when working on multiple images in succession.

Any order clicking

Allow the user to click on the annuli in any order (1st, 4th, 3rd, 2nd).

Should be easy to implement by sorting the radial measurements. Will want to be careful to make sure that the x-y coordinates get sorted in the same order. Might be some other issues.

Changes needed after transfer to fishR-Core-Team

The following items should be changed, modified, or corrected following the transfer of the repo to fishrR-Core-Team.

  • Change the ReadMe
    • Remove references to Derek and DerekOgle.com,
    • Correct links to RFishBC webpage (once it has been transferred)
    • Correct link to fishR webpage (once that is at AFS)
  • Start a new .9000 version
  • Start a new "ongoing" section in the NEWS
  • Setup codecov (and should update the GitHub Action to here).
  • Transfer. update, or setup the Zenodo DOI.
  • Determine team member access (see Settings ... Collaborators and teams)
  • Make sure the action works
    • RCMD-CHECK
    • pkgdown
  • Update sticker (will have new URL)
  • Reconsider the license type (complete descriptions, summarized, help choosing)

Add more items as we think of them.

Those on fishR-Core-Team should update our remote link to RFishbC or checkout a new local copy if they had a local copy from droglenc.

Too many transect points causes a problem

If there are more than 2 points when marking focus and margin and “f” is pressed an error occur is printed but the images is locked. To continue the image must be closed and reopened. Is there a way to keep the image open to allow the user to delete the extra points?

Replace captioner package

The captioner package has been archived. Thus, its use in some of the vignettes is causing problems during webpage development. I suggest changing vignettes to quarto (if that is possible) to fix this issue. Will need to research how to use quarto for vignettes.

Put some image information on the image

Not a pressing issue by any means, but would it be easy to overlay the assigned id somewhere on the image that pops up from digitizeRadii()? I found myself moving through images pretty quick and it might be an additional layer of quality control. Then again, it might get in the way of the image.

Delete point on image

Is there a way to make deleted points go away rather than overlaying an 'error point' on top of them? I messed with the settings to make the error point transparent, but the initial point I placed in error remained. I think things would be cleaner if the point simply disappeared after pushing 'd'.

Selected points don't appear on a vertical transect

If the transect is perfectly vertical then the points don't appear on the transect when selecting annuli. This is likely a problem with the "snapping to the transect" and will likely also be a problem with horizontal transects.

Allow user to quickly review digitized images across multiple individuals

A user (Nathan Stewart) would like to be able to quickly look at (review) his digitized images across multiple individuals. This can be accomplished with the following code (using a list of rds files in a directory as an example).

setwd()
tmp <- listFiles(".rds")
for (i in tmp) {
  showDigitizedImage(i)
  invisible(readline(prompt="Press [enter] to continue"))
} 

but it requires the user to click back to the console to continue to the next image. It would be better if I created a reviewDigitizedImages() function that took a list of rds file names, cycled through those but allowed the user to press "N" to go to the next image or "P" to go to a previous image. The new function should be able to rely on many of the internals for showDigitizedImage() along with some of the key press code in iSelectPoints().

Add Carlander standards

Create a data.frame that contains the Carlander length correction standards and a function that can extract them based on a given species. Similar to PSDlit and psdVals() in FSA package.

Measurement Tool and Start Annuli Count elsewhere

Consider making a tool that will show an actual measurement to a point. And then consider making it so that the annuli counting starts at other than the first mark.

See this ... "We age only continental growth in eel, as its essentially impossible to age the period of time from the centre of the otolith to the first annulus while the juvenile is at sea. In our work, the distance from the centre of the otolith to the “zero band” (the band laid down when an elver moved from sea to freshwater) is generally accepted as being approximately 172 microns (give-or-take). We use a measure tool in ImagePro to identify and mark this zero band before applying other annuli. The annuli from there onwards would be years 1, 2, 3 etc. Is it possible to include a measurement tool in RFishBC to measure from otolith centre outwards in order to identify the zero band? Then have subsequent annuli counted as 1, 2, 3 etc."

Issues with tibbles and `backCalc()`

backCalc() fails when the data is a tibble because the following lines return a one-column data.frame on tibbles but a vector on regular data.frames. This can be corrected by converting the tibble to a data.frame with as.data.frame() but I need to find a more robust answer. Another possible solution, but I need to research this more, is to add drop=TRUE to the following lines in backCalc().

regLcap <- regdat[,rlang::quo_name(rlang::enquo(lencap))]
Lcap <- dat[,rlang::quo_name(rlang::enquo(lencap))]

Error in FUN(X[[i]], ...) : object 'pos' not found in showDigitizedImage()

library(RFishBC)
#Measure Radii
digitizeRadii("Oto.jpg",

  •           id = "Oto",
    
  •           reading = "DHO",
    
  •           description = "Used to demonstrate use of scale-bar.",
    
  •           scaleBar = TRUE,
    
  •           scaleBarLength = 0.1,# this image had a 1-mm scale-bar
    
  •           edgeIsAnnulus = F)
    

✔ Loaded the Oto.jpg image.

☰ Select the endpoints of the scale-bar.
Press 'f' when finished, 'd' to delete selection.
✔ Found scaling factor from the selected scale-bar.

☰ Select the FOCUS (center) and MARGIN (edge) of the structure.
Press 'f' when finished, 'd' to delete selection.
✔ Transect selected and shown on image.

☰ Select points that are annuli.
Press 'f' when finished, 'd' to delete selection.
✔ 6 points were selected.

✔ Results written to Oto_DHO.rds

#Data from One Structure
combineData("Oto_DHO.rds")
id reading agecap ann rad radcap
1 Oto DHO 4 1 0.05653221 0.2061728
2 Oto DHO 4 2 0.10065765 0.2061728
3 Oto DHO 4 3 0.13284496 0.2061728
4 Oto DHO 4 4 0.16040859 0.2061728
combineData("Oto_DHO.rds",outFormat = "wide")
id reading agecap radcap rad1 rad2 rad3 rad4
1 Oto DHO 4 0.2061728 0.05653221 0.1006576 0.132845 0.1604086
#Visualize One Set of Annuli
showDigitizedImage("Oto_DHO.rds",

  •                pch.show = "+",
    
  •                col.show = "blue",
    
  •                col.transect = "white",
    
  •                col.ann = "black",
    
  •                cex.ann = 1,
    
  •                annuliLabels = 1:4,
    
  •                lwd.transect = 2)
    

Error in FUN(X[[i]], ...) : object 'pos' not found

Preserve Fish that Cannot be Back-Calculated

This message came from a user ...

I am using RFishBC to age and back calculate some bass otoliths. There were a few fish whose otos were not usable, but I wanted to preserve those length/weight entries throughout my data. I used left_join (instead of inner join) when combining my fish data to the age data, which worked to keep those fish. However, when I used the backCalc function, those fish with NAs for ages went away. Is there an argument to keep those when using the backCalc function? Thanks for any tips you can offer.

This does seem to be the case as the code below demonstrates.

library(tidyverse)
library(RFishBC)

# Get some data (same data as in vignette)
data(SMBassWB1,package="RFishBC") ## fish data
data(SMBassWB2,package="RFishBC") ## rad data

# Simplify to 3 fish so we can see what is going on
tmp1 <- filter(SMBassWB1,id %in% c(377,378,379))
tmp2 <- filter(SMBassWB2,id %in% c(377,378,379))

# Create an extra fish with length (tmp1) but no rad
tmp1 <- rbind(tmp1,
              data.frame(id=999,
                         species="SMB",lake="WB",gear="E",
                         yearcap=1990,lencap=225))
# Combine data frames
tmp <- left_join(tmp1,tmp2,by="id")
tmp

## Demonstrate that fish 999 is lost
res1 <- backCalc(tmp,lencap,BCM="DALE",
                 inFormat="wide",digits=0)
res1

Change color of focus and margin point

Consider creating an option that uses something other than the same pch or col for the focus and the margin. This would make it easier to count the annuli.

Could set up a pch.fm= and col.fm= that could be set for the pch and col of the focus and margin. These could default to pch.show= and col.show= to maintain the current behavior. Consider dropping the points if showTransect=TRUE as the focus and margin are the ends of the transect.

Ability to add a comment to the RDS file

In digitizeRadii(), it would be useful to have an option to append a comment to the rds file that you could subsequently pull into your data output. In our previous workflow, we would frequently flag a reading with a comment for some reason, for example, for quality audit if we felt the aging was suspect or we wanted a second opinion.

Compatible R versions for RFishBC

Describe the bug
Unable to load RFishBC in R version 4.3
To Reproduce
attempted to install package RFishBC
Are there plans to update RFishBC so it operates in R version 4.3?

Expected behavior
the package to load and be usable

Screenshots

Desktop (please complete the following information):

  • OS: [Microsoft Windows 11]
  • Browser [chrome]
  • Version [23H2]

Additional context
Warning message:
package "RFishBC' is not available for this version of R

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.