I have a dataframe (or a csv file I suppose) like this:
"Financial Institution","Rate","Insured By" Saven Financial,1.55,FSRA Neo Financial,1.55,CDIC
I wish to convert this to a CSVW JSON-LD format as per this article on tabular data.
I've hand coded a version in Rmarkdown. See below. Is there an R package that makes this transformation easy?
--- title: "Structured Demo 3 - Test" --- <script type="application/ld+json"> { "@context": "http://schema.org", "@type": "Dataset", "name":"Canadian High-Interest Savings Accounts", "description": "Up-to-date and unbiased table of rates of high-interest savings accounts from Canadian banks and credit unions along with their insurer.", "publisher": { "@type": "Organization", "name": "Company X" }, "mainEntity" : { "@type" : "csvw:Table", "csvw:tableSchema": { "csvw:columns": [ { "csvw:name": "Financial Institution", "csvw:datatype": "string", "csvw:cells": [ { "csvw:value": "Saven Financial", "csvw:primaryKey": "Saven Financial" }, { "csvw:value": "Neo Financial", "csvw:primaryKey": "Neo Financial" }] }, { "csvw:name": "Rate", "csvw:datatype": "string", "csvw:cells": [ { "csvw:value": "1.55", "csvw:primaryKey": "Saven Financial" }, { "csvw:value": "1.55", "csvw:primaryKey": "Neo Financial" }] }, { "csvw:name": "Insured By", "csvw:datatype": "string", "csvw:cells": [ { "csvw:value": "FSRA", "csvw:primaryKey": "Saven Financial" }, { "csvw:value": "CDIC", "csvw:primaryKey": "Neo Financial" }] }] } } } </script>
https://stackoverflow.com/questions/67377891/r-package-to-go-from-csv-to-csvw-json-ld May 04, 2021 at 10:05AM
没有评论:
发表评论