This is a test version of Biostars. For the public version, visit https://www.biostars.org.
object of type 'closure' is not subsettable

Dear all I am analyzing my data of GEO using R and got the below error. Please guide me in this regards, Raheleh

tasks <- c("sorted.download_data")
source("runall.R")
Found 1 file(s)
GSE20853_series_matrix.txt.gz
Using locally cached version: ~/proj/lung/data/Kyoto_Expression/GSE20853_series_matrix.txt.gz
Parsed with column specification:
cols(
  .default = col_double()
)
See spec(...) for full column specifications.
|=================================================================| 100%   70 MB
Using locally cached version of GPL962 found here:
~/proj/lung/data/Kyoto_Expression/GPL962.annot.gz 
Error in df$fudan <- NA : object of type 'closure' is not subsettable
> tasks
[1] "sorted.download_data"
r

just check if file GSE20853_series_matrix.txt.gz is unzipped and a data frame is created within R, before trouble shooting. Also check if script accommodates gz files or not.

I unzipped the file and ran again, but the error exits yet,

In general, this happens when you index some thing that is not sub-settable (for eg. a function). Without code and example it may not be easy to troubleshoot the issue. Look at this object sorted.download_data

would you please guide me for creating a data frame.

I am not sure about the contents of runall.R and sorted.download_data. Without that it is not possible to understand the error (for me). Keep printing the type of the objects you have in the current workspace.

I would appreciate to provide more details for me in this matter.

This is not how this community works. Please be patient. We are driven by volunteers and not on-demand supporters. Your question is only 5h old by now (which is not much and it is a Saturday) and your post lacks details which currently prevents us from providing help.

=> As cpad0112 mentioned already, please show the content of that script you are running. Without that it is impossible to help.

The comment was:

I am not sure about the contents of runall.R and sorted.download_data. Without that it is not possible to understand the error (for me). Keep printing the type of the objects you have in the current workspace.

The code is here;

for (i in 1:nchar(gsms)) { sml[i] <- substr(gsms,i,i) } Error in nchar(gsms) : cannot coerce type 'closure' to vector of type 'character'

I doubt that is the full code. Where is df$fudan <- NA from the toplevel question and where does gsms and sml even comde from? If you want people to provide help please show full code.

1 answer

gset <- getGEO("GSE20853", GSEMatrix =TRUE, destdir = "~/proj/lung/data/Kyoto_Expression", AnnotGPL=TRUE)[[1]] Found 1 file(s) GSE20853_series_matrix.txt.gz Using locally cached version: ~/proj/lung/data/Kyoto_Expression/GSE20853_series_matrix.txt.gz Parsed with column specification: cols( .default = col_double() ) See spec(...) for full column specifications. |=================================================================| 100% 70 MB Using locally cached version of GPL962 found here: ~/proj/lung/data/Kyoto_Expression/GPL962.annot.gz

fvarLabels(gset) <- make.names(fvarLabels(gset)) gsms <- paste0 sml <- c() for (i in 1:nchar(gsms)) { sml[i] <- substr(gsms,i,i) } Error in nchar(gsms) : cannot coerce type 'closure' to vector of type 'character'

Log in to answer this question.