Linear Model with covariate adjustment (Metadata Analysis) in R

Hello everyone,
I had to move my analysis from the Webpage to R to be able to process a very large data set. I am trying to do a Linear Model with Covariate Adjustment (Webpage module Statistical Analysis Metadata Table), but I do not get the same plot from the website and the R code provided in the side panel of the website does not work.
I tried plotting various results from the two files the analysis creates, but I do not end up with the same plot as on the webpage. Instead of the png.file the code should create, it creates a .json file. Has anyone had the same problem and might help me to solve this? Thanks in advance, ro_nina

Here is the respective R-Code:
install.packages(“dplyr”)
install.packages(“RJSONIO”)
install.packages(“plotly”)
install.packages(“limma”)
install.packages(“rjson”)
install.packages(“FAIRmaterials”)
install.packages(“jsonlite”)
install.packages(“igraph”)

library(MetaboAnalystR)
library(dplyr)
library(limma)
library(RJSONIO)
library(limma)
library(FAIRmaterials)
library(jsonlite)
library(igraph)
library(rjson)
library(ggplot2)
library(readxl)

getwd()
setwd(“C:/Users/nmr25/OneDrive/OneNote Notizbücher/R-Kurs/MetaboAnalyst/LinearCovariateModel/PI ET/”)

#Set-up mSET-Object, load data, filter and normalize them
mSet_Linear_PI<-InitDataObjects(“pktable”, “mf”, FALSE)
mSet_Linear_PI<-SetDesignType(mSet_Linear_PI, “multi”)
mSet_Linear_PI<-Read.TextDataTs(mSet_Linear_PI, “240318_ContFerm1_PI_ET.csv”, “colmf”);
mSet_Linear_PI<-ReadMetaData(mSet_Linear_PI, “240318_Metadata_PI_ET.csv”);
mSet_Linear_PI<-SanityCheckData(mSet_Linear_PI)
mSet_Linear_PI<-ReplaceMin(mSet_Linear_PI);
mSet_Linear_PI<-SanityCheckMeta(mSet_Linear_PI, 0);
mSet_Linear_PI<-SetDataTypeOfMeta(mSet_Linear_PI);
mSet_Linear_PI<-SanityCheckData(mSet_Linear_PI)
mSet_Linear_PI<-FilterVariable(mSet_Linear_PI, “F”, 25, “rsd”, 40, “mean”, 0)
mSet_Linear_PI<-PreparePrenormData(mSet_Linear_PI)
mSet_Linear_PI<-Normalization(mSet_Linear_PI, “MedianNorm”, “NULL”, “MeanCenter”, ratio=FALSE, ratioNum=20)
mSet_Linear_PI<-PlotNormSummary(mSet_Linear_PI, “norm_0_”, “png”, 72, width=NA)
mSet_Linear_PI<-PlotSampleNormSummary(mSet_Linear_PI, “snorm_0_”, “png”, 72, width=NA)

#Prepare Data for linear model calculation
sel.meta.df ← mSet_Linear_PI$Timepoint
adj.vec ← colnames(sel.meta.df)

mSet_Linear_PI<-CovariateScatter.Anal(adj.vec, “CovariatePlot.png”, “png”, “Group”, “ET”, “NA” , 0.001, “fdr”, “anova”)
mSet_Linear_PI ← CreateCovAdj(mSet_Linear_PI)

mSet_Linear_PI ← GetRawCovThresh(mSet_Linear_PI)
mSet_Linear_PI ← PlotCovariateMap(mSet_Linear_PI, “CovariatePlot.png”,“png”)

Session info:
R version 4.3.3 (2024-02-29 ucrt)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 11 x64 (build 22631)

Matrix products: default

locale:
[1] LC_COLLATE=German_Germany.utf8 LC_CTYPE=German_Germany.utf8 LC_MONETARY=German_Germany.utf8
[4] LC_NUMERIC=C LC_TIME=German_Germany.utf8

time zone: Europe/Berlin
tzcode source: internal

attached base packages:
character(0)

other attached packages:
[1] MetaboAnalystR_4.0.0

loaded via a namespace (and not attached):
[1] compiler_4.3.3 graphics_4.3.3 tools_4.3.3 rstudioapi_0.16.0 utils_4.3.3 grDevices_4.3.3
[7] stats_4.3.3 datasets_4.3.3 methods_4.3.3 base_4.3.3