background preloader


Facebook Twitter

Write your thesis or paper in R Markdown! There are many reasons why you would want to use some variant of Markdown for writing, and indeed, posts are common on the net as to why you should.1 A simple summary of the reasons are that Markdown is: 1) easy; 2) easy; 3) yup, you guessed it – it’s easy.

Write your thesis or paper in R Markdown!

One variant of Markdown is R Markdown, developed by the RStudio team, and in particular the genius that is Yihui Xie, creator of the knitr R package. R Markdown is pretty much like regular Markdown, except you get a whole load of nice extra features, including the ability to run code chunks, produce .pdfs and presentations, and even .docx (if you really, really want to2). Indeed, the ioslides presentation format lets you use the power of html and css to make browser-based presentations. But surely academic papers require certain formats, and sometimes mathematical expressions and funny Greek letters? Writing your thesis with R Markdown (3) – Figures, R code and tables. This is the third post in a short series of tutorials to write your thesis in R Markdown.

Writing your thesis with R Markdown (3) – Figures, R code and tables

You can find instructions on how to get started in the first post. These tutorials were written by a Windows user, so if you are using a different operating system some details may differ. A Stargazer Cheatsheet. Dataset: dplyr and nycflights13 Setting up a dataset for this cheatsheet allows me to spotlight two recent R packages created by Hadley Wickham.

A Stargazer Cheatsheet

The first, dplyr, is a set of new tools for data manipulation. Using dplyr, I will extract flights and weather data from another new package called nycflights13. With this data I will show how to estimate a couple of regression models and nicely format the results into tables with stargazer. Understanding R for Epidemiologists. Correcting bias in meta-analyses: What not to do (meta-showdown Part 1) Tl;dr: Publication bias and p-hacking can dramatically inflate effect size estimates in meta-analyses.

Correcting bias in meta-analyses: What not to do (meta-showdown Part 1)

Many methods have been proposed to correct for such bias and to estimate the underlying true effect. In a large simulation study, we found out which methods do not work well under which conditions, and give recommendations what not to use. Estimated reading time: 7 min. Using knitr and pandoc to create reproducible scientific reports. An Introduction to the printr Package - Yihui Xie. The printr (read “printer” or “print R”) package is a companion package to knitr.

An Introduction to the printr Package - Yihui Xie

Its main purpose is to extend the S3 generic function knit_print() in knitr, which is the default value of the chunk option render, as explained in the vignette knit_print.html. How to install the ‘RWordPress’ package in R. How to install the ‘RWordPress’ package in R The RWordPress package is a very convenient tool for publishing blog posts from R to WordPress.

How to install the ‘RWordPress’ package in R

Writing R packages: A guide for scientists. RStudio Blog. The JSM conference in Chicago, July 31 thru August 4, 2016, is one of the largest to be found on statistics, with many terrific talks for R users.

RStudio Blog

We’ve listed some of the sessions that we’re particularly excited about below. These include talks from RStudio employees, like Hadley Wickham, Yihui Xie, Mine Cetinkaya-Rundel, Garrett Grolemund, and Joe Cheng, but also include a bunch of other talks about R that we think look interesting. Bookdown: Easy Book Publishing with R Markdown.

Bookdown: Authoring Books and Technical Documents with R Markdown. In this section, we give a very brief introduction to Pandoc’s Markdown.

bookdown: Authoring Books and Technical Documents with R Markdown

Readers who are familiar with Markdown can skip this section. The comprehensive syntax of Pandoc’s Markdown can be found on the Pandoc website Inline formatting You can make text italic by surrounding it with underscores or asterisks, e.g., _text_ or *text*. Introduction to pacman. The pacman package is an R package management tool that combines the functionality of base library related functions into intuitively named functions.

Introduction to pacman

This package is ideally added to .Rprofile to increase workflow by reducing time recalling obscurely named functions, reducing code, and integrating functionality of base functions to simultaneously perform multiple actions. The function p_load is particularly well suited for help forums and blog posts, as it will load and, if necessary, install missing packages.

Function names in the pacman package follow the format of p_xxx where 'xxx' is the task the function performs. For instance the p_load function allows the user to load one or more packages as a more generic substitute for the library or require functions and if the package isn't available locally it will install it for you. In keeping with the library function, the user need not use quotes around package names for most *pacman functions. Quick Reference Table Installing and Loading. Wilcoxon-Mann-Whitney rank sum test (or test U) Comparison of the averages of two independent groups of samples, of which we can not assume a distribution of Gaussian type; is also known as Mann-Whitney U-test.

Wilcoxon-Mann-Whitney rank sum test (or test U)

You want to see if the mean of goals suffered by two football teams over the years is the same. Are below the number of goals suffered by each team in 6 games for each year. Team A: 6, 8, 2, 4, 4, 5Team B: 7, 10, 4, 3, 5, 6. Dealing with non-proportional hazards in R. Since I’m frequently working with large datasets and survival data I often find that the proportional hazards assumption for the Cox regressions doesn’t hold. In my most recent study on cardiovascular deaths after total hip arthroplasty the coefficient was close to zero when looking at the period between 5 and 21 years after surgery.

Grambsch and Thernau’s test for non-proportionality hinted though of a problem and as I explored it there was a clear correlation between mortality and hip arthroplasty surgery. The effect increased over time, just as we had originally thought, see below figure. In this post I’ll try to show how I handle with non-proportional hazards in R. Why should we care? As we scale up to larger datasets we are increasingly looking at smaller effects. Missing the exposure In the example above I would have missed the fact that a hip implant may affect mortality in the long run. Java - rJava load error in RStudio/R after "upgrading" to OSX Yosemite. List of useful RStudio addins made by useRs (a github repo)

Dean Attali started a GitHub repo listing RStudio addins, with the hope that other useRs will add to the list and make it a place to discover addins. Feel free to browse for useful addins, or make a pull request to add your own addin to the list. Here are the current items on the list: Related. Knsv/mermaid. DiagrammeR - Documentation. Graphviz support is an integral part of the DiagrammeR package. Graphviz consists of a graph description language called the DOT language and it also comprises various tools that can process the DOT language. DOT is highly customizable and it allows you to control line colors, arrow shapes, node shapes, and many other layout features. DiagrammeR Implementation For Graphviz graphs, DiagrammeR uses the processing function called grViz(). What you pass into grViz() is a valid graph specification in the DOT language.

All of the code examples provided in later sections call the grViz() function in an R script and pass in a graph description as a string. In very recent builds of RStudio, the use of an external text file with the .gv file extension can provide the advantage of syntax coloring and previewing in the RStudio Viewer pane after saving (if 'Preview on Save' is selected), or, by pressing the 'Preview' button on the Source pane. Why R is the best data science language to learn today. In last week’s blog, I explained why you should Master R (even if it may eventually become obsolete). I wrote that article to address people who claim mastering R is a bit of a waste of time (because it will eventually become obsolete).

But when I suggested that R may eventually become obsolete, this seemed to provoke fear that R is becoming obsolete right now. I want to allay your fears: R is still very popular. R has been one of the fastest growing programming languages of the last decade. In fact, if you’re getting started with data science, it’s still the language that I recommend. Reading .docx [MS Word] Transcripts into R · trinker/qdap Wiki. Typically a researcher will have a data set in a .docx format (MS Word and Open Office use this format). A transcript may look something like this (LINK). read.transcript enables the user to import .docx, .csv and .xlsx files into R for use with the qdap package. There are a caveats to be aware of when reading .docx files into R. The function expects .docx files to be in a two column format separated with some character (default is colon). While document headers do not affect the read in, any text before the dialogue may need to be skipped using the skip argument.

Generally a break in a turn of talk is handled by the merge.broke.tot argument and will merge the two, however, some of these breaks may need to be removed from the .docx manually after inspecting the data frame that is read in. How to import a .csv file that uses UTF-8 character encoding. Create and format PowerPoint documents from R software. There are at least, two reasons for this, as described in the next sections. Why I would rather use ReporteRs than RMarkdown. Create and format Word documents using R software and Reporters package - Easy Guides - Wiki - STHDA. Overview of Vietnamese pharmacovigilance system - a lesson learned from resource-restricted country \thanks{\textbf{Supporting Information - Overleaf. Posts. Posts. Jobname - How to influence the name of the pdf file created with pdfLaTeX (from within the source code)? Docx2Latex. Osx - Installing R on Mac - Warning messages: Setting LC_CTYPE failed, using "C"

Docx2Latex. Toán Học Việt Nam: LaTex. LaTeX 7 : Tài liệu tham khảo LaTex – Math2IT. Bibliography management with bibtex. LaTeX supports bibliographies out of the box, either embedding the references in your document or storing them in an external file. This article explains how to manage bibliography with the \thebibliography environment and the BibTeX system. Bibliography and citation style. The default bibliography [\bibliographystyle{plain}] and citation [ \cite ] styles in latex are not used very commonly used nowadays. Handout Zotero BibTeX. VerbTeX LaTeX Editor. LaTeX.

Using Zotero with LaTeX (and, naturally, BibTex) – Justin Wiegand Blog. If you don’t yet know, Zotero is a fantastic choice for reference management. If you manage references you should use it. It does everything at least as well as the competition and does one thing the competition does not–it clips not only citations, but also full text PDFs from all major databases. Plugins [Zotero Documentation] Écrire un package. Pourquoi ? Définir son propre package permet : de ne pas avoir à toujours insérer toujours les mêmes lignes : \usepackage[francais]{babel} \usepackage[latin1]{inputenc} \usepackage[T1]{fontenc} \usepackage{graphicx} \usepackage{amsmath} \usepackage{amssymb} de ne pas avoir à redéfinir toutes ses macros et aussi de gagner du temps à force de s'habituer à ses commandes persos ; d'avoir des documents cohérents entre eux.

What to do to switch to biblatex? Bibliographie. I’m switching to TeXstudio. How to Write a Thesis in LaTeX pt 1 - Basic Structure. Overleaf. GitHub - nguyenkhacdung/LatexSweaveR: presentation-these-projection. Kinh nghiệm làm và báo cáo PhD proposal - Hỗ trợ sinh viên du học Đức. LaTeX Templates. Lỗi latex – Math2IT. CTAN: Packages. Exporting R tables in LaTeX. Options: Chunk options and package options. R - Suppress library comments from ouput with knitr. Sweave: Transition from Sweave to knitr. Sectioning - LaTeX Beamer: Frame outside sections?

Troubleshooting Sweave. Beamer. Beamer Presentation - LaTeX Template on Overleaf. Authoring R Presentations. Function to Clear the Console in R. How to include ggplot graphics within Sweave. Inserting Images.