├── .Rbuildignore ├── .github ├── .gitignore ├── CONTRIBUTING.md ├── ISSUE_TEMPLATE.md └── workflows │ ├── R-CMD-check.yaml │ ├── pkgdown.yaml │ └── test-coverage.yaml ├── .gitignore ├── DESCRIPTION ├── LICENSE ├── LICENSE.md ├── NAMESPACE ├── NEWS.md ├── R ├── artifact_edition.R ├── artifact_helpers.R ├── channel_functions.R ├── compat_utils.R ├── constructors.R ├── constructors_helpers.R ├── data.R ├── defunct.R ├── deprecated.R ├── dplyr_ext.R ├── dplyr_verbs.R ├── dplyr_verbs_helpers.R ├── eeguana-package.R ├── events_tbl.R ├── exported_utils.R ├── filters.R ├── filters_helpers.R ├── funs.R ├── ica.R ├── ica_funs.R ├── ini.R ├── k.R ├── out.R ├── plot.R ├── plot_helpers.R ├── psd.R ├── read.R ├── read_helpers.R ├── reexports.R ├── segmentation.R ├── signal_helpers.R ├── signal_processing.R ├── signal_processing_helpers.R ├── signal_tbl.R ├── simulation.R ├── sysdata.rda ├── tbl.R ├── test_utils.R ├── tf.R ├── time_sample.R ├── to_eeg_lst.R ├── to_tbl.R ├── tools.R ├── utils-pipe.R ├── utils-prep.R ├── utils.R ├── utils_dt.R ├── write.R └── zzz.R ├── README.Rmd ├── README.md ├── _pipeline.txt ├── _pkgdown.yml ├── codecov.yml ├── codemeta.json ├── data-raw ├── create_MNE.R ├── create_faces_data.R ├── create_layout.R ├── create_test_data.R ├── layout_32_1020.csv └── logo.png ├── data ├── data_faces_10_trials.rda ├── data_faces_ERPs.rda └── layout_32_1020.rda ├── eeguana.Rproj ├── inst ├── CITATION ├── WORDLIST ├── logos │ ├── logo.eps │ ├── logo.png │ └── logo.svg ├── pkgdown.yml └── testdata │ ├── EMP01.vhdr │ ├── EMP01.vmrk │ ├── EMP01_events.csv │ ├── Newtest17-256.bdf │ ├── asalab_export_bv.eeg │ ├── asalab_export_bv.vhdr │ ├── asalab_export_bv.vmrk │ ├── asalab_export_bv_2.vhdr │ ├── asalab_export_edf_Segment_1.edf │ ├── bv_export_bv_txt_bin_multi.dat │ ├── bv_export_bv_txt_bin_multi.set │ ├── bv_export_bv_txt_bin_multi.vhdr │ ├── bv_export_bv_txt_bin_multi.vmrk │ ├── bv_export_bv_txt_bin_multi2.set │ ├── bv_export_bv_txt_bin_multi3.fdt │ ├── bv_export_bv_txt_bin_multi3.set │ ├── bv_export_bv_txt_bin_multi_16bit.dat │ ├── bv_export_bv_txt_bin_multi_16bit.vhdr │ ├── bv_export_bv_txt_bin_multi_16bit.vmrk │ ├── bv_export_bv_txt_bin_multi_32bit.dat │ ├── bv_export_bv_txt_bin_multi_32bit.vhdr │ ├── bv_export_bv_txt_bin_multi_32bit.vmrk │ ├── bv_export_bv_txt_bin_multi_epoched.fdt │ ├── bv_export_bv_txt_bin_multi_epoched.set │ ├── bv_export_bv_txt_bin_multi_epoched_1.set │ ├── bv_export_bv_txt_bin_multi_epoched_one.set │ ├── bv_export_bv_txt_bin_vector.dat │ ├── bv_export_bv_txt_bin_vector.vhdr │ ├── bv_export_bv_txt_bin_vector.vmrk │ ├── bv_export_bv_txt_bin_vector_16bit.dat │ ├── bv_export_bv_txt_bin_vector_16bit.vhdr │ ├── bv_export_bv_txt_bin_vector_16bit.vmrk │ ├── bv_export_bv_txt_bin_vector_32bit.dat │ ├── bv_export_bv_txt_bin_vector_32bit.vhdr │ ├── bv_export_bv_txt_bin_vector_32bit.vmrk │ ├── bv_export_bv_txt_txt_multi.dat │ ├── bv_export_bv_txt_txt_multi.vhdr │ ├── bv_export_bv_txt_txt_multi.vmrk │ ├── bv_export_bv_txt_txt_vector.dat │ ├── bv_export_bv_txt_txt_vector.vhdr │ ├── bv_export_bv_txt_txt_vector.vmrk │ ├── bv_export_edf+.edf │ ├── bv_export_edf.edf │ ├── bv_segexport_ascii.dat │ ├── bv_segexport_ascii.vhdr │ ├── bv_segexport_ascii.vmrk │ ├── bv_segexport_bin.dat │ ├── bv_segexport_bin.vhdr │ ├── bv_segexport_bin.vmrk │ ├── data.txt │ ├── eeglab_data.set │ ├── fieldtrip_matrix.mat │ ├── sample_audvis_10s_raw.fif │ ├── test_generator_2.bdf │ └── test_generator_2.edf ├── man ├── annotate_electrodes.Rd ├── annotate_events.Rd ├── annotate_head.Rd ├── as.data.frame.eeg_lst.Rd ├── as.data.frame.psd_lst.Rd ├── as.data.table.eeg_lst.Rd ├── as.data.table.psd_lst.Rd ├── as_channel_dbl.Rd ├── as_eeg_lst.Rd ├── as_sample_int.Rd ├── as_tibble.eeg_lst.Rd ├── as_tibble.psd_lst.Rd ├── as_tidytable.eeg_lst.Rd ├── as_tidytable.psd_lst.Rd ├── as_time.Rd ├── between.Rd ├── change_coord.Rd ├── channel_dbl.Rd ├── channels_tbl.Rd ├── chs_fun.Rd ├── chs_mean.Rd ├── component_dbl.Rd ├── count_complete_cases_tbl.Rd ├── data_faces_10_trials.Rd ├── data_faces_ERPs.Rd ├── defunct.Rd ├── dplyr_verbs.Rd ├── drop_incomplete_segments.Rd ├── eeg_artif.Rd ├── eeg_baseline.Rd ├── eeg_bind.Rd ├── eeg_downsample.Rd ├── eeg_events_to_NA.Rd ├── eeg_ica.Rd ├── eeg_ica_cor_tbl.Rd ├── eeg_ica_keep.Rd ├── eeg_ica_show.Rd ├── eeg_ica_summary_tbl.Rd ├── eeg_ica_var_tbl.Rd ├── eeg_interpolate_tbl.Rd ├── eeg_lst.Rd ├── eeg_power_band.Rd ├── eeg_psd.Rd ├── eeg_rereference.Rd ├── eeg_segment.Rd ├── eeg_slice_signal.Rd ├── eeguana-package.Rd ├── events_tbl.Rd ├── fICA.Rd ├── fast_ICA.Rd ├── figures │ ├── README-plot-1.png │ └── README-topo-1.png ├── filt.Rd ├── ggplot.eeg_lst.Rd ├── ica_matrix_lst.Rd ├── install_py_eeguana.Rd ├── is_channel_dbl.Rd ├── is_component_dbl.Rd ├── is_eeg_lst.Rd ├── is_events_tbl.Rd ├── is_psd_lst.Rd ├── is_psd_tbl.Rd ├── is_sample_int.Rd ├── is_signal_tbl.Rd ├── layout_32_1020.Rd ├── na_omit.Rd ├── pipe.Rd ├── plot.eeg_lst.Rd ├── plot_components.Rd ├── plot_in_layout.Rd ├── plot_topo.Rd ├── psd_lst.Rd ├── read_edf.Rd ├── read_fif.Rd ├── read_ft.Rd ├── read_set.Rd ├── read_vhdr.Rd ├── reexports.Rd ├── rpink.Rd ├── sample_int.Rd ├── segments_tbl.Rd ├── sig_fft.Rd ├── sig_ifft.Rd ├── signal_tbl.Rd ├── summaries.Rd ├── summary.eeg_lst.Rd ├── theme_eeguana.Rd └── write_vhdr.Rd ├── papers.bib ├── pkgdown └── favicon │ ├── apple-touch-icon-120x120.png │ ├── apple-touch-icon-60x60.png │ ├── apple-touch-icon-76x76.png │ ├── apple-touch-icon.png │ ├── favicon-16x16.png │ ├── favicon-32x32.png │ └── favicon.ico ├── tests ├── spelling.R ├── spelling.Rout.save ├── testthat.R └── testthat │ ├── _snaps │ ├── 01-reading.md │ ├── 02-ica.md │ ├── 10-summarizing.md │ └── 16-out_funs.md │ ├── helper_funs.R │ ├── setup.R │ ├── test_01-reading.R │ ├── test_02-ica.R │ ├── test_03-filt.R │ ├── test_04-segmentation.R │ ├── test_05-tv_01a-mutate.R │ ├── test_05-tv_01b-mutate.R │ ├── test_05-tv_02-filter.R │ ├── test_05-tv_03-joins.R │ ├── test_05-tv_04-summarize.R │ ├── test_05-tv_05-group_by.R │ ├── test_05-tv_06-bind.R │ ├── test_05-tv_07-select.R │ ├── test_05-tv_08-rename.R │ ├── test_05-tv_09-atif.R │ ├── test_06-artifacts.R │ ├── test_07-EEG-specialized.R │ ├── test_08-channels.R │ ├── test_09-plots.R │ ├── test_10-summarizing.R │ ├── test_11-editing.R │ ├── test_12-constr.R │ ├── test_13-defunct.R │ ├── test_14-load.R │ ├── test_15-misc.R │ ├── test_16-out_funs.R │ ├── test_17-time.R │ ├── test_18-to_tbl.R │ ├── test_19-vs_python.R │ └── test_20-psd.R └── vignettes ├── gotchas.Rmd ├── intro.Rmd ├── preprocessing_erp.Rmd ├── psd.Rmd_ └── references.bib /.Rbuildignore: -------------------------------------------------------------------------------- 1 | ^\.github$ 2 | ^data-raw$ 3 | ^appveyor\.yml$ 4 | ^Meta$ 5 | ^doc$ 6 | ^codecov\.yml$ 7 | ^\.travis\.yml$ 8 | ^docs$ 9 | ^_pkgdown\.yml$ 10 | ^LICENSE\.md$ 11 | ^README\.Rmd$ 12 | ^codemeta\.json$ 13 | ^CONTRIBUTE\.md$ 14 | experimental 15 | ^faces.* 16 | ^before.* 17 | ^.*\.Rproj$ 18 | ^\.Rproj\.user$ 19 | ^eeguana\.sublime-project 20 | ^eeguana.sublime-workspace 21 | ^temp_exp.* 22 | ^vignettes\.*\.vhdr 23 | ^vignettes\.*\.vmrk 24 | ^vignettes\.*\.dat 25 | ^vignettes\.*\.eeg 26 | ^vignettes\.*\.Rmd 27 | ^vignettes.* 28 | ^pkgdown.* 29 | ^_pipeline.* 30 | ^_.* 31 | ^papers.bib 32 | 33 | -------------------------------------------------------------------------------- /.github/.gitignore: -------------------------------------------------------------------------------- 1 | *.html 2 | -------------------------------------------------------------------------------- /.github/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing to pangoling 2 | 3 | This outlines how to propose a change to eeguana. 4 | For a detailed discussion on contributing to this and other tidyverse packages, please see the [development contributing guide](https://rstd.io/tidy-contrib) and our [code review principles](https://code-review.tidyverse.org/). 5 | 6 | ## Fixing typos 7 | 8 | You can fix typos, spelling mistakes, or grammatical errors in the documentation directly using the GitHub web interface, as long as the changes are made in the _source_ file. 9 | This generally means you'll need to edit [roxygen2 comments](https://roxygen2.r-lib.org/articles/roxygen2.html) in an `.R`, not a `.Rd` file. 10 | You can find the `.R` file that generates the `.Rd` by reading the comment in the first line. 11 | 12 | ## Bigger changes 13 | 14 | If you want to make a bigger change, it's a good idea to first file an issue and make sure someone from the team agrees that it’s needed. 15 | If you’ve found a bug, please file an issue that illustrates the bug with a minimal 16 | [reprex](https://www.tidyverse.org/help/#reprex) (this will also help you write a unit test, if needed). 17 | See our guide on [how to create a great issue](https://code-review.tidyverse.org/issues/) for more advice. 18 | 19 | ### Pull request process 20 | 21 | * Fork the package and clone onto your computer. If you haven't done this before, we recommend using `usethis::create_from_github("bnicenboim/pangoling", fork = TRUE)`. 22 | 23 | * Install all development dependencies with `devtools::install_dev_deps()`, and then make sure the package passes R CMD check by running `devtools::check()`. 24 | If R CMD check doesn't pass cleanly, it's a good idea to ask for help before continuing. 25 | * Create a Git branch for your pull request (PR). We recommend using `usethis::pr_init("brief-description-of-change")`. 26 | 27 | * Make your changes, commit to git, and then create a PR by running `usethis::pr_push()`, and following the prompts in your browser. 28 | The title of your PR should briefly describe the change. 29 | The body of your PR should contain `Fixes #issue-number`. 30 | 31 | * For user-facing changes, add a bullet to the top of `NEWS.md` (i.e. just below the first header). Follow the style described in . 32 | 33 | ### Code style 34 | 35 | * New code should follow the tidyverse [style guide](https://style.tidyverse.org). 36 | You can use the [styler](https://CRAN.R-project.org/package=styler) package to apply these styles, but please don't restyle code that has nothing to do with your PR. 37 | 38 | * We use [roxygen2](https://cran.r-project.org/package=roxygen2), with [Markdown syntax](https://cran.r-project.org/web/packages/roxygen2/vignettes/rd-formatting.html), for documentation. 39 | 40 | * We use [testthat](https://cran.r-project.org/package=testthat) for unit tests. 41 | Contributions with test cases included are easier to accept. 42 | 43 | ## Code of conduct 44 | 45 | Please note that this package is released with a [Contributor 46 | Code of Conduct](https://ropensci.org/code-of-conduct/). 47 | By contributing to this project, you agree to abide by its terms. 48 | 49 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Please briefly describe your problem and what output you expect. If you have a question, please don't use this form. Instead, ask on https://github.com/bnicenboim/eeguana/discussions. 2 | 3 | Please include a minimal reproducible example (AKA a reprex). If you've never heard of a [reprex](http://reprex.tidyverse.org/) before, start by reading . 4 | 5 | --- 6 | 7 | *Brief description of the problem* 8 | 9 | ```r 10 | # insert reprex here 11 | ``` 12 | 13 | *Operative system:* 14 | 15 | (Windows 10, Ubuntu 20.04.2 LTS, etc) 16 | 17 | *Output of `sessionInfo()`:* 18 | 19 | ``` 20 | 21 | ``` 22 | -------------------------------------------------------------------------------- /.github/workflows/R-CMD-check.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | branches: [main, master] 8 | 9 | name: R-CMD-check 10 | 11 | jobs: 12 | R-CMD-check: 13 | runs-on: ${{ matrix.config.os }} 14 | 15 | name: ${{ matrix.config.os }} (${{ matrix.config.r }}) 16 | 17 | strategy: 18 | fail-fast: false 19 | matrix: 20 | config: 21 | - {os: macos-latest, r: 'release'} 22 | - {os: windows-latest, r: 'release'} 23 | - {os: ubuntu-latest, r: 'devel', http-user-agent: 'release'} 24 | - {os: ubuntu-latest, r: 'release'} 25 | - {os: ubuntu-latest, r: 'oldrel-1'} 26 | 27 | env: 28 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 29 | R_KEEP_PKG_SOURCE: yes 30 | 31 | steps: 32 | - uses: actions/checkout@v3 33 | 34 | - uses: r-lib/actions/setup-pandoc@v2 35 | 36 | - uses: r-lib/actions/setup-r@v2 37 | with: 38 | r-version: ${{ matrix.config.r }} 39 | http-user-agent: ${{ matrix.config.http-user-agent }} 40 | use-public-rspm: true 41 | 42 | - uses: r-lib/actions/setup-r-dependencies@v2 43 | with: 44 | extra-packages: any::rcmdcheck 45 | needs: check 46 | # - uses: actions/setup-python@v4 47 | # with: 48 | # python-version: "3.9.x" 49 | # 50 | # - name: setup r-reticulate venv 51 | # shell: Rscript {0} 52 | # run: | 53 | # python_packages <- 54 | # c("numpy", "torch", "transformers") 55 | # 56 | # library(reticulate) 57 | # virtualenv_create("r-reticulate", Sys.which("python")) 58 | # virtualenv_install("r-reticulate", python_packages) 59 | # 60 | # path_to_python <- virtualenv_python("r-reticulate") 61 | # writeLines(sprintf("RETICULATE_PYTHON=%s", path_to_python), 62 | # Sys.getenv("GITHUB_ENV")) 63 | # 64 | 65 | 66 | 67 | - uses: r-lib/actions/check-r-package@v2 68 | with: 69 | upload-snapshots: true 70 | -------------------------------------------------------------------------------- /.github/workflows/pkgdown.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | branches: [main, master] 8 | release: 9 | types: [published] 10 | workflow_dispatch: 11 | 12 | name: pkgdown 13 | 14 | jobs: 15 | pkgdown: 16 | runs-on: ubuntu-latest 17 | # Only restrict concurrency for non-PR jobs 18 | concurrency: 19 | group: pkgdown-${{ github.event_name != 'pull_request' || github.run_id }} 20 | env: 21 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 22 | steps: 23 | 24 | - uses: actions/checkout@v3 25 | 26 | - uses: r-lib/actions/setup-pandoc@v2 27 | 28 | - uses: r-lib/actions/setup-r@v2 29 | with: 30 | use-public-rspm: true 31 | 32 | - uses: r-lib/actions/setup-r-dependencies@v2 33 | with: 34 | extra-packages: any::pkgdown, local::. 35 | needs: website 36 | 37 | # - uses: actions/setup-python@v4 38 | # with: 39 | # python-version: "3.9.x" 40 | 41 | # - name: setup r-reticulate venv 42 | # shell: Rscript {0} 43 | # run: | 44 | # python_packages <- 45 | # c("numpy", "torch", "transformers") 46 | # 47 | # library(reticulate) 48 | # virtualenv_create("r-reticulate", Sys.which("python")) 49 | # virtualenv_install("r-reticulate", python_packages) 50 | # 51 | # path_to_python <- virtualenv_python("r-reticulate") 52 | # writeLines(sprintf("RETICULATE_PYTHON=%s", path_to_python), 53 | # Sys.getenv("GITHUB_ENV")) 54 | 55 | - name: Build site 56 | run: pkgdown::build_site_github_pages(new_process = FALSE, install = FALSE) 57 | shell: Rscript {0} 58 | 59 | - name: Deploy to GitHub pages 🚀 60 | if: github.event_name != 'pull_request' 61 | uses: JamesIves/github-pages-deploy-action@v4.4.1 62 | with: 63 | clean: false 64 | branch: gh-pages 65 | folder: docs 66 | -------------------------------------------------------------------------------- /.github/workflows/test-coverage.yaml: -------------------------------------------------------------------------------- 1 | # Workflow derived from https://github.com/r-lib/actions/tree/v2/examples 2 | # Need help debugging build failures? Start at https://github.com/r-lib/actions#where-to-find-help 3 | on: 4 | push: 5 | branches: [main, master] 6 | pull_request: 7 | branches: [main, master] 8 | 9 | name: test-coverage 10 | 11 | jobs: 12 | test-coverage: 13 | runs-on: ubuntu-latest 14 | env: 15 | GITHUB_PAT: ${{ secrets.GITHUB_TOKEN }} 16 | 17 | steps: 18 | - uses: actions/checkout@v3 19 | 20 | - uses: r-lib/actions/setup-r@v2 21 | with: 22 | use-public-rspm: true 23 | 24 | - uses: r-lib/actions/setup-r-dependencies@v2 25 | with: 26 | extra-packages: any::covr 27 | needs: coverage 28 | 29 | # - uses: actions/setup-python@v4 30 | # with: 31 | # python-version: "3.9.x" 32 | # 33 | # - name: setup r-reticulate venv 34 | # shell: Rscript {0} 35 | # run: | 36 | # python_packages <- 37 | # c("numpy", "torch", "transformers") 38 | # 39 | # library(reticulate) 40 | # virtualenv_create("r-reticulate", Sys.which("python")) 41 | # virtualenv_install("r-reticulate", python_packages) 42 | # 43 | # path_to_python <- virtualenv_python("r-reticulate") 44 | # writeLines(sprintf("RETICULATE_PYTHON=%s", path_to_python), 45 | # Sys.getenv("GITHUB_ENV")) 46 | # 47 | 48 | - name: Test coverage 49 | env: 50 | CODECOV_TOKEN: ${{secrets.codecov_token}} 51 | run: | 52 | covr::codecov( 53 | quiet = FALSE, 54 | clean = FALSE, 55 | install_path = file.path(Sys.getenv("RUNNER_TEMP"), "package") 56 | ) 57 | shell: Rscript {0} 58 | 59 | - name: Show testthat output 60 | if: always() 61 | run: | 62 | ## -------------------------------------------------------------------- 63 | find ${{ runner.temp }}/package -name 'testthat.Rout*' -exec cat '{}' \; || true 64 | shell: bash 65 | 66 | - name: Upload test results 67 | if: failure() 68 | uses: actions/upload-artifact@v3 69 | with: 70 | name: coverage-test-failures 71 | path: ${{ runner.temp }}/package 72 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Meta 2 | doc 3 | .Rproj.user 4 | .Rhistory 5 | .RData 6 | .Ruserdata 7 | eegble_func.old 8 | eegble_func.old.R 9 | read.old 10 | test_del.R 11 | inst/doc/ 12 | temp_exp/ 13 | tests/testthat/other_tests.R 14 | # produced vignettes 15 | vignettes/*.html 16 | vignettes/*.pdf 17 | #data used in the vignettes 18 | vignettes/*.vhdr 19 | vignettes/*.vmrk 20 | vignettes/*.dat 21 | # Workspace files are user-specific 22 | *.sublime-workspace 23 | *.sublime-project 24 | /*.vhdr 25 | /*.dat 26 | /*.vmrk 27 | inst/doc 28 | -------------------------------------------------------------------------------- /DESCRIPTION: -------------------------------------------------------------------------------- 1 | Package: eeguana 2 | Type: Package 3 | Title: Flexible Manipulation of EEG Data 4 | Description: Flexible manipulation of EEG data in R. It provides a data.table 5 | powered framework for manipulating EEG data with dplyr-based functions 6 | (e.g., `mutate`, `filter`, `summarize`) extended to a new class, eeg_lst, 7 | other EEG-specialized functions, and `ggplot` wrapper functions. The new 8 | class is inspired by tidyverse principles but it's not really "tidy" (due 9 | to space considerations), it's a list of (i) a wide data table (signal_tbl) 10 | that contains the signal amplitudes at every sample point of the EEG, (ii) 11 | an events data table with information about markers (or triggers), blinks 12 | and other exported information, and (iii) a long table with experimental 13 | information, such as participant number (.recording), conditions, etc. 14 | eeguana can do only basic pre-processing for now. 15 | Version: 0.1.11.9001 16 | Authors@R: c( 17 | person("Bruno", "Nicenboim", email = "bruno.nicenboim@tilburguniversity.edu", role = c("aut", "cre")), 18 | person("Kate", "Stone", email = "kate.stone@uni-potsdam.de", role = "ctb"), 19 | person("Mark", "Fairbanks", email = "mark.t.fairbanks@gmail.com", role = "ctb")) 20 | URL: https://bruno.nicenboim.me/eeguana, https://github.com/bnicenboim/eeguana 21 | BugReports: https://github.com/bnicenboim/eeguana/issues 22 | License: MIT + file LICENSE 23 | Encoding: UTF-8 24 | RoxygenNote: 7.2.3 25 | Depends: 26 | R (>= 3.1.0), 27 | stats 28 | Imports: 29 | ggplot2 (>= 3.1.0), 30 | dplyr (>= 1.0.0), 31 | tidyr (>= 0.8.2), 32 | purrr (>= 0.2.5), 33 | tidyselect (>= 0.2.5), 34 | tools, 35 | magrittr (>= 1.5), 36 | rlang (>= 0.3.1), 37 | MBA (>= 0.0.9), 38 | data.table (>= 1.12.2), 39 | edfReader (>= 1.2.0), 40 | gtable (>= 0.2.0), 41 | scales (>= 1.0.0), 42 | fICA (>= 1.1), 43 | JADE (>= 2.0.1), 44 | methods, 45 | MASS, 46 | RcppRoll (>= 0.3.0), 47 | ellipsis (>= 0.1.0), 48 | fastICA, 49 | pracma, 50 | tidytable (>= 0.10.0), 51 | gsignal 52 | Suggests: 53 | akima (>= 0.6.2), 54 | tibble (>= 2.1.1), 55 | plotly (>= 4.8.0), 56 | R.matlab (>= 3.6.2), 57 | reticulate (>= 1.11.1), 58 | testthat (>= 2.0.1), 59 | roxygen2 (>= 6.1.1), 60 | knitr (>= 1.21), 61 | rmarkdown (>= 1.11), 62 | spelling (>= 2.0), 63 | covr (>= 3.2.1), 64 | httr, 65 | cowplot, 66 | rstudioapi 67 | LazyData: true 68 | LazyDataCompression: xz 69 | VignetteBuilder: knitr 70 | Language: en-US 71 | Roxygen: list(markdown = TRUE) 72 | Config/testthat/edition: 3 73 | Remotes: 74 | gjmvanboxtel/gsignal 75 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | YEAR: 2018 2 | COPYRIGHT HOLDER: Bruno Nicenboim 3 | -------------------------------------------------------------------------------- /LICENSE.md: -------------------------------------------------------------------------------- 1 | # MIT License 2 | 3 | Copyright (c) 2018 Bruno Nicenboim 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /R/compat_utils.R: -------------------------------------------------------------------------------- 1 | 2 | 3 | register_s3_method <- function(pkg, generic, class, fun = NULL) { 4 | stopifnot(is.character(pkg), length(pkg) == 1) 5 | envir <- asNamespace(pkg) 6 | 7 | stopifnot(is.character(generic), length(generic) == 1) 8 | stopifnot(is.character(class), length(class) == 1) 9 | if (is.null(fun)) { 10 | fun <- get(paste0(generic, ".", class), envir = parent.frame()) 11 | } 12 | stopifnot(is.function(fun)) 13 | 14 | 15 | if (pkg %in% loadedNamespaces()) { 16 | registerS3method(generic, class, fun, envir = envir) 17 | } 18 | 19 | # Always register hook in case package is later unloaded & reloaded 20 | setHook( 21 | packageEvent(pkg, "onLoad"), 22 | function(...) { 23 | registerS3method(generic, class, fun, envir = envir) 24 | } 25 | ) 26 | } 27 | -------------------------------------------------------------------------------- /R/data.R: -------------------------------------------------------------------------------- 1 | #' ERPs elicited when one subject saw faces and non-faces objects. 2 | #' 3 | #' A dataset containing the ERPs elicited when one subject saw faces and non-faces objects. See also the vignette [Introduction - Manipulating a clean EEG file exported from BrainVision 2.0](https://bnicenboim.github.io/eeguana/articles/brainvision_files.html). 4 | #' 5 | #' 6 | #' @format An eeg_lst with 2 conditions (faces, non-faces) 7 | #' @family EEG datasets 8 | #' @usage data(data_faces_ERPs) 9 | "data_faces_ERPs" 10 | 11 | #' EEGs elicited when one subject saw faces and non-faces objects. 12 | #' 13 | #' A dataset containing 10 trials where one subject either saw faces or a non-faces objects with preprocessing done in BrainVision 2.0. See also the vignette [Introduction - Manipulating a clean EEG file exported from BrainVision 2.0](https://bnicenboim.github.io/eeguana/articles/brainvision_files.html). 14 | #' 15 | #' 16 | #' @format An eeg_lst with the following events: 17 | #' * `.type == "New Segment"` indicates the beginning of the recording. 18 | #' * `.type == "Bad Interval"` indicates an interval marked as an artifact by BrainVision 2.0. 19 | #' * `.type == "UserDefined", .description == "Blink` indicates an interval marked as a blink by BrainVision 2.0. 20 | #' * `.type == "Stimulus", .description == "s5` indicates the beginning of the experiment. 21 | #' * `.type == "Stimulus", .description == "s111` indicates 22 | #' * `.type == "Stimulus", .description == "s130` indicates the beginning of the trial. 23 | #' * `.type == "Stimulus", .description == "s122` indicates 24 | #' * `.type == "Stimulus", .description == "s121` indicates 25 | #' * `.type == "Stimulus", .description == "s70` indicates that a face was presented. 26 | #' * `.type == "Stimulus", .description == "s71` indicates that a non-face was presented. 27 | #' @family EEG datasets 28 | #' @usage data(data_faces_10_trials) 29 | "data_faces_10_trials" 30 | 31 | 32 | #' Layout for a 32 electrodes cap at the standard 10-20 system 33 | #' 34 | #' A dataset containing coordinates of a 32 electrodes mounted in an elastic cap at the standard 10-20 system (Jasper, 1958) 35 | #' 36 | #' 37 | #' @format An table with channel names and locations 38 | #' @family topographic plots and layouts 39 | #' @usage data(layout_32_1020) 40 | #' 41 | "layout_32_1020" 42 | -------------------------------------------------------------------------------- /R/deprecated.R: -------------------------------------------------------------------------------- 1 | #' update eeg_lst from prev version 2 | #' @noRd 3 | update_eeg_lst <- function(.data) { 4 | if (!data.table::is.data.table(.data$.segments)) { 5 | message_verbose("Object created with an old version of eeguana.") 6 | message_verbose("Use as_eeg_lst(object) to convert it to the new format.") 7 | message_verbose("This message will be converted into a warning in future versions.") 8 | # message_verbose("(.by_reference = TRUE won't work for segment table)") 9 | return(as_eeg_lst(.data)) 10 | } 11 | .data 12 | } 13 | -------------------------------------------------------------------------------- /R/eeguana-package.R: -------------------------------------------------------------------------------- 1 | #' @keywords internal 2 | "_PACKAGE" 3 | 4 | ## usethis namespace: start 5 | #' @importFrom tidytable case_when 6 | #' @importFrom tidytable if_else 7 | ## usethis namespace: end 8 | NULL 9 | -------------------------------------------------------------------------------- /R/exported_utils.R: -------------------------------------------------------------------------------- 1 | #' Pipe operator 2 | #' 3 | #' See \code{magrittr::\link[magrittr]{\%>\%}} for details. 4 | #' 5 | #' @name %>% 6 | #' @rdname pipe 7 | #' @keywords internal 8 | #' @export 9 | #' @importFrom magrittr %>% 10 | #' @usage lhs \%>\% rhs 11 | NULL 12 | 13 | 14 | #' Convenience function for range subsets 15 | #' 16 | #' `between` is a thin wrapper for the between function of [data.table::between]. 17 | #' It is equivalent to x >= lower & x <= upper when incbounds=TRUE, or x > lower & y < upper when FALSE. In comparison 18 | #' with [dplyr::between], it doesn't loose the class of its argument, and it's more appropriate for manipulating 19 | #' the column `.sample`. For more information and the description of the arguments, see [data.table::between]. 20 | #' @name between 21 | #' @importFrom data.table between 22 | #' 23 | #' @examples 24 | #' 25 | #' data_faces_ERPs %>% 26 | #' eeg_filter(.sample %>% between(10, 100)) 27 | #' 28 | #' @export 29 | NULL 30 | -------------------------------------------------------------------------------- /R/funs.R: -------------------------------------------------------------------------------- 1 | #' Replacement of str_remove 2 | #' @noRd 3 | chr_remove <- function(string, pattern) { 4 | gsub(pattern = pattern, replacement = "", x = string) 5 | } 6 | 7 | #' Replacement of str_match 8 | #' @noRd 9 | chr_match <- function(string, pattern) { 10 | matches <- regexec(pattern = pattern, text = string) 11 | list_matches <- lapply( 12 | regmatches(x = string, m = matches), 13 | function(x) if (length(x) == 0) NA else x 14 | ) 15 | do.call("rbind", list_matches) 16 | } 17 | #' Replacement of str_detect 18 | #' @noRd 19 | chr_detect <- function(string, pattern, ignore.case = FALSE) { 20 | grepl(pattern = pattern, x = string, ignore.case = ignore.case) 21 | } 22 | #' Replacement of str_extract 23 | #' @noRd 24 | chr_extract_all <- function(string, pattern, ignore.case = FALSE, perl = TRUE, ...) { 25 | matches <- gregexpr(pattern = pattern, text = string, ignore.case = ignore.case, perl = perl, ...) 26 | list_matches <- lapply( 27 | regmatches(string, m = matches), 28 | function(x) if (length(x) == 0) character(0) else x 29 | ) 30 | list_matches 31 | } 32 | 33 | #' @noRd 34 | chr_extract <- function(string, pattern, ignore.case = FALSE, perl = TRUE, ...) { 35 | matches <- gregexpr(pattern = pattern, text = string, ignore.case = ignore.case, perl = perl, ...) 36 | list_matches <- lapply( 37 | regmatches(string, m = matches), 38 | function(x) if (length(x) == 0) NA else x[[1]] 39 | ) 40 | unlist(list_matches) 41 | } 42 | -------------------------------------------------------------------------------- /R/k.R: -------------------------------------------------------------------------------- 1 | url_issues <- "https://github.com/bnicenboim/eeguana/issues" 2 | 3 | 4 | obligatory_cols <- list( 5 | .signal = c(.id = ".id", .sample = ".sample"), 6 | .psd = c(.id = ".id", .freq = ".freq"), 7 | .events = c(.id = ".id", .type = ".type", .description = ".description", .initial = ".initial", .final = ".final", .channel = ".channel"), 8 | .segments = c(.id = ".id", .recording = ".recording") 9 | ) 10 | -------------------------------------------------------------------------------- /R/reexports.R: -------------------------------------------------------------------------------- 1 | # tidyselect ------------------------ 2 | #' @importFrom tidyselect starts_with contains ends_with everything any_of all_of num_range matches last_col where 3 | #' @export 4 | tidyselect::starts_with 5 | 6 | #' @export 7 | tidyselect::contains 8 | 9 | #' @export 10 | tidyselect::ends_with 11 | 12 | #' @export 13 | tidyselect::everything 14 | 15 | #' @export 16 | tidyselect::any_of 17 | 18 | #' @export 19 | tidyselect::all_of 20 | 21 | #' @export 22 | tidyselect::matches 23 | 24 | #' @export 25 | tidyselect::num_range 26 | 27 | #' @export 28 | tidyselect::last_col 29 | 30 | #' @export 31 | tidyselect::where -------------------------------------------------------------------------------- /R/signal_processing_helpers.R: -------------------------------------------------------------------------------- 1 | #' wrapper for signal::decimate that allows a vector in q, for decimating several times serially 2 | #' When using IIR downsampling, it is recommended to call decimate multiple times for downsampling factors higher than 13. reference: https://docs.scipy.org/doc/scipy/reference/generated/scipy.signal.decimate.html 3 | #' @noRd 4 | decimate_ch <- function(.channel, q, n = if (ftype == "iir") 8 else 30, ftype = "iir") { 5 | attrs <- attributes(.channel) 6 | .channel <- as.numeric(.channel) 7 | 8 | if (anyNA(.channel)) { 9 | warning("There are NAs, downsampling might be inaccurate.") 10 | r <- .channel[seq(1, length(.channel), by = prod(q))] 11 | } else if (length(q) > 1) { 12 | r <- Reduce(function(x, q) gsignal::decimate(x = x, q = q, n = n, ftype = ftype), x = q, init = .channel) 13 | } else { 14 | r <- gsignal::decimate(x = .channel, q = q, n = n, ftype = ftype) 15 | } 16 | mostattributes(r) <- attrs 17 | r 18 | } 19 | 20 | #' @noRd 21 | decimate_chs <- function(.channels, q, n = if (ftype == "iir") 8 else 30, ftype = "iir") { 22 | attrs <- lapply(.channels, attributes) 23 | .channels <- as.matrix(.channels) 24 | 25 | if (anyNA(.channels)) { 26 | warning("There are NAs, downsampling might be inaccurate.") 27 | r <- .channels[seq(1, nrow(.channels), by = prod(q)),] 28 | } else if (length(q) > 1) { 29 | r <- Reduce(function(x, q) gsignal::decimate(x = x, q = q, n = n, ftype = ftype), x = q, init = .channels) 30 | } else { 31 | r <- gsignal::decimate(x = .channels, q = q, n = n, ftype = ftype) 32 | } 33 | r <- data.table::as.data.table(r) 34 | map2_dtc(r,attrs, function(c,a) {mostattributes(c)<-a 35 | c}) 36 | 37 | } 38 | 39 | # d <- tidytable::tidytable(a=1:100, b=1:100) 40 | # tidytable::map_dfc(d, function(c) {c}) 41 | # purrr::map_dfc(d, function(c) {c}) 42 | 43 | 44 | -------------------------------------------------------------------------------- /R/simulation.R: -------------------------------------------------------------------------------- 1 | ##' Generates pink noise 2 | ##' 3 | ##' Adapted from Matlab code of Smith (2011) 4 | ##' 5 | ##' 6 | ##' Reference: 7 | ##' Smith, J.O. Spectral Audio Signal Processing, 8 | ##' , online book, 9 | ##' 2011 edition. 10 | ##' 11 | ##' @param n number of observations. 12 | ##' @param scale scale parameter. 13 | ##' @return a vector 14 | ##' @export 15 | ##' 16 | rpink <- function(n, scale = 1) { 17 | ## adapted to R from https://ccrma.stanford.edu/~jos/sasp/Example_Synthesis_1_F_Noise.html 18 | B <- c(0.049922035, -0.095993537, 0.050612699, -0.004408786) 19 | A <- c(1, -2.494956002, 2.017265875, -0.522189400) 20 | v <- stats::rnorm(n) # Gaussian white noise: N(0,1) 21 | x <- gsignal::filter(B, A, v) * scale 22 | x %>% as.numeric() # Apply 1/F roll-off to PSD 23 | } 24 | -------------------------------------------------------------------------------- /R/sysdata.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/R/sysdata.rda -------------------------------------------------------------------------------- /R/test_utils.R: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /R/time_sample.R: -------------------------------------------------------------------------------- 1 | #' Convert a sample point into a time point. 2 | #' 3 | #' 4 | #' @param x A `sample_id` object. 5 | #' @param .unit "seconds" (or "s"), "milliseconds" (or "ms") 6 | #' 7 | #' @return A vector of times. 8 | #' 9 | #' 10 | #' @export 11 | as_time <- function(x, .unit = "second") { 12 | UseMethod("as_time") 13 | } 14 | 15 | #' @export 16 | as_time.sample_int <- function(x, .unit = "second") { 17 | time <- (x - 1) / scaling(attributes(x)$sampling_rate, .unit) 18 | attributes(time) <- NULL 19 | time 20 | } 21 | #' @export 22 | as_time.default <- function(x, .unit = "second") { 23 | stop("`as_time()` can only be used with samples. Tip: You should probably use it with `.sample`.") 24 | } 25 | 26 | #' Convert a time point into a sample. 27 | #' 28 | #' 29 | #' 30 | #' @return A sample_int object. 31 | #' @param ... Not in use. 32 | #' @export 33 | as_sample_int <- function(x, ...) { 34 | UseMethod("as_sample_int") 35 | } 36 | #' @rdname as_sample_int 37 | #' @param x A vector of numeric values. 38 | #' @param .unit "seconds" (or "s"), "milliseconds" (or "ms"), or "samples" 39 | #' @param .sampling_rate Sampling rate in Hz 40 | #' @export 41 | as_sample_int.numeric <- function(x, .sampling_rate = NULL, .unit = "s", ...) { 42 | if (is.null(.sampling_rate)) stop("'.sampling_rate' needs to be specified", call. = FALSE) 43 | scale <- scaling(.sampling_rate, unit = .unit) 44 | # shift if it's in time scale so that sample 1 corresponds to time 0, 45 | # but not shift if it's converting samples into samples 46 | shift <- if (scale == 1) 0 else 1 47 | samples <- round(x * scale + shift) 48 | sample_int(samples, .sampling_rate) 49 | } 50 | #' @export 51 | as_sample_int.sample_int <- function(x, ...) { 52 | x 53 | } 54 | -------------------------------------------------------------------------------- /R/utils-pipe.R: -------------------------------------------------------------------------------- 1 | 2 | -------------------------------------------------------------------------------- /R/utils-prep.R: -------------------------------------------------------------------------------- 1 | # Adapted from: https://github.com/markfairbanks/tidytable/blob/main/R/utils-prep_exprs.R 2 | # "Prepare" quosures/expressions for use in a "[.data.table" call 3 | # Allows the use of functions like n() and across() 4 | # Replaces these functions with the necessary data.table translations 5 | # General idea follows dt_squash found here: https://github.com/tidyverse/dtplyr/blob/master/R/tidyeval.R 6 | prep_exprs <- function(x, data, .by = NULL, j = FALSE) { 7 | x <- lapply(x, prep_expr, data, {{ .by }}, j = j) 8 | list_flatten(x) 9 | } 10 | 11 | prep_expr <- function(x, data, .by = NULL, j = FALSE) { 12 | if (rlang::is_quosure(x)) { 13 | x <- rlang::get_expr(x) 14 | } 15 | 16 | if (rlang::is_symbol(x) || rlang::is_atomic(x) || rlang::is_null(x)) { 17 | x 18 | } else if (rlang::is_call(x, call_fns)) { 19 | prep_expr_call(x, data, {{ .by }}, j) 20 | } else { 21 | x[-1] <- lapply(x[-1], prep_expr, data, {{ .by }}) 22 | x 23 | } 24 | } 25 | 26 | call_fns <- c( 27 | "across_ch", 28 | "c_across_ch" 29 | ) 30 | 31 | prep_expr_call <- function(x, data, .by = NULL, j = FALSE) { 32 | if (rlang::is_call(x, c("across_ch"))) { 33 | call_dots <- as.list(x[-1]) 34 | x <- rlang::call2("across", rlang::expr(where(is_channel_dbl)), !!!call_dots) 35 | prep_expr(x, data, {{ .by }}, j = j) 36 | } 37 | } 38 | 39 | get_dt_env <- function(x, ...) { 40 | if (length(x) == 0) { 41 | dt_env <- rlang::caller_env(2) 42 | } else if (rlang::is_quosures(x)) { 43 | x <- x[[1]] 44 | dt_env <- rlang::get_env(x) 45 | } else { 46 | dt_env <- rlang::get_env(x) 47 | } 48 | if (identical(dt_env, rlang::empty_env())) { 49 | dt_env <- rlang::caller_env(2) 50 | } 51 | rlang::env(dt_env, ...) 52 | } 53 | 54 | prep_dots <- function(dots, data, .by = NULL, j = FALSE) { 55 | dt_env <- get_dt_env(dots) 56 | dots <- prep_exprs(x = dots, data, .by = !!by, j = TRUE) 57 | rlang::as_quosures(dots, env = dt_env) 58 | } 59 | -------------------------------------------------------------------------------- /_pipeline.txt: -------------------------------------------------------------------------------- 1 | #update the metadata: 2 | codemetar::write_codemeta(".") 3 | spelling::spell_check_package() 4 | goodpractice::gp() 5 | #all the new versions before test 6 | remotes::install_deps(upgrade = "always") 7 | -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | comment: false 2 | 3 | coverage: 4 | status: 5 | project: 6 | default: 7 | target: auto 8 | threshold: 5% 9 | patch: 10 | default: 11 | target: auto 12 | threshold: 5% 13 | -------------------------------------------------------------------------------- /data-raw/create_MNE.R: -------------------------------------------------------------------------------- 1 | library(eeguana) 2 | 3 | bvfile <- system.file("testdata", "bv_export_bv_txt_bin_vector.vhdr", package = "eeguana") 4 | eeg_read <- read_vhdr(bvfile, .recording = "bv1") 5 | bvfile_pkl <- paste0(bvfile, ".pkl") 6 | 7 | library(reticulate) 8 | use_condaenv("r-eeguana") 9 | mne <- import("mne") 10 | .data <- mne$io$read_raw_brainvision(bvfile, preload = TRUE, stim_channel = FALSE) 11 | 12 | py_save_object(.data, bvfile_pkl, pickle = "pickle") 13 | 14 | 15 | ## Mne example 16 | sample_data_folder <- mne$datasets$sample$data_path() 17 | sample_data_raw_file <- file.path(sample_data_folder, "MEG", "sample", "sample_audvis_raw.fif") 18 | raw = mne$io$read_raw_fif(sample_data_raw_file, verbose=FALSE) 19 | raw$crop(0, 10)$load_data() 20 | fiffile <- file.path(system.file("testdata", package = "eeguana"), "sample_audvis_raw_10s.fif") 21 | raw$save(fiffile) 22 | -------------------------------------------------------------------------------- /data-raw/create_faces_data.R: -------------------------------------------------------------------------------- 1 | library(dplyr) 2 | library(eeguana) 3 | library(httr) 4 | GET( 5 | "https://osf.io/q6b7x//?action=download", 6 | write_disk("./faces.vhdr", overwrite = TRUE), 7 | progress() 8 | ) 9 | GET( 10 | "https://osf.io/ft5ge//?action=download", 11 | write_disk("./faces.vmrk", overwrite = TRUE), 12 | progress() 13 | ) 14 | GET( 15 | "https://osf.io/85dgj//?action=download", 16 | write_disk("./faces.dat", overwrite = TRUE), 17 | progress() 18 | ) 19 | 20 | faces <- read_vhdr("faces.vhdr") 21 | channels_tbl(faces) <- select(channels_tbl(faces), .channel) %>% 22 | left_join(layout_32_1020) 23 | data_faces_ERPs <- faces %>% 24 | eeg_segment(.description %in% c("s70", "s71"), 25 | .lim = c(-.2, .25) 26 | ) %>% 27 | eeg_events_to_NA(.type == "Bad Interval") %>% 28 | eeg_baseline() %>% 29 | mutate( 30 | condition = 31 | if_else(description == "s70", "faces", "non-faces") 32 | ) %>% 33 | select(-type) %>% 34 | group_by(.sample, condition, .recording) %>% 35 | summarize_at(channel_names(.), mean, na.rm = TRUE) %>% 36 | ungroup() 37 | 38 | pos_10 <- events_tbl(faces) %>% 39 | filter(.type == "Stimulus", .description == "s130") %>% 40 | pull(.initial) %>% 41 | .[10] 42 | 43 | data_faces_10_trials <- faces %>% 44 | filter(.sample %>% between(15000, pos_10)) %>% 45 | ungroup() 46 | 47 | usethis::use_data(data_faces_ERPs, data_faces_10_trials, overwrite = TRUE, compress = "xz") 48 | -------------------------------------------------------------------------------- /data-raw/create_layout.R: -------------------------------------------------------------------------------- 1 | library(eeguana) 2 | 3 | layout_32_1020 <- readr::read_csv("data-raw/layout_32_1020.csv") 4 | 5 | usethis::use_data(layout_32_1020, overwrite = TRUE, compress = "xz") 6 | -------------------------------------------------------------------------------- /data-raw/layout_32_1020.csv: -------------------------------------------------------------------------------- 1 | .channel,radius,theta,phi,.x,.y,.z 2 | Fp1,1,-90,-72,-0.31,0.95,0 3 | Fpz,1,90,90,0,1,0 4 | Fp2,1,90,72,0.31,0.95,0 5 | F7,1,-90,-36,-0.81,0.59,0 6 | F3,1,-60,-51,-0.55,0.67,0.5 7 | Fz,1,45,90,0,0.71,0.71 8 | F4,1,60,51,0.55,0.67,0.5 9 | F8,1,90,36,0.81,0.59,0 10 | FC5,1,-69,-21,-0.87,0.33,0.36 11 | FC1,1,-31,-46,-0.36,0.37,0.86 12 | FC2,1,31,46,0.36,0.37,0.86 13 | FC6,1,69,21,0.87,0.33,0.36 14 | M1,0,0,0,NA,NA,NA 15 | T7,1,-90,0,-1,0,0 16 | C3,1,-45,0,-0.71,0,0.71 17 | Cz,1,0,0,0,0,1 18 | C4,1,45,0,0.71,0,0.71 19 | T8,1,90,0,1,0,0 20 | M2,0,0,0,NA,NA,NA 21 | CP5,1,-69,21,-0.87,-0.33,0.36 22 | CP1,1,-31,46,-0.36,-0.37,0.86 23 | CP2,1,31,-46,0.36,-0.37,0.86 24 | CP6,1,69,-21,0.87,-0.33,0.36 25 | P7,1,-90,36,-0.81,-0.59,0 26 | P3,1,-60,51,-0.55,-0.67,0.5 27 | Pz,1,45,-90,0,-0.71,0.71 28 | P4,1,60,-51,0.55,-0.67,0.5 29 | P8,1,90,-36,0.81,-0.59,0 30 | POz,1,67,-90,0,-0.92,0.39 31 | O1,1,-90,72,-0.31,-0.95,0 32 | Oz,1,90,-90,0,-1,0 33 | O2,1,90,-72,0.31,-0.95,0 34 | HEOG,0,0,0,NA,NA,NA 35 | VEOG,0,0,0,NA,NA,NA 36 | -------------------------------------------------------------------------------- /data-raw/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/data-raw/logo.png -------------------------------------------------------------------------------- /data/data_faces_10_trials.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/data/data_faces_10_trials.rda -------------------------------------------------------------------------------- /data/data_faces_ERPs.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/data/data_faces_ERPs.rda -------------------------------------------------------------------------------- /data/layout_32_1020.rda: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/data/layout_32_1020.rda -------------------------------------------------------------------------------- /eeguana.Rproj: -------------------------------------------------------------------------------- 1 | Version: 1.0 2 | 3 | RestoreWorkspace: No 4 | SaveWorkspace: No 5 | AlwaysSaveHistory: Default 6 | 7 | EnableCodeIndexing: Yes 8 | UseSpacesForTab: Yes 9 | NumSpacesForTab: 2 10 | Encoding: UTF-8 11 | 12 | RnwWeave: knitr 13 | LaTeX: pdfLaTeX 14 | 15 | BuildType: Package 16 | PackageUseDevtools: Yes 17 | PackageInstallArgs: --no-multiarch --with-keep.source 18 | PackageRoxygenize: rd,collate,namespace,vignette 19 | 20 | PythonType: conda 21 | PythonVersion: 3.12.1 22 | PythonPath: ~/miniconda3/envs/r-eeguana/bin/python3.12 23 | -------------------------------------------------------------------------------- /inst/CITATION: -------------------------------------------------------------------------------- 1 | utils::citHeader("To cite eeguana in publications use:") 2 | 3 | utils::citEntry(entry = "manual", 4 | title = "{eeguana}: A package for manipulating {EEG} data in {R}", 5 | author = utils::personList(utils::as.person("Bruno Nicenboim")), 6 | year = "2018", 7 | url = "https://github.com/bnicenboim/eeguana", 8 | doi = "10.5281/zenodo.2533138", 9 | 10 | textVersion = 11 | paste("Nicenboim, Bruno. (2018).", 12 | "{eeguana}: A package for manipulating {EEG} data in {R}.", 13 | "URL https://github.com/bnicenboim/eeguana", 14 | "doi:10.5281/zenodo.2533138") 15 | ) 16 | 17 | -------------------------------------------------------------------------------- /inst/WORDLIST: -------------------------------------------------------------------------------- 1 | BrainVision 2 | aes 3 | Akima 4 | AppVeyor 5 | Arcara 6 | bdf 7 | bnicenboim 8 | bicubic 9 | dat 10 | Downsample 11 | downsample 12 | downsampling 13 | eeg 14 | Fieldtrip 15 | ggplot 16 | ICA 17 | knitr 18 | lim 19 | lst 20 | Nicenboim 21 | nrow 22 | occipital 23 | pre 24 | preprocessed 25 | rmarkdown 26 | vhdr 27 | VignetteEncoding 28 | VignetteEngine 29 | VignetteIndexEntry 30 | vmrk 31 | dplyr 32 | Dplyr 33 | dplyr's 34 | EEGLAB 35 | eegUtils 36 | EOG 37 | eog 38 | FASTICA 39 | fICA 40 | Giorgio 41 | microvolts 42 | stereographic 43 | tanh 44 | saccades 45 | quosure 46 | MNE 47 | lifecycle 48 | IIR 49 | FIR 50 | tibble 51 | Fieldtrip 52 | Fieldtrip's 53 | ERPs 54 | erpR 55 | Craddock 56 | Codecov 57 | Brainamp 58 | github 59 | tidyverse 60 | https -------------------------------------------------------------------------------- /inst/logos/logo.eps: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/logos/logo.eps -------------------------------------------------------------------------------- /inst/logos/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/logos/logo.png -------------------------------------------------------------------------------- /inst/pkgdown.yml: -------------------------------------------------------------------------------- 1 | pandoc: 3.1.1 2 | pkgdown: 2.0.7 3 | pkgdown_sha: ~ 4 | articles: 5 | gotchas: gotchas.html 6 | intro: intro.html 7 | preprocessing_erp: preprocessing_erp.html 8 | last_built: 2024-02-08T09:10Z 9 | urls: 10 | reference: https://bruno.nicenboim.me/eeguana/reference 11 | article: https://bruno.nicenboim.me/eeguana/articles 12 | 13 | -------------------------------------------------------------------------------- /inst/testdata/EMP01.vhdr: -------------------------------------------------------------------------------- 1 | Brain Vision Data Exchange Header File Version 1.0 2 | ; Data created from the EEGLAB software 3 | 4 | [Common Infos] 5 | DataFile=EMP01.dat 6 | MarkerFile=EMP01.vmrk 7 | DataFormat=BINARY 8 | ; Data orientation: VECTORIZED=ch1,pt1, ch1,pt2..., MULTIPLEXED=ch1,pt1, ch2,pt1 ... 9 | DataOrientation=VECTORIZED 10 | DataType=TIMEDOMAIN 11 | NumberOfChannels=72 12 | DataPoints=2541056 13 | ; Sampling interval in microseconds if time domain (convert to Hertz: 14 | ; 1000000 / SamplingInterval) or in Hertz if frequency domain: 15 | SamplingInterval=1.953125e+03 16 | 17 | [Binary Infos] 18 | BinaryFormat=IEEE_FLOAT_32 19 | 20 | [Channel Infos] 21 | ; Each entry: Ch=,, 22 | ; ,=,, 20 | ; ,=,,, 9 | ; , 10 | ; Fields are delimited by commas, some fields might be omitted (empty). 11 | ; Commas in type or description text are coded as "\1". 12 | Mk1=New Segment,,0,1,0,20181106153757758000 13 | Mk2=Stimulus,s10,142,1,0 14 | Mk3=Stimulus,s11,424,1,0 15 | Mk4=Stimulus,s12,745,1,0 16 | Mk5=Stimulus,s10,1303,1,0 17 | Mk6=Stimulus,s11,1584,1,0 18 | Mk7=Stimulus,s12,1876,1,0 19 | Mk8=Stimulus,s10,2374,1,0 20 | Mk9=Stimulus,s11,2654,1,0 21 | Mk10=Stimulus,s12,3018,1,0 22 | Mk11=Stimulus,s10,3531,1,0 23 | Mk12=Stimulus,s11,3812,1,0 24 | Mk13=Stimulus,s12,4165,1,0 25 | -------------------------------------------------------------------------------- /inst/testdata/asalab_export_bv_2.vhdr: -------------------------------------------------------------------------------- 1 | BrainVision Data Exchange Header File Version 1.0 2 | ; Data created by EEMAGINE EEG Data Exporter 3 | 4 | [Common Infos] 5 | DataFile=asalab_export_bv.eeg 6 | MarkerFile=asalab_export_bv.vmrk 7 | DataFormat=BINARY 8 | ; Data orientation: MULTIPLEXED=ch1,pt1, ch2,pt1 ... 9 | DataOrientation=MULTIPLEXED 10 | NumberOfChannels=34 11 | ; Sampling interval in microseconds 12 | SamplingInterval=1953.125000 13 | 14 | 15 | [Binary Infos] 16 | BinaryFormat=IEEE_FLOAT_32 17 | 18 | [Channel Infos] 19 | ; Each entry: Ch=,, 20 | ; ,=,,,,..., 20 | ; Property number must be unique. Types can be int, single, string, bool, byte, double, uint 21 | ; or arrays of those, indicated int-array etc 22 | ; Array types have more than one value, number of values determines size of array. 23 | ; Fields are delimited by commas, commas in strings are written \1 24 | 25 | [Binary Infos] 26 | BinaryFormat=IEEE_FLOAT_32 27 | 28 | [Channel Infos] 29 | ; Each entry: Ch=,, 30 | ; ,, Future extensions... 31 | ; Fields are delimited by commas, some fields might be omitted (empty). 32 | ; Commas in channel names are coded as "\1". 33 | Ch1=Fp1,,,µV 34 | Ch2=Fpz,,,µV 35 | Ch3=Fp2,,,µV 36 | Ch4=F7,,,µV 37 | Ch5=F3,,,µV 38 | Ch6=Fz,,,µV 39 | Ch7=F4,,,µV 40 | Ch8=F8,,,µV 41 | Ch9=FC5,,,µV 42 | Ch10=FC1,,,µV 43 | Ch11=FC2,,,µV 44 | Ch12=FC6,,,µV 45 | Ch13=M1,,,µV 46 | Ch14=T7,,,µV 47 | Ch15=C3,,,µV 48 | Ch16=Cz,,,µV 49 | Ch17=C4,,,µV 50 | Ch18=T8,,,µV 51 | Ch19=M2,,,µV 52 | Ch20=CP5,,,µV 53 | Ch21=CP1,,,µV 54 | Ch22=CP2,,,µV 55 | Ch23=CP6,,,µV 56 | Ch24=P7,,,µV 57 | Ch25=P3,,,µV 58 | Ch26=Pz,,,µV 59 | Ch27=P4,,,µV 60 | Ch28=P8,,,µV 61 | Ch29=POz,,,µV 62 | Ch30=O1,,,µV 63 | Ch31=Oz,,,µV 64 | Ch32=O2,,,µV 65 | Ch33=HEOG,,,µV 66 | Ch34=VEOG,,,µV 67 | 68 | [Channel User Infos] 69 | ; Each entry: Prop=Ch,,,,,..., 70 | ; Property number must be unique. Types can be int, single, string, bool, byte, double, uint 71 | ; or arrays of those, indicated int-array etc 72 | ; Array types have more than one value, number of values determines size of array. 73 | ; Fields are delimited by commas, commas in strings are written \1 74 | ; Properties are assigned to channels using their channel number. 75 | 76 | [Coordinates] 77 | ; Each entry: Ch=,, 78 | Ch1=1,-90,-72 79 | Ch2=1,90,90 80 | Ch3=1,90,72 81 | Ch4=1,-90,-36 82 | Ch5=1,-60,-51 83 | Ch6=1,45,90 84 | Ch7=1,60,51 85 | Ch8=1,90,36 86 | Ch9=1,-69,-21 87 | Ch10=1,-31,-46 88 | Ch11=1,31,46 89 | Ch12=1,69,21 90 | Ch13=0,0,0 91 | Ch14=1,-90,0 92 | Ch15=1,-45,0 93 | Ch16=1,0,0 94 | Ch17=1,45,0 95 | Ch18=1,90,0 96 | Ch19=0,0,0 97 | Ch20=1,-69,21 98 | Ch21=1,-31,46 99 | Ch22=1,31,-46 100 | Ch23=1,69,-21 101 | Ch24=1,-90,36 102 | Ch25=1,-60,51 103 | Ch26=1,45,-90 104 | Ch27=1,60,-51 105 | Ch28=1,90,-36 106 | Ch29=1,67,-90 107 | Ch30=1,-90,72 108 | Ch31=1,90,-90 109 | Ch32=1,90,-72 110 | Ch33=0,0,0 111 | Ch34=0,0,0 112 | -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_bin_multi.vmrk: -------------------------------------------------------------------------------- 1 | Brain Vision Data Exchange Marker File, Version 2.0 2 | ; Data created from history path: asalab_export_bv/Raw Data 3 | ; The channel numbers are related to the channels in the exported file. 4 | 5 | [Common Infos] 6 | Codepage=UTF-8 7 | DataFile=bv_export_bv_txt_bin_multi.dat 8 | 9 | [Marker Infos] 10 | ; Each entry: Mk=,,, 11 | ; , , 12 | ; , Visible 13 | ; Fields are delimited by commas, some fields may be omitted (empty). 14 | ; Commas in type or description text are coded as "\1". 15 | Mk1=New Segment,,1,1,0,20181106153757758000 16 | Mk2=Stimulus,s10,142,1,0 17 | Mk3=Stimulus,s11,424,1,0 18 | Mk4=Stimulus,s12,745,1,0 19 | Mk5=Stimulus,s10,1303,1,0 20 | Mk6=Stimulus,s11,1584,1,0 21 | Mk7=Stimulus,s12,1876,1,0 22 | Mk8=Stimulus,s10,2374,1,0 23 | Mk9=Stimulus,s11,2654,1,0 24 | Mk10=Stimulus,s12,3018,1,0 25 | Mk11=Stimulus,s10,3531,1,0 26 | Mk12=Stimulus,s11,3812,1,0 27 | Mk13=Stimulus,s12,4165,1,0 28 | 29 | [Marker User Infos] 30 | ; Each entry: Prop=Mk,,,,,..., 31 | ; Property number must be unique. Types can be int, single, string, bool, byte, double, uint 32 | ; or arrays of those, indicated int-array etc 33 | ; Array types have more than one value, number of values determines size of array. 34 | ; Fields are delimited by commas, commas in strings are written \1 35 | ; Properties are assigned to markers using their marker number. 36 | -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_bin_multi2.set: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/bv_export_bv_txt_bin_multi2.set -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_bin_multi3.fdt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/bv_export_bv_txt_bin_multi3.fdt -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_bin_multi3.set: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/bv_export_bv_txt_bin_multi3.set -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_bin_multi_16bit.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/bv_export_bv_txt_bin_multi_16bit.dat -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_bin_multi_16bit.vmrk: -------------------------------------------------------------------------------- 1 | Brain Vision Data Exchange Marker File, Version 2.0 2 | ; Data created from history path: asalab_export_bv/Raw Data 3 | ; The channel numbers are related to the channels in the exported file. 4 | 5 | [Common Infos] 6 | Codepage=UTF-8 7 | DataFile=bv_export_bv_txt_bin_multi_16bit.dat 8 | 9 | [Marker Infos] 10 | ; Each entry: Mk=,,, 11 | ; , , 12 | ; , Visible 13 | ; Fields are delimited by commas, some fields may be omitted (empty). 14 | ; Commas in type or description text are coded as "\1". 15 | Mk1=New Segment,,1,1,0,20181106153757758000 16 | Mk2=Stimulus,s10,142,1,0 17 | Mk3=Stimulus,s11,424,1,0 18 | Mk4=Stimulus,s12,745,1,0 19 | Mk5=Stimulus,s10,1303,1,0 20 | Mk6=Stimulus,s11,1584,1,0 21 | Mk7=Stimulus,s12,1876,1,0 22 | Mk8=Stimulus,s10,2374,1,0 23 | Mk9=Stimulus,s11,2654,1,0 24 | Mk10=Stimulus,s12,3018,1,0 25 | Mk11=Stimulus,s10,3531,1,0 26 | Mk12=Stimulus,s11,3812,1,0 27 | Mk13=Stimulus,s12,4165,1,0 28 | 29 | [Marker User Infos] 30 | ; Each entry: Prop=Mk,,,,,..., 31 | ; Property number must be unique. Types can be int, single, string, bool, byte, double, uint 32 | ; or arrays of those, indicated int-array etc 33 | ; Array types have more than one value, number of values determines size of array. 34 | ; Fields are delimited by commas, commas in strings are written \1 35 | ; Properties are assigned to markers using their marker number. 36 | -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_bin_multi_32bit.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/bv_export_bv_txt_bin_multi_32bit.dat -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_bin_multi_32bit.vmrk: -------------------------------------------------------------------------------- 1 | Brain Vision Data Exchange Marker File, Version 2.0 2 | ; Data created from history path: asalab_export_bv/Raw Data 3 | ; The channel numbers are related to the channels in the exported file. 4 | 5 | [Common Infos] 6 | Codepage=UTF-8 7 | DataFile=bv_export_bv_txt_bin_multi_32bit.dat 8 | 9 | [Marker Infos] 10 | ; Each entry: Mk=,,, 11 | ; , , 12 | ; , Visible 13 | ; Fields are delimited by commas, some fields may be omitted (empty). 14 | ; Commas in type or description text are coded as "\1". 15 | Mk1=New Segment,,1,1,0,20181106153757758000 16 | Mk2=Stimulus,s10,142,1,0 17 | Mk3=Stimulus,s11,424,1,0 18 | Mk4=Stimulus,s12,745,1,0 19 | Mk5=Stimulus,s10,1303,1,0 20 | Mk6=Stimulus,s11,1584,1,0 21 | Mk7=Stimulus,s12,1876,1,0 22 | Mk8=Stimulus,s10,2374,1,0 23 | Mk9=Stimulus,s11,2654,1,0 24 | Mk10=Stimulus,s12,3018,1,0 25 | Mk11=Stimulus,s10,3531,1,0 26 | Mk12=Stimulus,s11,3812,1,0 27 | Mk13=Stimulus,s12,4165,1,0 28 | 29 | [Marker User Infos] 30 | ; Each entry: Prop=Mk,,,,,..., 31 | ; Property number must be unique. Types can be int, single, string, bool, byte, double, uint 32 | ; or arrays of those, indicated int-array etc 33 | ; Array types have more than one value, number of values determines size of array. 34 | ; Fields are delimited by commas, commas in strings are written \1 35 | ; Properties are assigned to markers using their marker number. 36 | -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_bin_multi_epoched.fdt: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/bv_export_bv_txt_bin_multi_epoched.fdt -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_bin_multi_epoched.set: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/bv_export_bv_txt_bin_multi_epoched.set -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_bin_multi_epoched_1.set: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/bv_export_bv_txt_bin_multi_epoched_1.set -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_bin_multi_epoched_one.set: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/bv_export_bv_txt_bin_multi_epoched_one.set -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_bin_vector.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/bv_export_bv_txt_bin_vector.dat -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_bin_vector.vhdr: -------------------------------------------------------------------------------- 1 | Brain Vision Data Exchange Header File Version 2.0 2 | ; Data created from history path: asalab_export_bv/Raw Data 3 | 4 | [Common Infos] 5 | Codepage=UTF-8 6 | DataFile=bv_export_bv_txt_bin_vector.dat 7 | MarkerFile=bv_export_bv_txt_bin_vector.vmrk 8 | DataFormat=BINARY 9 | ; Data orientation: VECTORIZED=ch1,pt1, ch1,pt2..., MULTIPLEXED=ch1,pt1, ch2,pt1 ... 10 | DataOrientation=VECTORIZED 11 | DataType=TIMEDOMAIN 12 | NumberOfChannels=34 13 | DataPoints=4722 14 | ; Sampling interval in microseconds if time domain (convert to Hertz: 15 | ; 1000000 / SamplingInterval) or in Hertz if frequency domain: 16 | SamplingInterval=1953.125 17 | 18 | [User Infos] 19 | ; Each entry: Prop=,,,,..., 20 | ; Property number must be unique. Types can be int, single, string, bool, byte, double, uint 21 | ; or arrays of those, indicated int-array etc 22 | ; Array types have more than one value, number of values determines size of array. 23 | ; Fields are delimited by commas, commas in strings are written \1 24 | 25 | [Binary Infos] 26 | BinaryFormat=IEEE_FLOAT_32 27 | 28 | [Channel Infos] 29 | ; Each entry: Ch=,, 30 | ; ,, Future extensions... 31 | ; Fields are delimited by commas, some fields might be omitted (empty). 32 | ; Commas in channel names are coded as "\1". 33 | Ch1=Fp1,,,µV 34 | Ch2=Fpz,,,µV 35 | Ch3=Fp2,,,µV 36 | Ch4=F7,,,µV 37 | Ch5=F3,,,µV 38 | Ch6=Fz,,,µV 39 | Ch7=F4,,,µV 40 | Ch8=F8,,,µV 41 | Ch9=FC5,,,µV 42 | Ch10=FC1,,,µV 43 | Ch11=FC2,,,µV 44 | Ch12=FC6,,,µV 45 | Ch13=M1,,,µV 46 | Ch14=T7,,,µV 47 | Ch15=C3,,,µV 48 | Ch16=Cz,,,µV 49 | Ch17=C4,,,µV 50 | Ch18=T8,,,µV 51 | Ch19=M2,,,µV 52 | Ch20=CP5,,,µV 53 | Ch21=CP1,,,µV 54 | Ch22=CP2,,,µV 55 | Ch23=CP6,,,µV 56 | Ch24=P7,,,µV 57 | Ch25=P3,,,µV 58 | Ch26=Pz,,,µV 59 | Ch27=P4,,,µV 60 | Ch28=P8,,,µV 61 | Ch29=POz,,,µV 62 | Ch30=O1,,,µV 63 | Ch31=Oz,,,µV 64 | Ch32=O2,,,µV 65 | Ch33=HEOG,,,µV 66 | Ch34=VEOG,,,µV 67 | 68 | [Channel User Infos] 69 | ; Each entry: Prop=Ch,,,,,..., 70 | ; Property number must be unique. Types can be int, single, string, bool, byte, double, uint 71 | ; or arrays of those, indicated int-array etc 72 | ; Array types have more than one value, number of values determines size of array. 73 | ; Fields are delimited by commas, commas in strings are written \1 74 | ; Properties are assigned to channels using their channel number. 75 | 76 | [Coordinates] 77 | ; Each entry: Ch=,, 78 | Ch1=1,-90,-72 79 | Ch2=1,90,90 80 | Ch3=1,90,72 81 | Ch4=1,-90,-36 82 | Ch5=1,-60,-51 83 | Ch6=1,45,90 84 | Ch7=1,60,51 85 | Ch8=1,90,36 86 | Ch9=1,-69,-21 87 | Ch10=1,-31,-46 88 | Ch11=1,31,46 89 | Ch12=1,69,21 90 | Ch13=0,0,0 91 | Ch14=1,-90,0 92 | Ch15=1,-45,0 93 | Ch16=1,0,0 94 | Ch17=1,45,0 95 | Ch18=1,90,0 96 | Ch19=0,0,0 97 | Ch20=1,-69,21 98 | Ch21=1,-31,46 99 | Ch22=1,31,-46 100 | Ch23=1,69,-21 101 | Ch24=1,-90,36 102 | Ch25=1,-60,51 103 | Ch26=1,45,-90 104 | Ch27=1,60,-51 105 | Ch28=1,90,-36 106 | Ch29=1,67,-90 107 | Ch30=1,-90,72 108 | Ch31=1,90,-90 109 | Ch32=1,90,-72 110 | Ch33=0,0,0 111 | Ch34=0,0,0 112 | -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_bin_vector.vmrk: -------------------------------------------------------------------------------- 1 | Brain Vision Data Exchange Marker File, Version 2.0 2 | ; Data created from history path: asalab_export_bv/Raw Data 3 | ; The channel numbers are related to the channels in the exported file. 4 | 5 | [Common Infos] 6 | Codepage=UTF-8 7 | DataFile=bv_export_bv_txt_bin_vector.dat 8 | 9 | [Marker Infos] 10 | ; Each entry: Mk=,,, 11 | ; , , 12 | ; , Visible 13 | ; Fields are delimited by commas, some fields may be omitted (empty). 14 | ; Commas in type or description text are coded as "\1". 15 | Mk1=New Segment,,1,1,0,20181106153757758000 16 | Mk2=Stimulus,s10,142,1,0 17 | Mk3=Stimulus,s11,424,1,0 18 | Mk4=Stimulus,s12,745,1,0 19 | Mk5=Stimulus,s10,1303,1,0 20 | Mk6=Stimulus,s11,1584,1,0 21 | Mk7=Stimulus,s12,1876,1,0 22 | Mk8=Stimulus,s10,2374,1,0 23 | Mk9=Stimulus,s11,2654,1,0 24 | Mk10=Stimulus,s12,3018,1,0 25 | Mk11=Stimulus,s10,3531,1,0 26 | Mk12=Stimulus,s11,3812,1,0 27 | Mk13=Stimulus,s12,4165,1,0 28 | 29 | [Marker User Infos] 30 | ; Each entry: Prop=Mk,,,,,..., 31 | ; Property number must be unique. Types can be int, single, string, bool, byte, double, uint 32 | ; or arrays of those, indicated int-array etc 33 | ; Array types have more than one value, number of values determines size of array. 34 | ; Fields are delimited by commas, commas in strings are written \1 35 | ; Properties are assigned to markers using their marker number. 36 | -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_bin_vector_16bit.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/bv_export_bv_txt_bin_vector_16bit.dat -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_bin_vector_16bit.vmrk: -------------------------------------------------------------------------------- 1 | Brain Vision Data Exchange Marker File, Version 2.0 2 | ; Data created from history path: asalab_export_bv/Raw Data 3 | ; The channel numbers are related to the channels in the exported file. 4 | 5 | [Common Infos] 6 | Codepage=UTF-8 7 | DataFile=bv_export_bv_txt_bin_vector_16bit.dat 8 | 9 | [Marker Infos] 10 | ; Each entry: Mk=,,, 11 | ; , , 12 | ; , Visible 13 | ; Fields are delimited by commas, some fields may be omitted (empty). 14 | ; Commas in type or description text are coded as "\1". 15 | Mk1=New Segment,,1,1,0,20181106153757758000 16 | Mk2=Stimulus,s10,142,1,0 17 | Mk3=Stimulus,s11,424,1,0 18 | Mk4=Stimulus,s12,745,1,0 19 | Mk5=Stimulus,s10,1303,1,0 20 | Mk6=Stimulus,s11,1584,1,0 21 | Mk7=Stimulus,s12,1876,1,0 22 | Mk8=Stimulus,s10,2374,1,0 23 | Mk9=Stimulus,s11,2654,1,0 24 | Mk10=Stimulus,s12,3018,1,0 25 | Mk11=Stimulus,s10,3531,1,0 26 | Mk12=Stimulus,s11,3812,1,0 27 | Mk13=Stimulus,s12,4165,1,0 28 | 29 | [Marker User Infos] 30 | ; Each entry: Prop=Mk,,,,,..., 31 | ; Property number must be unique. Types can be int, single, string, bool, byte, double, uint 32 | ; or arrays of those, indicated int-array etc 33 | ; Array types have more than one value, number of values determines size of array. 34 | ; Fields are delimited by commas, commas in strings are written \1 35 | ; Properties are assigned to markers using their marker number. 36 | -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_bin_vector_32bit.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/bv_export_bv_txt_bin_vector_32bit.dat -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_bin_vector_32bit.vmrk: -------------------------------------------------------------------------------- 1 | Brain Vision Data Exchange Marker File, Version 2.0 2 | ; Data created from history path: asalab_export_bv/Raw Data 3 | ; The channel numbers are related to the channels in the exported file. 4 | 5 | [Common Infos] 6 | Codepage=UTF-8 7 | DataFile=bv_export_bv_txt_bin_vector_32bit.dat 8 | 9 | [Marker Infos] 10 | ; Each entry: Mk=,,, 11 | ; , , 12 | ; , Visible 13 | ; Fields are delimited by commas, some fields may be omitted (empty). 14 | ; Commas in type or description text are coded as "\1". 15 | Mk1=New Segment,,1,1,0,20181106153757758000 16 | Mk2=Stimulus,s10,142,1,0 17 | Mk3=Stimulus,s11,424,1,0 18 | Mk4=Stimulus,s12,745,1,0 19 | Mk5=Stimulus,s10,1303,1,0 20 | Mk6=Stimulus,s11,1584,1,0 21 | Mk7=Stimulus,s12,1876,1,0 22 | Mk8=Stimulus,s10,2374,1,0 23 | Mk9=Stimulus,s11,2654,1,0 24 | Mk10=Stimulus,s12,3018,1,0 25 | Mk11=Stimulus,s10,3531,1,0 26 | Mk12=Stimulus,s11,3812,1,0 27 | Mk13=Stimulus,s12,4165,1,0 28 | 29 | [Marker User Infos] 30 | ; Each entry: Prop=Mk,,,,,..., 31 | ; Property number must be unique. Types can be int, single, string, bool, byte, double, uint 32 | ; or arrays of those, indicated int-array etc 33 | ; Array types have more than one value, number of values determines size of array. 34 | ; Fields are delimited by commas, commas in strings are written \1 35 | ; Properties are assigned to markers using their marker number. 36 | -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_txt_multi.vhdr: -------------------------------------------------------------------------------- 1 | Brain Vision Data Exchange Header File Version 2.0 2 | ; Data created from history path: asalab_export_bv/Raw Data 3 | 4 | [Common Infos] 5 | Codepage=UTF-8 6 | DataFile=bv_export_bv_txt_txt_multi.dat 7 | MarkerFile=bv_export_bv_txt_txt_multi.vmrk 8 | DataFormat=ASCII 9 | ; Data orientation: VECTORIZED=ch1,pt1, ch1,pt2..., MULTIPLEXED=ch1,pt1, ch2,pt1 ... 10 | DataOrientation=MULTIPLEXED 11 | DataType=TIMEDOMAIN 12 | NumberOfChannels=34 13 | DataPoints=4722 14 | ; Sampling interval in microseconds if time domain (convert to Hertz: 15 | ; 1000000 / SamplingInterval) or in Hertz if frequency domain: 16 | SamplingInterval=1953.125 17 | 18 | [User Infos] 19 | ; Each entry: Prop=,,,,..., 20 | ; Property number must be unique. Types can be int, single, string, bool, byte, double, uint 21 | ; or arrays of those, indicated int-array etc 22 | ; Array types have more than one value, number of values determines size of array. 23 | ; Fields are delimited by commas, commas in strings are written \1 24 | 25 | [ASCII Infos] 26 | ; Decimal symbol for floating point numbers: the header file always uses a dot (.), 27 | ; however the data file might use a different one 28 | DecimalSymbol=. 29 | ; SkipLines, SkipColumns: leading lines and columns with additional information. 30 | SkipLines=1 31 | SkipColumns=0 32 | 33 | [Channel Infos] 34 | ; Each entry: Ch=,, 35 | ; ,, Future extensions... 36 | ; Fields are delimited by commas, some fields might be omitted (empty). 37 | ; Commas in channel names are coded as "\1". 38 | Ch1=Fp1,,,µV 39 | Ch2=Fpz,,,µV 40 | Ch3=Fp2,,,µV 41 | Ch4=F7,,,µV 42 | Ch5=F3,,,µV 43 | Ch6=Fz,,,µV 44 | Ch7=F4,,,µV 45 | Ch8=F8,,,µV 46 | Ch9=FC5,,,µV 47 | Ch10=FC1,,,µV 48 | Ch11=FC2,,,µV 49 | Ch12=FC6,,,µV 50 | Ch13=M1,,,µV 51 | Ch14=T7,,,µV 52 | Ch15=C3,,,µV 53 | Ch16=Cz,,,µV 54 | Ch17=C4,,,µV 55 | Ch18=T8,,,µV 56 | Ch19=M2,,,µV 57 | Ch20=CP5,,,µV 58 | Ch21=CP1,,,µV 59 | Ch22=CP2,,,µV 60 | Ch23=CP6,,,µV 61 | Ch24=P7,,,µV 62 | Ch25=P3,,,µV 63 | Ch26=Pz,,,µV 64 | Ch27=P4,,,µV 65 | Ch28=P8,,,µV 66 | Ch29=POz,,,µV 67 | Ch30=O1,,,µV 68 | Ch31=Oz,,,µV 69 | Ch32=O2,,,µV 70 | Ch33=HEOG,,,µV 71 | Ch34=VEOG,,,µV 72 | 73 | [Channel User Infos] 74 | ; Each entry: Prop=Ch,,,,,..., 75 | ; Property number must be unique. Types can be int, single, string, bool, byte, double, uint 76 | ; or arrays of those, indicated int-array etc 77 | ; Array types have more than one value, number of values determines size of array. 78 | ; Fields are delimited by commas, commas in strings are written \1 79 | ; Properties are assigned to channels using their channel number. 80 | 81 | [Coordinates] 82 | ; Each entry: Ch=,, 83 | Ch1=1,-90,-72 84 | Ch2=1,90,90 85 | Ch3=1,90,72 86 | Ch4=1,-90,-36 87 | Ch5=1,-60,-51 88 | Ch6=1,45,90 89 | Ch7=1,60,51 90 | Ch8=1,90,36 91 | Ch9=1,-69,-21 92 | Ch10=1,-31,-46 93 | Ch11=1,31,46 94 | Ch12=1,69,21 95 | Ch13=0,0,0 96 | Ch14=1,-90,0 97 | Ch15=1,-45,0 98 | Ch16=1,0,0 99 | Ch17=1,45,0 100 | Ch18=1,90,0 101 | Ch19=0,0,0 102 | Ch20=1,-69,21 103 | Ch21=1,-31,46 104 | Ch22=1,31,-46 105 | Ch23=1,69,-21 106 | Ch24=1,-90,36 107 | Ch25=1,-60,51 108 | Ch26=1,45,-90 109 | Ch27=1,60,-51 110 | Ch28=1,90,-36 111 | Ch29=1,67,-90 112 | Ch30=1,-90,72 113 | Ch31=1,90,-90 114 | Ch32=1,90,-72 115 | Ch33=0,0,0 116 | Ch34=0,0,0 117 | -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_txt_multi.vmrk: -------------------------------------------------------------------------------- 1 | Brain Vision Data Exchange Marker File, Version 2.0 2 | ; Data created from history path: asalab_export_bv/Raw Data 3 | ; The channel numbers are related to the channels in the exported file. 4 | 5 | [Common Infos] 6 | Codepage=UTF-8 7 | DataFile=bv_export_bv_txt_txt_multi.dat 8 | 9 | [Marker Infos] 10 | ; Each entry: Mk=,,, 11 | ; , , 12 | ; , Visible 13 | ; Fields are delimited by commas, some fields may be omitted (empty). 14 | ; Commas in type or description text are coded as "\1". 15 | Mk1=New Segment,,1,1,0,20181106153757758000 16 | Mk2=Stimulus,s10,142,1,0 17 | Mk3=Stimulus,s11,424,1,0 18 | Mk4=Stimulus,s12,745,1,0 19 | Mk5=Stimulus,s10,1303,1,0 20 | Mk6=Stimulus,s11,1584,1,0 21 | Mk7=Stimulus,s12,1876,1,0 22 | Mk8=Stimulus,s10,2374,1,0 23 | Mk9=Stimulus,s11,2654,1,0 24 | Mk10=Stimulus,s12,3018,1,0 25 | Mk11=Stimulus,s10,3531,1,0 26 | Mk12=Stimulus,s11,3812,1,0 27 | Mk13=Stimulus,s12,4165,1,0 28 | 29 | [Marker User Infos] 30 | ; Each entry: Prop=Mk,,,,,..., 31 | ; Property number must be unique. Types can be int, single, string, bool, byte, double, uint 32 | ; or arrays of those, indicated int-array etc 33 | ; Array types have more than one value, number of values determines size of array. 34 | ; Fields are delimited by commas, commas in strings are written \1 35 | ; Properties are assigned to markers using their marker number. 36 | -------------------------------------------------------------------------------- /inst/testdata/bv_export_bv_txt_txt_vector.vmrk: -------------------------------------------------------------------------------- 1 | Brain Vision Data Exchange Marker File, Version 2.0 2 | ; Data created from history path: asalab_export_bv/Raw Data 3 | ; The channel numbers are related to the channels in the exported file. 4 | 5 | [Common Infos] 6 | Codepage=UTF-8 7 | DataFile=bv_export_bv_txt_txt_vector.dat 8 | 9 | [Marker Infos] 10 | ; Each entry: Mk=,,, 11 | ; , , 12 | ; , Visible 13 | ; Fields are delimited by commas, some fields may be omitted (empty). 14 | ; Commas in type or description text are coded as "\1". 15 | Mk1=New Segment,,1,1,0,20181106153757758000 16 | Mk2=Stimulus,s10,142,1,0 17 | Mk3=Stimulus,s11,424,1,0 18 | Mk4=Stimulus,s12,745,1,0 19 | Mk5=Stimulus,s10,1303,1,0 20 | Mk6=Stimulus,s11,1584,1,0 21 | Mk7=Stimulus,s12,1876,1,0 22 | Mk8=Stimulus,s10,2374,1,0 23 | Mk9=Stimulus,s11,2654,1,0 24 | Mk10=Stimulus,s12,3018,1,0 25 | Mk11=Stimulus,s10,3531,1,0 26 | Mk12=Stimulus,s11,3812,1,0 27 | Mk13=Stimulus,s12,4165,1,0 28 | 29 | [Marker User Infos] 30 | ; Each entry: Prop=Mk,,,,,..., 31 | ; Property number must be unique. Types can be int, single, string, bool, byte, double, uint 32 | ; or arrays of those, indicated int-array etc 33 | ; Array types have more than one value, number of values determines size of array. 34 | ; Fields are delimited by commas, commas in strings are written \1 35 | ; Properties are assigned to markers using their marker number. 36 | -------------------------------------------------------------------------------- /inst/testdata/bv_export_edf+.edf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/bv_export_edf+.edf -------------------------------------------------------------------------------- /inst/testdata/bv_export_edf.edf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/bv_export_edf.edf -------------------------------------------------------------------------------- /inst/testdata/bv_segexport_ascii.vmrk: -------------------------------------------------------------------------------- 1 | Brain Vision Data Exchange Marker File, Version 2.0 2 | ; Data created from history path: asalab_export_bv/Raw Data/Segmentation 3 | ; The channel numbers are related to the channels in the exported file. 4 | 5 | [Common Infos] 6 | Codepage=UTF-8 7 | DataFile=bv_segexport_ascii.dat 8 | 9 | [Marker Infos] 10 | ; Each entry: Mk=,,, 11 | ; , , 12 | ; , Visible 13 | ; Fields are delimited by commas, some fields may be omitted (empty). 14 | ; Commas in type or description text are coded as "\1". 15 | Mk1=Time 0,,1,1,0 16 | Mk2=New Segment,,1,1,0,20181106153758033390 17 | Mk3=Stimulus,s10,1,1,0 18 | Mk4=Time 0,,257,1,0 19 | Mk5=Stimulus,s11,257,1,0 20 | Mk6=New Segment,,257,1,0,20181106153758584171 21 | Mk7=Time 0,,513,1,0 22 | Mk8=New Segment,,513,1,0,20181106153759211125 23 | Mk9=Stimulus,s12,513,1,0 24 | Mk10=Stimulus,s10,769,1,0 25 | Mk11=New Segment,,769,1,0,20181106153800300968 26 | Mk12=Time 0,,769,1,0 27 | Mk13=New Segment,,1025,1,0,20181106153800849796 28 | Mk14=Time 0,,1025,1,0 29 | Mk15=Stimulus,s11,1025,1,0 30 | Mk16=New Segment,,1281,1,0,20181106153801420109 31 | Mk17=Time 0,,1281,1,0 32 | Mk18=Stimulus,s12,1281,1,0 33 | Mk19=Stimulus,s10,1537,1,0 34 | Mk20=Time 0,,1537,1,0 35 | Mk21=New Segment,,1537,1,0,20181106153802392765 36 | Mk22=Time 0,,1793,1,0 37 | Mk23=New Segment,,1793,1,0,20181106153802939640 38 | Mk24=Stimulus,s11,1793,1,0 39 | Mk25=Stimulus,s12,2049,1,0 40 | Mk26=New Segment,,2049,1,0,20181106153803650578 41 | Mk27=Time 0,,2049,1,0 42 | Mk28=Time 0,,2305,1,0 43 | Mk29=Stimulus,s10,2305,1,0 44 | Mk30=New Segment,,2305,1,0,20181106153804652531 45 | Mk31=New Segment,,2561,1,0,20181106153805201359 46 | Mk32=Time 0,,2561,1,0 47 | Mk33=Stimulus,s11,2561,1,0 48 | Mk34=Time 0,,2817,1,0 49 | Mk35=New Segment,,2817,1,0,20181106153805890812 50 | Mk36=Stimulus,s12,2817,1,0 51 | 52 | [Marker User Infos] 53 | ; Each entry: Prop=Mk,,,,,..., 54 | ; Property number must be unique. Types can be int, single, string, bool, byte, double, uint 55 | ; or arrays of those, indicated int-array etc 56 | ; Array types have more than one value, number of values determines size of array. 57 | ; Fields are delimited by commas, commas in strings are written \1 58 | ; Properties are assigned to markers using their marker number. 59 | -------------------------------------------------------------------------------- /inst/testdata/bv_segexport_bin.dat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/bv_segexport_bin.dat -------------------------------------------------------------------------------- /inst/testdata/bv_segexport_bin.vhdr: -------------------------------------------------------------------------------- 1 | Brain Vision Data Exchange Header File Version 2.0 2 | ; Data created from history path: asalab_export_bv/Raw Data/Segmentation 3 | 4 | [Common Infos] 5 | Codepage=UTF-8 6 | DataFile=bv_segexport_bin.dat 7 | MarkerFile=bv_segexport_bin.vmrk 8 | DataFormat=BINARY 9 | ; Data orientation: VECTORIZED=ch1,pt1, ch1,pt2..., MULTIPLEXED=ch1,pt1, ch2,pt1 ... 10 | DataOrientation=VECTORIZED 11 | DataType=TIMEDOMAIN 12 | NumberOfChannels=34 13 | DataPoints=3072 14 | ; Sampling interval in microseconds if time domain (convert to Hertz: 15 | ; 1000000 / SamplingInterval) or in Hertz if frequency domain: 16 | SamplingInterval=1953.125 17 | SegmentationType=MARKERBASED 18 | SegmentDataPoints=256 19 | 20 | [User Infos] 21 | ; Each entry: Prop=,,,,..., 22 | ; Property number must be unique. Types can be int, single, string, bool, byte, double, uint 23 | ; or arrays of those, indicated int-array etc 24 | ; Array types have more than one value, number of values determines size of array. 25 | ; Fields are delimited by commas, commas in strings are written \1 26 | 27 | [Binary Infos] 28 | BinaryFormat=IEEE_FLOAT_32 29 | 30 | [Channel Infos] 31 | ; Each entry: Ch=,, 32 | ; ,, Future extensions... 33 | ; Fields are delimited by commas, some fields might be omitted (empty). 34 | ; Commas in channel names are coded as "\1". 35 | Ch1=Fp1,,,µV 36 | Ch2=Fpz,,,µV 37 | Ch3=Fp2,,,µV 38 | Ch4=F7,,,µV 39 | Ch5=F3,,,µV 40 | Ch6=Fz,,,µV 41 | Ch7=F4,,,µV 42 | Ch8=F8,,,µV 43 | Ch9=FC5,,,µV 44 | Ch10=FC1,,,µV 45 | Ch11=FC2,,,µV 46 | Ch12=FC6,,,µV 47 | Ch13=M1,,,µV 48 | Ch14=T7,,,µV 49 | Ch15=C3,,,µV 50 | Ch16=Cz,,,µV 51 | Ch17=C4,,,µV 52 | Ch18=T8,,,µV 53 | Ch19=M2,,,µV 54 | Ch20=CP5,,,µV 55 | Ch21=CP1,,,µV 56 | Ch22=CP2,,,µV 57 | Ch23=CP6,,,µV 58 | Ch24=P7,,,µV 59 | Ch25=P3,,,µV 60 | Ch26=Pz,,,µV 61 | Ch27=P4,,,µV 62 | Ch28=P8,,,µV 63 | Ch29=POz,,,µV 64 | Ch30=O1,,,µV 65 | Ch31=Oz,,,µV 66 | Ch32=O2,,,µV 67 | Ch33=HEOG,,,µV 68 | Ch34=VEOG,,,µV 69 | 70 | [Channel User Infos] 71 | ; Each entry: Prop=Ch,,,,,..., 72 | ; Property number must be unique. Types can be int, single, string, bool, byte, double, uint 73 | ; or arrays of those, indicated int-array etc 74 | ; Array types have more than one value, number of values determines size of array. 75 | ; Fields are delimited by commas, commas in strings are written \1 76 | ; Properties are assigned to channels using their channel number. 77 | 78 | [Coordinates] 79 | ; Each entry: Ch=,, 80 | Ch1=1,-90,-72 81 | Ch2=1,90,90 82 | Ch3=1,90,72 83 | Ch4=1,-90,-36 84 | Ch5=1,-60,-51 85 | Ch6=1,45,90 86 | Ch7=1,60,51 87 | Ch8=1,90,36 88 | Ch9=1,-69,-21 89 | Ch10=1,-31,-46 90 | Ch11=1,31,46 91 | Ch12=1,69,21 92 | Ch13=0,0,0 93 | Ch14=1,-90,0 94 | Ch15=1,-45,0 95 | Ch16=1,0,0 96 | Ch17=1,45,0 97 | Ch18=1,90,0 98 | Ch19=0,0,0 99 | Ch20=1,-69,21 100 | Ch21=1,-31,46 101 | Ch22=1,31,-46 102 | Ch23=1,69,-21 103 | Ch24=1,-90,36 104 | Ch25=1,-60,51 105 | Ch26=1,45,-90 106 | Ch27=1,60,-51 107 | Ch28=1,90,-36 108 | Ch29=1,67,-90 109 | Ch30=1,-90,72 110 | Ch31=1,90,-90 111 | Ch32=1,90,-72 112 | Ch33=0,0,0 113 | Ch34=0,0,0 114 | -------------------------------------------------------------------------------- /inst/testdata/bv_segexport_bin.vmrk: -------------------------------------------------------------------------------- 1 | Brain Vision Data Exchange Marker File, Version 2.0 2 | ; Data created from history path: asalab_export_bv/Raw Data/Segmentation 3 | ; The channel numbers are related to the channels in the exported file. 4 | 5 | [Common Infos] 6 | Codepage=UTF-8 7 | DataFile=bv_segexport_bin.dat 8 | 9 | [Marker Infos] 10 | ; Each entry: Mk=,,, 11 | ; , , 12 | ; , Visible 13 | ; Fields are delimited by commas, some fields may be omitted (empty). 14 | ; Commas in type or description text are coded as "\1". 15 | Mk1=Time 0,,1,1,0 16 | Mk2=New Segment,,1,1,0,20181106153758033390 17 | Mk3=Stimulus,s10,1,1,0 18 | Mk4=Time 0,,257,1,0 19 | Mk5=Stimulus,s11,257,1,0 20 | Mk6=New Segment,,257,1,0,20181106153758584171 21 | Mk7=Time 0,,513,1,0 22 | Mk8=New Segment,,513,1,0,20181106153759211125 23 | Mk9=Stimulus,s12,513,1,0 24 | Mk10=Stimulus,s10,769,1,0 25 | Mk11=New Segment,,769,1,0,20181106153800300968 26 | Mk12=Time 0,,769,1,0 27 | Mk13=New Segment,,1025,1,0,20181106153800849796 28 | Mk14=Time 0,,1025,1,0 29 | Mk15=Stimulus,s11,1025,1,0 30 | Mk16=New Segment,,1281,1,0,20181106153801420109 31 | Mk17=Time 0,,1281,1,0 32 | Mk18=Stimulus,s12,1281,1,0 33 | Mk19=Stimulus,s10,1537,1,0 34 | Mk20=Time 0,,1537,1,0 35 | Mk21=New Segment,,1537,1,0,20181106153802392765 36 | Mk22=Time 0,,1793,1,0 37 | Mk23=New Segment,,1793,1,0,20181106153802939640 38 | Mk24=Stimulus,s11,1793,1,0 39 | Mk25=Stimulus,s12,2049,1,0 40 | Mk26=New Segment,,2049,1,0,20181106153803650578 41 | Mk27=Time 0,,2049,1,0 42 | Mk28=Time 0,,2305,1,0 43 | Mk29=Stimulus,s10,2305,1,0 44 | Mk30=New Segment,,2305,1,0,20181106153804652531 45 | Mk31=New Segment,,2561,1,0,20181106153805201359 46 | Mk32=Time 0,,2561,1,0 47 | Mk33=Stimulus,s11,2561,1,0 48 | Mk34=Time 0,,2817,1,0 49 | Mk35=New Segment,,2817,1,0,20181106153805890812 50 | Mk36=Stimulus,s12,2817,1,0 51 | 52 | [Marker User Infos] 53 | ; Each entry: Prop=Mk,,,,,..., 54 | ; Property number must be unique. Types can be int, single, string, bool, byte, double, uint 55 | ; or arrays of those, indicated int-array etc 56 | ; Array types have more than one value, number of values determines size of array. 57 | ; Fields are delimited by commas, commas in strings are written \1 58 | ; Properties are assigned to markers using their marker number. 59 | -------------------------------------------------------------------------------- /inst/testdata/eeglab_data.set: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/eeglab_data.set -------------------------------------------------------------------------------- /inst/testdata/fieldtrip_matrix.mat: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/fieldtrip_matrix.mat -------------------------------------------------------------------------------- /inst/testdata/sample_audvis_10s_raw.fif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/sample_audvis_10s_raw.fif -------------------------------------------------------------------------------- /inst/testdata/test_generator_2.bdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/test_generator_2.bdf -------------------------------------------------------------------------------- /inst/testdata/test_generator_2.edf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/inst/testdata/test_generator_2.edf -------------------------------------------------------------------------------- /man/annotate_electrodes.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot.R 3 | \name{annotate_electrodes} 4 | \alias{annotate_electrodes} 5 | \title{Adds the electrode labels to a head shape} 6 | \usage{ 7 | annotate_electrodes(.label = .key, ...) 8 | } 9 | \arguments{ 10 | \item{.label}{Label name for the electrodes} 11 | 12 | \item{...}{other arguments to control the text} 13 | } 14 | \value{ 15 | A layer for a ggplot 16 | } 17 | \description{ 18 | Adds the electrode labels to a head shape 19 | } 20 | \examples{ 21 | library(ggplot2) 22 | data_faces_ERPs \%>\% 23 | eeg_filter(between(as_time(.sample, .unit = "milliseconds"), 100, 200)) \%>\% 24 | eeg_group_by(condition) \%>\% 25 | eeg_summarize(across_ch(mean, na.rm = TRUE)) \%>\% 26 | plot_topo() + 27 | annotate_head(size = .9, color = "black", stroke = 1) + 28 | annotate_electrodes(color = "gray") 29 | } 30 | \seealso{ 31 | Other plotting functions: 32 | \code{\link{annotate_events}()}, 33 | \code{\link{annotate_head}()}, 34 | \code{\link{eeg_downsample}()}, 35 | \code{\link{ggplot.eeg_lst}()}, 36 | \code{\link{plot.eeg_lst}()}, 37 | \code{\link{plot_components}()}, 38 | \code{\link{plot_in_layout}()}, 39 | \code{\link{plot_topo}()}, 40 | \code{\link{theme_eeguana}()} 41 | } 42 | \concept{plotting functions} 43 | -------------------------------------------------------------------------------- /man/annotate_events.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot.R 3 | \name{annotate_events} 4 | \alias{annotate_events} 5 | \title{Adds a layer with the events on top of a plot of an eeg_lst.} 6 | \usage{ 7 | annotate_events(data = NULL, alpha = 0.2) 8 | } 9 | \arguments{ 10 | \item{data}{The data to be displayed in this layer. There are three options: 11 | * If NULL, the default, the events table is inherited from the plot data as specified 12 | in the call to ggplot(). 13 | * An events table will override the plot events table data.} 14 | 15 | \item{alpha}{new alpha level in 0,1.} 16 | } 17 | \value{ 18 | A \code{\link[ggplot2:ggplot]{ggplot}} layer. 19 | } 20 | \description{ 21 | Adds a layer with the events on top of a plot of an eeg_lst. 22 | } 23 | \seealso{ 24 | Other plotting functions: 25 | \code{\link{annotate_electrodes}()}, 26 | \code{\link{annotate_head}()}, 27 | \code{\link{eeg_downsample}()}, 28 | \code{\link{ggplot.eeg_lst}()}, 29 | \code{\link{plot.eeg_lst}()}, 30 | \code{\link{plot_components}()}, 31 | \code{\link{plot_in_layout}()}, 32 | \code{\link{plot_topo}()}, 33 | \code{\link{theme_eeguana}()} 34 | } 35 | \concept{plotting functions} 36 | -------------------------------------------------------------------------------- /man/annotate_head.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot.R 3 | \name{annotate_head} 4 | \alias{annotate_head} 5 | \title{Add a head shape to a ggplot} 6 | \usage{ 7 | annotate_head(size = 1.1, color = "black", stroke = 1) 8 | } 9 | \arguments{ 10 | \item{size}{Size of the head} 11 | 12 | \item{color}{Color of the head} 13 | 14 | \item{stroke}{Line thickness} 15 | } 16 | \value{ 17 | A layer for a ggplot 18 | } 19 | \description{ 20 | Adds the outline of a head and nose to a ggplot. 21 | } 22 | \examples{ 23 | library(ggplot2) 24 | data_faces_ERPs \%>\% 25 | eeg_filter(between(as_time(.sample, .unit = "milliseconds"), 100, 200)) \%>\% 26 | eeg_group_by(condition) \%>\% 27 | eeg_summarize(across_ch(mean, na.rm = TRUE)) \%>\% 28 | plot_topo() + 29 | annotate_head(size = .9, color = "black", stroke = 1) + 30 | annotate_electrodes() 31 | } 32 | \seealso{ 33 | Other plotting functions: 34 | \code{\link{annotate_electrodes}()}, 35 | \code{\link{annotate_events}()}, 36 | \code{\link{eeg_downsample}()}, 37 | \code{\link{ggplot.eeg_lst}()}, 38 | \code{\link{plot.eeg_lst}()}, 39 | \code{\link{plot_components}()}, 40 | \code{\link{plot_in_layout}()}, 41 | \code{\link{plot_topo}()}, 42 | \code{\link{theme_eeguana}()} 43 | } 44 | \concept{plotting functions} 45 | -------------------------------------------------------------------------------- /man/as.data.frame.eeg_lst.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/to_tbl.R 3 | \name{as.data.frame.eeg_lst} 4 | \alias{as.data.frame.eeg_lst} 5 | \title{Convert an eeg_lst to a (base) data frame.} 6 | \usage{ 7 | \method{as.data.frame}{eeg_lst}(x, row.names = NULL, optional = FALSE, ..., .unit = "second") 8 | } 9 | \arguments{ 10 | \item{x}{An \code{eeg_lst} object.} 11 | 12 | \item{row.names}{\code{NULL} or a character vector giving the row 13 | names for the data frame. Missing values are not allowed.} 14 | 15 | \item{optional}{logical. If \code{TRUE}, setting row names and 16 | converting column names (to syntactic names: see 17 | \code{\link[base]{make.names}}) is optional. Note that all of \R's 18 | \pkg{base} package \code{as.data.frame()} methods use 19 | \code{optional} only for column names treatment, basically with the 20 | meaning of \code{\link[base]{data.frame}(*, check.names = !optional)}. 21 | See also the \code{make.names} argument of the \code{matrix} method.} 22 | 23 | \item{...}{Additional arguments to be passed to or from other methods.} 24 | 25 | \item{.unit}{Unit for the \code{.time} column of the transformed object: "s" (default), "ms", "samples".} 26 | } 27 | \value{ 28 | A data.frame. 29 | } 30 | \description{ 31 | Convert an eeg_lst to a (base) data frame. 32 | } 33 | -------------------------------------------------------------------------------- /man/as.data.frame.psd_lst.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/to_tbl.R 3 | \name{as.data.frame.psd_lst} 4 | \alias{as.data.frame.psd_lst} 5 | \title{Convert a psd_lst to a (base) data frame.} 6 | \usage{ 7 | \method{as.data.frame}{psd_lst}(x, row.names = NULL, optional = FALSE, ...) 8 | } 9 | \arguments{ 10 | \item{x}{A \code{psd_lst} object.} 11 | 12 | \item{row.names}{\code{NULL} or a character vector giving the row 13 | names for the data frame. Missing values are not allowed.} 14 | 15 | \item{optional}{logical. If \code{TRUE}, setting row names and 16 | converting column names (to syntactic names: see 17 | \code{\link[base]{make.names}}) is optional. Note that all of \R's 18 | \pkg{base} package \code{as.data.frame()} methods use 19 | \code{optional} only for column names treatment, basically with the 20 | meaning of \code{\link[base]{data.frame}(*, check.names = !optional)}. 21 | See also the \code{make.names} argument of the \code{matrix} method.} 22 | 23 | \item{...}{Additional arguments to be passed to or from other methods.} 24 | } 25 | \value{ 26 | A data.frame. 27 | } 28 | \description{ 29 | Convert a psd_lst to a (base) data frame. 30 | } 31 | \seealso{ 32 | Other tibble: 33 | \code{\link{as_tibble.eeg_lst}()}, 34 | \code{\link{as_tibble.psd_lst}()} 35 | } 36 | \concept{tibble} 37 | -------------------------------------------------------------------------------- /man/as.data.table.eeg_lst.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/to_tbl.R 3 | \name{as.data.table.eeg_lst} 4 | \alias{as.data.table.eeg_lst} 5 | \title{Convert an eeg_lst to a long table in \code{\link[data.table:data.table]{data.table}} format.} 6 | \usage{ 7 | as.data.table.eeg_lst(x, .unit = "s", ...) 8 | } 9 | \arguments{ 10 | \item{x}{An \code{eeg_lst} object.} 11 | 12 | \item{.unit}{Unit for the \code{.time} column of the transformed object: "s" (default), "ms", "samples".} 13 | 14 | \item{...}{Additional arguments to be passed to or from other methods.} 15 | } 16 | \value{ 17 | A \code{\link[data.table:data.table]{data.table}}. 18 | } 19 | \description{ 20 | Convert the signal_tbl table from wide to long format. 21 | } 22 | -------------------------------------------------------------------------------- /man/as.data.table.psd_lst.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/to_tbl.R 3 | \name{as.data.table.psd_lst} 4 | \alias{as.data.table.psd_lst} 5 | \title{Convert a psd_lst list to a long table in \code{\link[data.table:data.table]{data.table}} format.} 6 | \usage{ 7 | as.data.table.psd_lst(x, ...) 8 | } 9 | \arguments{ 10 | \item{x}{A \code{psd_lst} object.} 11 | 12 | \item{...}{Additional arguments to be passed to or from other methods.} 13 | } 14 | \value{ 15 | A \code{\link[data.table:data.table]{data.table}}. 16 | } 17 | \description{ 18 | Convert the psd_tbl table from wide to long format. 19 | } 20 | -------------------------------------------------------------------------------- /man/as_channel_dbl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/constructors.R 3 | \name{as_channel_dbl} 4 | \alias{as_channel_dbl} 5 | \title{Coerce a vector of real (double) numbers into a channel object} 6 | \usage{ 7 | as_channel_dbl(x) 8 | } 9 | \arguments{ 10 | \item{x}{A vector.} 11 | } 12 | \value{ 13 | A channel_dbl. 14 | } 15 | \description{ 16 | Coerce a vector of real (double) numbers into a channel object 17 | } 18 | \seealso{ 19 | Other channel: 20 | \code{\link{channel_dbl}()}, 21 | \code{\link{is_channel_dbl}()} 22 | } 23 | \concept{channel} 24 | -------------------------------------------------------------------------------- /man/as_eeg_lst.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ica.R 3 | \name{as_eeg_lst} 4 | \alias{as_eeg_lst} 5 | \title{Transforms an object to a eeg_lst} 6 | \usage{ 7 | as_eeg_lst(.data, ...) 8 | } 9 | \arguments{ 10 | \item{.data}{An \code{eeg_ica_lst} and experimentally an MNE raw signal using \link[reticulate:reticulate]{reticulate::reticulate}.} 11 | 12 | \item{...}{Not in use.} 13 | } 14 | \description{ 15 | Transforms an object to a eeg_lst 16 | } 17 | -------------------------------------------------------------------------------- /man/as_sample_int.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/time_sample.R 3 | \name{as_sample_int} 4 | \alias{as_sample_int} 5 | \alias{as_sample_int.numeric} 6 | \title{Convert a time point into a sample.} 7 | \usage{ 8 | as_sample_int(x, ...) 9 | 10 | \method{as_sample_int}{numeric}(x, .sampling_rate = NULL, .unit = "s", ...) 11 | } 12 | \arguments{ 13 | \item{x}{A vector of numeric values.} 14 | 15 | \item{...}{Not in use.} 16 | 17 | \item{.sampling_rate}{Sampling rate in Hz} 18 | 19 | \item{.unit}{"seconds" (or "s"), "milliseconds" (or "ms"), or "samples"} 20 | } 21 | \value{ 22 | A sample_int object. 23 | } 24 | \description{ 25 | Convert a time point into a sample. 26 | } 27 | -------------------------------------------------------------------------------- /man/as_tibble.eeg_lst.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/to_tbl.R 3 | \name{as_tibble.eeg_lst} 4 | \alias{as_tibble.eeg_lst} 5 | \alias{as_data_frame.eeg_lst} 6 | \alias{as_long_tbl.eeg_lst} 7 | \title{Convert an eeg_lst to a long table in \code{\link[tibble:tibble]{tibble}} format.} 8 | \usage{ 9 | as_tibble.eeg_lst(x, .unit = "s", ...) 10 | 11 | as_data_frame.eeg_lst(x, .unit = "s", ...) 12 | 13 | \method{as_long_tbl}{eeg_lst}(x, .unit = "s", ...) 14 | } 15 | \arguments{ 16 | \item{x}{An \code{eeg_lst} object.} 17 | 18 | \item{.unit}{Unit for the \code{.time} column of the transformed object: "s" (default), "ms", "samples".} 19 | 20 | \item{...}{Additional arguments to be passed to or from other methods.} 21 | } 22 | \value{ 23 | A \code{\link[tibble:tibble]{tibble}} 24 | } 25 | \description{ 26 | Convert the signal_tbl table from wide to long format. 27 | } 28 | \seealso{ 29 | Other tibble: 30 | \code{\link{as.data.frame.psd_lst}()}, 31 | \code{\link{as_tibble.psd_lst}()} 32 | } 33 | \concept{tibble} 34 | -------------------------------------------------------------------------------- /man/as_tibble.psd_lst.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/to_tbl.R 3 | \name{as_tibble.psd_lst} 4 | \alias{as_tibble.psd_lst} 5 | \title{Convert an psd_lst to a long table in \code{\link[tibble:tibble]{tibble}} format.} 6 | \usage{ 7 | as_tibble.psd_lst(x, ...) 8 | } 9 | \arguments{ 10 | \item{x}{A \code{psd_lst} object.} 11 | 12 | \item{...}{Additional arguments to be passed to or from other methods.} 13 | } 14 | \value{ 15 | A \code{\link[tibble:tibble]{tibble}} 16 | } 17 | \description{ 18 | Convert the signal_tbl table from wide to long format. 19 | } 20 | \seealso{ 21 | Other tibble: 22 | \code{\link{as.data.frame.psd_lst}()}, 23 | \code{\link{as_tibble.eeg_lst}()} 24 | } 25 | \concept{tibble} 26 | -------------------------------------------------------------------------------- /man/as_tidytable.eeg_lst.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/to_tbl.R 3 | \name{as_tidytable.eeg_lst} 4 | \alias{as_tidytable.eeg_lst} 5 | \title{Convert an eeg_lst to a long table in \code{\link[tidytable:tidytable]{tidytable}} format.} 6 | \usage{ 7 | as_tidytable.eeg_lst(x, .unit = "s", ...) 8 | } 9 | \arguments{ 10 | \item{x}{An \code{eeg_lst} object.} 11 | 12 | \item{.unit}{Unit for the \code{.time} column of the transformed object: "s" (default), "ms", "samples".} 13 | 14 | \item{...}{Additional arguments to be passed to or from other methods.} 15 | } 16 | \value{ 17 | A \code{\link[tidytable:tidytable]{tidytable}}. 18 | } 19 | \description{ 20 | Convert the signal_tbl table from wide to long format. 21 | } 22 | -------------------------------------------------------------------------------- /man/as_tidytable.psd_lst.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/to_tbl.R 3 | \name{as_tidytable.psd_lst} 4 | \alias{as_tidytable.psd_lst} 5 | \title{Convert an psd_lst to a long table in \code{\link[tidytable:tidytable]{tidytable}} format.} 6 | \usage{ 7 | as_tidytable.psd_lst(x, ...) 8 | } 9 | \arguments{ 10 | \item{x}{A \code{psd_lst} object.} 11 | 12 | \item{...}{unused} 13 | } 14 | \value{ 15 | A \code{\link[tidytable:tidytable]{tidytable}}. 16 | } 17 | \description{ 18 | Convert the signal_tbl table from wide to long format. 19 | } 20 | -------------------------------------------------------------------------------- /man/as_time.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/time_sample.R 3 | \name{as_time} 4 | \alias{as_time} 5 | \title{Convert a sample point into a time point.} 6 | \usage{ 7 | as_time(x, .unit = "second") 8 | } 9 | \arguments{ 10 | \item{x}{A \code{sample_id} object.} 11 | 12 | \item{.unit}{"seconds" (or "s"), "milliseconds" (or "ms")} 13 | } 14 | \value{ 15 | A vector of times. 16 | } 17 | \description{ 18 | Convert a sample point into a time point. 19 | } 20 | -------------------------------------------------------------------------------- /man/between.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/exported_utils.R 3 | \name{between} 4 | \alias{between} 5 | \title{Convenience function for range subsets} 6 | \description{ 7 | \code{between} is a thin wrapper for the between function of \link[data.table:between]{data.table::between}. 8 | It is equivalent to x >= lower & x <= upper when incbounds=TRUE, or x > lower & y < upper when FALSE. In comparison 9 | with \link[dplyr:between]{dplyr::between}, it doesn't loose the class of its argument, and it's more appropriate for manipulating 10 | the column \code{.sample}. For more information and the description of the arguments, see \link[data.table:between]{data.table::between}. 11 | } 12 | \examples{ 13 | 14 | data_faces_ERPs \%>\% 15 | eeg_filter(.sample \%>\% between(10, 100)) 16 | 17 | } 18 | -------------------------------------------------------------------------------- /man/change_coord.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot_helpers.R 3 | \name{change_coord} 4 | \alias{change_coord} 5 | \title{Change coordinate system from 3D to 2D} 6 | \usage{ 7 | change_coord(data, .projection = "polar") 8 | } 9 | \arguments{ 10 | \item{data}{A tbl created with .keys_tbl} 11 | 12 | \item{.projection}{projection type} 13 | } 14 | \value{ 15 | A modified .keys_tbl 16 | } 17 | \description{ 18 | Change coordinate system from 3D to 2D 19 | } 20 | -------------------------------------------------------------------------------- /man/channel_dbl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/constructors.R 3 | \name{channel_dbl} 4 | \alias{channel_dbl} 5 | \title{Builds a channel.} 6 | \usage{ 7 | channel_dbl( 8 | values, 9 | x = NA_real_, 10 | y = NA_real_, 11 | z = NA_real_, 12 | reference = NA, 13 | ... 14 | ) 15 | } 16 | \arguments{ 17 | \item{values}{Vector of doubles indicating amplitudes.} 18 | 19 | \item{x}{Position in the scalp.} 20 | 21 | \item{y}{Position in the scalp.} 22 | 23 | \item{z}{Position in the scalp.} 24 | 25 | \item{reference}{Reference electrode.} 26 | 27 | \item{...}{further arguments passed to or from other methods.} 28 | } 29 | \value{ 30 | A channel_dbl. 31 | } 32 | \description{ 33 | Builds a channel from a vector of numbers. 34 | } 35 | \examples{ 36 | 37 | Cz <- channel_dbl(runif(100, -5, 5)) 38 | } 39 | \seealso{ 40 | Other channel: 41 | \code{\link{as_channel_dbl}()}, 42 | \code{\link{is_channel_dbl}()} 43 | } 44 | \concept{channel} 45 | -------------------------------------------------------------------------------- /man/channels_tbl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tbl.R 3 | \name{channels_tbl} 4 | \alias{channels_tbl} 5 | \alias{channels_tbl<-} 6 | \title{Functions to get or set the channel information of an eeg_lst object.} 7 | \usage{ 8 | channels_tbl(.data, ...) 9 | 10 | channels_tbl(.data) <- value 11 | } 12 | \arguments{ 13 | \item{.data}{An eeg_lst object.} 14 | 15 | \item{...}{Not in use.} 16 | 17 | \item{value}{A channel table.} 18 | } 19 | \value{ 20 | A table. 21 | } 22 | \description{ 23 | Functions to get or set the channel information of an eeg_lst object. 24 | } 25 | \examples{ 26 | \dontrun{ 27 | library(dplyr) 28 | # Get channel information: 29 | channels_tbl(faces_seg) 30 | # Set channel information using dplyr's mutate and replace 31 | channels_tbl(faces_seg) <- mutate(channels_tbl(faces_seg), 32 | .channel = replace(.channel, .channel == "HEOG", "EOGH"), 33 | .channel = replace(.channel, .channel == "VEOG", "EOGV") 34 | ) 35 | } 36 | 37 | } 38 | \seealso{ 39 | Other functions to expose internal parts of eeg_(ica_)_lst: 40 | \code{\link{events_tbl}()}, 41 | \code{\link{ica_matrix_lst}()}, 42 | \code{\link{segments_tbl}()}, 43 | \code{\link{signal_tbl}()} 44 | } 45 | \concept{functions to expose internal parts of eeg_(ica_)_lst} 46 | -------------------------------------------------------------------------------- /man/chs_fun.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/channel_functions.R 3 | \name{chs_fun} 4 | \alias{chs_fun} 5 | \title{Get the by-sample (or by-row) function of the specified channels.} 6 | \usage{ 7 | chs_fun(x, .funs, ..., .pars = list()) 8 | } 9 | \arguments{ 10 | \item{x}{An eeg_lst.} 11 | 12 | \item{.funs}{A function \code{fun}, a quosure style lambda \code{~ fun(.)} or a list of either form.} 13 | 14 | \item{...}{A group of channels, it can be used in combination with \code{across}.} 15 | 16 | \item{.pars}{List that contains the additional arguments for the function calls in .funs.} 17 | } 18 | \value{ 19 | A new channel or an \code{eeg_lst} object with a channel where a function was instead of the previous channels. 20 | } 21 | \description{ 22 | Get the by-sample (or by-row) function of the specified channels. 23 | } 24 | \seealso{ 25 | Other channel functions: 26 | \code{\link{chs_mean}()} 27 | } 28 | \concept{channel functions} 29 | -------------------------------------------------------------------------------- /man/chs_mean.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/channel_functions.R 3 | \name{chs_mean} 4 | \alias{chs_mean} 5 | \title{Get the by-sample (or by-row) mean of the specified channels.} 6 | \usage{ 7 | chs_mean(x, ..., na.rm = FALSE) 8 | } 9 | \arguments{ 10 | \item{x}{An \code{eeg_lst} object.} 11 | 12 | \item{...}{A group of channels, it can be used in combination with \code{across}.} 13 | 14 | \item{na.rm}{a logical evaluating to \code{TRUE} or \code{FALSE} 15 | indicating whether \code{NA} values should be stripped before the 16 | computation proceeds.} 17 | } 18 | \value{ 19 | A new channel or an \code{eeg_lst} object with a \code{mean} channel instead of the previous channels. 20 | } 21 | \description{ 22 | Wrapper of \code{rowMeans} that performs a by-sample mean of the specified channels. 23 | } 24 | \examples{ 25 | \dontrun{ 26 | faces_segs_some \%>\% 27 | eeg_transmute( 28 | Occipital = chs_mean(O1, O2, Oz, na.rm = TRUE), 29 | Parietal = chs_mean(P3, P4, P7, P8, Pz, na.rm = TRUE) 30 | ) 31 | 32 | faces_segs_some \%>\% 33 | eeg_transmute( 34 | Occipital = chs_mean(O1, O2, Oz, na.rm = TRUE), 35 | Parietal = chs_mean(P3, P4, P7, P8, Pz, na.rm = TRUE) 36 | ) 37 | faces_seg \%>\% 38 | eeg_transmute( 39 | Occipital = chs_mean(across(starts_with("O")), na.rm = TRUE), # O1, O2, Oz 40 | Parietal = chs_mean(across(starts_with("O")), na.rm = TRUE) # P3, P4, P7, P8, Pz 41 | ) 42 | faces_segs_some \%>\% 43 | chs_mean(na.rm = TRUE) 44 | } 45 | } 46 | \seealso{ 47 | Other channel functions: 48 | \code{\link{chs_fun}()} 49 | } 50 | \concept{channel functions} 51 | -------------------------------------------------------------------------------- /man/component_dbl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/constructors.R 3 | \name{component_dbl} 4 | \alias{component_dbl} 5 | \title{Builds a component.} 6 | \usage{ 7 | component_dbl(values) 8 | } 9 | \arguments{ 10 | \item{values}{Vector of doubles indicating amplitudes.} 11 | } 12 | \description{ 13 | Builds a component. 14 | } 15 | \examples{ 16 | 17 | Cz <- component_dbl(runif(100, -5)) 18 | } 19 | \seealso{ 20 | Other component: 21 | \code{\link{is_component_dbl}()} 22 | } 23 | \concept{component} 24 | -------------------------------------------------------------------------------- /man/count_complete_cases_tbl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/out.R 3 | \name{count_complete_cases_tbl} 4 | \alias{count_complete_cases_tbl} 5 | \title{Count number of complete segments of an eeg_lst object.} 6 | \usage{ 7 | count_complete_cases_tbl(x, ...) 8 | } 9 | \arguments{ 10 | \item{x}{An \code{eeg_lst} object.} 11 | 12 | \item{...}{Variables from the segment table to group by.} 13 | } 14 | \value{ 15 | A tbl. 16 | } 17 | \description{ 18 | Count number of complete segments of an eeg_lst object. 19 | } 20 | \examples{ 21 | \dontrun{ 22 | faces_segs_some \%>\% count_complete_cases(.recording, .description) 23 | } 24 | } 25 | \seealso{ 26 | Other summary functions: 27 | \code{\link{eeg_ica_cor_tbl}()}, 28 | \code{\link{eeg_ica_summary_tbl}()}, 29 | \code{\link{eeg_ica_var_tbl}()}, 30 | \code{\link{summaries}}, 31 | \code{\link{summary.eeg_lst}()} 32 | } 33 | \concept{summarize} 34 | \concept{summary functions} 35 | -------------------------------------------------------------------------------- /man/data_faces_10_trials.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{data_faces_10_trials} 5 | \alias{data_faces_10_trials} 6 | \title{EEGs elicited when one subject saw faces and non-faces objects.} 7 | \format{ 8 | An eeg_lst with the following events: 9 | \itemize{ 10 | \item \code{.type == "New Segment"} indicates the beginning of the recording. 11 | \item \code{.type == "Bad Interval"} indicates an interval marked as an artifact by BrainVision 2.0. 12 | \item \verb{.type == "UserDefined", .description == "Blink} indicates an interval marked as a blink by BrainVision 2.0. 13 | \item \verb{.type == "Stimulus", .description == "s5} indicates the beginning of the experiment. 14 | \item \verb{.type == "Stimulus", .description == "s111} indicates 15 | \item \verb{.type == "Stimulus", .description == "s130} indicates the beginning of the trial. 16 | \item \verb{.type == "Stimulus", .description == "s122} indicates 17 | \item \verb{.type == "Stimulus", .description == "s121} indicates 18 | \item \verb{.type == "Stimulus", .description == "s70} indicates that a face was presented. 19 | \item \verb{.type == "Stimulus", .description == "s71} indicates that a non-face was presented. 20 | } 21 | } 22 | \usage{ 23 | data(data_faces_10_trials) 24 | } 25 | \description{ 26 | A dataset containing 10 trials where one subject either saw faces or a non-faces objects with preprocessing done in BrainVision 2.0. See also the vignette \href{https://bnicenboim.github.io/eeguana/articles/brainvision_files.html}{Introduction - Manipulating a clean EEG file exported from BrainVision 2.0}. 27 | } 28 | \seealso{ 29 | Other EEG datasets: 30 | \code{\link{data_faces_ERPs}} 31 | } 32 | \concept{EEG datasets} 33 | \keyword{datasets} 34 | -------------------------------------------------------------------------------- /man/data_faces_ERPs.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{data_faces_ERPs} 5 | \alias{data_faces_ERPs} 6 | \title{ERPs elicited when one subject saw faces and non-faces objects.} 7 | \format{ 8 | An eeg_lst with 2 conditions (faces, non-faces) 9 | } 10 | \usage{ 11 | data(data_faces_ERPs) 12 | } 13 | \description{ 14 | A dataset containing the ERPs elicited when one subject saw faces and non-faces objects. See also the vignette \href{https://bnicenboim.github.io/eeguana/articles/brainvision_files.html}{Introduction - Manipulating a clean EEG file exported from BrainVision 2.0}. 15 | } 16 | \seealso{ 17 | Other EEG datasets: 18 | \code{\link{data_faces_10_trials}} 19 | } 20 | \concept{EEG datasets} 21 | \keyword{datasets} 22 | -------------------------------------------------------------------------------- /man/defunct.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/defunct.R 3 | \name{defunct} 4 | \alias{defunct} 5 | \alias{downsample} 6 | \alias{segment} 7 | \alias{interpolate_tbl} 8 | \alias{event_to_ch_NA} 9 | \alias{eeg_intervals_to_NA} 10 | \alias{ch_filt_low_pass} 11 | \alias{ch_filt_high_pass} 12 | \alias{ch_filt_band_pass} 13 | \alias{ch_filt_stop_pass} 14 | \alias{events} 15 | \alias{events<-} 16 | \alias{summarize_all_ch} 17 | \alias{summarize_at_ch} 18 | \alias{plot_gg} 19 | \alias{ch_baseline} 20 | \title{Defunct functions in eeguana} 21 | \usage{ 22 | downsample(x, q = 2, max_sample = NULL, ...) 23 | 24 | segment(x, ...) 25 | 26 | interpolate_tbl(.data, ...) 27 | 28 | event_to_ch_NA(x, ...) 29 | 30 | eeg_intervals_to_NA(x, ...) 31 | 32 | ch_filt_low_pass(x, ...) 33 | 34 | ch_filt_high_pass(x, ...) 35 | 36 | ch_filt_band_pass(x, ...) 37 | 38 | ch_filt_stop_pass(x, ...) 39 | 40 | events(x, ...) 41 | 42 | events(x) <- value 43 | 44 | summarize_all_ch(x, ...) 45 | 46 | summarize_at_ch(x, ...) 47 | 48 | plot_gg(x, ...) 49 | 50 | ch_baseline(x, ...) 51 | } 52 | \arguments{ 53 | \item{x}{Variable storing the x coordinate, generally \code{.x} (default).} 54 | 55 | \item{q}{integer factor(s) to downsample by.} 56 | 57 | \item{max_sample}{Optionally, the (approximated) maximum sample number can be defined here, which is at least half of the total number of samples} 58 | 59 | \item{...}{Not in use.} 60 | 61 | \item{.data}{An eeg_lst object.} 62 | 63 | \item{value}{Values used for the interpolation, generally \code{.value} (default).} 64 | } 65 | \description{ 66 | These functions are defunct. 67 | } 68 | \details{ 69 | \itemize{ 70 | \item 'downsample()' should be changed to 'eeg_downsample()'. 71 | \item 'segment()' should be changed to 'eeg_segment()'. 72 | \item 'interpolate_tbl()' should be changed to 'eeg_interpolate_tbl()'. 73 | \item 'event_to_ch_NA()' should be changed to 'eeg_intervals_to_NA()'. 74 | \item 'ch_filt_low_pass()' should be changed to 'eeg_filt_low_pass()'. 75 | \item 'ch_filt_high_pass()' should be changed to 'eeg_filt_high_pass()'. 76 | \item 'ch_filt_band_pass()' should be changed to 'eeg_filt_band_pass()'. 77 | \item 'ch_filt_stop_pass()' should be changed to 'eeg_filt_band_stop()'. 78 | \item 'ch_baseline()' should be changed to 'eeg_baseline()'. 79 | \item 'events()' should be changed to 'events_tbl()'. 80 | \item 'plot_gg()' should be changed to 'ggplot(aes(x=.time, y=.value))'. 81 | \item 'summarize_all_ch(...)' should be changed to \code{summarize_at(channel_names(.),...)}. 82 | \item 'summarize_at_ch(...)' should be changed to \code{summarize_at(...)}. 83 | } 84 | } 85 | \keyword{internal} 86 | -------------------------------------------------------------------------------- /man/drop_incomplete_segments.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/out.R 3 | \name{drop_incomplete_segments} 4 | \alias{drop_incomplete_segments} 5 | \title{Drop segments with NAs from the eeg_lst} 6 | \usage{ 7 | drop_incomplete_segments(x) 8 | } 9 | \arguments{ 10 | \item{x}{eeg_lst} 11 | } 12 | \value{ 13 | An eeg_lst object 14 | } 15 | \description{ 16 | Drop segments with NAs from the eeg_lst. 17 | } 18 | \seealso{ 19 | Other tidyverse-like functions: 20 | \code{\link{dplyr_verbs}}, 21 | \code{\link{eeg_bind}()}, 22 | \code{\link{eeg_slice_signal}()} 23 | } 24 | \concept{tidyverse-like functions} 25 | -------------------------------------------------------------------------------- /man/eeg_baseline.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/channel_functions.R 3 | \name{eeg_baseline} 4 | \alias{eeg_baseline} 5 | \title{Baseline an eeg_lst} 6 | \usage{ 7 | eeg_baseline(x, ..., .lim = -Inf, .unit = "s") 8 | } 9 | \arguments{ 10 | \item{x}{An \code{eeg_lst} object or a channel.} 11 | 12 | \item{...}{Channels to include. All channels by default.} 13 | 14 | \item{.lim}{A negative number indicating from when to baseline; the interval is defined as [lim,0]. The default is to use all the negative times.} 15 | 16 | \item{.unit}{"seconds" (or "s"), "milliseconds" (or "ms")} 17 | } 18 | \value{ 19 | An eeg_lst. 20 | } 21 | \description{ 22 | Subtract the average or baseline of the points in a defined interval from all points in the segment. 23 | } 24 | \seealso{ 25 | Other preprocessing functions: 26 | \code{\link{eeg_downsample}()}, 27 | \code{\link{eeg_ica_keep}()}, 28 | \code{\link{eeg_ica}()}, 29 | \code{\link{eeg_rereference}()}, 30 | \code{\link{eeg_segment}()}, 31 | \code{\link{filt}} 32 | } 33 | \concept{preprocessing functions} 34 | -------------------------------------------------------------------------------- /man/eeg_bind.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/dplyr_ext.R 3 | \name{eeg_bind} 4 | \alias{eeg_bind} 5 | \alias{bind} 6 | \title{Bind eeg_lst objects.} 7 | \usage{ 8 | eeg_bind(...) 9 | 10 | bind(...) 11 | } 12 | \arguments{ 13 | \item{...}{\code{eeg_lst} objects to combine.} 14 | } 15 | \value{ 16 | An \code{eeg_lst} object. 17 | } 18 | \description{ 19 | Binds eeg_lst and throws a warning if there is a mismatch in the channel information. 20 | } 21 | \examples{ 22 | \dontrun{ 23 | 24 | # Load multiple subjects using purrr::map, extracting subject IDs from file names. 25 | faces_list <- purrr::map(list.files("./", "vhdr"), ~ 26 | read_vhdr(.x)) 27 | # Bind all the eeg_lsts into a large one: 28 | faces <- eeg_bind(faces_list) 29 | } 30 | 31 | } 32 | \seealso{ 33 | Other tidyverse-like functions: 34 | \code{\link{dplyr_verbs}}, 35 | \code{\link{drop_incomplete_segments}()}, 36 | \code{\link{eeg_slice_signal}()} 37 | } 38 | \concept{tidyverse-like functions} 39 | -------------------------------------------------------------------------------- /man/eeg_downsample.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/signal_processing.R 3 | \name{eeg_downsample} 4 | \alias{eeg_downsample} 5 | \title{Downsample EEG data} 6 | \usage{ 7 | eeg_downsample( 8 | .data, 9 | .q = 2, 10 | .max_sample = NULL, 11 | .n = if (.ftype == "iir") 8 else 30, 12 | .ftype = "iir", 13 | .multiple_times = FALSE, 14 | ... 15 | ) 16 | } 17 | \arguments{ 18 | \item{.data}{An eeg_lst object.} 19 | 20 | \item{.q}{integer factor(s) to downsample by.} 21 | 22 | \item{.max_sample}{Optionally, the (approximated) maximum sample number can be defined here, which is at least half of the total number of samples} 23 | 24 | \item{.n}{Order of the filter used prior to the downsampling, specified as a 25 | positive integer. Default: 8 if \code{ftype} equals \code{"iir"}; 30 of 26 | \code{ftype} equals \code{"fir"}.} 27 | 28 | \item{.ftype}{filter type; either \code{"fir"}, specifying a FIR filter of 29 | length \code{n} designed with the function \code{\link[gsignal]{fir1}}, or 30 | \code{"iir"} (default), specifying an IIR Chebyshev filter of order 8 using 31 | the function \code{\link[gsignal]{cheby1}}.} 32 | 33 | \item{.multiple_times}{Indicates whether to factorize `q`` and apply the downsampling in steps.} 34 | 35 | \item{...}{Not in use.} 36 | } 37 | \description{ 38 | Downsample a signal_tbl by a factor \code{q}, using an FIR or IIR filter. 39 | This is a wrapper for \code{\link[gsignal:decimate]{decimate}} from the 40 | \code{gsignal} package, see its documentation for details. 41 | } 42 | \details{ 43 | A factor q larger than 13 can result in NAs. To avoid this, 44 | the downsampling can be done in steps. For example, instead of setting 45 | \code{q = 20}, it is possible to set \code{q = c(2,10)}. 46 | } 47 | \seealso{ 48 | Other preprocessing functions: 49 | \code{\link{eeg_baseline}()}, 50 | \code{\link{eeg_ica_keep}()}, 51 | \code{\link{eeg_ica}()}, 52 | \code{\link{eeg_rereference}()}, 53 | \code{\link{eeg_segment}()}, 54 | \code{\link{filt}} 55 | 56 | Other plotting functions: 57 | \code{\link{annotate_electrodes}()}, 58 | \code{\link{annotate_events}()}, 59 | \code{\link{annotate_head}()}, 60 | \code{\link{ggplot.eeg_lst}()}, 61 | \code{\link{plot.eeg_lst}()}, 62 | \code{\link{plot_components}()}, 63 | \code{\link{plot_in_layout}()}, 64 | \code{\link{plot_topo}()}, 65 | \code{\link{theme_eeguana}()} 66 | } 67 | \concept{plotting functions} 68 | \concept{preprocessing functions} 69 | -------------------------------------------------------------------------------- /man/eeg_events_to_NA.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/artifact_edition.R 3 | \name{eeg_events_to_NA} 4 | \alias{eeg_events_to_NA} 5 | \title{Remove (transform to NA) problematic events from the signal table of an eeg_lst.} 6 | \usage{ 7 | eeg_events_to_NA( 8 | x, 9 | ..., 10 | .n_chs = NULL, 11 | .entire_seg = TRUE, 12 | .drop_events = TRUE, 13 | .all_chs = FALSE 14 | ) 15 | } 16 | \arguments{ 17 | \item{x}{An \code{eeg_lst} object.} 18 | 19 | \item{...}{Description of the problematic event.} 20 | 21 | \item{.n_chs}{If set to \code{NULL} (default), it will only set \code{NA} to the relevant channel.If set to a number \code{N}, it will set all the channels of the entire segment or interval to \code{NA}, if \code{N} or more channels have a certain event, and otherwise only the relevant channel.} 22 | 23 | \item{.entire_seg}{If set to \code{FALSE}, it will consider only the marked part of the segment, otherwise it will consider the entire segment (Default: .entire_seg = TRUE).} 24 | 25 | \item{.drop_events}{If set to \code{TRUE} (default), the events that were used for setting signals to NA, will be removed from the events table.} 26 | 27 | \item{.all_chs}{Deprecated.} 28 | } 29 | \value{ 30 | An eeg_lst. 31 | } 32 | \description{ 33 | Remove (transform to NA) problematic events from the signal table of an eeg_lst. 34 | } 35 | \examples{ 36 | \dontrun{ 37 | 38 | # Signals with artifacts are turned into NA values: 39 | faces_clean <- faces_seg_artif \%>\% 40 | eeg_events_to_NA(.type == "artifact", .entire_seg = TRUE, .drop_events = TRUE) 41 | 42 | 43 | # Specific segments are turned into NA values: 44 | faces_clean <- faces_seg_artif \%>\% 45 | eeg_events_to_NA(.id \%in\% c(1:3), .entire_seg = TRUE, .drop_events = TRUE) 46 | } 47 | 48 | } 49 | \seealso{ 50 | Other events functions: 51 | \code{\link{eeg_artif}} 52 | } 53 | \concept{events functions} 54 | -------------------------------------------------------------------------------- /man/eeg_ica_cor_tbl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/out.R 3 | \name{eeg_ica_cor_tbl} 4 | \alias{eeg_ica_cor_tbl} 5 | \title{Show correlations between ICA sources and eye (EOG) electrodes.} 6 | \usage{ 7 | eeg_ica_cor_tbl(.data, ...) 8 | } 9 | \arguments{ 10 | \item{.data}{An \code{eeg_ica_lst} object} 11 | 12 | \item{...}{If left empty, the function will assume that EOG channels include eog/EOG in their names, alternatively, EOG channels can be selected here.} 13 | } 14 | \value{ 15 | A table with the correlations between each component and each EOG channel in each recording. 16 | } 17 | \description{ 18 | Show correlations between ICA sources and eye (EOG) electrodes. 19 | } 20 | \seealso{ 21 | Other ICA functions: 22 | \code{\link{eeg_ica_keep}()}, 23 | \code{\link{eeg_ica_show}()}, 24 | \code{\link{eeg_ica_summary_tbl}()}, 25 | \code{\link{eeg_ica_var_tbl}()}, 26 | \code{\link{eeg_ica}()}, 27 | \code{\link{plot_components}()} 28 | 29 | Other summary functions: 30 | \code{\link{count_complete_cases_tbl}()}, 31 | \code{\link{eeg_ica_summary_tbl}()}, 32 | \code{\link{eeg_ica_var_tbl}()}, 33 | \code{\link{summaries}}, 34 | \code{\link{summary.eeg_lst}()} 35 | } 36 | \concept{ICA functions} 37 | \concept{summary functions} 38 | -------------------------------------------------------------------------------- /man/eeg_ica_keep.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ica.R 3 | \name{eeg_ica_keep} 4 | \alias{eeg_ica_keep} 5 | \title{Select independent components (or sources) to keep.} 6 | \usage{ 7 | eeg_ica_keep(.data, ...) 8 | } 9 | \arguments{ 10 | \item{.data}{An eeg_ica_lst object} 11 | 12 | \item{...}{Components to keep from the mixing matrix of the ICA transformation. See \link[dplyr:select]{dplyr::select} and \link[tidyselect:language]{tidyselect::select_helpers} for details.} 13 | } 14 | \description{ 15 | This function will transform the channels according to the independent components that are kept or removed. 16 | } 17 | \examples{ 18 | # For demonstration only, since ICA won't converge 19 | # Suppressing an important warning: 20 | suppressWarnings(data_faces_10_trials \%>\% 21 | eeg_ica(-EOGH, -EOGV, -M1, -M2, .method = fast_ICA, .config = list(maxit = 10))) \%>\% 22 | eeg_ica_keep(-ICA1) 23 | } 24 | \seealso{ 25 | Other preprocessing functions: 26 | \code{\link{eeg_baseline}()}, 27 | \code{\link{eeg_downsample}()}, 28 | \code{\link{eeg_ica}()}, 29 | \code{\link{eeg_rereference}()}, 30 | \code{\link{eeg_segment}()}, 31 | \code{\link{filt}} 32 | 33 | Other ICA functions: 34 | \code{\link{eeg_ica_cor_tbl}()}, 35 | \code{\link{eeg_ica_show}()}, 36 | \code{\link{eeg_ica_summary_tbl}()}, 37 | \code{\link{eeg_ica_var_tbl}()}, 38 | \code{\link{eeg_ica}()}, 39 | \code{\link{plot_components}()} 40 | } 41 | \concept{ICA functions} 42 | \concept{preprocessing functions} 43 | -------------------------------------------------------------------------------- /man/eeg_ica_show.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ica.R 3 | \name{eeg_ica_show} 4 | \alias{eeg_ica_show} 5 | \title{Add independent components (or sources) to the signal table for visualization.} 6 | \usage{ 7 | eeg_ica_show(.data, ...) 8 | } 9 | \arguments{ 10 | \item{.data}{An eeg_ica_lst object} 11 | 12 | \item{...}{Components to extract from the mixing matrix of the ICA transformation.} 13 | } 14 | \description{ 15 | Add independent components (or sources) to the signal table for visualization. 16 | } 17 | \examples{ 18 | 19 | # For demonstration only, since ICA won't converge 20 | library(ggplot2) 21 | library(dplyr) 22 | # Suppressing an important warning: 23 | suppressWarnings(data_faces_10_trials \%>\% 24 | eeg_ica(-EOGH, -EOGV, -M1, -M2, .method = fast_ICA, .config = list(maxit = 10))) \%>\% 25 | eeg_ica_show(ICA1) \%>\% 26 | plot() 27 | } 28 | \seealso{ 29 | Other ICA functions: 30 | \code{\link{eeg_ica_cor_tbl}()}, 31 | \code{\link{eeg_ica_keep}()}, 32 | \code{\link{eeg_ica_summary_tbl}()}, 33 | \code{\link{eeg_ica_var_tbl}()}, 34 | \code{\link{eeg_ica}()}, 35 | \code{\link{plot_components}()} 36 | } 37 | \concept{ICA functions} 38 | -------------------------------------------------------------------------------- /man/eeg_ica_summary_tbl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/out.R 3 | \name{eeg_ica_summary_tbl} 4 | \alias{eeg_ica_summary_tbl} 5 | \title{Show a table with a summary of the results of the ICA.} 6 | \usage{ 7 | eeg_ica_summary_tbl(.data, ...) 8 | } 9 | \arguments{ 10 | \item{.data}{An \code{eeg_ica_lst} object} 11 | 12 | \item{...}{If left empty, the function will assume that EOG channels include eog/EOG in their names, alternatively, EOG channels can be selected here.} 13 | } 14 | \value{ 15 | A table with the variance explained by each component, and the correlation between EOG channels and each components in each recording. 16 | } 17 | \description{ 18 | This function generates a table with the variance explained by each ICA component, and the correlations 19 | between ICA components and EOG channels. See more details in \link{eeg_ica_cor_tbl} and \link{eeg_ica_var_tbl}. 20 | } 21 | \seealso{ 22 | Other ICA functions: 23 | \code{\link{eeg_ica_cor_tbl}()}, 24 | \code{\link{eeg_ica_keep}()}, 25 | \code{\link{eeg_ica_show}()}, 26 | \code{\link{eeg_ica_var_tbl}()}, 27 | \code{\link{eeg_ica}()}, 28 | \code{\link{plot_components}()} 29 | 30 | Other summary functions: 31 | \code{\link{count_complete_cases_tbl}()}, 32 | \code{\link{eeg_ica_cor_tbl}()}, 33 | \code{\link{eeg_ica_var_tbl}()}, 34 | \code{\link{summaries}}, 35 | \code{\link{summary.eeg_lst}()} 36 | } 37 | \concept{ICA functions} 38 | \concept{summary functions} 39 | -------------------------------------------------------------------------------- /man/eeg_ica_var_tbl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/out.R 3 | \name{eeg_ica_var_tbl} 4 | \alias{eeg_ica_var_tbl} 5 | \title{Show the variance explained for each ICA sources.} 6 | \usage{ 7 | eeg_ica_var_tbl(.data, ..., .max_sample = 1e+05) 8 | } 9 | \arguments{ 10 | \item{.data}{An \code{eeg_ica_lst} object} 11 | 12 | \item{...}{Not in use.} 13 | 14 | \item{.max_sample}{The maximum number of samples to use for calculating the variance explained.} 15 | } 16 | \value{ 17 | A table with the variance explained by each component in each recording. 18 | } 19 | \description{ 20 | This function shows the variance explained by each ICA component following the approach of the matlab function .... 21 | } 22 | \details{ 23 | If the dataset is large, this function can take very long to run. Setting a maximum number of samples (\code{max_sample}) will speed up the calculations by downsampling the data. 24 | } 25 | \seealso{ 26 | Other ICA functions: 27 | \code{\link{eeg_ica_cor_tbl}()}, 28 | \code{\link{eeg_ica_keep}()}, 29 | \code{\link{eeg_ica_show}()}, 30 | \code{\link{eeg_ica_summary_tbl}()}, 31 | \code{\link{eeg_ica}()}, 32 | \code{\link{plot_components}()} 33 | 34 | Other summary functions: 35 | \code{\link{count_complete_cases_tbl}()}, 36 | \code{\link{eeg_ica_cor_tbl}()}, 37 | \code{\link{eeg_ica_summary_tbl}()}, 38 | \code{\link{summaries}}, 39 | \code{\link{summary.eeg_lst}()} 40 | } 41 | \concept{ICA functions} 42 | \concept{summary functions} 43 | -------------------------------------------------------------------------------- /man/eeg_interpolate_tbl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot_helpers.R 3 | \name{eeg_interpolate_tbl} 4 | \alias{eeg_interpolate_tbl} 5 | \alias{eeg_interpolate_tbl.eeg_lst} 6 | \alias{eeg_interpolate_tbl.data.frame} 7 | \title{Create a table with interpolated signals of an eeg_lst object.} 8 | \usage{ 9 | eeg_interpolate_tbl(.data, ...) 10 | 11 | \method{eeg_interpolate_tbl}{eeg_lst}( 12 | .data, 13 | .radius = 1.2, 14 | .diam_points = 100, 15 | .method = "MBA", 16 | ... 17 | ) 18 | 19 | \method{eeg_interpolate_tbl}{data.frame}( 20 | .data, 21 | .radius = 1.2, 22 | .x = .x, 23 | .y = .y, 24 | .value = .value, 25 | .label = .key, 26 | .diam_points = 100, 27 | .method = "MBA", 28 | ... 29 | ) 30 | } 31 | \arguments{ 32 | \item{.data}{An \code{eeg_lst} object or a long table with amplitudes..} 33 | 34 | \item{...}{Various arguments passed to the interpolation method.} 35 | 36 | \item{.radius}{Indicates the radius of the extrapolation, for standard locations of electrodes, \code{1} indicates no extrapolation beyond the position of the electrodes, \code{1.2} is the default} 37 | 38 | \item{.diam_points}{Density of the interpolation (number of points that are interpolated in the diameter of the scalp).} 39 | 40 | \item{.method}{Method of interpolation (\code{"MBA"} Multilevel B-splines using the function \code{mba.surf} of the package \code{MBA} or (\code{"akima"} bicubic spline Akima interpolation algorithm using the function \code{interp} of the package \code{akima}.)..).} 41 | 42 | \item{.x}{Variable storing the x coordinate, generally \code{.x} (default).} 43 | 44 | \item{.y}{Variable storing the y coordinate, generally \code{.y} (default).} 45 | 46 | \item{.value}{Values used for the interpolation, generally \code{.value} (default).} 47 | 48 | \item{.label}{Label of the points that are used for the interpolation, generally \code{.key} (default).} 49 | } 50 | \description{ 51 | Create a default topographic plot based on the segments of the \code{eeg_lst} object. 52 | } 53 | -------------------------------------------------------------------------------- /man/eeg_lst.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/constructors.R 3 | \name{eeg_lst} 4 | \alias{eeg_lst} 5 | \title{Create an eeg_lst} 6 | \usage{ 7 | eeg_lst( 8 | signal_tbl = NULL, 9 | events_tbl = NULL, 10 | segments_tbl = NULL, 11 | channels_tbl = NULL, 12 | .sampling_rate = NULL 13 | ) 14 | } 15 | \arguments{ 16 | \item{signal_tbl}{See \code{\link[=signal_tbl]{signal_tbl()}}.} 17 | 18 | \item{events_tbl}{See \code{\link[=events_tbl]{events_tbl()}}.} 19 | 20 | \item{segments_tbl}{A data table of segment numbers and related information. See \code{\link[=segments_tbl]{segments_tbl()}}.} 21 | 22 | \item{channels_tbl}{Optionally a table with channels information. See \code{\link[=channels_tbl]{channels_tbl()}}.} 23 | 24 | \item{.sampling_rate}{Optional: If the signal_tbl doesn't have samples, they will be included with this sampling rate.} 25 | } 26 | \value{ 27 | A valid eeg_lst. 28 | } 29 | \description{ 30 | Builds an eeg_lst object composed of two \code{data.table::data.table} objects and one \code{tibble::tibble}. All three are linked by a unique identifier \code{.id}. Amplitude values and timestamps appear in the \code{signal} table. Triggers, blinks, artifact rejection markings, and other events logged by the EEG recording software appear in the \code{events} table. Segment information and recording IDs appear in the \code{segments} tibble. 31 | } 32 | \details{ 33 | The \code{signal} table is organized into columns representing timestamps (\code{.sample}) and individual electrodes. Each \code{.sample} corresponds to 1 sample in the original recording, i.e. if the sampling rate of the EEG recording is 500 Hz, then each \code{.sample} corresponds to 2 milliseconds. These timestamps correspond to \code{.initial} in the \code{events} table, which displays only the timestamps where logged events began. 34 | 35 | The \code{events} table is organized into columns representing the \code{.type} of event associated with the trigger listed under \code{.description}. The timestamp marking the beginning and the end of the event is listed under \code{.initial} and \code{.final} (in samples). The \code{.channel} column is a linking variable only, so will generally only contain NAs, unless the event is specific to a certain channel. 36 | 37 | The \code{segments} tibble contains the subject ID under \code{recording}, which is the file name unless otherwise specified. If the data has been segmented in BrainVision, the segment number will be listed under \code{segment}. The data can also be segmented according to trigger labels in \code{eeguana}, see \code{segment}. \code{segment} will be place the segment number under \code{segment}, the trigger name under \code{.type.x}, and the trigger label under \code{.description.x}. Other information such as condition labels or response times can be added by the user by merging into the \code{segments} tibble using non-eeguana merge functions, e.g. the \code{dplyr} join series. 38 | } 39 | \seealso{ 40 | Other eeg_lst: 41 | \code{\link{is_eeg_lst}()} 42 | } 43 | \concept{eeg_lst} 44 | -------------------------------------------------------------------------------- /man/eeg_power_band.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tf.R 3 | \name{eeg_power_band} 4 | \alias{eeg_power_band} 5 | \title{Compute power bands.} 6 | \usage{ 7 | eeg_power_band( 8 | .data, 9 | .bands = list(delta = c(0.5, 4), theta = c(4, 8), alpha = c(8, 13), beta = c(13, 30)), 10 | .relative = FALSE, 11 | ... 12 | ) 13 | } 14 | \arguments{ 15 | \item{.data}{An \code{eeg_lst} or \code{psd_lst}.} 16 | 17 | \item{.bands}{A named list of frequency bands.} 18 | 19 | \item{.relative}{Calculate band power relative to total power.} 20 | 21 | \item{...}{Other arguments passed to \code{eeg_psd()}} 22 | } 23 | \description{ 24 | Compute power bands. 25 | } 26 | \seealso{ 27 | Other frequency-based functions: 28 | \code{\link{eeg_psd}()} 29 | } 30 | \concept{frequency-based functions} 31 | -------------------------------------------------------------------------------- /man/eeg_psd.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tf.R 3 | \name{eeg_psd} 4 | \alias{eeg_psd} 5 | \title{Compute the power spectral density (PSD) of an EEG signal.} 6 | \usage{ 7 | eeg_psd( 8 | .data, 9 | .method = "welch", 10 | .config = list(window = function(x) 2^ceiling(log2(sqrt(NROW(x)))), overlap = 0.5, nfft 11 | = NULL, detrend = c("long-mean", "short-mean", "long-linear", "short-linear", 12 | "none"), range = "half") 13 | ) 14 | } 15 | \arguments{ 16 | \item{.data}{A \code{eeg_lst} object.} 17 | 18 | \item{.method}{"welch" for Welch's method.} 19 | 20 | \item{.config}{See \link[gsignal:pwelch]{gsignal::pwelch}.} 21 | } 22 | \value{ 23 | A \code{psd_lst} object 24 | } 25 | \description{ 26 | Compute the power spectral density (PSD) based on an \code{eeg_lst} object. For now it only uses Welch's method, so essentially it is a wrapper of the \link[gsignal:pwelch]{gsignal::pwelch} function. 27 | } 28 | \examples{ 29 | psd_faces <- eeg_psd(data_faces_ERPs) 30 | psd_faces \%>\% 31 | eeg_select(F3) \%>\% 32 | plot() 33 | } 34 | \seealso{ 35 | Other frequency-based functions: 36 | \code{\link{eeg_power_band}()} 37 | } 38 | \concept{frequency-based functions} 39 | -------------------------------------------------------------------------------- /man/eeg_rereference.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/channel_functions.R 3 | \name{eeg_rereference} 4 | \alias{eeg_rereference} 5 | \title{Re-reference a channel or group of channels.} 6 | \usage{ 7 | eeg_rereference(.data, ..., .ref = NULL, na.rm = FALSE) 8 | } 9 | \arguments{ 10 | \item{.data}{An eeg_lst object.} 11 | 12 | \item{...}{Channels to include. All the channels by default, but eye channels should be removed.} 13 | 14 | \item{.ref}{Channels that will be averaged as the reference. tidyselect compatible.} 15 | 16 | \item{na.rm}{a logical evaluating to \code{TRUE} or \code{FALSE} 17 | indicating whether \code{NA} values should be stripped before the 18 | computation proceeds.} 19 | } 20 | \value{ 21 | An eeg_lst with some channels re-referenced. 22 | } 23 | \description{ 24 | Re-reference a channel or group of channels. 25 | } 26 | \details{ 27 | Notice that this function will also rereference the eye electrodes unless excluded. See examples. 28 | } 29 | \examples{ 30 | # Re-reference all channels using the left mastoid excluding the eye electrodes. 31 | data_faces_ERPs_M1 <- data_faces_ERPs \%>\% 32 | eeg_rereference(-EOGV, -EOGH, .ref = M1) 33 | 34 | # Re-reference using the linked mastoids excluding the eye electrodes. 35 | data_faces_ERPs_M1M2 <- data_faces_ERPs \%>\% 36 | eeg_rereference(-EOGV, -EOGH, .ref = c(M1, M2)) 37 | } 38 | \seealso{ 39 | Other preprocessing functions: 40 | \code{\link{eeg_baseline}()}, 41 | \code{\link{eeg_downsample}()}, 42 | \code{\link{eeg_ica_keep}()}, 43 | \code{\link{eeg_ica}()}, 44 | \code{\link{eeg_segment}()}, 45 | \code{\link{filt}} 46 | } 47 | \concept{preprocessing functions} 48 | -------------------------------------------------------------------------------- /man/eeg_segment.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/segmentation.R 3 | \name{eeg_segment} 4 | \alias{eeg_segment} 5 | \alias{eeg_unsegment} 6 | \title{Segment (and unsegment) an eeg_lst.} 7 | \usage{ 8 | eeg_segment(.data, ..., .lim = c(-0.5, 0.5), .end, .unit = "s") 9 | 10 | eeg_unsegment( 11 | .data, 12 | .start = 1, 13 | .sep = c(.type = "New Segment", .description = ""), 14 | .zero = c(.type = "Time 0", .description = "") 15 | ) 16 | } 17 | \arguments{ 18 | \item{.data}{An \code{eeg_lst} object.} 19 | 20 | \item{...}{Description of the event.} 21 | 22 | \item{.lim}{Vector indicating the time before and after the event. Or dataframe with two columns, with nrow=total number of segments} 23 | 24 | \item{.end}{Description of the event that indicates the end of the segment, if this is used, \code{.lim} is ignored.} 25 | 26 | \item{.unit}{"seconds" (or "s"), "milliseconds" (or "ms"), or samples.} 27 | 28 | \item{.start}{Initial sample when an object is unsegmented} 29 | 30 | \item{.sep}{Segment separation marker. By default: \code{.type == "New Segment"}} 31 | 32 | \item{.zero}{Time zero marker. By default: \code{.type == "Time 0"}} 33 | } 34 | \value{ 35 | An \code{eeg_lst}. 36 | } 37 | \description{ 38 | \itemize{ 39 | \item \code{eeg_segment()} subdivides of the EEG into different segments or epochs. (Fieldtrip calls the segment "trials".) The limits of \code{segment} are inclusive: If, for example, \code{lim = c(0,0)}, the segment would contain only sample 1. 40 | } 41 | } 42 | \details{ 43 | \itemize{ 44 | \item \code{eeg_unsegment()} does \strong{not} reverse the segmentation, it simply concatenates all segments creating one object with only one segment. 45 | } 46 | 47 | When there is no segmentation, the \code{eeg_lst} contain one segment. 48 | } 49 | \examples{ 50 | 51 | # Segments 500ms before and 1000ms after the triggers s70 and s71 52 | data_faces_10_trials \%>\% eeg_segment(.description \%in\% c("s70", "s71"), 53 | .lim = c(-5, 1) 54 | ) 55 | 56 | # Segments 500ms before and after the triggers all the triggers (which start with s) 57 | data_faces_10_trials \%>\% eeg_segment(startsWith(.description, "s")) 58 | } 59 | \seealso{ 60 | Other preprocessing functions: 61 | \code{\link{eeg_baseline}()}, 62 | \code{\link{eeg_downsample}()}, 63 | \code{\link{eeg_ica_keep}()}, 64 | \code{\link{eeg_ica}()}, 65 | \code{\link{eeg_rereference}()}, 66 | \code{\link{filt}} 67 | } 68 | \concept{preprocessing functions} 69 | -------------------------------------------------------------------------------- /man/eeg_slice_signal.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/dplyr_ext.R 3 | \name{eeg_slice_signal} 4 | \alias{eeg_slice_signal} 5 | \alias{slice_signal} 6 | \title{Choose samples by the position} 7 | \usage{ 8 | eeg_slice_signal(.data, ..., .preserve = FALSE) 9 | 10 | slice_signal(.data, ..., .preserve = FALSE) 11 | } 12 | \arguments{ 13 | \item{.data}{An eeg_lst object.} 14 | 15 | \item{...}{Integer row values.} 16 | 17 | \item{.preserve}{Not in use.} 18 | } 19 | \description{ 20 | Choose samples by their ordinal position in the signal table. Grouped eeg_lst object use the ordinal position in the signal table within the group. 21 | } 22 | \seealso{ 23 | Other tidyverse-like functions: 24 | \code{\link{dplyr_verbs}}, 25 | \code{\link{drop_incomplete_segments}()}, 26 | \code{\link{eeg_bind}()} 27 | } 28 | \concept{tidyverse-like functions} 29 | -------------------------------------------------------------------------------- /man/eeguana-package.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/eeguana-package.R 3 | \docType{package} 4 | \name{eeguana-package} 5 | \alias{eeguana} 6 | \alias{eeguana-package} 7 | \title{eeguana: Flexible Manipulation of EEG Data} 8 | \description{ 9 | Flexible manipulation of EEG data in R. It provides a data.table powered framework for manipulating EEG data with dplyr-based functions (e.g., `mutate`, `filter`, `summarize`) extended to a new class, eeg_lst, other EEG-specialized functions, and `ggplot` wrapper functions. The new class is inspired by tidyverse principles but it's not really "tidy" (due to space considerations), it's a list of (i) a wide data table (signal_tbl) that contains the signal amplitudes at every sample point of the EEG, (ii) an events data table with information about markers (or triggers), blinks and other exported information, and (iii) a long table with experimental information, such as participant number (.recording), conditions, etc. eeguana can do only basic pre-processing for now. 10 | } 11 | \seealso{ 12 | Useful links: 13 | \itemize{ 14 | \item \url{https://bruno.nicenboim.me/eeguana} 15 | \item \url{https://github.com/bnicenboim/eeguana} 16 | \item Report bugs at \url{https://github.com/bnicenboim/eeguana/issues} 17 | } 18 | 19 | } 20 | \author{ 21 | \strong{Maintainer}: Bruno Nicenboim \email{bruno.nicenboim@tilburguniversity.edu} 22 | 23 | Other contributors: 24 | \itemize{ 25 | \item Kate Stone \email{kate.stone@uni-potsdam.de} [contributor] 26 | \item Mark Fairbanks \email{mark.t.fairbanks@gmail.com} [contributor] 27 | } 28 | 29 | } 30 | \keyword{internal} 31 | -------------------------------------------------------------------------------- /man/events_tbl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tbl.R 3 | \name{events_tbl} 4 | \alias{events_tbl} 5 | \alias{events_tbl<-} 6 | \title{Functions to get or set the events table of an eeg_lst object.} 7 | \usage{ 8 | events_tbl(.data, ...) 9 | 10 | events_tbl(.data) <- value 11 | } 12 | \arguments{ 13 | \item{.data}{An eeg_lst object.} 14 | 15 | \item{...}{Not in use.} 16 | 17 | \item{value}{An events table.} 18 | } 19 | \value{ 20 | A table. 21 | } 22 | \description{ 23 | Functions to get or set the events table of an eeg_lst object. 24 | } 25 | \seealso{ 26 | Other functions to expose internal parts of eeg_(ica_)_lst: 27 | \code{\link{channels_tbl}()}, 28 | \code{\link{ica_matrix_lst}()}, 29 | \code{\link{segments_tbl}()}, 30 | \code{\link{signal_tbl}()} 31 | } 32 | \concept{functions to expose internal parts of eeg_(ica_)_lst} 33 | -------------------------------------------------------------------------------- /man/fICA.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ica_funs.R 3 | \name{fICA} 4 | \alias{fICA} 5 | \alias{adapt_fast_ICA} 6 | \alias{fast_ICA2} 7 | \title{Wrapper for FastICA methods for Independent Component Analysis from fICA package} 8 | \usage{ 9 | adapt_fast_ICA( 10 | X, 11 | gs = fICA::gf, 12 | dgs = fICA::dgf, 13 | kj = 0, 14 | eps = 1e-06, 15 | maxiter = 1000 16 | ) 17 | 18 | fast_ICA2( 19 | X, 20 | g = "tanh", 21 | dg = NULL, 22 | G = NULL, 23 | init = NULL, 24 | n.init = 1, 25 | method = "def", 26 | eps = 1e-06, 27 | maxiter = 1000 28 | ) 29 | } 30 | \arguments{ 31 | \item{X}{A matrix of data frame.} 32 | 33 | \item{gs}{a list of functions containing the nonlinearities.} 34 | 35 | \item{dgs}{a list of functions containing the first derivatives of the nonlinearities.} 36 | 37 | \item{kj}{defines the initial estimate of the unmixing matrix, see details.} 38 | 39 | \item{eps}{convergence tolerance.} 40 | 41 | \item{maxiter}{maximum number of iterations.} 42 | 43 | \item{g}{the nonlinearity, tanh by default, see details.} 44 | 45 | \item{dg}{the first derivative of the nonlinearity, see details.} 46 | 47 | \item{G}{the integral function of the nonlinearity, see details.} 48 | 49 | \item{init}{a numeric matrix for the initial value of the algorithm} 50 | 51 | \item{n.init}{a positive integer for the number of initial values in symmetric algorithms, see details.} 52 | 53 | \item{method}{squared symmetric (\code{"sym2"}), symmetric (\code{"sym"}) or deflation-based (\code{"def"})} 54 | } 55 | \value{ 56 | A list with the unmixing matrix W and the mixing matrix A. 57 | } 58 | \description{ 59 | \code{adapt_fast_ICA()} and \code{fast_ICA2()} are wrappers for \link[fICA:adapt_fICA]{fICA::adapt_fICA} and \link[fICA:fICA]{fICA::fICA} that only run in C, and return a transposed 60 | version 61 | of the original estimated unmixing matrix in W, and the mixing matrix A, 62 | consistent with the formulation \code{X= S \%*\% A}, where X is the matrix of data with 63 | N_samples by N_channels, and S is a matrix of sources with N_samples by N_sources. 64 | They are meant to be used with \code{\link[=eeg_ica]{eeg_ica()}}. In order to save memory, these wrappers do not 65 | return the estimated 66 | source components. 67 | } 68 | \seealso{ 69 | Other ica methods: 70 | \code{\link{fast_ICA}()}, 71 | \code{\link{ica_matrix_lst}()} 72 | } 73 | \concept{ica methods} 74 | -------------------------------------------------------------------------------- /man/fast_ICA.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/ica_funs.R 3 | \name{fast_ICA} 4 | \alias{fast_ICA} 5 | \title{Wrapper for FastICA method for Independent Component Analysis from fastICA package} 6 | \usage{ 7 | fast_ICA( 8 | X, 9 | n.comp = NULL, 10 | alg.typ = "parallel", 11 | fun = "logcosh", 12 | alpha = 1, 13 | method = "C", 14 | row.norm = FALSE, 15 | maxit = 1000, 16 | tol = 1e-06, 17 | w.init = NULL 18 | ) 19 | } 20 | \arguments{ 21 | \item{X}{A matrix or data frame.} 22 | 23 | \item{n.comp}{number of components to be extracted} 24 | 25 | \item{alg.typ}{if \code{alg.typ == "parallel"} the components are extracted 26 | simultaneously (the default). if \code{alg.typ == "deflation"} the 27 | components are extracted one at a time.} 28 | 29 | \item{fun}{the functional form of the \eqn{G} function used in the 30 | approximation to neg-entropy (see \sQuote{details}).} 31 | 32 | \item{alpha}{constant in range [1, 2] used in approximation to 33 | neg-entropy when \code{fun == "logcosh"}} 34 | 35 | \item{method}{if \code{method == "R"} then computations are done 36 | exclusively in \R (default). The code allows the interested \R user to 37 | see exactly what the algorithm does. 38 | if \code{method == "C"} then C code is used to perform most of the 39 | computations, which makes the algorithm run faster. During 40 | compilation the C code is linked to an optimized BLAS library if 41 | present, otherwise stand-alone BLAS routines are compiled.} 42 | 43 | \item{row.norm}{a logical value indicating whether rows of the data 44 | matrix \code{X} should be standardized beforehand.} 45 | 46 | \item{maxit}{maximum number of iterations to perform.} 47 | 48 | \item{tol}{a positive scalar giving the tolerance at which the 49 | un-mixing matrix is considered to have converged.} 50 | 51 | \item{w.init}{Initial un-mixing matrix of dimension 52 | \code{c(n.comp, n.comp)}. If \code{NULL} (default) then a matrix of 53 | normal r.v.'s is used.} 54 | } 55 | \value{ 56 | A list with the unmixing matrix W and the mixing matrix A. 57 | } 58 | \description{ 59 | \code{fast_ICA()} is a wrapper for \link[fastICA:fastICA]{fastICA::fastICA}, with different defaults (runs in C, maximum iteration = 1000, tolerance = 1e-04, verbose), and that throws a warning in case of non-convergence. It returns an estimated unmixing matrix W (equivalent to the original \code{K \%*\% W}), and the mixing matrix A, consistent with the formulation \code{X= S \%*\% A}, and \code{X \%*\% W = S} where X is the matrix of data with N_samples by N_channels, and S is a matrix of sources with N_samples by N_sources. They are meant to be used with \code{\link[=eeg_ica]{eeg_ica()}}. 60 | } 61 | \seealso{ 62 | Other ica methods: 63 | \code{\link{fICA}}, 64 | \code{\link{ica_matrix_lst}()} 65 | } 66 | \concept{ica methods} 67 | -------------------------------------------------------------------------------- /man/figures/README-plot-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/man/figures/README-plot-1.png -------------------------------------------------------------------------------- /man/figures/README-topo-1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/man/figures/README-topo-1.png -------------------------------------------------------------------------------- /man/ggplot.eeg_lst.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot.R 3 | \name{ggplot.eeg_lst} 4 | \alias{ggplot.eeg_lst} 5 | \title{Create an ERP plot} 6 | \usage{ 7 | \method{ggplot}{eeg_lst}(data = NULL, mapping = ggplot2::aes(), ..., .max_sample = 64000) 8 | } 9 | \arguments{ 10 | \item{data}{An \code{eeg_lst} object.} 11 | 12 | \item{mapping}{Default list of aesthetic mappings to use for plot. 13 | If not specified, must be supplied in each layer added to the plot.} 14 | 15 | \item{...}{Other arguments passed on to methods. Not currently used.} 16 | 17 | \item{.max_sample}{Downsample to approximately 6400 samples by default.} 18 | } 19 | \value{ 20 | A ggplot object 21 | } 22 | \description{ 23 | \code{ggplot} initializes a ggplot object which takes an \code{eeg_lst} object as 24 | its input data. Layers can then be added in the same way as for a 25 | \link[ggplot2:ggplot]{ggplot2::ggplot} object. 26 | } 27 | \details{ 28 | If necessary, t will first downsample the \code{eeg_lst} object so that there is a 29 | maximum of 6400 samples. The \code{eeg_lst} object is then converted to a long-format 30 | tibble via \link{as_tibble}. In this tibble, the \code{.key} variable is the 31 | channel/component name and \code{.value} its respective amplitude. The sample 32 | number (\code{.sample} in the \code{eeg_lst} object) is automatically converted to milliseconds 33 | to create the variable \code{.time}. By default, time is plotted on the 34 | x-axis and amplitude on the y-axis. 35 | 36 | To add additional components to the plot such as titles and annotations, simply 37 | use the \code{+} symbol and add layers exactly as you would for \link[ggplot2:ggplot]{ggplot2::ggplot}. 38 | } 39 | \examples{ 40 | library(ggplot2) 41 | library(dplyr) 42 | # Plot grand averages for selected channels 43 | data_faces_ERPs \%>\% 44 | # select the desired electrodes 45 | select(O1, O2, P7, P8) \%>\% 46 | ggplot(aes(x = .time, y = .key)) + 47 | # add a grand average wave 48 | stat_summary( 49 | fun.y = "mean", geom = "line", alpha = 1, linewidth = 1.5, 50 | aes(color = condition) 51 | ) + 52 | # facet by channel 53 | facet_wrap(~.key) + 54 | theme(legend.position = "bottom") 55 | 56 | } 57 | \seealso{ 58 | Other plotting functions: 59 | \code{\link{annotate_electrodes}()}, 60 | \code{\link{annotate_events}()}, 61 | \code{\link{annotate_head}()}, 62 | \code{\link{eeg_downsample}()}, 63 | \code{\link{plot.eeg_lst}()}, 64 | \code{\link{plot_components}()}, 65 | \code{\link{plot_in_layout}()}, 66 | \code{\link{plot_topo}()}, 67 | \code{\link{theme_eeguana}()} 68 | } 69 | \concept{plotting functions} 70 | -------------------------------------------------------------------------------- /man/ica_matrix_lst.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tbl.R 3 | \name{ica_matrix_lst} 4 | \alias{ica_matrix_lst} 5 | \title{Function to get the list of mixing and unmixing matrices of an eeg_ica_lst object.} 6 | \usage{ 7 | ica_matrix_lst(.data, ...) 8 | } 9 | \arguments{ 10 | \item{.data}{An eeg_ica_lst object.} 11 | 12 | \item{...}{Not in use.} 13 | } 14 | \value{ 15 | A list. 16 | } 17 | \description{ 18 | Function to get the list of mixing and unmixing matrices of an eeg_ica_lst object. 19 | } 20 | \seealso{ 21 | Other functions to expose internal parts of eeg_(ica_)_lst: 22 | \code{\link{channels_tbl}()}, 23 | \code{\link{events_tbl}()}, 24 | \code{\link{segments_tbl}()}, 25 | \code{\link{signal_tbl}()} 26 | 27 | Other ica methods: 28 | \code{\link{fICA}}, 29 | \code{\link{fast_ICA}()} 30 | } 31 | \concept{functions to expose internal parts of eeg_(ica_)_lst} 32 | \concept{ica methods} 33 | -------------------------------------------------------------------------------- /man/install_py_eeguana.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tools.R 3 | \name{install_py_eeguana} 4 | \alias{install_py_eeguana} 5 | \title{Install the Python packages needed for \code{eeguana}} 6 | \usage{ 7 | install_py_eeguana( 8 | conda = "auto", 9 | envname = "r-eeguana", 10 | restart_session = TRUE, 11 | forge = TRUE, 12 | ..., 13 | new_env = identical(envname, "r-eeguana"), 14 | python_version = NULL 15 | ) 16 | } 17 | \arguments{ 18 | \item{conda}{The path to a \code{conda} executable. Use \code{"auto"} to allow 19 | \code{reticulate} to automatically find an appropriate \code{conda} binary. 20 | See \strong{Finding Conda} and \code{\link[reticulate:conda_binary]{conda_binary()}} for more details.} 21 | 22 | \item{envname}{The name of the virtual environment to create or use. Default is 'r-eeguana'.} 23 | 24 | \item{restart_session}{Whether to restart the R session after installation. Default is TRUE.} 25 | 26 | \item{forge}{Whether to use conda-forge to install packages. Default is TRUE.} 27 | 28 | \item{...}{Additional arguments passed to \code{reticulate::py_install}.} 29 | 30 | \item{new_env}{Whether to create a new environment if \code{envname} is 'r-eeguana'. Default behavior is determined by the identity of \code{envname}.} 31 | 32 | \item{python_version}{The requested Python version. Ignored when attempting 33 | to install with a Python virtual environment.} 34 | } 35 | \value{ 36 | Returns \code{NULL} invisibly and prints a message upon successful installation. If \code{restart_session} is TRUE and the R session is running within RStudio, the session will restart automatically. 37 | } 38 | \description{ 39 | \code{install_py_eeguana} facilitates the installation of Python packages required by \code{eeguana} within an R environment. 40 | It leverages the \code{reticulate} package to manage Python environments and supports various installation methods, 41 | environment configurations, and Python versions. 42 | } 43 | \details{ 44 | The function selects an appropriate method for environment management and Python installation, focusing on ease of use and flexibility. 45 | It supports creating new virtual or conda environments, installing necessary packages, and handling Python version requirements. 46 | 47 | The function is designed to be robust, handling various scenarios such as existing environments, and provides detailed feedback during the process. 48 | } 49 | -------------------------------------------------------------------------------- /man/is_channel_dbl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/constructors.R 3 | \name{is_channel_dbl} 4 | \alias{is_channel_dbl} 5 | \title{Test if the object is a channel or EOG channel} 6 | \usage{ 7 | is_channel_dbl(x) 8 | } 9 | \arguments{ 10 | \item{x}{An object.} 11 | } 12 | \value{ 13 | \code{TRUE} if the object inherits from the \code{channel_dbl} class. 14 | } 15 | \description{ 16 | \itemize{ 17 | \item \code{is_channel_dbl()} returns TRUE for all channels including EOG channels. 18 | \item \code{is_eog_channel_dbl()} returns TRUE only for EOG channels. 19 | } 20 | } 21 | \seealso{ 22 | Other channel: 23 | \code{\link{as_channel_dbl}()}, 24 | \code{\link{channel_dbl}()} 25 | } 26 | \concept{channel} 27 | -------------------------------------------------------------------------------- /man/is_component_dbl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/constructors.R 3 | \name{is_component_dbl} 4 | \alias{is_component_dbl} 5 | \title{Test if the object is a component 6 | This function returns TRUE for components.} 7 | \usage{ 8 | is_component_dbl(x) 9 | } 10 | \arguments{ 11 | \item{x}{An object.} 12 | } 13 | \value{ 14 | \code{TRUE} if the object inherits from the \code{sample_id} class. 15 | } 16 | \description{ 17 | Test if the object is a component 18 | This function returns TRUE for components. 19 | } 20 | \seealso{ 21 | Other component: 22 | \code{\link{component_dbl}()} 23 | } 24 | \concept{component} 25 | -------------------------------------------------------------------------------- /man/is_eeg_lst.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/constructors.R 3 | \name{is_eeg_lst} 4 | \alias{is_eeg_lst} 5 | \title{Test if the object is an eeg_lst.} 6 | \usage{ 7 | is_eeg_lst(x) 8 | } 9 | \arguments{ 10 | \item{x}{An object.} 11 | } 12 | \value{ 13 | \code{TRUE} if the object inherits from the \code{eeg_lst} class. 14 | } 15 | \description{ 16 | This function returns TRUE for eeg_lsts. 17 | } 18 | \seealso{ 19 | Other eeg_lst: 20 | \code{\link{eeg_lst}()} 21 | } 22 | \concept{eeg_lst} 23 | -------------------------------------------------------------------------------- /man/is_events_tbl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/events_tbl.R 3 | \name{is_events_tbl} 4 | \alias{is_events_tbl} 5 | \title{Test if the object is an events_tbl 6 | This function returns TRUE for events_tbl.} 7 | \usage{ 8 | is_events_tbl(x) 9 | } 10 | \arguments{ 11 | \item{x}{An object.} 12 | } 13 | \value{ 14 | \code{TRUE} if the object inherits from the \code{events_tbl} class. 15 | } 16 | \description{ 17 | Test if the object is an events_tbl 18 | This function returns TRUE for events_tbl. 19 | } 20 | \concept{events_tbl} 21 | -------------------------------------------------------------------------------- /man/is_psd_lst.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/constructors.R 3 | \name{is_psd_lst} 4 | \alias{is_psd_lst} 5 | \title{Test if the object is a psd_lst.} 6 | \usage{ 7 | is_psd_lst(x) 8 | } 9 | \arguments{ 10 | \item{x}{An object.} 11 | } 12 | \value{ 13 | \code{TRUE} if the object inherits from the \code{psd_lst} class. 14 | } 15 | \description{ 16 | This function returns TRUE for psd_lsts. 17 | } 18 | \seealso{ 19 | Other psd_lst: 20 | \code{\link{psd_lst}()} 21 | } 22 | \concept{psd_lst} 23 | -------------------------------------------------------------------------------- /man/is_psd_tbl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/psd.R 3 | \name{is_psd_tbl} 4 | \alias{is_psd_tbl} 5 | \title{Test if the object is a psd_tbl} 6 | \usage{ 7 | is_psd_tbl(x) 8 | } 9 | \arguments{ 10 | \item{x}{An object.} 11 | } 12 | \value{ 13 | \code{TRUE} if the object inherits from the \code{psd_tbl} class. 14 | } 15 | \description{ 16 | This function returns TRUE for psds. 17 | } 18 | \concept{psd_tbl} 19 | -------------------------------------------------------------------------------- /man/is_sample_int.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/constructors.R 3 | \name{is_sample_int} 4 | \alias{is_sample_int} 5 | \title{Test if the object is a sample 6 | This function returns TRUE for samples.} 7 | \usage{ 8 | is_sample_int(x) 9 | } 10 | \arguments{ 11 | \item{x}{An object.} 12 | } 13 | \value{ 14 | \code{TRUE} if the object inherits from the \code{sample} class. 15 | } 16 | \description{ 17 | Test if the object is a sample 18 | This function returns TRUE for samples. 19 | } 20 | \seealso{ 21 | Other sample_int: 22 | \code{\link{sample_int}()} 23 | } 24 | \concept{sample_int} 25 | -------------------------------------------------------------------------------- /man/is_signal_tbl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/signal_tbl.R 3 | \name{is_signal_tbl} 4 | \alias{is_signal_tbl} 5 | \title{Test if the object is a signal_tbl} 6 | \usage{ 7 | is_signal_tbl(x) 8 | } 9 | \arguments{ 10 | \item{x}{An object.} 11 | } 12 | \value{ 13 | \code{TRUE} if the object inherits from the \code{signal_tbl} class. 14 | } 15 | \description{ 16 | This function returns TRUE for signals. 17 | } 18 | \concept{signal_tbl} 19 | -------------------------------------------------------------------------------- /man/layout_32_1020.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/data.R 3 | \docType{data} 4 | \name{layout_32_1020} 5 | \alias{layout_32_1020} 6 | \title{Layout for a 32 electrodes cap at the standard 10-20 system} 7 | \format{ 8 | An table with channel names and locations 9 | } 10 | \usage{ 11 | data(layout_32_1020) 12 | } 13 | \description{ 14 | A dataset containing coordinates of a 32 electrodes mounted in an elastic cap at the standard 10-20 system (Jasper, 1958) 15 | } 16 | \seealso{ 17 | Other topographic plots and layouts: 18 | \code{\link{plot_components}()}, 19 | \code{\link{plot_in_layout}()}, 20 | \code{\link{plot_topo}()} 21 | } 22 | \concept{topographic plots and layouts} 23 | \keyword{datasets} 24 | -------------------------------------------------------------------------------- /man/na_omit.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/write.R 3 | \name{na_omit} 4 | \alias{na_omit} 5 | \title{Handle Missing Values in eeg_lst objects} 6 | \usage{ 7 | na_omit(object, ...) 8 | } 9 | \arguments{ 10 | \item{object}{an \code{eeg_lst}.} 11 | 12 | \item{...}{further arguments special methods could require.} 13 | } 14 | \description{ 15 | Remove all NAs from an \code{eeg_lst} signal table. 16 | } 17 | -------------------------------------------------------------------------------- /man/pipe.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/exported_utils.R 3 | \name{\%>\%} 4 | \alias{\%>\%} 5 | \title{Pipe operator} 6 | \usage{ 7 | lhs \%>\% rhs 8 | } 9 | \description{ 10 | See \code{magrittr::\link[magrittr]{\%>\%}} for details. 11 | } 12 | \keyword{internal} 13 | -------------------------------------------------------------------------------- /man/plot.eeg_lst.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot.R 3 | \name{plot.eeg_lst} 4 | \alias{plot.eeg_lst} 5 | \alias{plot.psd_lst} 6 | \title{Create a basic signal plot} 7 | \usage{ 8 | \method{plot}{eeg_lst}(x, .max_sample = 6400, ...) 9 | 10 | \method{plot}{psd_lst}(x, ...) 11 | } 12 | \arguments{ 13 | \item{x}{An \code{eeg_lst} object.} 14 | 15 | \item{.max_sample}{Downsample to approximately 6400 samples by default.} 16 | 17 | \item{...}{Not in use.} 18 | } 19 | \value{ 20 | A ggplot object 21 | } 22 | \description{ 23 | \code{plot} creates a ggplot object in which the EEG signal over the whole 24 | recording is plotted by electrode. Useful as a quick visual check for major 25 | noise issues in the recording. 26 | } 27 | \details{ 28 | Note that for normal-size datasets, the plot may take some time to compile. 29 | If necessary, \code{plot} will first downsample the \code{eeg_lst} object so that there is a 30 | maximum of 6,400 samples. The \code{eeg_lst} object is then converted to a long-format 31 | tibble via \code{as_tibble}. In this tibble, the \code{.key} variable is the 32 | channel/component name and \code{.value} its respective amplitude. The sample 33 | number (\code{.sample} in the \code{eeg_lst} object) is automatically converted to seconds 34 | to create the variable \code{time}. By default, time is then plotted on the 35 | x-axis and amplitude on the y-axis, and uses \code{scales = "free"}; see \code{\link[ggplot2:facet_grid]{ggplot2::facet_grid()}}. 36 | 37 | To add additional components to the plot such as titles and annotations, simply 38 | use the \code{+} symbol and add layers exactly as you would for \link[ggplot2:ggplot]{ggplot2::ggplot}. 39 | } 40 | \examples{ 41 | # Basic plot 42 | plot(data_faces_ERPs) 43 | 44 | # Add ggplot layers 45 | library(ggplot2) 46 | plot(data_faces_ERPs) + 47 | coord_cartesian(ylim = c(-500, 500)) 48 | } 49 | \seealso{ 50 | Other plotting functions: 51 | \code{\link{annotate_electrodes}()}, 52 | \code{\link{annotate_events}()}, 53 | \code{\link{annotate_head}()}, 54 | \code{\link{eeg_downsample}()}, 55 | \code{\link{ggplot.eeg_lst}()}, 56 | \code{\link{plot_components}()}, 57 | \code{\link{plot_in_layout}()}, 58 | \code{\link{plot_topo}()}, 59 | \code{\link{theme_eeguana}()} 60 | } 61 | \concept{plotting functions} 62 | -------------------------------------------------------------------------------- /man/plot_components.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot.R 3 | \name{plot_components} 4 | \alias{plot_components} 5 | \title{Generates topographic plots of the components after running ICA on an eeg_lst} 6 | \usage{ 7 | plot_components(data, ..., .projection = "polar", .standardize = TRUE) 8 | } 9 | \arguments{ 10 | \item{data}{An eeg_ica_lst} 11 | 12 | \item{...}{arguments passed to interpolate.} 13 | 14 | \item{.projection}{.Projection type for converting the 3D coordinates of the electrodes into 2d coordinates. .Projection types available: "polar" (default), "orthographic", or "stereographic"} 15 | 16 | \item{.standardize}{Whether to standardize the color scale of each topographic plot.} 17 | } 18 | \description{ 19 | Note that unlike \link{plot_topo}, there is no need for faceting, or adding layers. 20 | } 21 | \examples{ 22 | # For demonstration only, since ICA won't converge 23 | library(ggplot2) 24 | # Suppressing an important warning: 25 | suppressWarnings(data_faces_10_trials \%>\% 26 | eeg_ica(-EOGH, -EOGV, -M1, -M2, .method = fast_ICA, .config = list(maxit = 10))) \%>\% 27 | eeg_ica_keep(ICA1, ICA2) \%>\% 28 | plot_components() + 29 | annotate_head() + 30 | geom_contour() + 31 | annotate_electrodes(color = "black") + 32 | theme(legend.position = "none") 33 | } 34 | \seealso{ 35 | Other plotting functions: 36 | \code{\link{annotate_electrodes}()}, 37 | \code{\link{annotate_events}()}, 38 | \code{\link{annotate_head}()}, 39 | \code{\link{eeg_downsample}()}, 40 | \code{\link{ggplot.eeg_lst}()}, 41 | \code{\link{plot.eeg_lst}()}, 42 | \code{\link{plot_in_layout}()}, 43 | \code{\link{plot_topo}()}, 44 | \code{\link{theme_eeguana}()} 45 | 46 | Other ICA functions: 47 | \code{\link{eeg_ica_cor_tbl}()}, 48 | \code{\link{eeg_ica_keep}()}, 49 | \code{\link{eeg_ica_show}()}, 50 | \code{\link{eeg_ica_summary_tbl}()}, 51 | \code{\link{eeg_ica_var_tbl}()}, 52 | \code{\link{eeg_ica}()} 53 | 54 | Other topographic plots and layouts: 55 | \code{\link{layout_32_1020}}, 56 | \code{\link{plot_in_layout}()}, 57 | \code{\link{plot_topo}()} 58 | } 59 | \concept{ICA functions} 60 | \concept{plotting functions} 61 | \concept{topographic plots and layouts} 62 | -------------------------------------------------------------------------------- /man/plot_in_layout.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot.R 3 | \name{plot_in_layout} 4 | \alias{plot_in_layout} 5 | \alias{plot_in_layout.gg} 6 | \title{Arrange ERP plots according to scalp layout} 7 | \usage{ 8 | plot_in_layout(plot, ...) 9 | 10 | \method{plot_in_layout}{gg}(plot, .projection = "polar", .ratio = c(1, 1), ...) 11 | } 12 | \arguments{ 13 | \item{plot}{A ggplot object with channels} 14 | 15 | \item{...}{Not in use.} 16 | 17 | \item{.projection}{.Projection type for converting the 3D coordinates of the electrodes into 2d coordinates. .Projection types available: "polar" (default), "orthographic", or "stereographic"} 18 | 19 | \item{.ratio}{Ratio of the individual panels} 20 | } 21 | \value{ 22 | A ggplot object 23 | } 24 | \description{ 25 | Arranges a ggplot so that the facet for each channel appears in its position 26 | on the scalp. 27 | } 28 | \details{ 29 | This function requires two steps: first, a ggplot object must be created with 30 | ERPs faceted by channel (\code{.key}). 31 | Then, the ggplot object is called in \code{plot_in_layout}. The function uses grobs 32 | arranged according to .x .y coordinates extracted from the \code{eeg_lst} object, by 33 | default in polar arrangement. The arrangement can be changed with the \code{ .projection} 34 | argument. White space in the plot can be reduced by changing \code{ratio}. 35 | 36 | Additional components such as titles and annotations should be added to the 37 | plot object using \code{+} exactly as you would for \link[ggplot2:ggplot]{ggplot2::ggplot}. 38 | Title and legend adjustments will be treated as applying to the 39 | whole plot object, while other theme adjustments will be treated as applying 40 | to individual facets. x-axis and y-axis labels cannot be added at this stage. 41 | } 42 | \examples{ 43 | library(ggplot2) 44 | # Create a ggplot object with some grand averaged ERPs 45 | ERP_plot <- data_faces_ERPs \%>\% 46 | # select a few electrodes 47 | eeg_select(Fz, FC1, FC2, C3, Cz, C4, CP1, CP2, Pz) \%>\% 48 | # group by time point and condition 49 | eeg_group_by(.sample, condition) \%>\% 50 | # compute averages 51 | eeg_summarize(across_ch(mean, na.rm = TRUE)) \%>\% 52 | ggplot(aes(x = .time, y = .value)) + 53 | # plot the averaged waveforms 54 | geom_line(aes(color = condition)) + 55 | # facet by channel 56 | facet_wrap(~.key) + 57 | # add a legend and title 58 | theme(legend.position = "bottom") + 59 | ggtitle("ERPs for faces vs non-faces") 60 | 61 | # Call the ggplot object with the layout function 62 | plot_in_layout(ERP_plot) 63 | } 64 | \seealso{ 65 | Other plotting functions: 66 | \code{\link{annotate_electrodes}()}, 67 | \code{\link{annotate_events}()}, 68 | \code{\link{annotate_head}()}, 69 | \code{\link{eeg_downsample}()}, 70 | \code{\link{ggplot.eeg_lst}()}, 71 | \code{\link{plot.eeg_lst}()}, 72 | \code{\link{plot_components}()}, 73 | \code{\link{plot_topo}()}, 74 | \code{\link{theme_eeguana}()} 75 | 76 | Other topographic plots and layouts: 77 | \code{\link{layout_32_1020}}, 78 | \code{\link{plot_components}()}, 79 | \code{\link{plot_topo}()} 80 | } 81 | \concept{plotting functions} 82 | \concept{topographic plots and layouts} 83 | -------------------------------------------------------------------------------- /man/psd_lst.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/constructors.R 3 | \name{psd_lst} 4 | \alias{psd_lst} 5 | \title{Creates a \code{psd_lst}.} 6 | \usage{ 7 | psd_lst(psd_tbl = NULL, segments_tbl = NULL, channels_tbl = NULL) 8 | } 9 | \arguments{ 10 | \item{psd_tbl}{A psd_lst.} 11 | 12 | \item{segments_tbl}{A data table of segment numbers and related information. See \code{\link[=segments_tbl]{segments_tbl()}}.} 13 | 14 | \item{channels_tbl}{Optionally a table with channels information. See \code{\link[=channels_tbl]{channels_tbl()}}.} 15 | } 16 | \value{ 17 | A valid psd_lst. 18 | } 19 | \description{ 20 | Creates a \code{psd_lst}. 21 | } 22 | \seealso{ 23 | Other psd_lst: 24 | \code{\link{is_psd_lst}()} 25 | } 26 | \concept{psd_lst} 27 | -------------------------------------------------------------------------------- /man/read_edf.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/read.R 3 | \name{read_edf} 4 | \alias{read_edf} 5 | \title{Read an edf/edf+/bdf file into R} 6 | \usage{ 7 | read_edf(file, .recording = file) 8 | } 9 | \arguments{ 10 | \item{file}{A edf/bdf file} 11 | 12 | \item{.recording}{Recording name (file name, by default). If set to NULL or NA, the patient name will be used.} 13 | } 14 | \value{ 15 | An \code{eeg_lst} object. 16 | } 17 | \description{ 18 | Creates an eeg_lst object from edf, edf+, and bdf file export formats. 19 | } 20 | \details{ 21 | When trigger information is stored in a "Status" or "Trigger" channel, the trigger 22 | value is stored only when the value of the channel increases. This follows the 23 | default behavior of \href{https://mne.tools/0.18/generated/mne.find_events.html?highlight=find_events#mne.find_events}{find_events in MNE 0.18}. 24 | If you have a case where this assumption is incorrect, please open an issue in \url{https://github.com/bnicenboim/eeguana/issues}. 25 | } 26 | \examples{ 27 | \dontrun{ 28 | s1 <- read_edf("./faces.edf", .recording = 1) 29 | } 30 | 31 | } 32 | \seealso{ 33 | Other reading and writing functions: 34 | \code{\link{read_fif}()}, 35 | \code{\link{read_ft}()}, 36 | \code{\link{read_set}()}, 37 | \code{\link{read_vhdr}()} 38 | } 39 | \concept{reading and writing functions} 40 | -------------------------------------------------------------------------------- /man/read_fif.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/read.R 3 | \name{read_fif} 4 | \alias{read_fif} 5 | \title{Read a FIF file into R} 6 | \usage{ 7 | read_fif(file, .recording = file) 8 | } 9 | \arguments{ 10 | \item{file}{A .fif file containing EEG/MEG data.} 11 | 12 | \item{.recording}{Recording name, by default is the file name. This parameter is currently not used in the function but reserved for future use or metadata purposes.} 13 | } 14 | \value{ 15 | An \code{eeg_lst} object with signal_tbl and event information from a .fif file. 16 | } 17 | \description{ 18 | Creates an eeg_lst object from EEG/MEG data in FIF format. The function reads a .fif file using the \code{mne} Python package via \code{reticulate}. 19 | If you do not already have \code{mne} installed in your Python environment, ensure to install it prior to using this function using \link{install_py_eeguana}. 20 | The .fif file is a standard format used by MNE and other neurophysiological data analysis software. 21 | } 22 | \examples{ 23 | \dontrun{ 24 | eeg_data <- read_fiff("./subject1_raw.fif") 25 | } 26 | 27 | } 28 | \seealso{ 29 | Other reading and writing functions: 30 | \code{\link{read_edf}()}, 31 | \code{\link{read_ft}()}, 32 | \code{\link{read_set}()}, 33 | \code{\link{read_vhdr}()} 34 | } 35 | \concept{reading and writing functions} 36 | -------------------------------------------------------------------------------- /man/read_ft.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/read.R 3 | \name{read_ft} 4 | \alias{read_ft} 5 | \title{Read a Fieldtrip file into R} 6 | \usage{ 7 | read_ft(file, .layout = NULL, .recording = file) 8 | } 9 | \arguments{ 10 | \item{file}{A .mat file containing a fieldtrip struct.} 11 | 12 | \item{.layout}{A .mat \href{http://www.fieldtriptoolbox.org/template/layout}{layout from Fieldtrip}} 13 | 14 | \item{.recording}{Recording name, by default is the file name.} 15 | } 16 | \value{ 17 | An \code{eeg_lst} object with signal_tbl and event from a Matlab file. 18 | } 19 | \description{ 20 | Creates an eeg_lst object from Matlab exported files.The function reads a .mat 21 | file using \code{R.matlab}. If you do not already have 22 | \code{R.matlab} installed in R, you will need to install it yourself. The .mat file 23 | should have the structure described in 24 | this \href{http://www.fieldtriptoolbox.org/reference/ft_datatype_raw}{Fieldtrip reference article}. 25 | } 26 | \examples{ 27 | \dontrun{ 28 | s1 <- read_ft("./subject1.mat", layout = "easycapM25.mat", .recording = 1) 29 | } 30 | 31 | } 32 | \seealso{ 33 | Other reading and writing functions: 34 | \code{\link{read_edf}()}, 35 | \code{\link{read_fif}()}, 36 | \code{\link{read_set}()}, 37 | \code{\link{read_vhdr}()} 38 | } 39 | \concept{reading and writing functions} 40 | -------------------------------------------------------------------------------- /man/read_set.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/read.R 3 | \name{read_set} 4 | \alias{read_set} 5 | \title{Read EEGlab set files (Matlab files) into R} 6 | \usage{ 7 | read_set(file, .recording = file) 8 | } 9 | \arguments{ 10 | \item{file}{A .mat or .set file containing a fieldtrip struct.} 11 | 12 | \item{.recording}{Recording name, by default is the file name.} 13 | } 14 | \value{ 15 | An \code{eeg_lst} object with signal_tbl and event from a Matlab file. 16 | } 17 | \description{ 18 | Creates an eeg_lst object from Matlab exported files. The function reads a .mat or .set file using \code{R.matlab}. If you do not already have \code{R.matlab} installed in R, you will need to install it yourself. The file should have the structure described in this \href{https://sccn.ucsd.edu/wiki/A05:_Data_Structures}{Data structure article}. This function is experimental (there are many different formats of eeglab files). If your file cannot be opened please open an issue with a link to the file in \href{https://github.com/bnicenboim/eeguana/issues}{github}. 19 | } 20 | \examples{ 21 | \dontrun{ 22 | s1 <- read_ft("./subject1.set", .recording = 1) 23 | } 24 | 25 | } 26 | \seealso{ 27 | Other reading and writing functions: 28 | \code{\link{read_edf}()}, 29 | \code{\link{read_fif}()}, 30 | \code{\link{read_ft}()}, 31 | \code{\link{read_vhdr}()} 32 | } 33 | \concept{reading and writing functions} 34 | -------------------------------------------------------------------------------- /man/read_vhdr.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/read.R 3 | \name{read_vhdr} 4 | \alias{read_vhdr} 5 | \title{Read a BrainVision file into R} 6 | \usage{ 7 | read_vhdr( 8 | file, 9 | .sep = .type == "New Segment", 10 | .zero = .type == "Time 0", 11 | .recording = file 12 | ) 13 | } 14 | \arguments{ 15 | \item{file}{A vhdr file in a folder that contains a .vmrk and .dat files} 16 | 17 | \item{.sep}{Segment separation marker. By default: \code{.type == "New Segment"}} 18 | 19 | \item{.zero}{Time zero marker. By default: \code{.type == "Time 0"}} 20 | 21 | \item{.recording}{Recording name (\code{file} name, by default).} 22 | } 23 | \value{ 24 | An \code{eeg_lst} object with signal_tbl and event from file_name.dat, 25 | file_name.vhdr, and file_name.vmrk. 26 | } 27 | \description{ 28 | Creates an eeg_lst object from BrainVision exported files.The function reads 29 | metadata from the .vhdr BrainVision file, which draws on 30 | the .vmrk and .dat/.eeg files. All three 31 | files must be in the same directory. 32 | } 33 | \examples{ 34 | \dontrun{ 35 | # load a single subject 36 | s1 <- read_vhdr("./faces.vhdr", .recording = "1") 37 | 38 | # load multiple subjects using purrr::map, extracting subject IDs from file names 39 | faces_list <- purrr::map(list.files("./", "vhdr"), ~ 40 | read_vhdr(.x)) 41 | faces <- bind(faces_list) 42 | } 43 | 44 | } 45 | \seealso{ 46 | Other reading and writing functions: 47 | \code{\link{read_edf}()}, 48 | \code{\link{read_fif}()}, 49 | \code{\link{read_ft}()}, 50 | \code{\link{read_set}()} 51 | } 52 | \concept{reading and writing functions} 53 | -------------------------------------------------------------------------------- /man/reexports.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/reexports.R 3 | \docType{import} 4 | \name{reexports} 5 | \alias{reexports} 6 | \alias{starts_with} 7 | \alias{contains} 8 | \alias{ends_with} 9 | \alias{everything} 10 | \alias{any_of} 11 | \alias{all_of} 12 | \alias{matches} 13 | \alias{num_range} 14 | \alias{last_col} 15 | \alias{where} 16 | \title{Objects exported from other packages} 17 | \keyword{internal} 18 | \description{ 19 | These objects are imported from other packages. Follow the links 20 | below to see their documentation. 21 | 22 | \describe{ 23 | \item{tidyselect}{\code{\link[tidyselect]{all_of}}, \code{\link[tidyselect:all_of]{any_of}}, \code{\link[tidyselect:starts_with]{contains}}, \code{\link[tidyselect:starts_with]{ends_with}}, \code{\link[tidyselect]{everything}}, \code{\link[tidyselect:everything]{last_col}}, \code{\link[tidyselect:starts_with]{matches}}, \code{\link[tidyselect:starts_with]{num_range}}, \code{\link[tidyselect]{starts_with}}, \code{\link[tidyselect]{where}}} 24 | }} 25 | 26 | -------------------------------------------------------------------------------- /man/rpink.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/simulation.R 3 | \name{rpink} 4 | \alias{rpink} 5 | \title{Generates pink noise} 6 | \usage{ 7 | rpink(n, scale = 1) 8 | } 9 | \arguments{ 10 | \item{n}{number of observations.} 11 | 12 | \item{scale}{scale parameter.} 13 | } 14 | \value{ 15 | a vector 16 | } 17 | \description{ 18 | Adapted from Matlab code of Smith (2011) 19 | } 20 | \details{ 21 | Reference: 22 | Smith, J.O. Spectral Audio Signal Processing, 23 | \url{http://ccrma.stanford.edu/~jos/sasp/}, online book, 24 | 2011 edition. 25 | } 26 | -------------------------------------------------------------------------------- /man/sample_int.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/constructors.R 3 | \name{sample_int} 4 | \alias{sample_int} 5 | \title{Builds a series of sample numbers.} 6 | \usage{ 7 | sample_int(values, .sampling_rate) 8 | } 9 | \arguments{ 10 | \item{values}{Sequence of integers.} 11 | 12 | \item{.sampling_rate}{Double indicating the sampling rate in Hz.} 13 | } 14 | \description{ 15 | Builds a series of sample numbers. 16 | } 17 | \examples{ 18 | 19 | sample_int(1:100, .sampling_rate = 500) 20 | } 21 | \seealso{ 22 | Other sample_int: 23 | \code{\link{is_sample_int}()} 24 | } 25 | \concept{sample_int} 26 | -------------------------------------------------------------------------------- /man/segments_tbl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tbl.R 3 | \name{segments_tbl} 4 | \alias{segments_tbl} 5 | \title{Function to get the segments table of an eeg_lst object.} 6 | \usage{ 7 | segments_tbl(.data, ...) 8 | } 9 | \arguments{ 10 | \item{.data}{An eeg_lst object.} 11 | 12 | \item{...}{Not in use.} 13 | } 14 | \value{ 15 | A table. 16 | } 17 | \description{ 18 | Function to get the segments table of an eeg_lst object. 19 | } 20 | \seealso{ 21 | Other functions to expose internal parts of eeg_(ica_)_lst: 22 | \code{\link{channels_tbl}()}, 23 | \code{\link{events_tbl}()}, 24 | \code{\link{ica_matrix_lst}()}, 25 | \code{\link{signal_tbl}()} 26 | } 27 | \concept{functions to expose internal parts of eeg_(ica_)_lst} 28 | -------------------------------------------------------------------------------- /man/sig_fft.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/signal_helpers.R 3 | \name{sig_fft} 4 | \alias{sig_fft} 5 | \title{Compute the one-dimensional discrete Fourier Transform.} 6 | \usage{ 7 | sig_fft(x, n = NULL) 8 | } 9 | \arguments{ 10 | \item{x}{A vector} 11 | 12 | \item{n}{Length of the transformed axis of the output. If \code{n} is smaller 13 | than the length of the input, the input is cropped. If it is larger, the input 14 | is padded with zeros. If n is not given, the length of the input along 15 | the axis specified by axis is used.} 16 | } 17 | \description{ 18 | Computes the Discrete Fourier Transform (DFT) of an array 19 | with a fast algorithm, the “Fast Fourier Transform” (FFT). Wrapper 20 | of \link[stats:fft]{stats::fft} with an extra argument similar to python's \href{https://docs.scipy.org/doc/numpy/reference/generated/numpy.fft.fft.html#numpy.fft.fft}{numpy.fft.fft}. 21 | } 22 | \examples{ 23 | a <- c(0, 4, 0, 0) 24 | sig_fft(a) 25 | } 26 | -------------------------------------------------------------------------------- /man/sig_ifft.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/signal_helpers.R 3 | \name{sig_ifft} 4 | \alias{sig_ifft} 5 | \title{Compute the one-dimensional inverse discrete Fourier Transform.} 6 | \usage{ 7 | sig_ifft(x, n = NULL) 8 | } 9 | \arguments{ 10 | \item{x}{A vector} 11 | 12 | \item{n}{Length of the transformed axis of the output. If \code{n} is smaller 13 | than the length of the input, the input is cropped. If it is larger, the input 14 | is padded with zeros. If n is not given, the length of the input along 15 | the axis specified by axis is used.} 16 | } 17 | \value{ 18 | A vector 19 | } 20 | \description{ 21 | This function computes the inverse of the one-dimensional n-point discrete Fourier 22 | transform computed by fft using a wrapper of \code{fft(z, inverse= TRUE)/length(z)} with 23 | an extra argument making it similar to \href{https://docs.scipy.org/doc/numpy-1.17.0/reference/generated/numpy.fft.ifft.html#numpy.fft.ifft}{numpy.fft.ifft}. 24 | For a general description of the algorithm and definitions, see \link[stats:fft]{stats::fft} and \href{https://docs.scipy.org/doc/numpy-1.17.0/reference/generated/numpy.fft.ifft.html#numpy.fft.ifft}{numpy.fft}. 25 | } 26 | \details{ 27 | The input should be ordered in the same way as is returned by fft, i.e., 28 | (\emph{if I converted the indexes from python correctly}) 29 | \itemize{ 30 | \item \code{a[1]} should contain the zero frequency term, 31 | \item \code{a[2:ceiling(n/2)]} should contain the positive-frequency terms, 32 | \item \code{a[ceiling(n/2) + 2:length(a)]} should contain the negative-frequency terms, 33 | in increasing order starting from the most negative frequency. 34 | \item For an even number of input points, \code{a[ceiling(n/2)]} represents 35 | the sum of the values at the positive and negative Nyquist frequencies, 36 | as the two are aliased together. See see \href{https://docs.scipy.org/doc/numpy-1.17.0/reference/generated/numpy.fft.ifft.html#numpy.fft.ifft}{numpy.fft} for details. 37 | } 38 | 39 | \strong{Notes} 40 | 41 | If the input parameter \code{n} is larger than the size of the input, 42 | the input is padded by appending zeros at the end. Even though this is 43 | the common approach, it might lead to surprising results. If a different padding 44 | is desired, it must be performed before calling ifft. 45 | } 46 | \examples{ 47 | 48 | a <- c(0, 4, 0, 0) 49 | sig_ifft(a) 50 | sig_ifft(sig_fft(a)) == a 51 | } 52 | -------------------------------------------------------------------------------- /man/signal_tbl.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/tbl.R 3 | \name{signal_tbl} 4 | \alias{signal_tbl} 5 | \title{Function to get the signal table of an eeg_lst object.} 6 | \usage{ 7 | signal_tbl(.data, ...) 8 | } 9 | \arguments{ 10 | \item{.data}{An eeg_lst object.} 11 | 12 | \item{...}{Not in use.} 13 | } 14 | \value{ 15 | A table. 16 | } 17 | \description{ 18 | Function to get the signal table of an eeg_lst object. 19 | } 20 | \seealso{ 21 | Other functions to expose internal parts of eeg_(ica_)_lst: 22 | \code{\link{channels_tbl}()}, 23 | \code{\link{events_tbl}()}, 24 | \code{\link{ica_matrix_lst}()}, 25 | \code{\link{segments_tbl}()} 26 | } 27 | \concept{functions to expose internal parts of eeg_(ica_)_lst} 28 | -------------------------------------------------------------------------------- /man/summaries.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/out.R 3 | \name{summaries} 4 | \alias{summaries} 5 | \alias{channel_names} 6 | \alias{channel_ica_names} 7 | \alias{nchannels} 8 | \alias{component_names} 9 | \alias{ncomponents} 10 | \alias{sampling_rate} 11 | \alias{nsamples} 12 | \title{Display information of the eeg_lst object.} 13 | \usage{ 14 | channel_names(x, ...) 15 | 16 | channel_ica_names(x, ...) 17 | 18 | nchannels(x, ...) 19 | 20 | component_names(x, ...) 21 | 22 | ncomponents(x, ...) 23 | 24 | sampling_rate(x, ...) 25 | 26 | nsamples(x, ...) 27 | } 28 | \arguments{ 29 | \item{x}{An eeg_lst object.} 30 | 31 | \item{...}{Not in use.} 32 | } 33 | \description{ 34 | \itemize{ 35 | \item \verb{*_names()} functions return a vector of names, 36 | \item \verb{n*()} return the number of elements channels or components. 37 | } 38 | } 39 | \details{ 40 | Components are only available after running \code{\link[=eeg_ica]{eeg_ica()}}. \code{channel_ica_names()} refers to channels used in the ICA. 41 | } 42 | \seealso{ 43 | Other summary functions: 44 | \code{\link{count_complete_cases_tbl}()}, 45 | \code{\link{eeg_ica_cor_tbl}()}, 46 | \code{\link{eeg_ica_summary_tbl}()}, 47 | \code{\link{eeg_ica_var_tbl}()}, 48 | \code{\link{summary.eeg_lst}()} 49 | } 50 | \concept{summary functions} 51 | -------------------------------------------------------------------------------- /man/summary.eeg_lst.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/out.R 3 | \name{summary.eeg_lst} 4 | \alias{summary.eeg_lst} 5 | \title{Summary of eeg_lst information.} 6 | \usage{ 7 | \method{summary}{eeg_lst}(object, ...) 8 | } 9 | \arguments{ 10 | \item{object}{An eeg_lst object.} 11 | 12 | \item{...}{additional arguments affecting the summary produced.} 13 | } 14 | \description{ 15 | It's also possible to extract the elements by accessing it as a list. 16 | } 17 | \examples{ 18 | 19 | summary(data_faces_ERPs) 20 | } 21 | \seealso{ 22 | Other summary functions: 23 | \code{\link{count_complete_cases_tbl}()}, 24 | \code{\link{eeg_ica_cor_tbl}()}, 25 | \code{\link{eeg_ica_summary_tbl}()}, 26 | \code{\link{eeg_ica_var_tbl}()}, 27 | \code{\link{summaries}} 28 | } 29 | \concept{summary functions} 30 | -------------------------------------------------------------------------------- /man/theme_eeguana.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/plot.R 3 | \name{theme_eeguana} 4 | \alias{theme_eeguana} 5 | \alias{theme_eeguana2} 6 | \alias{default_theme} 7 | \title{Eeguana ggplot themes} 8 | \usage{ 9 | theme_eeguana() 10 | 11 | theme_eeguana2() 12 | 13 | default_theme() 14 | } 15 | \value{ 16 | A ggplot theme. 17 | } 18 | \description{ 19 | These are complete light themes based on \code{\link[ggplot2:ggtheme]{ggplot2::theme_bw()}} which control all non-data display. 20 | } 21 | \seealso{ 22 | Other plotting functions: 23 | \code{\link{annotate_electrodes}()}, 24 | \code{\link{annotate_events}()}, 25 | \code{\link{annotate_head}()}, 26 | \code{\link{eeg_downsample}()}, 27 | \code{\link{ggplot.eeg_lst}()}, 28 | \code{\link{plot.eeg_lst}()}, 29 | \code{\link{plot_components}()}, 30 | \code{\link{plot_in_layout}()}, 31 | \code{\link{plot_topo}()} 32 | } 33 | \concept{plotting functions} 34 | -------------------------------------------------------------------------------- /man/write_vhdr.Rd: -------------------------------------------------------------------------------- 1 | % Generated by roxygen2: do not edit by hand 2 | % Please edit documentation in R/write.R 3 | \name{write_vhdr} 4 | \alias{write_vhdr} 5 | \title{Write an eeg_lst object to BrainVision file(s) (experimental)} 6 | \usage{ 7 | write_vhdr(x, file, overwrite = FALSE) 8 | } 9 | \arguments{ 10 | \item{x}{\code{eeg_lst} object.} 11 | 12 | \item{file}{Either a vector of file names (with the same length as the number of recordings), one file name (which will be appended the recording name if needed), or a path which will use the recording names as file names. By default, it will use the recording name in the current path as file names.} 13 | 14 | \item{overwrite}{Stop writing if the file exists.} 15 | } 16 | \description{ 17 | The function will write each recording in a different file. The function is highly experimental, if a file fails to open in BrainVision, please report the bug in (https://github.com/bnicenboim/eeguana/issues). 18 | } 19 | -------------------------------------------------------------------------------- /papers.bib: -------------------------------------------------------------------------------- 1 | @article{nicenboim2020words, 2 | title={Are words pre-activated probabilistically during sentence comprehension? {Evidence} from new data and a Bayesian random-effects meta-analysis using publicly available data}, 3 | author={Nicenboim, Bruno and Vasishth, Shravan and R{\"o}sler, Frank}, 4 | journal={Neuropsychologia}, 5 | volume={142}, 6 | pages={107427}, 7 | year={2020}, 8 | publisher={Elsevier} 9 | } 10 | 11 | @article{stone2023n400, 12 | title={The {N400} is Elicited by Meaning Changes but not Synonym Substitutions: Evidence From Persian Phrasal Verbs}, 13 | author={Stone, Kate and Khaleghi, Naghmeh and Rabovsky, Milena}, 14 | journal={Cognitive Science}, 15 | volume={47}, 16 | number={12}, 17 | pages={e13394}, 18 | year={2023}, 19 | publisher={Wiley Online Library} 20 | } 21 | 22 | @article{stone2023understanding, 23 | title={Understanding the effects of constraint and predictability in {ERP}}, 24 | author={Stone, Kate and Nicenboim, Bruno and Vasishth, Shravan and R{\"o}sler, Frank}, 25 | journal={Neurobiology of Language}, 26 | volume={4}, 27 | number={2}, 28 | pages={221--256}, 29 | year={2023}, 30 | publisher={MIT Press} 31 | } 32 | 33 | @article{corput2020locked, 34 | title={Locked in Syndrome Machine Learning Classification using Sentence Comprehension {EEG} Data}, 35 | author={Corput, Dani{\"e}l van den}, 36 | journal={arXiv preprint arXiv:2006.12336}, 37 | year={2020} 38 | } 39 | 40 | @article{szewczyk2022context, 41 | title={Context-based facilitation of semantic access follows both logarithmic and linear functions of stimulus probability}, 42 | author={Szewczyk, Jakub M and Federmeier, Kara D}, 43 | journal={Journal of memory and language}, 44 | volume={123}, 45 | pages={104311}, 46 | year={2022}, 47 | publisher={Elsevier} 48 | } 49 | 50 | @article{stone2022does, 51 | title={Does entropy modulate the prediction of {German} long-distance verb particles?}, 52 | author={Stone, Kate and Vasishth, Shravan and von der Malsburg, Titus}, 53 | journal={Plos one}, 54 | volume={17}, 55 | number={8}, 56 | pages={e0267813}, 57 | year={2022}, 58 | publisher={Public Library of Science San Francisco, CA USA} 59 | } 60 | 61 | @article{aristei2023affect, 62 | title={Affect as Anaesthetic: how emotional contexts modulate the processing of counterintuitive concepts}, 63 | author={Aristei, Sabrina and Knoop, Christine A and Lubrich, Oliver and Nehrlich, Thomas and Enge, Alexander and Stark, Kirsten and Sommer, Werner and Abdel Rahman, Rasha}, 64 | journal={Language, cognition and neuroscience}, 65 | volume={38}, 66 | number={10}, 67 | pages={1514--1530}, 68 | year={2023}, 69 | publisher={Taylor \& Francis} 70 | } 71 | 72 | @article{vik2021deteccion, 73 | title={Detecci{\'o}n de perfiles psicop{\'a}ticos mediante el an{\'a}lisis autom{\'a}tico de se{\~n}ales de encefalogramas}, 74 | author={Vik Esp{\'a}rrago, Erik Mart{\'\i}n}, 75 | year={2021} 76 | } -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-120x120.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/pkgdown/favicon/apple-touch-icon-120x120.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-60x60.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/pkgdown/favicon/apple-touch-icon-60x60.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon-76x76.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/pkgdown/favicon/apple-touch-icon-76x76.png -------------------------------------------------------------------------------- /pkgdown/favicon/apple-touch-icon.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/pkgdown/favicon/apple-touch-icon.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/pkgdown/favicon/favicon-16x16.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon-32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/pkgdown/favicon/favicon-32x32.png -------------------------------------------------------------------------------- /pkgdown/favicon/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/bnicenboim/eeguana/d140feaec178a08d355def603ed4ad4fcf1c3092/pkgdown/favicon/favicon.ico -------------------------------------------------------------------------------- /tests/spelling.R: -------------------------------------------------------------------------------- 1 | if (requireNamespace("spelling", quietly = TRUE)) { 2 | spelling::spell_check_test( 3 | vignettes = TRUE, error = FALSE, 4 | skip_on_cran = TRUE 5 | ) 6 | } 7 | -------------------------------------------------------------------------------- /tests/spelling.Rout.save: -------------------------------------------------------------------------------- 1 | 2 | R version 3.4.1 (2017-06-30) -- "Single Candle" 3 | Copyright (C) 2017 The R Foundation for Statistical Computing 4 | Platform: x86_64-apple-darwin15.6.0 (64-bit) 5 | 6 | R is free software and comes with ABSOLUTELY NO WARRANTY. 7 | You are welcome to redistribute it under certain conditions. 8 | Type 'license()' or 'licence()' for distribution details. 9 | 10 | R is a collaborative project with many contributors. 11 | Type 'contributors()' for more information and 12 | 'citation()' on how to cite R or R packages in publications. 13 | 14 | Type 'demo()' for some demos, 'help()' for on-line help, or 15 | 'help.start()' for an HTML browser interface to help. 16 | Type 'q()' to quit R. 17 | 18 | > if (requireNamespace("spelling", quietly = TRUE)) { 19 | + spelling::spell_check_test( 20 | + vignettes = TRUE, error = FALSE, 21 | + skip_on_cran = TRUE 22 | + ) 23 | + } 24 | All Done! 25 | > 26 | > proc.time() 27 | user system elapsed 28 | 0.372 0.039 0.408 29 | -------------------------------------------------------------------------------- /tests/testthat.R: -------------------------------------------------------------------------------- 1 | library(testthat) 2 | library(eeguana) 3 | test_check("eeguana") 4 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/02-ica.md: -------------------------------------------------------------------------------- 1 | # ica summaries 2 | 3 | Code 4 | eeg_ica_summary_tbl(data_fast_ICA, "Fz") 5 | Output 6 | .recording EOG .ICA cor var 7 | 8 | 1: recording1 Fz ICA2 -0.5629150 0.59371175 9 | 2: recording1 Fz ICA3 -0.8018246 0.33288750 10 | 3: recording1 Fz ICA1 0.2005095 0.07340075 11 | 12 | --- 13 | 14 | Code 15 | eeg_ica_summary_tbl(data_fast_ICA2) 16 | Output 17 | .recording EOG .ICA cor var 18 | 19 | 1: recording1 XEOG ICA2 0.01487848 0.59371175 20 | 2: recording1 XEOG ICA3 -0.02058590 0.33288750 21 | 3: recording1 XEOG ICA1 0.03040823 0.07340075 22 | 23 | # summaries work 24 | 25 | Code 26 | eeg_ica_cor_tbl(data_fast_ICA, tidyselect::all_of(c("Fz", "Cz"))) 27 | Output 28 | .recording EOG .ICA cor 29 | 30 | 1: recording1 Fz ICA3 -0.8018246 31 | 2: recording1 Cz ICA2 -0.7817242 32 | 3: recording1 Cz ICA3 -0.5665764 33 | 4: recording1 Fz ICA2 -0.5629150 34 | 5: recording1 Cz ICA1 0.2605735 35 | 6: recording1 Fz ICA1 0.2005095 36 | 37 | --- 38 | 39 | Code 40 | eeg_ica_var_tbl(data_fast_ICA) 41 | Output 42 | .recording .ICA var 43 | 44 | 1: recording1 ICA2 0.59371175 45 | 2: recording1 ICA3 0.33288750 46 | 3: recording1 ICA1 0.07340075 47 | 48 | -------------------------------------------------------------------------------- /tests/testthat/_snaps/10-summarizing.md: -------------------------------------------------------------------------------- 1 | # summarizing functions don't break 2 | 3 | Code 4 | channel_names(eeg_file) 5 | Output 6 | [1] "Fp1" "Fpz" "Fp2" "F7" "F3" "Fz" "F4" "F8" "FC5" "FC1" 7 | [11] "FC2" "FC6" "M1" "T7" "C3" "Cz" "C4" "T8" "M2" "CP5" 8 | [21] "CP1" "CP2" "CP6" "P7" "P3" "Pz" "P4" "P8" "POz" "O1" 9 | [31] "Oz" "O2" "HEOG" "VEOG" 10 | 11 | --- 12 | 13 | Code 14 | nchannels(eeg_file) 15 | Output 16 | [1] 34 17 | 18 | --- 19 | 20 | Code 21 | nsamples(eeg_file) 22 | Output 23 | [1] 4722 24 | 25 | -------------------------------------------------------------------------------- /tests/testthat/helper_funs.R: -------------------------------------------------------------------------------- 1 | #sourced by devtools::load_all() 2 | #(so they’re available interactively when developing your packages) and by 3 | #test_check() and friends (so that they’re available no matter how your tests are executed). 4 | suppress_python_output <- function(x) { 5 | invisible(reticulate::py_capture_output(x)) 6 | } 7 | 8 | 9 | other_testfiles <- file.path(testthat::test_path(), "other_files") 10 | 11 | skip_if_no_python_stuff <- function() { 12 | have_mne <- reticulate::py_module_available("mne") 13 | have_scipy <- reticulate::py_module_available("scipy") 14 | 15 | if (!have_mne) { 16 | skip("mne not available for testing") 17 | } 18 | if (!have_scipy) { 19 | skip("scipy not available for testing") 20 | } 21 | } 22 | 23 | skip_if_nofiles <- function(files) { 24 | # Check if each file exists 25 | missing_files <- files[!file.exists(files)] 26 | 27 | # If there are any missing files 28 | if (length(missing_files) > 0) { 29 | # Inform the user about the missing files 30 | skip(paste0("The following file(s) do not exist: ", paste(missing_files, collapse = ", "))) 31 | } 32 | } 33 | #' @noRd 34 | as_plain_df <- function(df) { 35 | df <- lapply(df, function(c) `attributes<-`(c, NULL)) 36 | as.data.frame(df) 37 | } 38 | 39 | #' @noRd 40 | expect_equal_plain_df <- function(object, expected, ..., info = NULL, label = NULL, expected.label = NULL) { 41 | eval(bquote(expect_equal(as_plain_df(.(object)), as_plain_df(.(expected))))) 42 | } 43 | 44 | #' @noRd 45 | remove_index <- function(.eeg_lst) { 46 | attributes(.eeg_lst$.signal)$index <- NULL 47 | attributes(.eeg_lst$.segments)$index <- NULL 48 | attributes(.eeg_lst$.events)$index <- NULL 49 | .eeg_lst 50 | } 51 | 52 | #' @noRd 53 | expect_equal_eeg_lst <- function(object, expected, ..., info = NULL, label = NULL, expected.label = NULL) { 54 | eval(bquote(expect_equal(remove_index(.(object)), remove_index(.(expected)), ...))) 55 | } 56 | 57 | #' @noRd 58 | expect_equal_but_cnt_sgl <- function(object, expected, ..., info = NULL, label = NULL, expected.label = NULL) { 59 | object$.signal <- object$.signal[0, ] 60 | expected$.signal <- expected$.signal[0, ] 61 | eval(bquote(expect_equal_eeg_lst(.(object), .(expected)))) 62 | } 63 | 64 | #' @noRd 65 | expect_equal_but_sgl <- function(object, expected, ..., info = NULL, label = NULL, expected.label = NULL) { 66 | object$.signal <- NULL 67 | expected$.signal <- NULL 68 | eval(bquote(expect_equal_eeg_lst(.(object), .(expected)))) 69 | } 70 | 71 | #' @noRd 72 | expect_equal_but_cnt_sgm <- function(object, expected, ..., info = NULL, label = NULL, expected.label = NULL) { 73 | object$.segments <- object$.segments[0, ] 74 | expected$.segments <- expected$.segments[0, ] 75 | eval(bquote(expect_equal_eeg_lst(.(object), .(expected)))) 76 | } 77 | 78 | #' @noRd 79 | expect_equal_but_sgm <- function(object, expected, ..., info = NULL, label = NULL, expected.label = NULL) { 80 | object$.segments <- NULL 81 | expected$.segments <- NULL 82 | eval(bquote(expect_equal_eeg_lst(.(object), .(expected)))) 83 | } 84 | 85 | #' helper functions (borrowed from github.com/stan-dev/bayesplot/R/helpers-testthat.R) 86 | #' @noRd 87 | expect_gg <- function(x) { 88 | testthat::expect_s3_class(x, "ggplot") 89 | invisible(ggplot2::ggplot_build(x)) 90 | } 91 | -------------------------------------------------------------------------------- /tests/testthat/setup.R: -------------------------------------------------------------------------------- 1 | 2 | other_testfiles <- file.path(testthat::test_path(), "other_files") 3 | if(!dir.exists(other_testfiles)) dir.create(other_testfiles) 4 | 5 | 6 | library(httr) 7 | GET("https://osf.io/6gpeh//?action=download", 8 | write_disk(file.path(other_testfiles, "EEG01.mat"), overwrite = TRUE), 9 | progress() 10 | ) 11 | -------------------------------------------------------------------------------- /tests/testthat/test_05-tv_03-joins.R: -------------------------------------------------------------------------------- 1 | library(eeguana) 2 | options(eeguana.verbose = FALSE) 3 | 4 | data <- eeguana:::data_sincos2id 5 | 6 | table0 <- dplyr::tibble(.id = 1L, condition = "BLUE") 7 | 8 | data_l <- eeg_left_join(data, table0) 9 | data_s <- eeg_semi_join(data, table0) 10 | data_a <- eeg_anti_join(data, table0) 11 | 12 | test_that("joins work", { 13 | expect_equal_plain_df(data_l$.segments, 14 | dplyr::left_join(data$.segments, table0, by = ".id")) 15 | expect_equal_plain_df(data_l$.signal, data$.signal) 16 | expect_equal_plain_df(data_s$.segments, dplyr::semi_join(data$.segments, table0, by = ".id")) 17 | expect_equal_eeg_lst(data_s, eeg_filter(data, .id == 1)) 18 | expect_equal_eeg_lst(data_a, eeg_filter(data, .id == 2)) 19 | }) 20 | 21 | message("\n***") 22 | message(" test by reference") 23 | message(" test errors") 24 | message(" test data frames/tibbles/data.tables") 25 | -------------------------------------------------------------------------------- /tests/testthat/test_05-tv_05-group_by.R: -------------------------------------------------------------------------------- 1 | library(eeguana) 2 | options(eeguana.verbose = FALSE) 3 | # tests when factors are used should be done. 4 | 5 | # create fake dataset 6 | data_1 <- eeguana:::data_sincos3id 7 | # data_1 <- eeg_lst( 8 | # signal_tbl = 9 | # dplyr::tibble( 10 | # X = sin(1:30), Y = cos(1:30), 11 | # .id = rep(c(1L, 2L, 3L), each = 10), 12 | # .sample = sample_int(rep(seq(-4L, 5L), times = 3), .sampling_rate = 500) 13 | # ), 14 | # channels_tbl = dplyr::tibble( 15 | # .channel = c("X", "Y"), .reference = NA, theta = NA, phi = NA, 16 | # radius = NA, .x = c(1, 1), .y = NA_real_, .z = NA_real_ 17 | # ), 18 | # events_tbl = dplyr::tribble( 19 | # ~.id, ~.type, ~.description, ~.initial, ~.final, ~.channel, 20 | # 1L, "New Segment", NA_character_, -4L, -4L, NA, 21 | # 1L, "Bad", NA_character_, -2L, 0L, NA, 22 | # 1L, "Time 0", NA_character_, 1L, 1L, NA, 23 | # 1L, "Bad", NA_character_, 2L, 3L, "X", 24 | # 2L, "New Segment", NA_character_, -4L, -4L, NA, 25 | # 2L, "Time 0", NA_character_, 1L, 1L, NA, 26 | # 2L, "Bad", NA_character_, 2L, 2L, "Y", 27 | # 3L, "New Segment", NA_character_, -4L, -4L, NA, 28 | # 3L, "Time 0", NA_character_, 1L, 1L, NA, 29 | # 3L, "Bad", NA_character_, 2L, 2L, "Y" 30 | # ), 31 | # segments_tbl = dplyr::tibble( 32 | # .id = c(1L, 2L, 3L), 33 | # .recording = "recording1", 34 | # segment = c(1L, 2L, 3L), 35 | # condition = c("a", "b", "a") 36 | # ) 37 | # ) 38 | 39 | 40 | 41 | # just some different X and Y 42 | data_2 <- eeg_mutate(data_1, .recording = "recording2", X = sin(X + 10), Y = cos(Y - 10), condition = c("b", "a", "b")) 43 | 44 | # bind it all together 45 | data <- bind(data_1, data_2) 46 | 47 | 48 | # for checks later 49 | reference_data <- data.table::copy(data) 50 | 51 | data_g_segment <- data %>% eeg_group_by(segment) 52 | data_g_recording <- data %>% eeg_group_by(.recording) 53 | data_g_recording_segment <- data %>% eeg_group_by(.recording, segment) 54 | data_g_segment2 <- data %>% 55 | eeg_group_by(.recording) %>% 56 | eeg_group_by(segment) 57 | data_g_recording_segment2 <- data %>% 58 | eeg_group_by(.recording) %>% 59 | eeg_group_by(segment, .add = TRUE) 60 | 61 | test_that("grouping works", { 62 | expect_equal(data_g_segment, data_g_segment2) 63 | expect_equal(data_g_recording_segment, data_g_recording_segment2) 64 | expect_equal(dplyr::group_vars(data), character(0)) 65 | }) 66 | -------------------------------------------------------------------------------- /tests/testthat/test_05-tv_06-bind.R: -------------------------------------------------------------------------------- 1 | library(eeguana) 2 | options(eeguana.verbose = FALSE) 3 | 4 | 5 | data_0 <- eeg_lst( 6 | signal_tbl = 7 | dplyr::tibble( 8 | X = sin(1:20), Y = cos(1:20), 9 | .id = rep(c(1L, 2L), each = 10), 10 | .sample = sample_int(rep(seq(-4L, 5L), times = 2), .sampling_rate = 500) 11 | ), 12 | channels_tbl = dplyr::tibble( 13 | .channel = c("X", "Y"), .reference = NA, theta = NA, phi = NA, 14 | radius = NA, .x = c(1, 1), .y = NA_real_, .z = NA_real_ 15 | ), 16 | events_tbl = dplyr::tribble( 17 | ~.id, ~.type, ~.description, ~.initial, ~.final, ~.channel, 18 | 1L, "New Segment", NA_character_, -4L, -4L, NA, 19 | 1L, "Bad", NA_character_, -2L, 0L, NA, 20 | 1L, "Time 0", NA_character_, 1L, 1L, NA, 21 | 1L, "Bad", NA_character_, 2L, 3L, "X", 22 | 2L, "New Segment", NA_character_, -4L, -4L, NA, 23 | 2L, "Time 0", NA_character_, 1L, 1L, NA, 24 | 2L, "Bad", NA_character_, 2L, 2L, "Y" 25 | ), 26 | segments_tbl = dplyr::tibble(.id = c(1L, 2L), .recording = "recording1", segment = c(1L, 2L)) 27 | ) 28 | 29 | 30 | data_1 <- eeg_lst( 31 | signal_tbl = 32 | dplyr::tibble( 33 | X = sin(1:30), Y = cos(1:30), 34 | .id = rep(c(1L, 2L, 3L), each = 10), 35 | .sample = sample_int(rep(seq(-4L, 5L), times = 3), .sampling_rate = 500) 36 | ), 37 | channels_tbl = dplyr::tibble( 38 | .channel = c("X", "Y"), .reference = NA, theta = NA, phi = NA, 39 | radius = NA, .x = c(1, 1), .y = NA_real_, .z = NA_real_ 40 | ), 41 | events_tbl = dplyr::tribble( 42 | ~.id, ~.type, ~.description, ~.initial, ~.final, ~.channel, 43 | 1L, "New Segment", NA_character_, -4L, -4L, NA, 44 | 1L, "Bad", NA_character_, -2L, 0L, NA, 45 | 1L, "Time 0", NA_character_, 1L, 1L, NA, 46 | 1L, "Bad", NA_character_, 2L, 3L, "X", 47 | 2L, "New Segment", NA_character_, -4L, -4L, NA, 48 | 2L, "Time 0", NA_character_, 1L, 1L, NA, 49 | 2L, "Bad", NA_character_, 2L, 2L, "Y", 50 | 3L, "New Segment", NA_character_, -4L, -4L, NA, 51 | 3L, "Time 0", NA_character_, 1L, 1L, NA, 52 | 3L, "Bad", NA_character_, 2L, 2L, "Y" 53 | ), 54 | segments_tbl = dplyr::tibble(.id = c(1L, 2L, 3L), .recording = "recording1", segment = c(1L, 2L, 3L)) 55 | ) 56 | 57 | reference_data_0 <- data.table::copy(data_0) 58 | reference_data_1 <- data.table::copy(data_1) 59 | 60 | test_that("can bind unlisted files", { 61 | data_2 <- bind(data_0, data_1) 62 | expect_equal(nrow(data_2$.signal), nrow(data_0$.signal) + nrow(data_1$.signal)) 63 | expect_equal(max(data_2$.signal$.id), max(data_0$.signal$.id) + max(data_1$.signal$.id)) 64 | }) 65 | 66 | test_that("can bind listed files", { 67 | expect_equal(bind(data_0, data_1), bind(list(data_0, data_1))) 68 | }) 69 | 70 | data_1_extra_channel <- dplyr::mutate(data_1, Z = X + 10) 71 | channels_tbl(data_1_extra_channel) 72 | test_that("can bind objects with different channels and throws a warning", { 73 | expect_warning(data_2_2 <- bind(data_0, data_1_extra_channel)) 74 | expect_equal(max(data_2_2$.signal$.id), max(data_0$.signal$.id) + max(data_1_extra_channel$.signal$.id)) 75 | }) 76 | -------------------------------------------------------------------------------- /tests/testthat/test_10-summarizing.R: -------------------------------------------------------------------------------- 1 | library(eeguana) 2 | options(eeguana.verbose = FALSE) 3 | 4 | eeg_file <- read_vhdr(system.file("testdata", "bv_export_bv_txt_bin_multi.vhdr", package = "eeguana")) 5 | 6 | data_sincos2id <- eeguana:::data_sincos2id_2 7 | 8 | d0 <- data_sincos2id %>% eeg_events_to_NA(.type == "Bad") 9 | d1 <- data_sincos2id 10 | events_tbl(d1) <- events_tbl(d1) %>% tidytable::filter(!.id==2 | !.type == "Bad") 11 | d1 <- d1 %>% eeg_events_to_NA(.type == "Bad") 12 | 13 | d2 <- data_sincos2id 14 | events_tbl(d2) <- events_tbl(d2) %>% tidytable::filter(!.id==1 | !.type == "Bad") 15 | d2 <- d2 %>% eeg_events_to_NA(.type == "Bad") 16 | 17 | test_that("count_complete_cases_tbl works", { 18 | 19 | expect_equal_plain_df(count_complete_cases_tbl(d0),data.table::data.table(N=0)) 20 | expect_equal_plain_df(count_complete_cases_tbl(d0, .recording), 21 | data.table::data.table(.recording = "recording1", N=0)) 22 | expect_equal_plain_df(count_complete_cases_tbl(d0, .recording, segment,.id), 23 | data.table::data.table(.recording = c("recording1","recording1"), 24 | segment = 1:2, .id =1:2,N=c(0,0))) 25 | 26 | expect_equal_plain_df(count_complete_cases_tbl(d1),data.table::data.table(N=1)) 27 | expect_equal_plain_df(count_complete_cases_tbl(d1, .recording), 28 | data.table::data.table(.recording = "recording1", N=1)) 29 | expect_equal_plain_df(count_complete_cases_tbl(d1, segment), 30 | data.table::data.table(segment = 1:2,N=c(0,1))) 31 | 32 | expect_equal_plain_df(count_complete_cases_tbl(d2),data.table::data.table(N=1)) 33 | expect_equal_plain_df(count_complete_cases_tbl(d2, .recording), 34 | data.table::data.table(.recording = "recording1", N=1)) 35 | expect_equal_plain_df(count_complete_cases_tbl(d2, segment), 36 | data.table::data.table(segment = 1:2,N=c(1,0))) 37 | }) 38 | 39 | test_that("summarizing functions don't break", { 40 | expect_snapshot(channel_names(eeg_file)) 41 | expect_snapshot(nchannels(eeg_file)) 42 | expect_snapshot(nsamples(eeg_file)) 43 | }) 44 | -------------------------------------------------------------------------------- /tests/testthat/test_11-editing.R: -------------------------------------------------------------------------------- 1 | library(eeguana) 2 | options(eeguana.verbose = FALSE) 3 | 4 | 5 | eeg_file <- read_vhdr(file = system.file("testdata", "bv_export_bv_txt_bin_multi.vhdr", package = "eeguana")) 6 | 7 | 8 | test_that("can read channels metadata", { 9 | channels_df <- channels_tbl(eeg_file) 10 | expect_equal(channels_df$.channel, channel_names(eeg_file)) 11 | expect_equal(length(channels_df$.x), nchannels(eeg_file)) 12 | }) 13 | 14 | 15 | 16 | test_that("can change channels metadata", { 17 | channels_info <- channels_tbl(eeg_file) 18 | channels_info$.channel[1] <- "NEW_CHANNEL" 19 | channels_info$.x[1] <- 100 20 | channels_info$.x[2] <- 100 21 | channels_tbl(eeg_file) <- channels_info 22 | expect_equal(names(eeg_file$.signal[, 3]), "NEW_CHANNEL") 23 | expect_equal(attributes(eeg_file$.signal[[4]])$.x, 100) 24 | }) 25 | -------------------------------------------------------------------------------- /tests/testthat/test_13-defunct.R: -------------------------------------------------------------------------------- 1 | library(eeguana) 2 | 3 | test_that("defunct functions", { 4 | expect_error(downsample()) 5 | expect_error(segment()) 6 | expect_error(interpolate_tbl()) 7 | expect_error(event_to_ch_NA()) 8 | expect_error(eeg_intervals_to_NA()) 9 | expect_error(ch_filt_low_pass()) 10 | expect_error(ch_filt_high_pass()) 11 | expect_error(ch_filt_band_pass()) 12 | expect_error(ch_filt_stop_pass()) 13 | expect_error(events()) 14 | expect_error(`events<-`()) 15 | expect_error(summarize_all_ch()) 16 | expect_error(summarize_at_ch()) 17 | expect_error(plot_gg()) 18 | expect_error(ch_baseline()) 19 | }) 20 | -------------------------------------------------------------------------------- /tests/testthat/test_14-load.R: -------------------------------------------------------------------------------- 1 | library(eeguana) 2 | 3 | test_that("loads without errors", { 4 | ## eeguana:::.onLoad() 5 | }) 6 | -------------------------------------------------------------------------------- /tests/testthat/test_15-misc.R: -------------------------------------------------------------------------------- 1 | library(eeguana) 2 | 3 | test_that("can check package", { 4 | expect_error(eeguana:::require_pkg("xzxzx")) 5 | expect_silent(eeguana:::require_pkg("data.table")) 6 | }) 7 | 8 | test_that("operator", { 9 | expect_equal(eeguana:::`%||%`(3, 5), 3) 10 | expect_equal(eeguana:::`%||%`(NULL, 5), 5) 11 | expect_equal(eeguana:::`%||%`(integer(0), 5), 5) 12 | }) 13 | -------------------------------------------------------------------------------- /tests/testthat/test_16-out_funs.R: -------------------------------------------------------------------------------- 1 | library(eeguana) 2 | options(eeguana.verbose = FALSE) 3 | 4 | test_that("prints correctly", { 5 | expect_snapshot(data_faces_10_trials) 6 | expect_snapshot(data_faces_10_trials) 7 | }) 8 | 9 | test_that("summary is correct", { 10 | expect_snapshot(summary(data_faces_10_trials)) 11 | }) 12 | -------------------------------------------------------------------------------- /tests/testthat/test_17-time.R: -------------------------------------------------------------------------------- 1 | library(eeguana) 2 | 3 | 4 | test_that("1 sample work fine", { 5 | s1 <- sample_int(1, 256) 6 | s1_as <- as_sample_int(1, 256, .unit = "samples") 7 | s1_ast <- as_sample_int(as_time(s1, .unit = "second"), 256, .unit = "second") 8 | s1_ast2 <- as_sample_int(as_time(s1, .unit = "ms"), 256, .unit = "ms") 9 | expect_equal(s1, s1_as) 10 | expect_equal(s1, s1_ast) 11 | expect_equal(s1, s1_ast2) 12 | }) 13 | 14 | test_that("vector of samples work fine", { 15 | v <- c(1:10, 20) 16 | sv <- sample_int(v, 256) 17 | sv_as <- as_sample_int(v, 256, .unit = "samples") 18 | sv_ast <- as_sample_int(as_time(sv, .unit = "second"), 256, .unit = "second") 19 | sv_ast2 <- as_sample_int(as_time(sv, .unit = "ms"), 256, .unit = "ms") 20 | expect_equal(sv, sv_as) 21 | expect_equal(sv, sv_ast) 22 | expect_equal(sv, sv_ast2) 23 | }) 24 | 25 | test_that("vector of samples with Inf work fine", { 26 | v <- c(1:10, -5, Inf, -Inf) 27 | sv <- sample_int(v, 256) 28 | sv_as <- as_sample_int(v, 256, .unit = "samples") 29 | sv_ast <- as_sample_int(as_time(sv, .unit = "second"), 256, .unit = "second") 30 | sv_ast2 <- as_sample_int(as_time(sv, .unit = "ms"), 256, .unit = "ms") 31 | expect_equal(sv, sv_as) 32 | expect_equal(sv, sv_ast) 33 | expect_equal(sv, sv_ast2) 34 | }) 35 | 36 | test_that("Inf work fine", { 37 | inf <- Inf 38 | si <- sample_int(inf, 256) 39 | si_as <- as_sample_int(inf, 256, .unit = "samples") 40 | si_ast <- as_sample_int(as_time(si, .unit = "second"), 256, .unit = "second") 41 | si_ast2 <- as_sample_int(as_time(si, .unit = "ms"), 256, .unit = "ms") 42 | expect_equal(si, si_as) 43 | expect_equal(si, si_ast) 44 | expect_equal(si, si_ast2) 45 | }) 46 | 47 | test_that("time zeros work", { 48 | expect_equal(as.integer(as_sample_int(0, 256, .unit = "second")), 1) 49 | expect_equal(as.integer(as_sample_int(1 / 256, 256, .unit = "second")), 2) 50 | expect_equal(as.integer(as_sample_int(-1 / 256, 256, .unit = "second")), 0) 51 | }) 52 | -------------------------------------------------------------------------------- /tests/testthat/test_18-to_tbl.R: -------------------------------------------------------------------------------- 1 | library(eeguana) 2 | 3 | 4 | data1 <- eeguana:::data_sincos3id 5 | data2 <- eeguana:::data_sincos3id %>% dplyr::mutate(.recording = "recording2") 6 | data <- bind(data1, data2) 7 | test_that("can transform to tibble", { 8 | df <- dplyr::as_tibble(data) 9 | expect_equal(nrow(df), nrow(data$.signal) * length(channel_names(data))) 10 | expect_equal(max(df$.time), max((data$.signal$.sample - 1)) / eeguana:::sampling_rate.eeg_lst(data)) 11 | df2 <- dplyr::as_tibble(data, .unit = "s") 12 | df3 <- dplyr::as_tibble(data, .unit = "ms") 13 | df2$.time <- df2$.time * 1000 14 | expect_equal(df2,df3) 15 | df2 <- data.table::as.data.table(data, .unit = "s") 16 | df3 <- data.table::as.data.table(data, .unit = "ms") 17 | df2$.time <- df2$.time * 1000 18 | expect_equal(df2,df3) 19 | 20 | expect_equal_plain_df(as.data.frame(df), as.data.frame(data)) 21 | expect_equal_plain_df(as.data.frame(data.table::as.data.table(data)), as.data.frame(data)) 22 | expect_equal_plain_df(as.data.frame(tidytable::as_tidytable(data)), 23 | as.data.frame(data)) 24 | expect_equal_plain_df(as.data.frame(df), as.data.frame(data, .unit="s")) 25 | expect_equal_plain_df(as.data.frame(data.table::as.data.table(data, .unit="s")), as.data.frame(data)) 26 | expect_equal_plain_df(as.data.frame(tidytable::as_tidytable(data, .unit="s")), as.data.frame(data)) 27 | }) 28 | -------------------------------------------------------------------------------- /vignettes/psd.Rmd_: -------------------------------------------------------------------------------- 1 | --- 2 | title: "Power spectral density example - Sleep stage classification from polysomnography (PSG) data" 3 | author: "Bruno Nicenboim" 4 | date: "`r Sys.Date()`" 5 | bibliography: references.bib 6 | output: rmarkdown::html_vignette 7 | vignette: > 8 | %\VignetteIndexEntry{Power spectral density example - Sleep stage classification from polysomnography (PSG) data} 9 | %\VignetteEngine{knitr::rmarkdown} 10 | %\VignetteEncoding{UTF-8} 11 | --- 12 | 13 | ```{r setup, include = FALSE} 14 | knitr::opts_chunk$set( 15 | collapse = TRUE, 16 | comment = "#>" 17 | ) 18 | options(width = 80) 19 | ``` 20 | 21 | https://mne.tools/stable/auto_tutorials/clinical/60_sleep.html 22 | 23 | 24 | First we download the data: 25 | 26 | https://physionet.org/content/sleep-edfx/1.0.0/ 27 | 28 | ```{r downloading, eval=any(!file.exists(c("SC4001E0-PSG.edf","SC4001E0-PSG.edf","s1_faces.eeg"))), cache=TRUE, include=TRUE, results='hide'} 29 | # Run the following or just download the files from raw_faces folder in https://osf.io/tbwvz/ 30 | library(httr) 31 | GET("https://physionet.org/files/sleep-edfx/1.0.0/sleep-cassette/SC4001E0-PSG.edf?download", 32 | write_disk("./SC4001E0-PSG.edf", overwrite = TRUE), 33 | progress() 34 | ) 35 | GET("https://physionet.org/files/sleep-edfx/1.0.0/sleep-cassette/SC4001EC-Hypnogram.edf?download", 36 | write_disk("./SC4001E0-PSG.edf", overwrite = TRUE), 37 | progress() 38 | ) 39 | GET("https://physionet.org/files/sleep-edfx/1.0.0/sleep-cassette/SC4002E0-PSG.edf?download", 40 | write_disk("./SC4002E0-PSG.edf", overwrite = TRUE), 41 | progress() 42 | ) 43 | GET("https://physionet.org/files/sleep-edfx/1.0.0/sleep-cassette/SC4002EC-Hypnogram.edf?download", 44 | write_disk("./SC4002EC-Hypnogram.edf", overwrite = TRUE), 45 | progress() 46 | ) 47 | ``` 48 | 49 | 50 | ```{r libs, message = FALSE} 51 | library(tidytable) 52 | library(ggplot2) 53 | library(eeguana) 54 | set.seed(123) 55 | ``` 56 | 57 | 58 | 59 | ```{r} 60 | psg_01 <- read_edf("SC4002E0-PSG.edf") 61 | 62 | ``` 63 | -------------------------------------------------------------------------------- /vignettes/references.bib: -------------------------------------------------------------------------------- 1 | @article{goldberger2000physiobank, 2 | title={{PhysioBank, PhysioToolkit, and PhysioNet}: {Components} of a new research resource for complex physiologic signals}, 3 | author={Goldberger, Ary L and Amaral, Luis AN and Glass, Leon and Hausdorff, Jeffrey M and Ivanov, Plamen Ch and Mark, Roger G and Mietus, Joseph E and Moody, George B and Peng, Chung-Kang and Stanley, H Eugene}, 4 | journal={circulation}, 5 | volume={101}, 6 | number={23}, 7 | pages={e215--e220}, 8 | year={2000}, 9 | publisher={Am Heart Assoc} 10 | } 11 | @article{kemp2000analysis, 12 | title={Analysis of a sleep-dependent neuronal feedback loop: The slow-wave microcontinuity of the {EEG}}, 13 | author={Kemp, Bob and Zwinderman, Aeilko H and Tuk, Bert and Kamphuisen, Hilbert AC and Oberye, Josefien JL}, 14 | journal={IEEE Transactions on Biomedical Engineering}, 15 | volume={47}, 16 | number={9}, 17 | pages={1185--1194}, 18 | year={2000}, 19 | publisher={IEEE} 20 | } 21 | --------------------------------------------------------------------------------