{"id":18555411,"url":"https://github.com/bearloga/dotnet","last_synced_at":"2025-06-26T00:03:40.551Z","repository":{"id":146996617,"uuid":"271366618","full_name":"bearloga/dotnet","owner":"bearloga","description":"'knitr' Engine for C# and F# Languages and R Wrapper for 'dotnet' Command Line Interface","archived":false,"fork":false,"pushed_at":"2022-03-22T21:36:25.000Z","size":22,"stargazers_count":8,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-06-26T00:02:15.378Z","etag":null,"topics":["c-sharp","csharp","dotnet","f-sharp","fsharp","knitr","r","r-package","rmarkdown"],"latest_commit_sha":null,"homepage":null,"language":"R","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bearloga.png","metadata":{"files":{"readme":"README.Rmd","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":"2020-06-10T19:27:04.000Z","updated_at":"2024-08-17T22:53:21.000Z","dependencies_parsed_at":null,"dependency_job_id":"7a91cf3f-c3ea-43da-9c1b-3463901be9f0","html_url":"https://github.com/bearloga/dotnet","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/bearloga/dotnet","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bearloga%2Fdotnet","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bearloga%2Fdotnet/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bearloga%2Fdotnet/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bearloga%2Fdotnet/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bearloga","download_url":"https://codeload.github.com/bearloga/dotnet/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bearloga%2Fdotnet/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261973720,"owners_count":23238585,"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":["c-sharp","csharp","dotnet","f-sharp","fsharp","knitr","r","r-package","rmarkdown"],"created_at":"2024-11-06T21:26:33.143Z","updated_at":"2025-06-26T00:03:40.368Z","avatar_url":"https://github.com/bearloga.png","language":"R","readme":"---\noutput: github_document\n---\n\n\u003c!-- README.md is generated from README.Rmd. Please edit that file --\u003e\n\n```{r, include = FALSE}\nknitr::opts_chunk$set(\n  collapse = TRUE,\n  comment = \"#\u003e\",\n  fig.path = \"man/figures/README-\",\n  out.width = \"100%\"\n)\n```\n\n# dotnet\n\n\u003c!-- badges: start --\u003e\n\u003c!-- badges: end --\u003e\n\nThe primary goal of {dotnet} is to provide a [{knitr}](https://yihui.org/knitr/) [engine](https://yihui.org/knitr/demo/engines/) for the [C#](https://docs.microsoft.com/en-us/dotnet/csharp/) and [F#](https://docs.microsoft.com/en-us/dotnet/fsharp/) languages and the [.NET Framework](https://dotnet.microsoft.com/). Internally, it accomplishes via an R6-based interface for the `dotnet` command line interface for building .NET applications. See `?DotNetApp` for details.\n\n*Not to be confused* with:\n\n- [{rDotNet}](https://cran.r-project.org/package=rDotNet) R package which is a \"low-level interface to '.NET' virtual machine\" and which \"can create '.NET' objects, call methods, get or set properties, call static functions, etc.\"\n- [R.NET](https://rdotnet.github.io/rdotnet/) NuGet package which \"enables the .NET Framework to interoperate with the R statistical language in the same process\"\n\n**Notice**: this package is released as-is. I don't know that I'll be able to maintain it all that much. Like, the original motivation for this package was wanting to write a blog post about Bayesian inference and probabilistic programming with [Infer.NET](https://dotnet.github.io/infer/) in [R Markdown](https://rmarkdown.rstudio.com/) for my [{blogdown}](https://bookdown.org/yihui/blogdown/)-based site. Which is to say it was a fun, goofy exercise in learning how to make a custom knitr engine. Also, \"C#/F# in R Markdown in blogdown-based websites\" is a VERY obscure use-case. Let me know on Twitter if you use this package. (I'm [bearloga](https://twitter.com/bearloga) on there.)\n\nIt is licensed under [BSD 2-Clause \"Simplified\" License](LICENSE.md).\n\n## Installation\n\nTo start rendering R Markdown documents with `dotnet` engine chunks, you need to be able to build .NET apps on your system. Download and install the [.NET SDK](https://dotnet.microsoft.com/download). If you can run `dotnet` in Terminal without problems, you're set.\n\n``` r\nremotes::install_github(\"bearloga/dotnet\")\n```\n\n## Usage\n\nFirst, the `dotnet` engine must be registered with knitr:\n\n```{r}\ndotnet::register_engine()\n```\n\nOnce registered with knitr, we use the `dotnet` engine to run programs written in C#:\n\n````\n`r ''````{dotnet}\nusing System;\n```\n````\n\nThe following examples are `dotnet`-using chunks in this README's source Rmd document.\n\n```{dotnet hello_world_cs, cache=TRUE}\nusing System;\n\nclass Program {\n  static void Main(string[] args) {\n    Console.WriteLine(\"Hello from C# and R Markdown!\");\n  }\n}\n```\n\n...and programs written in F#, by specifying `engine.opts = list(language = 'F#')` in the chunk options:\n\n```{dotnet hello_world_fs, engine.opts = list(language = 'F#'), cache=TRUE}\nopen System\n\n[\u003cEntryPoint\u003e]\nlet main argv =\n    printfn \"Hello from F# and R Markdown!\"\n    0 // return an integer exit code\n```\n\nPrograms with source code split across multiple chunks are supported. Refer to the [multi-chunk programs vignette](vignettes/multi-chunk-program.Rmd) for reference.\n\nPrograms with dependencies on NuGet packages can add those via `engine.opts`. For example:\n\n````\n`r ''````{dotnet, engine.opts = list(add_packages = c('Microsoft.ML.Probabilistic.Compiler'))}\nusing System;\nusing Microsoft.ML.Probabilistic.Models;\n```\n````\n\nThis is demonstrated in the [\"Inference on two coins with Infer.NET\" vignette](vignettes/two-coins.Rmd).\n\nRefer to `?register_engine` for more information about the `dotnet` knitr engine..\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbearloga%2Fdotnet","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbearloga%2Fdotnet","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbearloga%2Fdotnet/lists"}