Open RemyMG opened 1 year ago
Hi! Yes, it appears that MetaboAnalystR functions only provide images as outputs. This stackoverflow thread describes how you can plot images in the plot panel in RStudio.
One thing I have been doing is incorporating the images into a pdf output using RMarkdown. Below is a shortened example of how I have done this in a .Rmd file in RStudio, but here is also a link to a definitive guide to making pdf documents using RStudio.
---
title: "Metabolomics Report"
author: "jessieolough"
output: pdf_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = FALSE)```
```{r Code-from-MetaboAnalyst, message=FALSE, warning=FALSE, include=FALSE}
library(MetaboAnalystR)
# Construct mSetObj
mSet<-InitDataObjects("pktable", "stat", FALSE)
# Read raw csv file
mSet<-Read.TextData(mSet, "annotations.csv", "colu", "disc");
# Check that the data is in the correct format for further analysis
mSet<-SanityCheckData(mSet)
# Replace zero/missing values with half of the smallest positive values in the original dataset
mSet<-ReplaceMin(mSet);
mSet<-SanityCheckData(mSet)
# Filter dataset (filter out 5% based on Interquantile range, IQR)
mSet<-FilterVariable(mSet, "none", -1, "F", 25, F)
# Normalise data
mSet<-PreparePrenormData(mSet)
mSet<-Normalization(mSet, "NULL", "LogNorm", "ParetoNorm", ratio=FALSE, ratioNum=20)
# Make a two-plot summary plot (exported as .png into directory)
mSet<-PlotNormSummary(mSet, "norm_0_", "png", 72, width=NA)```
```{r Insert-MetaboAnalyst-boxplots, echo=FALSE, fig.align="center", message=FALSE, warning=FALSE, out.width = "100%"}
library(rmarkdown)
library(knitr)
knitr::include_graphics("norm_0_dpi72.png")```
Hello,
I'm running
MetaboAnalystR 4.0.0
on R 4.3.1 in RStudio 2023.06.0 Build 421 and I don't know how to plot any figures. The code linesmSet <- PlotNormSummary(mSet, "norm_0_", "png", 72, width=NA)
ormSet <- PlotFC(mSet, "fc_0_", "png", 72, width=NA)
don't display any figure and this single code linePlotNormSummary(mSet, "norm_0_", "png", 72, width=NA)
displays the whole mSet object in the console. So how can I get the plots in the RStudio "Plot" pane? Is it a bug from the MetaboAnalystR functions or is there something I'm not doing correctly?I really thank you for your help.
Here are the codes lines from my console, with data from the tutorial: