R Programming               

See R-Guru.com for R Training for SAS Programmers (Outline)

______________________________________________ 

         Become an R-Guru, Sign up for free R webinars    Search Stack Overflow

______________________________________________

Webinars

What is R and Why Should you Learn R?  [White Paper]

Writing Your First R Program, Just the Basics [R Program, White Paper]


Basics (Top)

R Programming Style   Tidy Programming Style   Basic Concepts for Beginners

  

                                   RStudio Cheat Sheets                                                                  R Reference Card  

Hardware Configuration: Workbench, Connect, Package Manager

Required Steps: 1. Install R 4.0.4 for Windows, 2. Install RStudio 3. Click R icon 4. Select US option for CRAN mirror

Installation Steps Videos(Install R Packages)

   

Tutorials Point Quick Guide       The Analysis Factor Tutorials

R Examples  

R Programming Style Types

      

Data Access   and Data Management  

     

Data Processing (Wrangling) book                                                              Data Cleaning book

Data Reporting, Analysis and Plotting  

 Common Operations  R Symbols
Variable Assignment <- (most popular), <<-, ->, ->>
Arthritic +, -, *, /
Comparison Operators return logic >, <, ==, !=, <=, >=
Logical &, ||, !
 Other :, %in%

        

                                                                          Common R Functions

______________________________________________

Advance (Top)

Advanced R Solutions book    Custom Functions

R4Stats - SAS and R code GitHub-Sheets R Project for Statistical Computing  

             

Advanced R book

______________________________________________ 

Compare with SAS (Top)

Run SAS in R: R Markdown, Example 1, Example 2

Run R in SAS:  SAS Programming for R Users book, Example 1, Example 2

Guru99 Blog  EDUCBA Blog   SAS and R Examples  Read/Write SAS Datasets

R Package for SAS Programmers

Example 1: Listing


Example 2: Summary Stats Table


Example 3: Figure

        

flextable() vs Proc Report




 SAS Syntax  R Function
proc print data=d1; var _all_; run;  d1 displays all records, head

(d1)  displays first 5 records, tail(d1) displays the last few records

To subset, first create R object based on subset and selected variables and then display all records

proc freq data=d1; tables sex*race; run;

table(d1$sex, d1$race)

prop.table()

proc univariate;

summary(d1)

proc sort data=dm2; by sex race; run;

dm2[order(dm1$sex, dm1$race)]  
proc format;

In Vectors: sex_code <- c(‘M’, ‘M’, ‘M’, ‘F’, ‘M’) # 1. data values in simple vector to store data values

sex_decode <- c(‘M’=’Male’, ‘F’=’Female’) # 2. named vector data = ‘label’ for values similar to proc format

sex <- sex_decode[sex_code] # 3. converts values to labels sex_code vector is subset of sex_code vector


As Functions: age_cat <- vectorize(function(x) { # x is input value

if (x < 18) { # condition

ret <- "< 18" # return label

} else if (x >= 18 & x < 24) {

ret <- "18 to 24"

} else if (x >= 24 & x < 45) {

ret <- "24 to 45"

} else if (x >= 45 & x < 60) {

ret <- "45 to 60"

} else if (x >= 60) {

ret <- "> 60"

} else {

ret <- "Unknown"

}

return(ret) })

df$age_cat <- age_cat(df$age) # apply function to age variable to create age_cat variable

 proc means;

summarise(AllPages = sum(Pages),

AvgLength = mean(Pages),

AvgRating = mean(MyRating),

AvgReadTime = mean(read_time),

ShortRT = min(read_time),

LongRT = max(read_time),

TotalAuthors = n_distinct(Author)) 

 proc contents;

library(hmisc)

content(dm)

 proc compare;

cmp <- comparedf(mockstudy, mockstudy2, by = "case", tol.vars = c("._ ", "case"), int.as.num = TRUE)

n.diffs(cmp) 

 proc report; flextable()

______________________________________________

R and SQL (Top)

Libraries: SQLDF(), DPLY, DDPLYR()

CRAN package     SQL Server

SQLDF() rdrr.io

        

SQLDF() in R                                                   SQLDF() Tutorial


   

SQLDF() Examples

  

Introduction to DPLY  

 SQL Feature  SQL Clause
 Select variables select()
 Create new variables definition mutate() & chg=
 Create new variable conditional logic ifelse()
 Where condition filter(),
 Group by group_by()
 Sort by arrange()

 R DataFrame Joins  SQL Function

left join to keep all dm1, dm1 and dm2 with different key variables


merge left join to keep all dm1, dm1 and dm2 with same key variables

merge right join to keep all dm2, dm1 and dm2 with same key variables


merge inner join for only dm1 and dm2 matching with same key variables

merge outer join for all dm1 and dm2, dm1 and dm2 with same key variables, similar to all.x=TRUE, all.y=TRUE

dm3 = left_join(dm1, dm2, by = c(‘usubjid’=’usubjid’, ‘race’=’race1’))

dm3 = merge(x=dm1, y=dm2, by = ‘usubjid’, all.x=TRUE)

dm3 = merge(x=dm1, y=dm2, by = ‘usubjid’, all.y=TRUE)

dm3 = merge(x=dm1, y=dm2, by = ‘usubjid’)

dm3 = merge(x=dm1, y=dm2, by = ‘usubjid’, all=TRUE) 

   
   

______________________________________________ 

Blogs, Classes and References (Top)

Listen Data R blog  Guru Blog   Wikipedia  R-blogger   R-Tutor   Joyti's R-blog  R Examples

DataCamp    CodeAcademy    DataMentor     R-Journal    Data Table   Study Trials blog

YouTube Videos  R Studio (Webinars)   GitHub-Submission   R-Bootcamp   Kickstarting R

R in Clinical Trial Data Analysis [YouTube]

R Tutorial: Designing and Analyzing Clinical Trials in R [YouTube]

R Consortium   How to Create a Pie Chart in R using GGPLOT2

R Programming in a Clinical Trial Data Analysis blog

TFL programming in R versus SAS blog

Interesting packages taken from R/Pharma blog   

Can Clinical Data Processed With R Be Used in a Regulatory Submission? [PhUSE Blog]

UCLA: Introduction to R, SeminarFAQs

A RISK-BASED APPROACH FOR ASSESSING R PACKAGE ACCURACY WITHIN A VALIDATED INFRASTRUCTURE Blog


Quick-R

            

Statistics Globe (Graph Gallery)



Geeks for Geeks - Task based examples

______________________________________________

Pharma Industry (Top)

Learning Path: QC Tables > Create Tables > QC SDTMs/ADaMs > Create SDTMs/ADaMs

Clinical Reporting with R   R/Pharma   R for Clinical Study Reports and Submission book [Demo Project]

GitHub: Sample SDTM/ADaM  Pharma Packages   R4CDISC/R4DSXML   Happy Git and GitHub for the useR

Using R in the Pharmaceutical Industry blog    R Package Validation Framework [Phuse White Paper, Blog]

Using the Statistical Programming Language R in the Pharma Industry blog

R Programming in clinical trial data analysis Blog by Shrishaila Patil

The Rise of R-should SAS programmers get up to speed? blog

FDA: R OK for drug trials blog

OpenFDA: Github, FDA SiteR Package

R: Regulatory Compliance and Validation Issues A Guidance Document for the Use of R in Regulated Clinical Trial Environments (2018) [GxP]

GxP Compliance in Pharma Made Easier: Good Documentation Practices with R Markdown and {officedown}

Using R in a GxP Environment   Microsoft R Validation Project Summary [GxP]

tidyverse, tidymodels, r-lib, and gt R packages: Regulatory Compliance and Validation Issues

R for Biostatisicians [Presentation]  Github [IQ/OQ]

Clinical Trials Package (R Packages for Clinical Trial Design, Monitoring, and Analysis)

Design and Monitoring, Design and Analysis, Analysis for Specific Designs, Analysis in General, Meta-Analysis
  • Atable - Creates Tables for Reporting Clinical Trials
  • compareODM - Comparison of medical forms in CDISC ODM format
  • CRTSize - Sample size estimation in cluster (group) randomized trials
  • Blockrand - Creates randomizations for block random clinical trials
  • DoseFinding - Supports design and analysis of dose-finding experiments
  • Pact - Predictive Analysis of Clinical Trials
  • SASxport - Read and write 'SAS' 'XPORT' Files
  • ADCT - Adaptive Design in Clinical Trials
  • ClinPK, cpk - Clinical Pharmacokinetics Toolkit
  • randomizeR - Randomization for Clinical Trials
  • Greport - Graphical Reporting for Clinical Trials

         Tools for Clinical Data Management Package

        atable: Create Tables for Reporting Clinical Trials Package [Documentation  Article]

R Programming for SAS Viya

    ______________________________________________

    R Shiny (Top)

    R Shiny Examples  

    RShinyTLF   OpenFDA RShiny   DemoRShinyTLF (PhUSE)

    R Shiny Lessions  Towards Data Science blog

    R Shiny Gallery

    ______________________________________________

    R Markdown (Validated Package from R Studio) (Top)

    Introduction   PDF Reports   Cheetsheet   Guide   RTF: Example 1    Example 2


    Gallery

    ______________________________________________

    Books (Top)

    R Packages   R for Data Science   Efficient R   R in Action   Data Cleaning with R

    DataQuest   SAS and R    R and Relational Databases    A Little Book of R For Time Series [HTML]

    Quick Start Guide for R   Learn to Use R   Flextable    Modern Statistics with R

    Hands-On Programming with R [Read and Write CSV, Dataframes, Debugging]   Cookbook   Mastering Shiny 

    Programming with R (Best Practices)    Data Analysis and Visualization in R for Ecologists

    Beginner Level

              

     UC of Riverside                                         University of Georgia

    Glossary: An Introduction to R book (PDF)

    ______________________________________________

    Popular R Packages (Top)

    R Packages   Useful R Packages

    DataCamp FAQs   CRAN Glossary   CRAN FAQs  

    Functional Data Analysis (FDA)  

    Tidyverse (Data Access, Data Management, Data Reporting and Analysis)


    Tidyverse  Manifesto  Design Guide   Introduction to Tidyverse   Book

    Getting Started with Tidyverse (Storybencth)   Tidy 101


    Tidy Definitions and Functions (Study.com)   David Robinson Blog to Learn Tidy

    Tidyverse Cheat Sheet   Data Transformation Cheat Sheet

    Microsoft  Data.Table   RStudio   

    Grammar of Tables (gt): GitHub    Intro    Examples    Syntax    Tutorial    Blog

    Presentation    Book    Workshop    rstudio/gt    YouTube

    gt Summary    Gallery




    Powered by Wild Apricot. Try our all-in-one platform for easy membership management