knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(gfsR) data("tw2")
The primary function of gfsR
is to be able to import FishNet2 (FN2) DATA.ZIP
files directly in to R. This is a short vignette to demonstrate some of the functionality available by using the common functions.
library(gfsR)
The most common usage is to import a single FN2 project. This is accomplished by providing the file path directly to one of the import functions. For this example we'll use import_fn_index_net
to import a gill net project. All functions import FN2 tables as tables in a list and thus will need to be assigned to a variable. This approach was taken to allow the option for different projects to be imported to a local environment at the same time and eventually combined as required.
tw2 <- import_fn_index_net("Data/TW2/IA15_TW2/DATA.ZIP")
The gfsR
functions make use of messages from the usethis
package to provide chatty functions that provide indications of progress and note any tables that are not available.
A quick way to examine the data is to use lapply
and head
.
lapply(tw2, head)
Frequently users will want to access the tables directly as dataframe in the global environment rather than as a dataframe in a list. This is quickly accomplished with the list2env
function. CAUTION: using the list2env
will overwrite existing tables in the global environment.
ls() # shows current variables in global environment list2env(tw2, envir = .GlobalEnv) # to move list elements to global env. ls() # verify all tables exist in global env.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.