Correlation and Association"


cat("\n# R Packages", fill=TRUE)
cat("The statistical numbers and graphics within this report are generated with following R and packages versions:", fill=TRUE)
cat("\\newline ")
cat("R version:", paste0(R.Version()[c("major","minor")], collapse = "."), fill=TRUE)
cat("\\newline ")
cat("Package boot, version:", paste0(packageVersion("boot")), fill=TRUE)
cat("\\newline ")
cat("Package car, version:", paste0(packageVersion("car")), fill=TRUE)
cat("\\newline ")
cat("Package data.table, version:", paste0(packageVersion("data.table")), fill=TRUE)
cat("\\newline ")
cat("Package DescTools, version:", paste0(packageVersion("DescTools")), fill=TRUE)
cat("\\newline ")
cat("Package energy, version:", paste0(packageVersion("energy")), fill=TRUE)
cat("\\newline ")
cat("Package testforDEP, version:", paste0(packageVersion("testforDEP")), fill=TRUE)
cat("\\pagebreak")

\pagestyle{empty}

cat("\n# R Code ", fill=TRUE)
cat("\\textcolor{blue}{Instructions ")
cat("\\newline ")  
cat("If not already available, please install R, RStudio and the requiered packages listed on the previous page. Copy the code below, paste it carefully in a new R Script within RStudio. For a seamless copy \\& paste process, open the PDF report in a browser. Change the path to your data in the line} ")
cat("`filepath <- ...` ") 
cat("\\textcolor{blue}{For Windows users, avoid using paths containing spaces. Run the code. Explore the results (numerical results in the Console, plots in the Plots tab). }")

```{whites, eval=FALSE, echo = eval2} options(na.action=na.omit) # Option for missing values

Import required libraries

suppressPackageStartupMessages(library(data.table)) suppressPackageStartupMessages(library(boot)) suppressPackageStartupMessages(library(car)) suppressPackageStartupMessages(library(DescTools)) suppressPackageStartupMessages(library(testforDEP)) suppressPackageStartupMessages(library(energy))

```r
cat("\\# `Define the path to your data (please remark the forward slash)`")
cat("\\newline ")  
cat("`filepath <-")
cat(paste0("\"C:/",params$filename[1],"\"`"))
if (params$decimal == "auto"){
  cat("\\# `Upload the data`")
  cat("\\newline ")  
 datainput1 <- fread(params$filename$datapath, header = "auto", sep="auto", dec=".", encoding = "UTF-8", data.table = FALSE, na.strings = "")

   # Probably comma as decimal
  colnames <- sapply(datainput1, function(col) is.numeric(col) & Negate(is.integer)(col))
  if (sum(colnames) == 0L){
    cat(paste0("`df <- fread(filepath, header =\"auto\", sep =\"auto\", dec =\",\", encoding =\"UTF-8\", data.table = FALSE, na.strings = \"\")`"))

  } else {
    cat(paste0("`df <- fread(filepath, header =\"auto\", sep =\"auto\", dec =\".\", encoding =\"UTF-8\", data.table = FALSE, na.strings = \"\")`"))
  }

} else {
  cat("\\# `Upload the data`")
  cat("\\newline ")
  cat(paste0("`df <- fread(filepath, header = \"auto\", sep =\"auto\", dec = \"", params$decimal,"\", encoding =  \"UTF-8\", data.table = FALSE, na.strings = \"\")`"))

}



Try the Statsomat package in your browser

Any scripts or data that you put into this service are public.

Statsomat documentation built on Nov. 17, 2021, 5:17 p.m.