A post from R

Last Updated on 20240124(08.56)

1 pub essai R to WP

publishing using R package duncantl/RWordPress (Lang 2023) wks half: the pandoc citation features and footnotes which are generated by the knit2wp()-function of the knitr package (Yihui 2024) are not correctly converted to the post html.

1.1 snc

  1. knitXwp lib installed on mini.2:post wt lib,apply.css,uniquecss id,chk,toc,img1

1.2 workaround

library(markdown)
library(rmarkdown)
pid<-0 # set postID of post created with knit2wp() or any existing post
rmd<-"sample.Rmd" # path of the R-Markdown file
wp.knit.post<-function(rmd,pid){
render(rmd) # renders the .Rmd according to the parameters specified in the YAML header of the .Rmd
md.ns<-gsub("\\.Rmd",".md",rmd)
p.content<-readLines(md.ns)
p.html<-mark(p.content) # renders the created .md file
editPost(pid,content = p.html) # actualises post content
}

script to create html content of post

---
title: "14022"
author: "xxx"
date: "2024-01-08"
output: 
  md_document:
   variant: markdown_phpextra+backtick_code_blocks
   toc: true
   number_sections: true
   pandoc_args: ["--wrap=none"]
bibliography: sample.bib
---

yaml-header of the .Rmd rendered

1.3 persistent solution

modified the content of the knit2wp() function as to use render() and mark() instead of knit() and markdownToHTML(). now works.

1.4 R package

wrote small R package that does the same: https://github.com/esteeschwarz/knitXwp

1.5 issues

1.5.1 14045.

  • if there are images in the post: they are uploaded, but not overwritten on the server, if uploaded again in case you actualise the post. that means for every post action a new image on the server is created with a trailing increasing number. this is a wordpress feature to prevent overwrite uploaded files with the same name.
  • tweaking in the wordpress functions to prevent that, had no success. so i will integrate a function which allows deleting old instances of images if you decide for that.

1.5.1.1 play along image references

quanteda wordcloud output of this document

1.6 versions

1.6.1 14037.v0.1.5

  • its now possible to apply a stylesheet to the html output of the post container in the blog.
  • prevent toc entry jumping across different post with possible same toc entries (references, method), added unique id to all section headers and toc entries
  • add back-to-top button to section headers to jump back to outline from there

2 B: references

Lang, Duncan Temple. 2023. “Duncantl/RWordPress.” https://github.com/duncantl/RWordPress.

Yihui, Xie. 2024. “Knitr – Yihui Xie 谢益辉.” https://yihui.org/knitr/.

14033.corpusLX.HA

Last Updated on 20240123(19.51)

1 term paper draft

topic #6, polysemous verbs with light and concrete senses, replication study of Mehl (2021), further used Gilquin (2008)

meta.snc.rmd>md>wp>pkg>toc

1.1 init

“If onomasiological frequency measurements do indeed correlate with elicitation tests, potential impact would be immense. Researchers would be able to examine onomasiological frequencies in spoken corpora rather than performing elicitation tests. That possibility would facilitate cognitive research into languages and varieties around the world, without the necessity of in situ psycholinguistic testing, and would also encourage the creation of more spoken corpora.” (Mehl (2021) p.23)

1.2 method

following corpus was used to determine frequencies:

Q.1: Santa Barbara corpus of spoken American English, (UCSB et al. (2005))

the corpus data was downloaded from: https://www.linguistics.ucsb.edu/sites/secure.lsit.ucsb.edu.ling.d7/files/sitefiles/research/SBC/SBCorpus.zip

1.2.1 corpus sample

scb id text lfd light alt
2974 3 242 % I wanted it to be home made Q . 2974 0 make
65343 57 123 … It’s gonna get messed up. 65343 NA a-other
9465 8 567 and then I didn’t and I .. kept making like, 9465 1 make
67928 59 714 And he’s really good at making out .. the budget. 67928 1 make
35078 30 612 … God is continually .. building character. 35078 0 build
61913 53 604 and make the payroll, 61913 1 make
28500 24 25 .. Yeah. 28500 NA a-other

1.2.2 script used:

14015.concrete-abstract_HA.R

1.2.3 process:

1.2.3.1 distribution analysis

cf. (Mehl 2021, 11–14)

ICE.written ICE.spoken SBC.spoken
concrete 68 96 89
light 321 353 381
distribution of lemma /make/ over corpora. ICE data from study.

1.2.3.2 semantic alternatives to make

this contrast includes made up alternatives to /make/ that Mehl defined in his study. we do not account for the context of these alternatives in the corpus texts, i.e. all occurences are counted. Mehl contrasted only these alternate occurences which “are defined as those verbs that occur in the corpus with the same concrete direct objects as make, (take, and give,) and with a roughly equivalent meaning.” Mehl puts these under “onomasiological alternates”. (cf. Mehl (2021) p.13)

Var1 Freq
build 101
construct 1
create 23
generate 4
make 89
produce 5

semantic alternatives

proportion of semantic alternatives to concrete /make/ in SBC
proportion of semantic alternatives, only equivalent meaning of alternates
SLOT1 SLOT2 fS1 fS2 OBS EXP ASSOC COLL.STR.LOGL SIGNIF
137 finish afghan 13 2 2 0 attr 28.51461 *****
654 Filled cookie 1 6 1 0 attr 15.81813 ****
924 create Adam 13 1 1 0 attr 14.17394 ***
928 create rift 13 1 1 0 attr 14.17394 ***
930 record Simpsons 13 1 1 0 attr 14.17394 ***
1337 shovel food 1 34 1 0 attr 12.20185 ***
1338 Unsweeten food 1 34 1 0 attr 12.20185 ***
1476 filling stuff 1 46 1 0 attr 11.58948 ***
1518 create cause 13 2 1 0 attr 11.40296 ***
1519 create committee 13 2 1 0 attr 11.40296 ***
1520 create condition 13 2 1 0 attr 11.40296 ***
1784 bake bread 5 7 1 0 attr 10.48243 **
1862 roll tamale 8 5 1 0 attr 10.19627 **
2626 record trip 13 8 1 0 attr 8.15687 **
3307 record game 13 16 1 0 attr 6.71671 **
semasiological log.like of near synonymes to make

2 B: references

Gilquin, Gaëtanelle. 2008. “What You Think Ain’t What You Get: Highly Polysemous Verbs in Mind and Language.” https://dial.uclouvain.be/pr/boreal/object/boreal:75833.

Mehl, Seth. 2021. “What We Talk about When We Talk about Corpus Frequency: The Example of Polysemous Verbs with Light and Concrete Senses.” Corpus Linguistics and Linguistic Theory 17 (1): 223–47. https://doi.org/10.1515/cllt-2017-0039.

UCSB, John W. DuBois, L. Chafe Wallace, Charles Meyer, Sandra A. Thompson, Robert Englebretson, and Nii Martey. 2005. “Santa Barbara Corpus of Spoken American English Department of Linguistics – UC Santa Barbara.” SBC. https://www.linguistics.ucsb.edu/research/santa-barbara-corpus.