R Markdown

This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see http://rmarkdown.rstudio.com.

When you click the Knit button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:

summary(cars)
##      speed           dist       
##  Min.   : 4.0   Min.   :  2.00  
##  1st Qu.:12.0   1st Qu.: 26.00  
##  Median :15.0   Median : 36.00  
##  Mean   :15.4   Mean   : 42.98  
##  3rd Qu.:19.0   3rd Qu.: 56.00  
##  Max.   :25.0   Max.   :120.00

Including Plots

You can also embed plots, for example:

Note that the echo = FALSE parameter was added to the code chunk to prevent printing of the R code that generated the plot.

df = read.csv2("D:\\TAM DAN NON-ORTHO\\05. Non ortho_TONGUE STRENGTH MEASUREMENT FORM\\05. Non ortho_TONGUE STRENGTH MEASUREMENT.csv")
library("lessR")
## Warning: package 'lessR' was built under R version 4.5.2
## 
## lessR 4.5                            feedback: gerbing@pdx.edu 
## --------------------------------------------------------------
## > d <- Read("")  Read data file, many formats available, e.g., Excel
##   d is the default data frame, data= in analysis routines optional
## 
## Many examples of reading, writing, and manipulating data, graphics,
## testing means and proportions, regression, factor analysis,
## customization, forecasting, and aggregation to pivot tables.
##   Enter: browseVignettes("lessR")
## 
## View lessR updates, now including modern time series forecasting
##   and many, new Plotly interactive visualizations output. Most
##   visualization functions are now reorganized to three functions:
##      Chart(): type="bar", "pie", "radar", "bubble", "treemap", "icicle"
##      X(): type="histogram", "density", "vbs" and more
##      XY(): type="scatter" for a scatterplot, or "contour", "smooth"
##    Most previous function calls still work, such as:
##      BarChart(), Histogram, and Plot().
##   Enter: news(package="lessR"), or ?Chart, ?X, or ?XY
## There is also Flows() for Sankey flow diagrams, see ?Flows
## 
## Interactive data analysis for constructing visualizations.
##   Enter: interact()
library(dplyr)
## 
## Attaching package: 'dplyr'
## The following objects are masked from 'package:lessR':
## 
##     order_by, recode, rename
## The following objects are masked from 'package:stats':
## 
##     filter, lag
## The following objects are masked from 'package:base':
## 
##     intersect, setdiff, setequal, union
library(labelled)
## Warning: package 'labelled' was built under R version 4.5.3
# 1. MÃ HÓA CÁC BIẾN PHÂN LOẠI
df <- df %>%
  mutate(
    # --- GENDER ---
    Gender = factor(Gender, levels = c(0, 1), labels = c("Male", "Female")),
    
    # --- BALL LOCATION (Dùng across để gộp chung 2 biến vị trí) ---
    across(
      c(TgPmax_lo, TgTime_lo),
      ~ factor(., levels = c(1, 2), labels = c("Back", "Front"))
    )
  )

# 2. GẮN NHÃN MÔ TẢ (LABELS) CHO TOÀN BỘ BIẾN
df <- df %>%
  set_variable_labels(
    Gender = "Gender",
    
    # --- TONGUE MUSCLE (kPa) ---
    AntStreng = "Muscle strength of the front of the tongue",
    PosStreng = "Muscle strength of the back of the tongue",
    TgPmax = "Largest tongue muscle force",
    TgPmax_lo = "Ball location TgPmax",
    TgTime = "Tongue endurance",
    TgTime_lo = "Ball location",
    
    # --- LIPS MUSCLE (kPa) ---
    LipStrengAL = "Anterior strength left",
    LipStrengAR = "Anterior strength right",
    LipStrengLL = "Side strength left",
    LipStrengLR = "Side strength right",
    AntLStreng = "Anterior Lip strength"
  )