Academic
Academic
Home
Publication
Post
META
Who We Are
Project
Event
Light
Dark
Automatic
R
Coefficient H
Please check McNeish (2018) for details. Here, I am using the NSCH dataset as an example. #load packages library(haven) library(tidyverse) library(userfriendlyscience) #import data data<-read_sav("nsch.sav") #clear the current graphics frame and get ready for the next plot plot.
Shonn Cheng
Last updated on Apr 9, 2024
2 min read
R
Create Dummy Variables
Load Packages library(fastDummies) library(tidyverse) library(psych) Create a DataSet # Create a vector of race scores race <- c("White", "Black", "Asian", "Hispanic", "Other") # Generate random income values for each race (100 cases) set.
Shonn Cheng
Last updated on Feb 28, 2024
2 min read
R
How to Display Chinese Characters in ggplot2
Introduction In this post, I am going to demonstrate how to display Chinese characters in ggplot2 #loading necessary packages library(rvest) library(xml2) library(tidyverse) library(tidytext) library(knitr) Let’s get our text data by scraping Chien-Ming Wang’s page on Wikipedia.
Shonn Cheng
Last updated on Sep 11, 2021
3 min read
R
Recoding Values
Introduction Recoding values is one of the most common tasks a researcher needs to do before data analysis. For me, often I need to prepare my data in R first before using it for advanced statistical analyses in Mplus.
Shonn Cheng
Last updated on Sep 10, 2021
6 min read
R
Computing Composite Scores (Mean)
Introduction In this post, I am going to demonstrate how to compute composite scores or means aggregated over multiple items. There are at least two approaches to achieve the goal.
Shonn Cheng
Last updated on Jul 29, 2021
4 min read
R
Cite
×