load data error (Read10X, Seurat - Guided Clustering Tutorial) - r

I am trying to follow the tutorial from Seurat website.
https://satijalab.org/seurat/v3.1/pbmc3k_tutorial.html
I got an error when loading the data.
Load the PBMC dataset
pbmc.data <- Read10X("1_Guided_tutorial/pbmc3k_filtered_gene_bc_matrices.tar.gz")
Error in Read10X("1_Guided_tutorial/pbmc3k_filtered_gene_bc_matrices.tar.gz") :
Directory provided does not exist
I have set my working directory as the image showed. Can anyone let me know what is the problem? Thank you!
if (!requireNamespace("BiocManager", quietly = TRUE))
install.packages("BiocManager")
BiocManager::install("multtest")
library(dplyr)
library(Seurat)
library(patchwork)
# Load the PBMC dataset
pbmc.data <- Read10X(data.dir = "1_Guided_tutorial/pbmc3k_filtered_gene_bc_matrices.tar.gz")

I was trapped with this problem few minutes before, and I find the solution now.
Try to use these codes:
install.packages("Seurat")
library(Seurat)
install.packages(c('dplyr','patchwork'))
library(dplyr)
library(Seurat)
library(patchwork)
in order to install the environment for scRNA analysis

Related

Error message when using ggcorrplot() and cor_pmat()

I have trouble with the following code:
library(ggplot2)
library(ggcorrplot)
data(USArrests)
correlation_matrix <- round(cor(USArrests),1)
corrp.mat <- cor_pmat(USArrests)
ggcorrplot(correlation_matrix, hc.order =TRUE, type ="lower",
p.mat = corrp.mat)
When I run the code, execution stops at ggcorrplot(...) and I get this error:
"Error in Math.data.frame(x = list(Assault = c(0.0695, 1.36e-07,
2.6e-12, : non-numeric-alike variable(s) in data frame: rowname"
I tried to run the code in an online R runner and it worked, but in RStudio it doesn´t.
I have no clue whats going on, has somebody an idea?
Thank you #Quinten for your suggestion. Unloading the unnecessary packages helped. The package rstatix seemed to interfere with the cor_pmat() command.

'extract_doi' is not an exported object from 'namespace:impactr'

I want to install the package impactr from github. Following the guideline stated by the package developer (https://rdrr.io/github/kamclean/impactr/f/vignettes/vignette_2_extract.Rmd), I repeatedly get the following error.
devtools::install_github("kamclean/impactr")
my_dois <- c("10.1111/j.1365-2486.2008.01617.x","10.1007/s10533-011-9655-2")
out_doi <- impactr::extract_doi(doi = my_dois, get_impact = TRUE)
Error: 'extract_doi' is not an exported object from 'namespace:impactr'
What is the problem? Any help is highly appreciated!

Base does not exist R

I have been trying to perform methylation data analysis, however I am stuck on the first few steps. I am trying to follow the workflow mentioned here and I am unable to read in my files as it gives me an error saying base does not exist.
library(methylationArrayAnalysis)
library(knitr)
library(limma)
library(minfi)
library(IlluminaHumanMethylation450kanno.ilmn12.hg19)
library(IlluminaHumanMethylation450kmanifest)
library(RColorBrewer)
library(missMethyl)
library(minfiData)
library(Gviz)
library(DMRcate)
library(stringr)
library(IlluminaHumanMethylationEPICanno.ilm10b4.hg19)
library(conumee)
dataDirectory <- "C:/Users/35389/Desktop/Medullos/All_combined/"
list.files(dataDirectory, recursive = TRUE)
target_EPIC <- read.metharray.sheet("C:/Users/35389/Desktop/Medullos/All_combined/", pattern = "sample_sheet_2.csv") #tried first with dataDirectory then put the link to files again by myself and still the same error of base does not exist
Error in read.metharray.sheet("C:/Users/35389/Desktop/Medullos/All_combined/", : 'base' does not exists
I have been trying to get around this error for a while now.
I tried to read in the methylation files directly using read.methyarray.exp() however, that way, it greatly reduces the dimensions of my data
I wonder if anyone of you has had any experiences with this and any help would be greatly appreciated! :)

Random, default, functions not working in R (freq_terms() yesterday, tokens() today)

I think i'm going crazy here. I'm working on some code for an assignment in r. Machine learning, so i have a bit of data but i've limited myself to 500 records for now to get it working.
Yet this weekend i ran into something really stupid, R suddenly couldn't remember that it had a freq_terms() function and told me that the function didn't exist.
Since it was only used to make an overview of most frequent terms used it wasn't a major deal.
Yet today that part of the code (that i didn't change) works again. Hooray! Only now Rstudio tells me that tokens() doesn't exist... and that's a big problem since i do need that function a lot!
This is the code and error:
reviewtokens <- tokens(Merged_Kaggle_Data$Merged_Review, what="word", remove_numbers=TRUE, remove_punct=TRUE, remove_symbols=TRUE, remove_hyphens=TRUE)
Error in tokens(Merged_Kaggle_Data$Merged_Review, what = "word", remove_numbers = TRUE, :
could not find function "tokens"
It worked fine on my desktop yesterday evening, today it doesn't work at all and i didn't change anything in that code.
library list:
library(biclust)
library(caret)
library(DBI)
library(dendextend)
library(dplyr)
library(e1071)
library(fpc)
library(ggplot2)
library(ggthemes)
library(igraph)
library(irlba)
library(plotrix)
library(qdap)
library(quanteda)
library(randomForest)
library(Rcampdf)
library(RColorBrewer)
library(reshape2)
library(RMySQL)
library(rpart)
library(rpart.plot)
library(RWeka)
library(SnowballC)
library(tm)
library(wordcloud)
library(glmnet)

rCharts dTable Error

Hi I'm new to rCharts and could definitely use some help. I'm getting the error below when I try to run the following.
Code:
dTable(airquality, sPaginationType = "full_numbers")
Error:
Error in as.character(tools:::httpdPort) :
cannot coerce type 'closure' to vector of type 'character'
Also when I try ?dTable I get the message:
No documentation for ‘dTable’ in specified packages and libraries:
you could try ‘??dTable’
I installed rCharts and devtools using:
install.packages("devtools")
and
install.packages("base64enc")
devtools::install_github("ramnathv/rCharts")
then I called both libraries using library(devtools) and library(rCharts).
Any tips greatly appreciated.
I created a fig directory under my current working directory, ran the following code and it created an html file with the sortable table in the fig directory:
#install.packages("devtools")
install.packages("base64enc")
require(base64enc)
library(devtools)
require(rCharts)
data("airquality")
table1 <- dTable(airquality, sPaginationType = "full_numbers")
table1$save('./fig/table1.html', standalone=TRUE)

Resources