{"id":16519099,"url":"https://github.com/peter-t-ruehr/ckpt2r","last_synced_at":"2025-06-27T22:32:38.986Z","repository":{"id":159300579,"uuid":"363876153","full_name":"Peter-T-Ruehr/ckpt2r","owner":"Peter-T-Ruehr","description":"Imports Stratovan Checkpoint files (*.ckpt) directly into R.","archived":false,"fork":false,"pushed_at":"2024-10-01T12:18:09.000Z","size":99,"stargazers_count":0,"open_issues_count":1,"forks_count":1,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-02T22:22:14.514Z","etag":null,"topics":["biology","botany","checkpoint","evolution","geometric-morphometrics","landmarks","microct","r","shape","tomography","zoology"],"latest_commit_sha":null,"homepage":"https://royalsocietypublishing.org/doi/10.1098/rspb.2021.0616","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/Peter-T-Ruehr.png","metadata":{"files":{"readme":"README.md","changelog":"NEWS.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2021-05-03T09:16:51.000Z","updated_at":"2024-10-01T12:18:13.000Z","dependencies_parsed_at":"2023-06-11T21:00:41.957Z","dependency_job_id":"bc6a8bda-8e5b-4246-9893-d552cfc7dbc4","html_url":"https://github.com/Peter-T-Ruehr/ckpt2r","commit_stats":null,"previous_names":["peter-t-ruehr/checkpoint_importer_for_r"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/Peter-T-Ruehr/ckpt2r","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Peter-T-Ruehr%2Fckpt2r","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Peter-T-Ruehr%2Fckpt2r/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Peter-T-Ruehr%2Fckpt2r/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Peter-T-Ruehr%2Fckpt2r/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/Peter-T-Ruehr","download_url":"https://codeload.github.com/Peter-T-Ruehr/ckpt2r/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/Peter-T-Ruehr%2Fckpt2r/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262343790,"owners_count":23296396,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["biology","botany","checkpoint","evolution","geometric-morphometrics","landmarks","microct","r","shape","tomography","zoology"],"created_at":"2024-10-11T16:45:09.775Z","updated_at":"2025-06-27T22:32:38.943Z","avatar_url":"https://github.com/Peter-T-Ruehr.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ckpt2r: Checkpoint importer for R (v.3-0-0)\n\nR package to import [Stratovan Checkpoint](https://www.stratovan.com/products/checkpoint) landmark files (*.ckpt) directly into R.\n\n## Info\n* `read_checkpoint()` imports landmarks from Stratovan Checkpoint files (*.ckpt) [1] into R[2] so that the Export-step within Checkpoint can be skipped. Returned will be a list of which each list element consists of a dataframe with the collowing columns:\n  * **defined:** missing (`M`) or present (`N`), as defined within Checkpoint. When `keep.missing = FALSE`, landmarks with the label `M` will be removed.\n  * **X, Y, Z:** x-, y- and z-coordinates of landmarks\n  * **LM:** names of landmarks\n  * **file:** name of the file that the list element was generated from\n* `array_2D_from_LM_list()` converts a set of landmarks loaded with `read_checkpoint()` into a 2D array which can then e.g. be used via [`geomorph`](https://cran.r-project.org/web/packages/geomorph/index.html) or [`mvMORPH`](https://cran.r-project.org/web/packages/mvMORPH/index.html) for geometric morphometrics analyses. The resulting data.frame will have the following dimensions: n.specimens x  n.landmarks*n.dimensions.\n\nNote that the old link `https://github.com/Peter-T-Ruehr/checkpoint_importer_for_R` links to this page.\n\n## Installation\nUse the command `devtools::install_github('https://github.com/Peter-T-Ruehr/ckpt2r')` to install the `ckpt2r` package directly from its [GitHub page](https://github.com/Peter-T-Ruehr/ckpt2r).\n\n## Issues\nIf you have trouble with the package, please raise an issue [here](https://github.com/Peter-T-Ruehr/checkpoint_importer_for_R/issues) and I will try to solve it as soon as I can.\n\n## Citation\nPlease cite the following paper when you use these functions:\n\nRühr et al. (2021): Juvenile ecology drives adult morphology in two insect orders. Proceedings of the Royal Society B 288: 20210616. https://doi.org/10.1098/rspb.2021.0616\n\n### References:\n\n[1] Stratovan Corporation, Davis, CA. https://www.stratovan.com/\n\n[2] R Core Team. 2022 R: A language and environment for statistical computing. R Foundation for Statistical Computing. Vienna, Austria: R Foundation for Statistical Computing. http://www.R-project.org.\n\n# Example R code\n```\n# if not already done, install ckpt2r\ndevtools::install_github('https://github.com/Peter-T-Ruehr/ckpt2r')\n\nremove.packages(\"ckpt2r\")\n\n# load ckpt2r\nlibrary(ckpt2r)\n\n# read all landmark files from folder without considering potential subfolders.\nfolder.with.landmarks \u003c- ckpt2r_examples()\nlandmarks_df \u003c- read_checkpoint(folder.with.landmarks,\n                                recursive = FALSE,\n                                pattern = NULL)\n\nprint(landmarks_df)\n\n# We have several two landmarks 'antenna_prox_L' and 'antenna_prox_R' marked as \n#   missing (defined = M). So let's remove these landmark lines:\nlandmarks_df \u003c- landmarks_df[landmarks_df$defined != \"M\",]\n\n# now we will convert the table into an array 2D\narray_2D \u003c- array_2D_from_df(landmarks_df, \n                             LM_column = \"LM\",\n                             specimen_column = \"file_name\",\n                             X_column = \"X\",\n                             Y_column = \"Y\",\n                             Z_column = \"Z\")\n\n# In our case, we have several landmarks that are not defined for all \n# species. Keeping these in the array_2D may cause problems in downstream\n# analyses. So let's remove all landmarks that contain NA values\narray_2D \u003c- array_2D[, - which(colSums(is.na(array_2D)) \u003e 0)]\n\n\n# convert array_2D to data.frame, add column names and remove specimen column\narray_2D \u003c- as.data.frame(array_2D)\nrownames(array_2D) \u003c- array_2D$specimen\narray_2D$specimen \u003c- NULL\n\ndim(array_2D)\n#  returns: n.specimens,  n.landmarks*n.dimensions\n#  in the example file case: (15, 51 [=17*3])\n\n# get names of landmarks that are still in array_2D\nLMs_present = unique(gsub(\"_\\\\w{1}$\", \"\", colnames(array_2D)))\nprint(LMs_present)\n\n# turn 2D array into 3D array\nrequire(geomorph)\narray.3D \u003c- arrayspecs(A = array_2D,\n                       p = (ncol(array_2D)/3),\n                       k = 3, \n                       sep = \".\") \ndim(array.3D)\n# n.landmarks, n.dimenions, specimens\n#  in the example file case: (17, 3, 15)\n\n# Procrustes alignment\ngpa.results \u003c- gpagen(array.3D)\n# !!! if this returned:\n#   Error in gpagen(array.3D) : \n#     Data matrix contains missing values. Estimate these first (see 'estimate.missing').\n# !!! then check if you still have NA values in your array 2D.\n\n# this should be fine now\nsummary(gpa.results$coords)\n\n# plot all LM points of all specimens\nfor(i in 1:length(landmarks_df)){\n  if(i == 1){\n    plot(gpa.results$coords[,,i], pch = 16, cex = 0.5, col=\"gray80\")\n  } else {\n    points(gpa.results$coords[,,i], pch = 16, cex = 0.5, col=\"gray80\")\n  }\n}\n\n# plot consensus of all LM points of all specimens\npoints(gpa.results$consensus, pch=16)\ntext(gpa.results$consensus, labels = LMs_present, \n     pos = 4, cex = 0.75, srt=-30)\n\n# run PCA\npca.results \u003c- gm.prcomp(A = gpa.results$coords)\n\n# print and plot PCA results\nsummary(pca.results)\nplot(pca.results, pch = 16)\ntext(pca.results$x[, 1:2], labels = rownames(pca.results$x), \n     pos = 4, cex = 0.75, srt=-0)\n\n# and so on...\n```\n\n# History\n* v.3-0-0 (2022-11-03)\n  * total re-write of code\n    * read_checkpoint() returns data frame now\n    * replaced array_2D_from_LM_list() with array_2D_from_df() accordingly\n* v.2-1-0 (2022-10-07)\n  * changed package name from `chkpt2r` to `ckpt2r` to reflect actual Checkpoint file names\n  * changed readme and example code accordingly\n* v.2-0-0 (2022-10-05)\n  * changed scripts into package\n  * renamed `read.checkpoint()` to `read_checkpoint()`\n  * renamed `array.2D.from.LM_list()` to `array_2D_from_LM_list()`\n  * reworked example code\n  * added example files\n  * added `ckpt2r_examples()` function\n* v.1-1-0 (2022-10-04)\n  * added `array.2D.from.LM_list()` (after request from Christy Anna Hipsley)\n  * added example R code to Readme file\n* v.1-0-0 (2021)\n  * [![DOI](https://zenodo.org/badge/DOI/10.5281/zenodo.5482977.svg)](https://doi.org/10.5281/zenodo.5482977)\n  * first version that came with the paper\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-t-ruehr%2Fckpt2r","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpeter-t-ruehr%2Fckpt2r","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpeter-t-ruehr%2Fckpt2r/lists"}