Getting error in GDCprepare fuction when using TCGAbiolinks package - r

I am using TCGAbiolinks package. I have run this code:
coadquery <- GDCquery(project = "TCGA-COAD",
data.category = "Transcriptome Profiling",
data.type ="Gene Expression Quantification",
workflow.type ="STAR - Counts", legacy = F,
experimental.strategy ="RNA-Seq")
GDCdownload(query = coadquery, method = "api")
coadprpr <- GDCprepare(coadquery, summarizedExperiment = T)
but when I run GDCprepare function it gives me error:
|==================================================|100%
Completed after 12 m
Error in `vectbl_as_col_location()`: ! Can't subset columns past the
end. i Locations 2, 3, and 4 don't exist. i There is only 1 column.
Run `rlang::last_error()` to see where the error occurred. There were
50 or more warnings (use warnings() to see the first 50)

Related

I am using ALDEx package for analysis of PICRUST2 output and gave me an error

I am following the tutorial below in the link:
https://ycl6.github.io/16S-Demo/4_picrust2_tutorial.html
after copying this code :
# EC
set.seed(12345)
system.time({
aldex2_EC1 = aldex(p2EC1, sample_data(ps1a)$Group, mc.samples = 500, test = "t",
effect = TRUE, denom = "iqlr", verbose = TRUE)
})
it gives me an error : Error in aldex.clr.function(as.data.frame(reads), conds, mc.samples, denom, :
mismatch between number of samples and condition vector.
I am working on 5 or 6 samples..
I don't know what is the cause of the error
I have no solution in google.

Difference between time points. Why mutate(dif_block1 = round((Date_T1 - Date_T0)/7, 2)). does not work?

I have a table with 6 columns in R (Date_T0, Date_T1 ...), all including Dates of assessment (e.g. 2015-03-29, 2015-04-14). I am now trying to calculate the difference between time points in weeks using the following code:
definition_blocks <- definition_blocks %>%
rowwise() %>%
mutate(dif_block1 = round((Date_T1-Date_T0)/7,2),
dif_block2 = round((Date_T2-Date_T1)/7,2),
dif_block3 = round((Date_T3-Date_T2)/7,2),
dif_block4 = round((Date_T4-Date_T3)/7,2),
dif_block5 = round((Date_T5-Date_T4)/7,2))
The following error occurs:
Error: Problem with `mutate()` column `dif_block1`.
i `dif_block1 = round((Date_T1 - Date_T0)/7, 2)`.
x / not defined for "Date" Object
i The error occurred in row 1.
Run `rlang::last_error()` to see where the error occurred.
In addition: Warning message:
Problem with `mutate()` column `dif_block1`.
i `dif_block1 = round((Date_T1 - Date_T0)/7, 2)`.
i Incompatible methods ("-.Date", "-.POSIXt") for "-"
i The warning occurred in row 1.
I am not sure why this code is not working. Can some help me? Thank you so much

Create a dtm using tokens

I try to run tis command
dtm <- CreateDtm(tokens$text,
doc_names = tokens$ID,
ngram_window = c(1, 2))
However I receive this error:
Error in seq.default(1, length(tokens), 5000) :
wrong sign in 'by' argument
In addition: Warning message:
In CreateDtm(tokens$text, doc_names = tokens$ID, ngram_window = c(1, :
No document names detected. Assigning 1:length(doc_vec) as names.
Any idea what I have to change in order to run it properly?

Error message when running npreg

I'm working the npreg example in the R np package documentation (by T. Hayfield, J. Racine), section 3.1 Univariate Regression.
library("np")
data("cps71")
model.par = lm(logwage~age + I(age^2),data=cps71)
summary(model.par)
#
attach(cps71)
bw = npregbw(logwage~age) # thislne not in example 3.1
model.np = npreg(logwage~age,regtype="ll", bwmethod="cv.aic",gradients="TRUE",
+ data=cps71)
This copied directly from the example, but the npreg call results in error message
*Rerun with Debug
Error in npreg.rbandwidth(txdat = txdat, tydat = tydat, bws = bws, ...) :
NAs in foreign function call (arg 15)
In addition: Warning message:
In npreg.rbandwidth(txdat = txdat, tydat = tydat, bws = bws, ...) :
NAs introduced by coercion*
The npreg R documentation indicates the first argument should be BW specificaion. I tried setting bws=1
model.np = npreg(bws=1,logwage~age,regtype="ll",
+ bwmethod="cv.aic",gradients="TRUE", data=cps71)
which gives the following error
*Error in toFrame(xdat) :
xdat must be a data frame, matrix, vector, or factor*
First time working with density estimation in R. Please suggest how to resolve these errors.

Error: object not found - cor.ci

I'm trying to use cor.ci to obtain polychoric correlations with significance tests, but it keeps giving me an error message. Here is the code:
install.packages("Hmisc")
library(Hmisc)
mydata <- spss.get("S-IAT for R.sav", use.value.labels=TRUE)
install.packages('psych')
library(psych)
poly.example <- cor.ci(mydata(nvar = 10,n = 100)$items,n.iter = 10,poly = TRUE)
poly.example
print(corr.test(poly.example$rho), short=FALSE)
Here is the error message it gives:
> library(psych)
> poly.example <- cor.ci(mydata(nvar = 10,n = 100)$items,n.iter = 10,poly = TRUE)
Error in cor.ci(mydata(nvar = 10, n = 100)$items, n.iter = 10, poly = TRUE) :
could not find function "mydata"
> poly.example
Error: object 'poly.example' not found
> print(corr.test(poly.example$rho), short=FALSE)
Error in is.data.frame(x) : object 'poly.example' not found
How can I make it recognize mydata and/or select certain variables from this dataset for the analysis? I got the above code from here:
Polychoric correlation matrix with significance in R
Thanks!
You have several problems.
1) As previously commented upon, you are treating mydata as a function, but you need to treat it as a data.frame. Thus the call should be
poly.example <- cor.ci(mydata,n.iter = 10,poly = TRUE)
If you are trying to just get the first 100 cases and the first 10 variables, then
poly.example <- cor.ci(mydata[1:10,1:100],n.iter = 10,poly = TRUE)
2) Then, you do not want to run corr.test on the resulting correlation matrix. corr.test should be run on the data.
print(corr.test(mydata[1:10,1:100],short=FALSE)
Note that corr.test is testing the Pearson correlation.

Resources