codemark 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/Gemfile +9 -0
- data/LICENSE +21 -0
- data/README.md +31 -0
- data/Rakefile +26 -0
- data/bin/codemark +21 -0
- data/codemark.gemspec +28 -0
- data/lib/codemark.rb +3 -0
- data/lib/codemark/rmd_to_r.rb +127 -0
- data/lib/codemark/version.rb +4 -0
- data/spec/fixtures/sem-intro.R +103 -0
- data/spec/fixtures/sem-intro.Rmd +146 -0
- metadata +133 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: edb0e35579c3fd7f5039a51ec781b72dc0fba90113440867585f217be7bd6fc3
|
4
|
+
data.tar.gz: c273461cab44d2de8aa3bd90baa436a803c1ef8c8258b7ad2e3b4e50a978fdea
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 3782a33d4902fe93d98f9918907f03b0a9f82b962f0a9e0a3da1152f321c9c11a84ed3daccbec48bff4049b621a3be768737fd9db7d30e53a53286d00ed0b039
|
7
|
+
data.tar.gz: 45cc3bdc0c9b59baaba9324f0c5f8363a387f5ed503da16b5b8af943c555630c98abc10e0adb19e387ff62e3151e381f776993164b3fbb20f344a83f30f509f1
|
data/.gitignore
ADDED
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2021 Soumya Ray
|
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.
|
data/README.md
ADDED
@@ -0,0 +1,31 @@
|
|
1
|
+
# CodeMark Gem
|
2
|
+
|
3
|
+
Ruby gem to convert RMarkdown (.Rmd) files to pure R scripts (.R)
|
4
|
+
|
5
|
+
## Main Features
|
6
|
+
|
7
|
+
- Strips out Rmd headers
|
8
|
+
- Converts Rmd regular text to R comments
|
9
|
+
- Converts headers to comment, marking the header level
|
10
|
+
- Wraps text to 80 chars/line and makes each line a comment
|
11
|
+
- Converts horizontal rules to commented series of many dashes
|
12
|
+
- Converts Rmd code chunks to regular R code
|
13
|
+
- Does not copy over non-echoed code (i.e., ignores `echo={FALSE|false|F}`)
|
14
|
+
|
15
|
+
## Usage
|
16
|
+
|
17
|
+
Execute in shell using:
|
18
|
+
|
19
|
+
```shell
|
20
|
+
codemark <filename.Rmd>
|
21
|
+
```
|
22
|
+
|
23
|
+
CodeMark will produce a corresponding file called `filename.R`
|
24
|
+
|
25
|
+
## Testing
|
26
|
+
|
27
|
+
Not yet implemented
|
28
|
+
|
29
|
+
## Contribute
|
30
|
+
|
31
|
+
Pull requests and issues are welcome on Github
|
data/Rakefile
ADDED
@@ -0,0 +1,26 @@
|
|
1
|
+
task :default => :spec
|
2
|
+
|
3
|
+
desc 'Run specs'
|
4
|
+
task :spec do
|
5
|
+
sh 'ruby -I lib spec/citesight_spec.rb'
|
6
|
+
end
|
7
|
+
|
8
|
+
desc 'Rerun specs'
|
9
|
+
task :respec do
|
10
|
+
sh 'rerun -c -p "**/*.{rb,Rmd}" ./bin/codemark sem-intro.Rmd'
|
11
|
+
end
|
12
|
+
|
13
|
+
desc 'Build the gem'
|
14
|
+
task :build do
|
15
|
+
sh 'gem build codemark.gemspec'
|
16
|
+
end
|
17
|
+
|
18
|
+
desc 'Install the local gemfile'
|
19
|
+
task :install => :build do
|
20
|
+
sh 'gem install --local codemark'
|
21
|
+
end
|
22
|
+
|
23
|
+
desc 'Install the local gemfile'
|
24
|
+
task :uninstall do
|
25
|
+
sh 'gem uninstall -x codemark'
|
26
|
+
end
|
data/bin/codemark
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
$LOAD_PATH.unshift File.join(File.dirname(__FILE__), *%w[.. lib])
|
4
|
+
require 'codemark'
|
5
|
+
|
6
|
+
fail ArgumentError, "Usage: codemark [filename.Rmd]\n" if ARGV.count == 0
|
7
|
+
|
8
|
+
# Read RMarkdown file
|
9
|
+
filename_rmd = ARGV[0]
|
10
|
+
rmd_file = File.open(filename_rmd, 'r').read
|
11
|
+
|
12
|
+
# Convert Rmd to R
|
13
|
+
code = Redcarpet::Markdown.new(CodeMark::MarkdownToR.new, extensions = {})
|
14
|
+
rendered = code.render(rmd_file)
|
15
|
+
|
16
|
+
# Output R file
|
17
|
+
file = filename_rmd.match(/(?<name>.*)\.rmd/i)
|
18
|
+
filename_r = "#{file[:name]}.R"
|
19
|
+
File.write(filename_r, rendered)
|
20
|
+
|
21
|
+
puts "#{filename_r} written\n"
|
data/codemark.gemspec
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
$:.push File.expand_path("../lib", __FILE__)
|
2
|
+
require 'codemark/version'
|
3
|
+
|
4
|
+
Gem::Specification.new do |s|
|
5
|
+
s.name = 'codemark'
|
6
|
+
s.version = CodeMark::VERSION
|
7
|
+
s.date = CodeMark::DATE
|
8
|
+
|
9
|
+
s.executables << 'codemark'
|
10
|
+
|
11
|
+
s.add_runtime_dependency 'redcarpet', '~> 3.5', '>= 3.5.1'
|
12
|
+
|
13
|
+
s.add_development_dependency 'minitest', '~> 5.14'
|
14
|
+
s.add_development_dependency 'minitest-rg', '~> 5.2'
|
15
|
+
s.add_development_dependency 'rerun', '~> 0.13'
|
16
|
+
s.add_development_dependency 'pry', '~> 0.14'
|
17
|
+
|
18
|
+
s.summary = 'Converts RMarkdown files to pure R scripts'
|
19
|
+
s.description = 'Makes Rmd text into R comments and unfences code chunks'
|
20
|
+
s.authors = ['Soumya Ray']
|
21
|
+
s.email = 'soumya.ray@gmail.com'
|
22
|
+
|
23
|
+
s.files = `git ls-files`.split("\n")
|
24
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
25
|
+
|
26
|
+
s.homepage = 'https://github.com/soumyaray/codemark'
|
27
|
+
s.license = 'MIT'
|
28
|
+
end
|
data/lib/codemark.rb
ADDED
@@ -0,0 +1,127 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'redcarpet'
|
4
|
+
|
5
|
+
module CodeMark
|
6
|
+
class MarkdownToR < Redcarpet::Render::Base
|
7
|
+
def preprocess(full_document)
|
8
|
+
# strip headers
|
9
|
+
headers_rx = "^---\n([a-zA-Z_]*:.[^\n]+\n)+---\n"
|
10
|
+
regx = /(?<headers>#{headers_rx})(?<body>.*)/m
|
11
|
+
doc = full_document.match(regx)
|
12
|
+
doc[:body]
|
13
|
+
end
|
14
|
+
|
15
|
+
# def block_code(code, language)
|
16
|
+
# code
|
17
|
+
# end
|
18
|
+
|
19
|
+
# def block_quote(quote)
|
20
|
+
# quote
|
21
|
+
# end
|
22
|
+
|
23
|
+
# def block_html(raw_html)
|
24
|
+
# raw_html
|
25
|
+
# end
|
26
|
+
|
27
|
+
# def footnotes(content)
|
28
|
+
# content
|
29
|
+
# end
|
30
|
+
|
31
|
+
# def footnote_def(content, number)
|
32
|
+
# content
|
33
|
+
# end
|
34
|
+
|
35
|
+
def header(text, header_level)
|
36
|
+
"#" + "*"*header_level + " " + text + "\n\n"
|
37
|
+
end
|
38
|
+
|
39
|
+
def hrule()
|
40
|
+
'#' + '-'*50
|
41
|
+
end
|
42
|
+
|
43
|
+
# def list(contents, list_type)
|
44
|
+
# contents
|
45
|
+
# end
|
46
|
+
|
47
|
+
# def list_item(text, list_type)
|
48
|
+
# text
|
49
|
+
# end
|
50
|
+
|
51
|
+
def paragraph(text)
|
52
|
+
return nil if text == '\newpage'
|
53
|
+
|
54
|
+
|
55
|
+
# codeblock started at this para?
|
56
|
+
start_code = text.match(/^```{r(?<code_spec>[^}]*)}[\n]*(?<code>.*)/m)
|
57
|
+
if start_code
|
58
|
+
@code_started = true
|
59
|
+
@code_ignore = false
|
60
|
+
if start_code[:code_spec].match(/echo[ ]*=[ ]*(f|F)/)
|
61
|
+
@code_ignore = true
|
62
|
+
end
|
63
|
+
|
64
|
+
text = start_code[:code]
|
65
|
+
end
|
66
|
+
|
67
|
+
# codeblock ends with this para?
|
68
|
+
end_code = text.match(/(?<code>.*)\n```$/m)
|
69
|
+
if end_code
|
70
|
+
text = end_code[:code]
|
71
|
+
@code_ends = true
|
72
|
+
end
|
73
|
+
|
74
|
+
# Comment out regular text
|
75
|
+
unless @code_started
|
76
|
+
text = "# " + text
|
77
|
+
|
78
|
+
# Wrap regular text with commented lines
|
79
|
+
if text.length > 80
|
80
|
+
final = text.split(' ').reduce({full:'', sentence:''}) do |sofar, word|
|
81
|
+
possible_sentence = sofar[:sentence] + " " + word
|
82
|
+
if (possible_sentence).length <= 80
|
83
|
+
sofar[:sentence] = possible_sentence
|
84
|
+
else
|
85
|
+
sofar[:full] = sofar[:full] + "\n" + sofar[:sentence]
|
86
|
+
sofar[:sentence] = "# " + word
|
87
|
+
end
|
88
|
+
sofar
|
89
|
+
end
|
90
|
+
|
91
|
+
text = final[:full].strip + "\n" + final[:sentence]
|
92
|
+
end
|
93
|
+
|
94
|
+
end
|
95
|
+
|
96
|
+
if @code_ends
|
97
|
+
@code_started = @code_ends = false
|
98
|
+
end
|
99
|
+
|
100
|
+
unless @code_ignore
|
101
|
+
text + "\n\n"
|
102
|
+
end
|
103
|
+
end
|
104
|
+
|
105
|
+
# def table(header, body)
|
106
|
+
# header
|
107
|
+
# end
|
108
|
+
|
109
|
+
# def table_row(content)
|
110
|
+
# content
|
111
|
+
# end
|
112
|
+
|
113
|
+
# def table_cell(content, alignment, header)
|
114
|
+
# content
|
115
|
+
# end
|
116
|
+
|
117
|
+
# SPAN LEVEL CALLS
|
118
|
+
# def codespan(code)
|
119
|
+
# code
|
120
|
+
# end
|
121
|
+
|
122
|
+
# LOW LEVEL CALLS
|
123
|
+
# def normal_text(text)
|
124
|
+
# text
|
125
|
+
# end
|
126
|
+
end
|
127
|
+
end
|
@@ -0,0 +1,103 @@
|
|
1
|
+
#* Introduction SEM
|
2
|
+
|
3
|
+
# Structural Equation Modeling excels at allowing researchers to measure
|
4
|
+
# relationships between multi-item constructs. *Constructs* are statistical
|
5
|
+
# representation of concepts that are hard to measure in with a singular metric,
|
6
|
+
# and are best represented by multiple measurements.
|
7
|
+
|
8
|
+
# Each SEM is defined by two models: a **measurement model** that describes how
|
9
|
+
# each construct is measured using multiple items, and **structural model** that
|
10
|
+
# describes the structure of causal relationships between the constructs. The
|
11
|
+
# parameters of an SEM can then be **estimated** and **visualized** by the
|
12
|
+
# SEMinR package.
|
13
|
+
|
14
|
+
#* Measurement Model
|
15
|
+
|
16
|
+
library(seminr)
|
17
|
+
|
18
|
+
influence_mm <- constructs(
|
19
|
+
reflective("PL", multi_items("pl_", 1:4)),
|
20
|
+
reflective("PQ", multi_items("pq_", 1:4)),
|
21
|
+
reflective("PI", multi_items("pi_", 1:5)))
|
22
|
+
|
23
|
+
# Four constructs are defined in this measurement model. Note how the
|
24
|
+
# constructs are collectively defined within the `constructs()` function. Each
|
25
|
+
# construct is defined as being reflected in their measurement items using the
|
26
|
+
# `reflective()` function. And the multiple items reflecting each construct are
|
27
|
+
# defined by the `multi_items()` function. **The syntax of our SEMinR package
|
28
|
+
# closely matches the vocabulary that researchers use to describe such models!**
|
29
|
+
|
30
|
+
#* Structural Model
|
31
|
+
|
32
|
+
# We can define the structural model of an SEM by specifying the
|
33
|
+
# *relationships* between the constructs — specifically, the causal paths *from*
|
34
|
+
# each construct *to* other constructs.
|
35
|
+
|
36
|
+
influence_sm <- relationships(
|
37
|
+
paths(from = c("PL", "PQ"), to = c("PI")))
|
38
|
+
|
39
|
+
# Note that we can define a set of relationships at once. In the `paths()`
|
40
|
+
# function call above, we defines two paths, one from each of `PL` and `PQ` to
|
41
|
+
# each of `PI`.
|
42
|
+
|
43
|
+
#* Data
|
44
|
+
|
45
|
+
# Once we have the measurement and structural models of an SEM defined in
|
46
|
+
# SEMinR, we can proceed to estimate the measurement and structural parameters
|
47
|
+
# from a sample of data. The data should contain *observations* of each
|
48
|
+
# measurement item for each case (e.g., survey respondent). The data typically
|
49
|
+
# resides in a file with a data format such as `.csv` (comma separated
|
50
|
+
# variables), though there are R packages to load data in other formats such as
|
51
|
+
# `.sav` (SPSS data), `xlsx` (Excel data sheet), and so on.
|
52
|
+
|
53
|
+
influence_data <- read.csv("data/influencer_data_book_final.csv")
|
54
|
+
|
55
|
+
#* Estimation
|
56
|
+
|
57
|
+
# We can use the data we have loaded to now estimate the parameters of our SEM.
|
58
|
+
# In this case, we use an estimate technique called *covariance-based SEM*
|
59
|
+
# (CB-SEM).
|
60
|
+
|
61
|
+
influence_model <- estimate_cbsem(
|
62
|
+
data = influence_data,
|
63
|
+
measurement_model = influence_mm,
|
64
|
+
structural_model = influence_sm)
|
65
|
+
|
66
|
+
# The `influence_model` object in which the estimation is stored does not
|
67
|
+
# contain a full report that researchers would be interested in. Instead,
|
68
|
+
# researchers will want to ask SEMinR to *summarize* the results cogently for
|
69
|
+
# interpretation.
|
70
|
+
|
71
|
+
influence_summary <- summary(influence_model)
|
72
|
+
|
73
|
+
# The `influence_summary` object holds a wealth of other estimated values that
|
74
|
+
# researchers might wish to inspect or report. For example, researchers applying
|
75
|
+
# CB-SEM are typically interested in the quality of the estimation, including
|
76
|
+
# details of how well the SEM model *fits* the data (we show only a part of the
|
77
|
+
# full fit report below):
|
78
|
+
|
79
|
+
influence_summary$quality$fit
|
80
|
+
|
81
|
+
influence_summary$quality$fit$curated$ordinary
|
82
|
+
|
83
|
+
# These fit metrics should be familiar to CB-SEM practitioners. The summary
|
84
|
+
# object can also be inspect for the estimated parameters of interest, such as
|
85
|
+
# the measurement quality:
|
86
|
+
|
87
|
+
influence_summary$quality$reliability
|
88
|
+
|
89
|
+
# And also the structural paths that researchers often hypothesize
|
90
|
+
|
91
|
+
influence_summary$paths
|
92
|
+
|
93
|
+
#* Visualization
|
94
|
+
|
95
|
+
# Researchers often find that it is helpful to get a high-level glimpse of
|
96
|
+
# their model description and results from a visualization.
|
97
|
+
|
98
|
+
#* Join us
|
99
|
+
|
100
|
+
#** Collaboration and Feedback
|
101
|
+
|
102
|
+
#** Social Media
|
103
|
+
|
@@ -0,0 +1,146 @@
|
|
1
|
+
---
|
2
|
+
title: "Introduction to SEM and SEMinR"
|
3
|
+
author: "Soumya Ray, Nicholas Danks"
|
4
|
+
date: "4/21/2021"
|
5
|
+
output: pdf_document
|
6
|
+
always_allow_html: true
|
7
|
+
---
|
8
|
+
|
9
|
+
# Introduction SEM
|
10
|
+
|
11
|
+
Structural Equation Modeling excels at allowing researchers to measure relationships between multi-item constructs. *Constructs* are statistical representation of concepts that are hard to measure in with a singular metric, and are best represented by multiple measurements.
|
12
|
+
|
13
|
+
Each SEM is defined by two models: a **measurement model** that describes how each construct is measured using multiple items, and **structural model** that describes the structure of causal relationships between the constructs. The parameters of an SEM can then be **estimated** and **visualized** by the SEMinR package.
|
14
|
+
|
15
|
+
```{r eval=TRUE, echo=FALSE}
|
16
|
+
library(seminr)
|
17
|
+
|
18
|
+
influence_mm <- constructs(
|
19
|
+
reflective("PL", multi_items("pl_", 1:4)),
|
20
|
+
reflective("PQ", multi_items("pq_", 1:4)),
|
21
|
+
reflective("PI", multi_items("pi_", 1:5)))
|
22
|
+
|
23
|
+
influence_sm <- relationships(
|
24
|
+
paths(from = c("PL", "PQ"), to = c("PI")))
|
25
|
+
|
26
|
+
influence_model <- specify_model(influence_mm, influence_sm)
|
27
|
+
influence_model_plot <- plot(influence_model)
|
28
|
+
save_plot("figures/influencer_model_plot.png", influence_model_plot)
|
29
|
+
```
|
30
|
+
|
31
|
+
```{r simpleModel, fig.align = 'center', out.width = "50%", fig.cap = "Simplified Influencer Model", echo = F}
|
32
|
+
knitr::include_graphics("figures/influencer_model_plot.png")
|
33
|
+
```
|
34
|
+
|
35
|
+
# Measurement Model
|
36
|
+
|
37
|
+
We can define the measurement model of an SEM simply by describing each construct by its set of *measurement items* that *reflect* the underlying concept. Let's see a simplified example from the Influencer model and dataset we will use:
|
38
|
+
|
39
|
+
```{r}
|
40
|
+
library(seminr)
|
41
|
+
|
42
|
+
influence_mm <- constructs(
|
43
|
+
reflective("PL", multi_items("pl_", 1:4)),
|
44
|
+
reflective("PQ", multi_items("pq_", 1:4)),
|
45
|
+
reflective("PI", multi_items("pi_", 1:5)))
|
46
|
+
```
|
47
|
+
|
48
|
+
Four constructs are defined in this measurement model. Note how the constructs are collectively defined within the `constructs()` function. Each construct is defined as being reflected in their measurement items using the `reflective()` function. And the multiple items reflecting each construct are defined by the `multi_items()` function. **The syntax of our SEMinR package closely matches the vocabulary that researchers use to describe such models!**
|
49
|
+
|
50
|
+
# Structural Model
|
51
|
+
|
52
|
+
We can define the structural model of an SEM by specifying the *relationships* between the constructs — specifically, the causal paths *from* each construct *to* other constructs.
|
53
|
+
|
54
|
+
```{r}
|
55
|
+
influence_sm <- relationships(
|
56
|
+
paths(from = c("PL", "PQ"), to = c("PI")))
|
57
|
+
```
|
58
|
+
|
59
|
+
Note that we can define a set of relationships at once. In the `paths()` function call above, we defines two paths, one from each of `PL` and `PQ` to each of `PI`.
|
60
|
+
|
61
|
+
# Data
|
62
|
+
|
63
|
+
Once we have the measurement and structural models of an SEM defined in SEMinR, we can proceed to estimate the measurement and structural parameters from a sample of data. The data should contain *observations* of each measurement item for each case (e.g., survey respondent). The data typically resides in a file with a data format such as `.csv` (comma separated variables), though there are R packages to load data in other formats such as `.sav` (SPSS data), `xlsx` (Excel data sheet), and so on.
|
64
|
+
|
65
|
+
```{r}
|
66
|
+
influence_data <- read.csv("data/influencer_data_book_final.csv")
|
67
|
+
```
|
68
|
+
|
69
|
+
# Estimation
|
70
|
+
|
71
|
+
We can use the data we have loaded to now estimate the parameters of our SEM. In this case, we use an estimate technique called *covariance-based SEM* (CB-SEM).
|
72
|
+
|
73
|
+
```{r}
|
74
|
+
influence_model <- estimate_cbsem(
|
75
|
+
data = influence_data,
|
76
|
+
measurement_model = influence_mm,
|
77
|
+
structural_model = influence_sm)
|
78
|
+
```
|
79
|
+
|
80
|
+
The `influence_model` object in which the estimation is stored does not contain a full report that researchers would be interested in. Instead, researchers will want to ask SEMinR to *summarize* the results cogently for interpretation.
|
81
|
+
|
82
|
+
```{r}
|
83
|
+
influence_summary <- summary(influence_model)
|
84
|
+
```
|
85
|
+
|
86
|
+
\newpage
|
87
|
+
|
88
|
+
The `influence_summary` object holds a wealth of other estimated values that researchers might wish to inspect or report. For example, researchers applying CB-SEM are typically interested in the quality of the estimation, including details of how well the SEM model *fits* the data (we show only a part of the full fit report below):
|
89
|
+
|
90
|
+
```{r eval=FALSE, echo=TRUE}
|
91
|
+
influence_summary$quality$fit
|
92
|
+
```
|
93
|
+
|
94
|
+
```{r eval=FALSE, echo=TRUE}
|
95
|
+
influence_summary$quality$fit$curated$ordinary
|
96
|
+
```
|
97
|
+
|
98
|
+
These fit metrics should be familiar to CB-SEM practitioners. The summary object can also be inspect for the estimated parameters of interest, such as the measurement quality:
|
99
|
+
|
100
|
+
```{r}
|
101
|
+
influence_summary$quality$reliability
|
102
|
+
```
|
103
|
+
|
104
|
+
And also the structural paths that researchers often hypothesize
|
105
|
+
|
106
|
+
```{r}
|
107
|
+
influence_summary$paths
|
108
|
+
```
|
109
|
+
|
110
|
+
\newpage
|
111
|
+
|
112
|
+
# Visualization
|
113
|
+
|
114
|
+
Researchers often find that it is helpful to get a high-level glimpse of their model description and results from a visualization.
|
115
|
+
|
116
|
+
```{r echo=FALSE, results='hide', cache=TRUE}
|
117
|
+
png(filename = "figures/influence_estimated_plot.png", width = 900, height=600)
|
118
|
+
plot(influence_model)
|
119
|
+
dev.off()
|
120
|
+
```
|
121
|
+
|
122
|
+
```{r estimated_model, fig.align = 'center', out.width = "70%", fig.cap = "Visualization of Simplified Influencer Model", echo = FALSE}
|
123
|
+
knitr::include_graphics("figures/influence_estimated_plot.png")
|
124
|
+
```
|
125
|
+
|
126
|
+
We hope this brief introduction gives you a sense of how SEMinR fits into your SEM workflow. We provide more detailed instructions on nuances and advanced methods elsewhere.
|
127
|
+
|
128
|
+
# Join us
|
129
|
+
|
130
|
+
We recommend you join our community of users and developers on various social media and collaborative platforms.
|
131
|
+
|
132
|
+
## Collaboration and Feedback
|
133
|
+
|
134
|
+
We have a Github repository where you can see our latest instructions:
|
135
|
+
|
136
|
+
https://github.com/sem-in-r/seminr
|
137
|
+
|
138
|
+
Please use this repository to report suspected bugs that you wish us to track and fix. You will have to create a Github account to report such issues:
|
139
|
+
|
140
|
+
https://github.com/sem-in-r/seminr/issues
|
141
|
+
|
142
|
+
## Social Media
|
143
|
+
|
144
|
+
We have a Facebook group of like-minded researchers where we ask questions about SEMinR and also keep abreast of developments around SEM.
|
145
|
+
|
146
|
+
https://www.facebook.com/groups/seminr/
|
metadata
ADDED
@@ -0,0 +1,133 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: codemark
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Soumya Ray
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-05-08 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: redcarpet
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '3.5'
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: 3.5.1
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '3.5'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: 3.5.1
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: minitest
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '5.14'
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '5.14'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: minitest-rg
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '5.2'
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: '5.2'
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rerun
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '0.13'
|
68
|
+
type: :development
|
69
|
+
prerelease: false
|
70
|
+
version_requirements: !ruby/object:Gem::Requirement
|
71
|
+
requirements:
|
72
|
+
- - "~>"
|
73
|
+
- !ruby/object:Gem::Version
|
74
|
+
version: '0.13'
|
75
|
+
- !ruby/object:Gem::Dependency
|
76
|
+
name: pry
|
77
|
+
requirement: !ruby/object:Gem::Requirement
|
78
|
+
requirements:
|
79
|
+
- - "~>"
|
80
|
+
- !ruby/object:Gem::Version
|
81
|
+
version: '0.14'
|
82
|
+
type: :development
|
83
|
+
prerelease: false
|
84
|
+
version_requirements: !ruby/object:Gem::Requirement
|
85
|
+
requirements:
|
86
|
+
- - "~>"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '0.14'
|
89
|
+
description: Makes Rmd text into R comments and unfences code chunks
|
90
|
+
email: soumya.ray@gmail.com
|
91
|
+
executables:
|
92
|
+
- codemark
|
93
|
+
extensions: []
|
94
|
+
extra_rdoc_files: []
|
95
|
+
files:
|
96
|
+
- ".gitignore"
|
97
|
+
- Gemfile
|
98
|
+
- LICENSE
|
99
|
+
- README.md
|
100
|
+
- Rakefile
|
101
|
+
- bin/codemark
|
102
|
+
- codemark.gemspec
|
103
|
+
- lib/codemark.rb
|
104
|
+
- lib/codemark/rmd_to_r.rb
|
105
|
+
- lib/codemark/version.rb
|
106
|
+
- spec/fixtures/sem-intro.R
|
107
|
+
- spec/fixtures/sem-intro.Rmd
|
108
|
+
homepage: https://github.com/soumyaray/codemark
|
109
|
+
licenses:
|
110
|
+
- MIT
|
111
|
+
metadata: {}
|
112
|
+
post_install_message:
|
113
|
+
rdoc_options: []
|
114
|
+
require_paths:
|
115
|
+
- lib
|
116
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
122
|
+
requirements:
|
123
|
+
- - ">="
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '0'
|
126
|
+
requirements: []
|
127
|
+
rubygems_version: 3.2.3
|
128
|
+
signing_key:
|
129
|
+
specification_version: 4
|
130
|
+
summary: Converts RMarkdown files to pure R scripts
|
131
|
+
test_files:
|
132
|
+
- spec/fixtures/sem-intro.R
|
133
|
+
- spec/fixtures/sem-intro.Rmd
|