Publications by STEM Research
R Data Frames
1.3 R DataFrames We will learn the following: 1.3.1. What is an R DataFrame? 1.3.2. Creating R DataFrames 1.3.3. Common DataFrame methods 1.3.1 What is an R DataFrame? An R DataFrame is a two-dimensional, tabular data structure within the R programming language. It resembles a spreadsheet or a SQL table, with rows representing observations and ...
2488 sym R (3917 sym/31 pcs) 4 img
Export datasets
library(haven) library(readr) library(writexl) library(tidyverse) library(gt) 1.5 Export datasets Upon completing data cleaning and pre-processing, the subsequent step involves exporting the DataFrame to a file. In this demonstration, we showcase the simplicity of exporting by covering the following methods: 1.5.1 Export to CSV 1.5.2 Expor...
1958 sym R (647 sym/10 pcs) 3 tbl
Import datasets
1.4 Import datasets The initial step in data analysis involves loading data into R. We will learn the following: 1.4.1 Import CSV files 1.4.2 Import Excel files 1.4.3 Import Stata files 1.4.4 Import SPSS files Before importing a dataset into an R DataFrame, it is advisable to gain insight into its contents. Skimming through the file beforehand ...
2173 sym R (481 sym/7 pcs) 4 tbl
Apply functions in R
library(stringr) It is import to note that the dplyr library can be used to achieve the same results as the apply() functions with efficiency and clean code (if working with DataFrames / Tibles). apply() Calculate body mass index given, height and weight. weight <- c( 94, 85, 82, 100, 83, 85, 77, 80, 64, 57, 98, 95, 85, 90, 51, 74, 88, 6...
2006 sym R (4762 sym/22 pcs)
Error handling functions
What is Error Handling? Error handling refers to the process of managing and responding to errors or exceptions that occur during the execution of a program. In R, error handling ensures that your code can gracefully handle unexpected situations, such as invalid inputs or runtime errors, without crashing. Importance of Error Handling Error han...
3035 sym Python (4173 sym/22 pcs)
Working with variables
1 . 2 Working with Variables Embark on a comprehensive journey through advanced DataFrame manipulation in R, where you’ll gain valuable insights into enhancing data organization and analysis. From assigning new row indices to creating and transforming variables, this Chapter covers a diverse range of techniques to elevate your data manipula...
11441 sym
Getting started with R
1 Getting Started with R We learn the following: 1.1. Introduction to R 1.1.1. Overview of data wrangling and cleaning 1.1.2. What is data cleaning 1.1.3. Understanding data type 1.2. R DataFrames 1.2.1. What is an R DataFrame? 1.2.2. Creating DataFrames 1.2.3. Common DataFrame methods 1.2.4. Select variables by their data types 1.3. Import datas...
32811 sym 6 img 16 tbl
Getting started with R
1 Getting Started with R We learn the following: 1.1. Introduction to R 1.1.1. Overview of data wrangling and cleaning 1.1.2. What is data cleaning 1.1.3. Understanding data type 1.2. R DataFrames 1.2.1. What is an R DataFrame? 1.2.2. Creating DataFrames 1.2.3. Common DataFrame methods 1.2.4. Select variables by their data types 1.3. Import datas...
32514 sym 6 img 16 tbl
Document
0.1 R Markdown Content here … df = relig_income tabresults(df = head(df, n = 20), caption = "Table 1") Table 1 religion <$10k $10-20k $20-30k $30-40k $40-50k $50-75k $75-100k $100-150k >150k Don’t know/refused Agnostic 27 34 60 81 76 137 122 109 84 96 Atheist 12 27 37 52 35 70 73 5...
352 sym 8 tbl
Rename variables
tabresults = function(df, caption="Table"){ kbl(df, caption = caption) %>% kable_styling(bootstrap_options = "striped", full_width = FALSE, position = "left") } 1 Import datasets from Excel Import dataset setwd("E:/training/DevImpact") nhanes <- read_excel("data/external/nhanes.xlsx", ...
1967 sym 2 tbl