{"id":21723456,"url":"https://github.com/ingmarboeschen/mongotable","last_synced_at":"2026-05-19T05:39:53.761Z","repository":{"id":262229091,"uuid":"886603455","full_name":"ingmarboeschen/mongoTable","owner":"ingmarboeschen","description":"Generates one-dimensional and two-dimensional frequency tables from data stored in a MongoDB database.","archived":false,"fork":false,"pushed_at":"2025-04-10T07:48:23.000Z","size":259,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-12T22:49:12.704Z","etag":null,"topics":["frequency-table","mongodb","r"],"latest_commit_sha":null,"homepage":"","language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ingmarboeschen.png","metadata":{"files":{"readme":"README.md","changelog":null,"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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2024-11-11T09:20:44.000Z","updated_at":"2025-04-10T07:48:26.000Z","dependencies_parsed_at":"2024-11-11T10:27:30.902Z","dependency_job_id":"f433f9e0-6f6c-4a87-98d6-555c1bd36370","html_url":"https://github.com/ingmarboeschen/mongoTable","commit_stats":null,"previous_names":["ingmarboeschen/mongotable"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ingmarboeschen/mongoTable","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ingmarboeschen%2FmongoTable","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ingmarboeschen%2FmongoTable/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ingmarboeschen%2FmongoTable/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ingmarboeschen%2FmongoTable/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ingmarboeschen","download_url":"https://codeload.github.com/ingmarboeschen/mongoTable/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ingmarboeschen%2FmongoTable/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279013280,"owners_count":26085250,"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","status":"online","status_checked_at":"2025-10-12T02:00:06.719Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["frequency-table","mongodb","r"],"created_at":"2024-11-26T02:39:26.282Z","updated_at":"2026-05-19T05:39:53.753Z","avatar_url":"https://github.com/ingmarboeschen.png","language":"R","funding_links":[],"categories":[],"sub_categories":[],"readme":"# mongoTable::mongoTable()\n\nThis R function generates one-dimensional and two-dimensional frequency tables from data stored in a MongoDB database. Rather than retrieving the entire dataset through a `find()` operation, this function leverages MongoDB's aggregation capabilities to compile frequency data directly on the server, followed by post-processing in R.\n\n## Usage\n```R\nmongoTable(connection, x, y = NULL, query = \"{}\",lowerize = FALSE, limit = NULL, sort = FALSE, decreasing = TRUE)\n```\n\n## Arguments\n\n| Name | Description|\n| :--- | :--- |\n| connection   | character. A mongo connection object initiated with mongolite::mongo().|\n| x            |  character. A field variable for which frequencies should be counted.|\n| y            |  character. An optional second field variable for which frequencies should be counted.|\n| query        |  character. An optional MongoDB query for data subset selection (e.g.: ’{\\\"year\\\": 2024}’). |\n| lowerize     | logical. All levels in one dimensional tables will be lowerized. |\n| limit     | integer. Defines the maximum length/dimensions of output.|\n| sort       |  logical. If TRUE, the output is sorted by frequency.|\n| decreasing  | logical. If TRUE and sort==TRUE, the output is returned with decreasing frequencies. If TRUE and sort==FALSE, level names are returned in decreasing manner.|\n\n## Installation with the pak package\n```R\nif(require(pak)!=TRUE) install.packages(\"pak\")\npak::pak(\"ingmarboeschen/mongoTable\")\n```\n\n## Examples\n```R\n## use mongolite::mongo() to connect to a MongoDB instance (demo server)\nmon \u003c- mongolite::mongo(\"mtcars\", url = \"mongodb+srv://readwrite:test@cluster0-84vdt.mongodb.net/test\")\nif(mon$count() \u003e 0) mon$drop()\nmon$insert(mtcars)\nstopifnot(mon$count() == nrow(mtcars))\n\n## Create a one-dimensional frequency table\n# for all x\nmongoTable(connection = \"mon\", x = \"cyl\")\n\n# for all x matching a query (cars with mpg greater than 20)\nmongoTable(connection=\"mon\", x=\"cyl\", query = '{\\\"mpg\\\": {\\\"$gt\": 20}}')\n\n## Create a two-dimensional frequency table\n# for all x and y\nmongoTable(con = \"mon\", x = \"cyl\", y = \"gear\")\n\n# for all x and y matching a query (cars with mpg greater than 20)\nmongoTable(con=\"mon\", x = \"cyl\", y = \"gear\", query = '{\\\"mpg\\\": {\\\"$gt\": 20}}')\n\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fingmarboeschen%2Fmongotable","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fingmarboeschen%2Fmongotable","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fingmarboeschen%2Fmongotable/lists"}