to get rid of warning and error: non-language object in R












0















I am coding in R and I have a small chunk that I need to loop it over.



the part of the code looks like this:



sc_1$ue <- cF(sc_1, 2500, 1000, 5)
sc_2$ue <- cF(sc_2, 2500, 1000, 5)
sc_3$ue <- cF(sc_3, 2500, 1000, 5)
sc_4$ue <- cF(sc_4, 3000, 1000, 5)


where cF is a function I am calling. This code in its present form works without any error.



However, when I try to loop it like the following:



sc_list=mget(sc)
for (i in 1:5)
sc_list[i]$ue <- cF(sc_list[i], 2500, 1000, 5)


where sc contains sc_1 to sc_n objects.



The output is not an immediate error but a warning.



## Warning in sc_list[i] <- `*vtmp*`: number of items to replace is not a
## multiple of replacement length

## Warning in sc_list[i] <- `*vtmp*`: number of items to replace is not a
## multiple of replacement length

## Warning in sc_list[i] <- `*vtmp*`: number of items to replace is not a
## multiple of replacement length

## Warning in sc_list[i] <- `*vtmp*`: number of items to replace is not a
## multiple of replacement length


because of this following code in the program gives me an error.



How can I fix this?



What I have tried is:



sc_list=mget(sc)
for (i in 1:length(paths))
paste0("sc_",i)$ue <- cF(sc_list[i], 2500, 1000, 5)


This throws up an error.



Quitting from lines 209-217 (prototype.Rmd) 
Error in paste0("sc_", i)$use <- cF(sc_list[i], 2500, 1000, :
target of assignment expands to non-language object
Calls: <Anonymous> ... handle -> withCallingHandlers -> withVisible -> eval -> eval
Execution halted


Edit: output of



 > str(sc_list)
List of 4
$ sc_1:Formal class 'SingleCellExperiment' [package "SingleCellExperiment"] with 10 slots
.. ..@ int_elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. ..@ rownames : NULL
.. .. .. ..@ nrows : int 33694
.. .. .. ..@ listData :List of 2
.. .. .. .. ..$ is_spike_MT: logi [1:33694] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. .. ..$ is_spike : logi [1:33694] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ int_colData :Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. ..@ rownames : NULL
.. .. .. ..@ nrows : int 5586
.. .. .. ..@ listData : Named list()
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ int_metadata :List of 2
.. .. ..$ version :Classes 'package_version', 'numeric_version' hidden list of 1
.. .. .. ..$ : int [1:3] 1 0 0
.. .. ..$ spike_names: chr "MT"
.. ..@ reducedDims :Formal class 'SimpleList' [package "S4Vectors"] with 4 slots
.. .. .. ..@ listData : list()
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ rowRanges :Formal class 'GRangesList' [package "GenomicRanges"] with 5 slots
.. .. .. ..@ unlistData :Formal class 'GRanges' [package "GenomicRanges"] with 6 slots
.. .. .. .. .. ..@ seqnames :Formal class 'Rle' [package "S4Vectors"] with 4 slots
.. .. .. .. .. .. .. ..@ values : Factor w/ 0 levels:
.. .. .. .. .. .. .. ..@ lengths : int(0)
.. .. .. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. .. .. ..@ metadata : list()
.. .. .. .. .. ..@ ranges :Formal class 'IRanges' [package "IRanges"] with 6 slots
.. .. .. .. .. .. .. ..@ start : int(0)
.. .. .. .. .. .. .. ..@ width : int(0)
.. .. .. .. .. .. .. ..@ NAMES : NULL
.. .. .. .. .. .. .. ..@ elementType : chr "integer"
.. .. .. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. .. .. ..@ metadata : list()
.. .. .. .. .. ..@ strand :Formal class 'Rle' [package "S4Vectors"] with 4 slots
.. .. .. .. .. .. .. ..@ values : Factor w/ 3 levels "+","-","*":
.. .. .. .. .. .. .. ..@ lengths : int(0)
.. .. .. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. .. .. ..@ metadata : list()
.. .. .. .. .. ..@ elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. .. .. .. .. ..@ rownames : NULL
.. .. .. .. .. .. .. ..@ nrows : int 0
.. .. .. .. .. .. .. ..@ listData : Named list()
.. .. .. .. .. .. .. ..@ elementType : chr "ANY"
.. .. .. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. .. .. ..@ metadata : list()
.. .. .. .. .. ..@ seqinfo :Formal class 'Seqinfo' [package "GenomeInfoDb"] with 4 slots
.. .. .. .. .. .. .. ..@ seqnames : chr(0)
.. .. .. .. .. .. .. ..@ seqlengths : int(0)
.. .. .. .. .. .. .. ..@ is_circular: logi(0)
.. .. .. .. .. .. .. ..@ genome : chr(0)
.. .. .. .. .. ..@ metadata : list()
.. .. .. ..@ elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. .. .. ..@ rownames : NULL
.. .. .. .. .. ..@ nrows : int 33694
.. .. .. .. .. ..@ listData :List of 11
.. .. .. .. .. .. ..$ id : chr [1:33694] "ENSG00000243485" "ENSG00000237613" "ENSG00000186092" "ENSG00000238009" ...
.. .. .. .. .. .. ..$ symbol : chr [1:33694] "RP11-34P13.3" "FAM138A" "OR4F5" "RP11-34P13.7" ...
.. .. .. .. .. .. ..$ is_feature_control : logi [1:33694] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. .. .. .. ..$ is_feature_control_MT: logi [1:33694] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. .. .. .. ..$ mean_counts : num [1:33694] 0 0 0 0.000895 0.000179 ...
.. .. .. .. .. .. ..$ log10_mean_counts : num [1:33694] 0.00 0.00 0.00 3.89e-04 7.77e-05 ...
.. .. .. .. .. .. ..$ rank_counts : num [1:33694] 6741 6741 6741 18054 14520 ...
.. .. .. .. .. .. ..$ n_cells_counts : int [1:33694] 0 0 0 5 1 0 0 0 611 542 ...
.. .. .. .. .. .. ..$ pct_dropout_counts : num [1:33694] 100 100 100 99.9 100 ...
.. .. .. .. .. .. ..$ total_counts : num [1:33694] 0 0 0 5 1 0 0 0 661 617 ...
.. .. .. .. .. .. ..$ log10_total_counts : num [1:33694] 0 0 0 0.778 0.301 ...
.. .. .. .. .. ..@ elementType : chr "ANY"
.. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. ..@ metadata : list()
.. .. .. ..@ partitioning :Formal class 'PartitioningByEnd' [package "IRanges"] with 5 slots
.. .. .. .. .. ..@ end : int [1:33694] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. .. ..@ NAMES : chr [1:33694] "ENSG00000243485" "ENSG00000237613" "ENSG00000186092" "ENSG00000238009" ...
.. .. .. .. .. ..@ elementType : chr "integer"
.. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. ..@ metadata : list()
.. .. .. ..@ elementType : chr "GRanges"
.. .. .. ..@ metadata : list()
.. ..@ colData :Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. ..@ rownames : chr [1:5586] "AAACCTGAGAAGGTTT-1" "AAACCTGAGCGTTCCG-1" "AAACCTGAGTACGTAA-1" "AAACCTGGTAAACACA-1" ...
.. .. .. ..@ nrows : int 5586
.. .. .. ..@ listData :List of 30
.. .. .. .. ..$ dataset : int [1:5586] 1 1 1 1 1 1 1 1 1 1 ...
.. .. .. .. ..$ barcode : chr [1:5586] "AAACCTGAGAAGGTTT-1" "AAACCTGAGCGTTCCG-1" "AAACCTGAGTACGTAA-1" "AAACCTGGTAAACACA-1" ...
.. .. .. .. ..$ total_features : int [1:5586] 1373 1837 2259 802 2601 1967 1236 1642 1153 1078 ...
.. .. .. .. ..$ log10_total_features : num [1:5586] 3.14 3.26 3.35 2.9 3.42 ...
.. .. .. .. ..$ total_counts : num [1:5586] 3380 7332 10099 1833 12184 ...
.. .. .. .. ..$ log10_total_counts : num [1:5586] 3.53 3.87 4 3.26 4.09 ...
.. .. .. .. ..$ pct_counts_top_50_features : num [1:5586] 33.1 38.9 42.5 40.9 42.2 ...
.. .. .. .. ..$ pct_counts_top_100_features : num [1:5586] 45 54.8 59.2 53.7 53.5 ...
.. .. .. .. ..$ pct_counts_top_200_features : num [1:5586] 57.5 66.9 69 66.4 64.7 ...
.. .. .. .. ..$ pct_counts_top_500_features : num [1:5586] 74.2 79.2 79.4 83.5 76.8 ...
.. .. .. .. ..$ total_features_endogenous : int [1:5586] 1373 1837 2259 802 2601 1967 1236 1642 1153 1078 ...
.. .. .. .. ..$ log10_total_features_endogenous : num [1:5586] 3.14 3.26 3.35 2.9 3.42 ...
.. .. .. .. ..$ total_counts_endogenous : num [1:5586] 3380 7332 10099 1833 12184 ...
.. .. .. .. ..$ log10_total_counts_endogenous : num [1:5586] 3.53 3.87 4 3.26 4.09 ...
.. .. .. .. ..$ pct_counts_endogenous : num [1:5586] 100 100 100 100 100 100 100 100 100 100 ...
.. .. .. .. ..$ pct_counts_top_50_features_endogenous : num [1:5586] 33.1 38.9 42.5 40.9 42.2 ...
.. .. .. .. ..$ pct_counts_top_100_features_endogenous: num [1:5586] 45 54.8 59.2 53.7 53.5 ...
.. .. .. .. ..$ pct_counts_top_200_features_endogenous: num [1:5586] 57.5 66.9 69 66.4 64.7 ...
.. .. .. .. ..$ pct_counts_top_500_features_endogenous: num [1:5586] 74.2 79.2 79.4 83.5 76.8 ...
.. .. .. .. ..$ total_features_feature_control : int [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ log10_total_features_feature_control : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ total_counts_feature_control : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ log10_total_counts_feature_control : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ pct_counts_feature_control : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ total_features_MT : int [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ log10_total_features_MT : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ total_counts_MT : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ log10_total_counts_MT : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ pct_counts_MT : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ is_cell_control : logi [1:5586] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ assays :Reference class 'ShallowSimpleListAssays' [package "SummarizedExperiment"] with 1 field
.. .. ..$ data: NULL
.. .. ..and 14 methods.
.. ..@ NAMES : NULL
.. ..@ elementMetadata :Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. ..@ rownames : NULL
.. .. .. ..@ nrows : int 33694
.. .. .. ..@ listData : Named list()
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ metadata :List of 1
.. .. ..$ name: chr "iMates-1"




Here is one of the four objects.


Could anyone of you help me.



Thank you










share|improve this question




















  • 1





    are you sure your sc_list contains anything? I'm not sure mget works that way...

    – iod
    Nov 22 '18 at 15:32











  • It is not empty.

    – user1826775
    Nov 22 '18 at 15:57











  • Please put the additional information about str(sc_list) from the comment in your question, i.e. edit your question: stackoverflow.com/posts/53434082/edit

    – jogo
    Nov 22 '18 at 18:44











  • @jogo edited the question. Please have a look.

    – user1826775
    Nov 22 '18 at 20:47











  • The object sc_list is a list of S4-objects. The components of a S4-object are slots. The operator to access a slot is @ (not $).

    – jogo
    Nov 22 '18 at 23:02
















0















I am coding in R and I have a small chunk that I need to loop it over.



the part of the code looks like this:



sc_1$ue <- cF(sc_1, 2500, 1000, 5)
sc_2$ue <- cF(sc_2, 2500, 1000, 5)
sc_3$ue <- cF(sc_3, 2500, 1000, 5)
sc_4$ue <- cF(sc_4, 3000, 1000, 5)


where cF is a function I am calling. This code in its present form works without any error.



However, when I try to loop it like the following:



sc_list=mget(sc)
for (i in 1:5)
sc_list[i]$ue <- cF(sc_list[i], 2500, 1000, 5)


where sc contains sc_1 to sc_n objects.



The output is not an immediate error but a warning.



## Warning in sc_list[i] <- `*vtmp*`: number of items to replace is not a
## multiple of replacement length

## Warning in sc_list[i] <- `*vtmp*`: number of items to replace is not a
## multiple of replacement length

## Warning in sc_list[i] <- `*vtmp*`: number of items to replace is not a
## multiple of replacement length

## Warning in sc_list[i] <- `*vtmp*`: number of items to replace is not a
## multiple of replacement length


because of this following code in the program gives me an error.



How can I fix this?



What I have tried is:



sc_list=mget(sc)
for (i in 1:length(paths))
paste0("sc_",i)$ue <- cF(sc_list[i], 2500, 1000, 5)


This throws up an error.



Quitting from lines 209-217 (prototype.Rmd) 
Error in paste0("sc_", i)$use <- cF(sc_list[i], 2500, 1000, :
target of assignment expands to non-language object
Calls: <Anonymous> ... handle -> withCallingHandlers -> withVisible -> eval -> eval
Execution halted


Edit: output of



 > str(sc_list)
List of 4
$ sc_1:Formal class 'SingleCellExperiment' [package "SingleCellExperiment"] with 10 slots
.. ..@ int_elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. ..@ rownames : NULL
.. .. .. ..@ nrows : int 33694
.. .. .. ..@ listData :List of 2
.. .. .. .. ..$ is_spike_MT: logi [1:33694] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. .. ..$ is_spike : logi [1:33694] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ int_colData :Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. ..@ rownames : NULL
.. .. .. ..@ nrows : int 5586
.. .. .. ..@ listData : Named list()
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ int_metadata :List of 2
.. .. ..$ version :Classes 'package_version', 'numeric_version' hidden list of 1
.. .. .. ..$ : int [1:3] 1 0 0
.. .. ..$ spike_names: chr "MT"
.. ..@ reducedDims :Formal class 'SimpleList' [package "S4Vectors"] with 4 slots
.. .. .. ..@ listData : list()
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ rowRanges :Formal class 'GRangesList' [package "GenomicRanges"] with 5 slots
.. .. .. ..@ unlistData :Formal class 'GRanges' [package "GenomicRanges"] with 6 slots
.. .. .. .. .. ..@ seqnames :Formal class 'Rle' [package "S4Vectors"] with 4 slots
.. .. .. .. .. .. .. ..@ values : Factor w/ 0 levels:
.. .. .. .. .. .. .. ..@ lengths : int(0)
.. .. .. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. .. .. ..@ metadata : list()
.. .. .. .. .. ..@ ranges :Formal class 'IRanges' [package "IRanges"] with 6 slots
.. .. .. .. .. .. .. ..@ start : int(0)
.. .. .. .. .. .. .. ..@ width : int(0)
.. .. .. .. .. .. .. ..@ NAMES : NULL
.. .. .. .. .. .. .. ..@ elementType : chr "integer"
.. .. .. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. .. .. ..@ metadata : list()
.. .. .. .. .. ..@ strand :Formal class 'Rle' [package "S4Vectors"] with 4 slots
.. .. .. .. .. .. .. ..@ values : Factor w/ 3 levels "+","-","*":
.. .. .. .. .. .. .. ..@ lengths : int(0)
.. .. .. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. .. .. ..@ metadata : list()
.. .. .. .. .. ..@ elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. .. .. .. .. ..@ rownames : NULL
.. .. .. .. .. .. .. ..@ nrows : int 0
.. .. .. .. .. .. .. ..@ listData : Named list()
.. .. .. .. .. .. .. ..@ elementType : chr "ANY"
.. .. .. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. .. .. ..@ metadata : list()
.. .. .. .. .. ..@ seqinfo :Formal class 'Seqinfo' [package "GenomeInfoDb"] with 4 slots
.. .. .. .. .. .. .. ..@ seqnames : chr(0)
.. .. .. .. .. .. .. ..@ seqlengths : int(0)
.. .. .. .. .. .. .. ..@ is_circular: logi(0)
.. .. .. .. .. .. .. ..@ genome : chr(0)
.. .. .. .. .. ..@ metadata : list()
.. .. .. ..@ elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. .. .. ..@ rownames : NULL
.. .. .. .. .. ..@ nrows : int 33694
.. .. .. .. .. ..@ listData :List of 11
.. .. .. .. .. .. ..$ id : chr [1:33694] "ENSG00000243485" "ENSG00000237613" "ENSG00000186092" "ENSG00000238009" ...
.. .. .. .. .. .. ..$ symbol : chr [1:33694] "RP11-34P13.3" "FAM138A" "OR4F5" "RP11-34P13.7" ...
.. .. .. .. .. .. ..$ is_feature_control : logi [1:33694] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. .. .. .. ..$ is_feature_control_MT: logi [1:33694] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. .. .. .. ..$ mean_counts : num [1:33694] 0 0 0 0.000895 0.000179 ...
.. .. .. .. .. .. ..$ log10_mean_counts : num [1:33694] 0.00 0.00 0.00 3.89e-04 7.77e-05 ...
.. .. .. .. .. .. ..$ rank_counts : num [1:33694] 6741 6741 6741 18054 14520 ...
.. .. .. .. .. .. ..$ n_cells_counts : int [1:33694] 0 0 0 5 1 0 0 0 611 542 ...
.. .. .. .. .. .. ..$ pct_dropout_counts : num [1:33694] 100 100 100 99.9 100 ...
.. .. .. .. .. .. ..$ total_counts : num [1:33694] 0 0 0 5 1 0 0 0 661 617 ...
.. .. .. .. .. .. ..$ log10_total_counts : num [1:33694] 0 0 0 0.778 0.301 ...
.. .. .. .. .. ..@ elementType : chr "ANY"
.. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. ..@ metadata : list()
.. .. .. ..@ partitioning :Formal class 'PartitioningByEnd' [package "IRanges"] with 5 slots
.. .. .. .. .. ..@ end : int [1:33694] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. .. ..@ NAMES : chr [1:33694] "ENSG00000243485" "ENSG00000237613" "ENSG00000186092" "ENSG00000238009" ...
.. .. .. .. .. ..@ elementType : chr "integer"
.. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. ..@ metadata : list()
.. .. .. ..@ elementType : chr "GRanges"
.. .. .. ..@ metadata : list()
.. ..@ colData :Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. ..@ rownames : chr [1:5586] "AAACCTGAGAAGGTTT-1" "AAACCTGAGCGTTCCG-1" "AAACCTGAGTACGTAA-1" "AAACCTGGTAAACACA-1" ...
.. .. .. ..@ nrows : int 5586
.. .. .. ..@ listData :List of 30
.. .. .. .. ..$ dataset : int [1:5586] 1 1 1 1 1 1 1 1 1 1 ...
.. .. .. .. ..$ barcode : chr [1:5586] "AAACCTGAGAAGGTTT-1" "AAACCTGAGCGTTCCG-1" "AAACCTGAGTACGTAA-1" "AAACCTGGTAAACACA-1" ...
.. .. .. .. ..$ total_features : int [1:5586] 1373 1837 2259 802 2601 1967 1236 1642 1153 1078 ...
.. .. .. .. ..$ log10_total_features : num [1:5586] 3.14 3.26 3.35 2.9 3.42 ...
.. .. .. .. ..$ total_counts : num [1:5586] 3380 7332 10099 1833 12184 ...
.. .. .. .. ..$ log10_total_counts : num [1:5586] 3.53 3.87 4 3.26 4.09 ...
.. .. .. .. ..$ pct_counts_top_50_features : num [1:5586] 33.1 38.9 42.5 40.9 42.2 ...
.. .. .. .. ..$ pct_counts_top_100_features : num [1:5586] 45 54.8 59.2 53.7 53.5 ...
.. .. .. .. ..$ pct_counts_top_200_features : num [1:5586] 57.5 66.9 69 66.4 64.7 ...
.. .. .. .. ..$ pct_counts_top_500_features : num [1:5586] 74.2 79.2 79.4 83.5 76.8 ...
.. .. .. .. ..$ total_features_endogenous : int [1:5586] 1373 1837 2259 802 2601 1967 1236 1642 1153 1078 ...
.. .. .. .. ..$ log10_total_features_endogenous : num [1:5586] 3.14 3.26 3.35 2.9 3.42 ...
.. .. .. .. ..$ total_counts_endogenous : num [1:5586] 3380 7332 10099 1833 12184 ...
.. .. .. .. ..$ log10_total_counts_endogenous : num [1:5586] 3.53 3.87 4 3.26 4.09 ...
.. .. .. .. ..$ pct_counts_endogenous : num [1:5586] 100 100 100 100 100 100 100 100 100 100 ...
.. .. .. .. ..$ pct_counts_top_50_features_endogenous : num [1:5586] 33.1 38.9 42.5 40.9 42.2 ...
.. .. .. .. ..$ pct_counts_top_100_features_endogenous: num [1:5586] 45 54.8 59.2 53.7 53.5 ...
.. .. .. .. ..$ pct_counts_top_200_features_endogenous: num [1:5586] 57.5 66.9 69 66.4 64.7 ...
.. .. .. .. ..$ pct_counts_top_500_features_endogenous: num [1:5586] 74.2 79.2 79.4 83.5 76.8 ...
.. .. .. .. ..$ total_features_feature_control : int [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ log10_total_features_feature_control : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ total_counts_feature_control : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ log10_total_counts_feature_control : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ pct_counts_feature_control : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ total_features_MT : int [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ log10_total_features_MT : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ total_counts_MT : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ log10_total_counts_MT : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ pct_counts_MT : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ is_cell_control : logi [1:5586] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ assays :Reference class 'ShallowSimpleListAssays' [package "SummarizedExperiment"] with 1 field
.. .. ..$ data: NULL
.. .. ..and 14 methods.
.. ..@ NAMES : NULL
.. ..@ elementMetadata :Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. ..@ rownames : NULL
.. .. .. ..@ nrows : int 33694
.. .. .. ..@ listData : Named list()
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ metadata :List of 1
.. .. ..$ name: chr "iMates-1"




Here is one of the four objects.


Could anyone of you help me.



Thank you










share|improve this question




















  • 1





    are you sure your sc_list contains anything? I'm not sure mget works that way...

    – iod
    Nov 22 '18 at 15:32











  • It is not empty.

    – user1826775
    Nov 22 '18 at 15:57











  • Please put the additional information about str(sc_list) from the comment in your question, i.e. edit your question: stackoverflow.com/posts/53434082/edit

    – jogo
    Nov 22 '18 at 18:44











  • @jogo edited the question. Please have a look.

    – user1826775
    Nov 22 '18 at 20:47











  • The object sc_list is a list of S4-objects. The components of a S4-object are slots. The operator to access a slot is @ (not $).

    – jogo
    Nov 22 '18 at 23:02














0












0








0








I am coding in R and I have a small chunk that I need to loop it over.



the part of the code looks like this:



sc_1$ue <- cF(sc_1, 2500, 1000, 5)
sc_2$ue <- cF(sc_2, 2500, 1000, 5)
sc_3$ue <- cF(sc_3, 2500, 1000, 5)
sc_4$ue <- cF(sc_4, 3000, 1000, 5)


where cF is a function I am calling. This code in its present form works without any error.



However, when I try to loop it like the following:



sc_list=mget(sc)
for (i in 1:5)
sc_list[i]$ue <- cF(sc_list[i], 2500, 1000, 5)


where sc contains sc_1 to sc_n objects.



The output is not an immediate error but a warning.



## Warning in sc_list[i] <- `*vtmp*`: number of items to replace is not a
## multiple of replacement length

## Warning in sc_list[i] <- `*vtmp*`: number of items to replace is not a
## multiple of replacement length

## Warning in sc_list[i] <- `*vtmp*`: number of items to replace is not a
## multiple of replacement length

## Warning in sc_list[i] <- `*vtmp*`: number of items to replace is not a
## multiple of replacement length


because of this following code in the program gives me an error.



How can I fix this?



What I have tried is:



sc_list=mget(sc)
for (i in 1:length(paths))
paste0("sc_",i)$ue <- cF(sc_list[i], 2500, 1000, 5)


This throws up an error.



Quitting from lines 209-217 (prototype.Rmd) 
Error in paste0("sc_", i)$use <- cF(sc_list[i], 2500, 1000, :
target of assignment expands to non-language object
Calls: <Anonymous> ... handle -> withCallingHandlers -> withVisible -> eval -> eval
Execution halted


Edit: output of



 > str(sc_list)
List of 4
$ sc_1:Formal class 'SingleCellExperiment' [package "SingleCellExperiment"] with 10 slots
.. ..@ int_elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. ..@ rownames : NULL
.. .. .. ..@ nrows : int 33694
.. .. .. ..@ listData :List of 2
.. .. .. .. ..$ is_spike_MT: logi [1:33694] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. .. ..$ is_spike : logi [1:33694] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ int_colData :Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. ..@ rownames : NULL
.. .. .. ..@ nrows : int 5586
.. .. .. ..@ listData : Named list()
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ int_metadata :List of 2
.. .. ..$ version :Classes 'package_version', 'numeric_version' hidden list of 1
.. .. .. ..$ : int [1:3] 1 0 0
.. .. ..$ spike_names: chr "MT"
.. ..@ reducedDims :Formal class 'SimpleList' [package "S4Vectors"] with 4 slots
.. .. .. ..@ listData : list()
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ rowRanges :Formal class 'GRangesList' [package "GenomicRanges"] with 5 slots
.. .. .. ..@ unlistData :Formal class 'GRanges' [package "GenomicRanges"] with 6 slots
.. .. .. .. .. ..@ seqnames :Formal class 'Rle' [package "S4Vectors"] with 4 slots
.. .. .. .. .. .. .. ..@ values : Factor w/ 0 levels:
.. .. .. .. .. .. .. ..@ lengths : int(0)
.. .. .. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. .. .. ..@ metadata : list()
.. .. .. .. .. ..@ ranges :Formal class 'IRanges' [package "IRanges"] with 6 slots
.. .. .. .. .. .. .. ..@ start : int(0)
.. .. .. .. .. .. .. ..@ width : int(0)
.. .. .. .. .. .. .. ..@ NAMES : NULL
.. .. .. .. .. .. .. ..@ elementType : chr "integer"
.. .. .. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. .. .. ..@ metadata : list()
.. .. .. .. .. ..@ strand :Formal class 'Rle' [package "S4Vectors"] with 4 slots
.. .. .. .. .. .. .. ..@ values : Factor w/ 3 levels "+","-","*":
.. .. .. .. .. .. .. ..@ lengths : int(0)
.. .. .. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. .. .. ..@ metadata : list()
.. .. .. .. .. ..@ elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. .. .. .. .. ..@ rownames : NULL
.. .. .. .. .. .. .. ..@ nrows : int 0
.. .. .. .. .. .. .. ..@ listData : Named list()
.. .. .. .. .. .. .. ..@ elementType : chr "ANY"
.. .. .. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. .. .. ..@ metadata : list()
.. .. .. .. .. ..@ seqinfo :Formal class 'Seqinfo' [package "GenomeInfoDb"] with 4 slots
.. .. .. .. .. .. .. ..@ seqnames : chr(0)
.. .. .. .. .. .. .. ..@ seqlengths : int(0)
.. .. .. .. .. .. .. ..@ is_circular: logi(0)
.. .. .. .. .. .. .. ..@ genome : chr(0)
.. .. .. .. .. ..@ metadata : list()
.. .. .. ..@ elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. .. .. ..@ rownames : NULL
.. .. .. .. .. ..@ nrows : int 33694
.. .. .. .. .. ..@ listData :List of 11
.. .. .. .. .. .. ..$ id : chr [1:33694] "ENSG00000243485" "ENSG00000237613" "ENSG00000186092" "ENSG00000238009" ...
.. .. .. .. .. .. ..$ symbol : chr [1:33694] "RP11-34P13.3" "FAM138A" "OR4F5" "RP11-34P13.7" ...
.. .. .. .. .. .. ..$ is_feature_control : logi [1:33694] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. .. .. .. ..$ is_feature_control_MT: logi [1:33694] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. .. .. .. ..$ mean_counts : num [1:33694] 0 0 0 0.000895 0.000179 ...
.. .. .. .. .. .. ..$ log10_mean_counts : num [1:33694] 0.00 0.00 0.00 3.89e-04 7.77e-05 ...
.. .. .. .. .. .. ..$ rank_counts : num [1:33694] 6741 6741 6741 18054 14520 ...
.. .. .. .. .. .. ..$ n_cells_counts : int [1:33694] 0 0 0 5 1 0 0 0 611 542 ...
.. .. .. .. .. .. ..$ pct_dropout_counts : num [1:33694] 100 100 100 99.9 100 ...
.. .. .. .. .. .. ..$ total_counts : num [1:33694] 0 0 0 5 1 0 0 0 661 617 ...
.. .. .. .. .. .. ..$ log10_total_counts : num [1:33694] 0 0 0 0.778 0.301 ...
.. .. .. .. .. ..@ elementType : chr "ANY"
.. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. ..@ metadata : list()
.. .. .. ..@ partitioning :Formal class 'PartitioningByEnd' [package "IRanges"] with 5 slots
.. .. .. .. .. ..@ end : int [1:33694] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. .. ..@ NAMES : chr [1:33694] "ENSG00000243485" "ENSG00000237613" "ENSG00000186092" "ENSG00000238009" ...
.. .. .. .. .. ..@ elementType : chr "integer"
.. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. ..@ metadata : list()
.. .. .. ..@ elementType : chr "GRanges"
.. .. .. ..@ metadata : list()
.. ..@ colData :Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. ..@ rownames : chr [1:5586] "AAACCTGAGAAGGTTT-1" "AAACCTGAGCGTTCCG-1" "AAACCTGAGTACGTAA-1" "AAACCTGGTAAACACA-1" ...
.. .. .. ..@ nrows : int 5586
.. .. .. ..@ listData :List of 30
.. .. .. .. ..$ dataset : int [1:5586] 1 1 1 1 1 1 1 1 1 1 ...
.. .. .. .. ..$ barcode : chr [1:5586] "AAACCTGAGAAGGTTT-1" "AAACCTGAGCGTTCCG-1" "AAACCTGAGTACGTAA-1" "AAACCTGGTAAACACA-1" ...
.. .. .. .. ..$ total_features : int [1:5586] 1373 1837 2259 802 2601 1967 1236 1642 1153 1078 ...
.. .. .. .. ..$ log10_total_features : num [1:5586] 3.14 3.26 3.35 2.9 3.42 ...
.. .. .. .. ..$ total_counts : num [1:5586] 3380 7332 10099 1833 12184 ...
.. .. .. .. ..$ log10_total_counts : num [1:5586] 3.53 3.87 4 3.26 4.09 ...
.. .. .. .. ..$ pct_counts_top_50_features : num [1:5586] 33.1 38.9 42.5 40.9 42.2 ...
.. .. .. .. ..$ pct_counts_top_100_features : num [1:5586] 45 54.8 59.2 53.7 53.5 ...
.. .. .. .. ..$ pct_counts_top_200_features : num [1:5586] 57.5 66.9 69 66.4 64.7 ...
.. .. .. .. ..$ pct_counts_top_500_features : num [1:5586] 74.2 79.2 79.4 83.5 76.8 ...
.. .. .. .. ..$ total_features_endogenous : int [1:5586] 1373 1837 2259 802 2601 1967 1236 1642 1153 1078 ...
.. .. .. .. ..$ log10_total_features_endogenous : num [1:5586] 3.14 3.26 3.35 2.9 3.42 ...
.. .. .. .. ..$ total_counts_endogenous : num [1:5586] 3380 7332 10099 1833 12184 ...
.. .. .. .. ..$ log10_total_counts_endogenous : num [1:5586] 3.53 3.87 4 3.26 4.09 ...
.. .. .. .. ..$ pct_counts_endogenous : num [1:5586] 100 100 100 100 100 100 100 100 100 100 ...
.. .. .. .. ..$ pct_counts_top_50_features_endogenous : num [1:5586] 33.1 38.9 42.5 40.9 42.2 ...
.. .. .. .. ..$ pct_counts_top_100_features_endogenous: num [1:5586] 45 54.8 59.2 53.7 53.5 ...
.. .. .. .. ..$ pct_counts_top_200_features_endogenous: num [1:5586] 57.5 66.9 69 66.4 64.7 ...
.. .. .. .. ..$ pct_counts_top_500_features_endogenous: num [1:5586] 74.2 79.2 79.4 83.5 76.8 ...
.. .. .. .. ..$ total_features_feature_control : int [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ log10_total_features_feature_control : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ total_counts_feature_control : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ log10_total_counts_feature_control : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ pct_counts_feature_control : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ total_features_MT : int [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ log10_total_features_MT : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ total_counts_MT : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ log10_total_counts_MT : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ pct_counts_MT : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ is_cell_control : logi [1:5586] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ assays :Reference class 'ShallowSimpleListAssays' [package "SummarizedExperiment"] with 1 field
.. .. ..$ data: NULL
.. .. ..and 14 methods.
.. ..@ NAMES : NULL
.. ..@ elementMetadata :Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. ..@ rownames : NULL
.. .. .. ..@ nrows : int 33694
.. .. .. ..@ listData : Named list()
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ metadata :List of 1
.. .. ..$ name: chr "iMates-1"




Here is one of the four objects.


Could anyone of you help me.



Thank you










share|improve this question
















I am coding in R and I have a small chunk that I need to loop it over.



the part of the code looks like this:



sc_1$ue <- cF(sc_1, 2500, 1000, 5)
sc_2$ue <- cF(sc_2, 2500, 1000, 5)
sc_3$ue <- cF(sc_3, 2500, 1000, 5)
sc_4$ue <- cF(sc_4, 3000, 1000, 5)


where cF is a function I am calling. This code in its present form works without any error.



However, when I try to loop it like the following:



sc_list=mget(sc)
for (i in 1:5)
sc_list[i]$ue <- cF(sc_list[i], 2500, 1000, 5)


where sc contains sc_1 to sc_n objects.



The output is not an immediate error but a warning.



## Warning in sc_list[i] <- `*vtmp*`: number of items to replace is not a
## multiple of replacement length

## Warning in sc_list[i] <- `*vtmp*`: number of items to replace is not a
## multiple of replacement length

## Warning in sc_list[i] <- `*vtmp*`: number of items to replace is not a
## multiple of replacement length

## Warning in sc_list[i] <- `*vtmp*`: number of items to replace is not a
## multiple of replacement length


because of this following code in the program gives me an error.



How can I fix this?



What I have tried is:



sc_list=mget(sc)
for (i in 1:length(paths))
paste0("sc_",i)$ue <- cF(sc_list[i], 2500, 1000, 5)


This throws up an error.



Quitting from lines 209-217 (prototype.Rmd) 
Error in paste0("sc_", i)$use <- cF(sc_list[i], 2500, 1000, :
target of assignment expands to non-language object
Calls: <Anonymous> ... handle -> withCallingHandlers -> withVisible -> eval -> eval
Execution halted


Edit: output of



 > str(sc_list)
List of 4
$ sc_1:Formal class 'SingleCellExperiment' [package "SingleCellExperiment"] with 10 slots
.. ..@ int_elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. ..@ rownames : NULL
.. .. .. ..@ nrows : int 33694
.. .. .. ..@ listData :List of 2
.. .. .. .. ..$ is_spike_MT: logi [1:33694] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. .. ..$ is_spike : logi [1:33694] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ int_colData :Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. ..@ rownames : NULL
.. .. .. ..@ nrows : int 5586
.. .. .. ..@ listData : Named list()
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ int_metadata :List of 2
.. .. ..$ version :Classes 'package_version', 'numeric_version' hidden list of 1
.. .. .. ..$ : int [1:3] 1 0 0
.. .. ..$ spike_names: chr "MT"
.. ..@ reducedDims :Formal class 'SimpleList' [package "S4Vectors"] with 4 slots
.. .. .. ..@ listData : list()
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ rowRanges :Formal class 'GRangesList' [package "GenomicRanges"] with 5 slots
.. .. .. ..@ unlistData :Formal class 'GRanges' [package "GenomicRanges"] with 6 slots
.. .. .. .. .. ..@ seqnames :Formal class 'Rle' [package "S4Vectors"] with 4 slots
.. .. .. .. .. .. .. ..@ values : Factor w/ 0 levels:
.. .. .. .. .. .. .. ..@ lengths : int(0)
.. .. .. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. .. .. ..@ metadata : list()
.. .. .. .. .. ..@ ranges :Formal class 'IRanges' [package "IRanges"] with 6 slots
.. .. .. .. .. .. .. ..@ start : int(0)
.. .. .. .. .. .. .. ..@ width : int(0)
.. .. .. .. .. .. .. ..@ NAMES : NULL
.. .. .. .. .. .. .. ..@ elementType : chr "integer"
.. .. .. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. .. .. ..@ metadata : list()
.. .. .. .. .. ..@ strand :Formal class 'Rle' [package "S4Vectors"] with 4 slots
.. .. .. .. .. .. .. ..@ values : Factor w/ 3 levels "+","-","*":
.. .. .. .. .. .. .. ..@ lengths : int(0)
.. .. .. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. .. .. ..@ metadata : list()
.. .. .. .. .. ..@ elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. .. .. .. .. ..@ rownames : NULL
.. .. .. .. .. .. .. ..@ nrows : int 0
.. .. .. .. .. .. .. ..@ listData : Named list()
.. .. .. .. .. .. .. ..@ elementType : chr "ANY"
.. .. .. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. .. .. ..@ metadata : list()
.. .. .. .. .. ..@ seqinfo :Formal class 'Seqinfo' [package "GenomeInfoDb"] with 4 slots
.. .. .. .. .. .. .. ..@ seqnames : chr(0)
.. .. .. .. .. .. .. ..@ seqlengths : int(0)
.. .. .. .. .. .. .. ..@ is_circular: logi(0)
.. .. .. .. .. .. .. ..@ genome : chr(0)
.. .. .. .. .. ..@ metadata : list()
.. .. .. ..@ elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. .. .. ..@ rownames : NULL
.. .. .. .. .. ..@ nrows : int 33694
.. .. .. .. .. ..@ listData :List of 11
.. .. .. .. .. .. ..$ id : chr [1:33694] "ENSG00000243485" "ENSG00000237613" "ENSG00000186092" "ENSG00000238009" ...
.. .. .. .. .. .. ..$ symbol : chr [1:33694] "RP11-34P13.3" "FAM138A" "OR4F5" "RP11-34P13.7" ...
.. .. .. .. .. .. ..$ is_feature_control : logi [1:33694] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. .. .. .. ..$ is_feature_control_MT: logi [1:33694] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. .. .. .. ..$ mean_counts : num [1:33694] 0 0 0 0.000895 0.000179 ...
.. .. .. .. .. .. ..$ log10_mean_counts : num [1:33694] 0.00 0.00 0.00 3.89e-04 7.77e-05 ...
.. .. .. .. .. .. ..$ rank_counts : num [1:33694] 6741 6741 6741 18054 14520 ...
.. .. .. .. .. .. ..$ n_cells_counts : int [1:33694] 0 0 0 5 1 0 0 0 611 542 ...
.. .. .. .. .. .. ..$ pct_dropout_counts : num [1:33694] 100 100 100 99.9 100 ...
.. .. .. .. .. .. ..$ total_counts : num [1:33694] 0 0 0 5 1 0 0 0 661 617 ...
.. .. .. .. .. .. ..$ log10_total_counts : num [1:33694] 0 0 0 0.778 0.301 ...
.. .. .. .. .. ..@ elementType : chr "ANY"
.. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. ..@ metadata : list()
.. .. .. ..@ partitioning :Formal class 'PartitioningByEnd' [package "IRanges"] with 5 slots
.. .. .. .. .. ..@ end : int [1:33694] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. .. ..@ NAMES : chr [1:33694] "ENSG00000243485" "ENSG00000237613" "ENSG00000186092" "ENSG00000238009" ...
.. .. .. .. .. ..@ elementType : chr "integer"
.. .. .. .. .. ..@ elementMetadata: NULL
.. .. .. .. .. ..@ metadata : list()
.. .. .. ..@ elementType : chr "GRanges"
.. .. .. ..@ metadata : list()
.. ..@ colData :Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. ..@ rownames : chr [1:5586] "AAACCTGAGAAGGTTT-1" "AAACCTGAGCGTTCCG-1" "AAACCTGAGTACGTAA-1" "AAACCTGGTAAACACA-1" ...
.. .. .. ..@ nrows : int 5586
.. .. .. ..@ listData :List of 30
.. .. .. .. ..$ dataset : int [1:5586] 1 1 1 1 1 1 1 1 1 1 ...
.. .. .. .. ..$ barcode : chr [1:5586] "AAACCTGAGAAGGTTT-1" "AAACCTGAGCGTTCCG-1" "AAACCTGAGTACGTAA-1" "AAACCTGGTAAACACA-1" ...
.. .. .. .. ..$ total_features : int [1:5586] 1373 1837 2259 802 2601 1967 1236 1642 1153 1078 ...
.. .. .. .. ..$ log10_total_features : num [1:5586] 3.14 3.26 3.35 2.9 3.42 ...
.. .. .. .. ..$ total_counts : num [1:5586] 3380 7332 10099 1833 12184 ...
.. .. .. .. ..$ log10_total_counts : num [1:5586] 3.53 3.87 4 3.26 4.09 ...
.. .. .. .. ..$ pct_counts_top_50_features : num [1:5586] 33.1 38.9 42.5 40.9 42.2 ...
.. .. .. .. ..$ pct_counts_top_100_features : num [1:5586] 45 54.8 59.2 53.7 53.5 ...
.. .. .. .. ..$ pct_counts_top_200_features : num [1:5586] 57.5 66.9 69 66.4 64.7 ...
.. .. .. .. ..$ pct_counts_top_500_features : num [1:5586] 74.2 79.2 79.4 83.5 76.8 ...
.. .. .. .. ..$ total_features_endogenous : int [1:5586] 1373 1837 2259 802 2601 1967 1236 1642 1153 1078 ...
.. .. .. .. ..$ log10_total_features_endogenous : num [1:5586] 3.14 3.26 3.35 2.9 3.42 ...
.. .. .. .. ..$ total_counts_endogenous : num [1:5586] 3380 7332 10099 1833 12184 ...
.. .. .. .. ..$ log10_total_counts_endogenous : num [1:5586] 3.53 3.87 4 3.26 4.09 ...
.. .. .. .. ..$ pct_counts_endogenous : num [1:5586] 100 100 100 100 100 100 100 100 100 100 ...
.. .. .. .. ..$ pct_counts_top_50_features_endogenous : num [1:5586] 33.1 38.9 42.5 40.9 42.2 ...
.. .. .. .. ..$ pct_counts_top_100_features_endogenous: num [1:5586] 45 54.8 59.2 53.7 53.5 ...
.. .. .. .. ..$ pct_counts_top_200_features_endogenous: num [1:5586] 57.5 66.9 69 66.4 64.7 ...
.. .. .. .. ..$ pct_counts_top_500_features_endogenous: num [1:5586] 74.2 79.2 79.4 83.5 76.8 ...
.. .. .. .. ..$ total_features_feature_control : int [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ log10_total_features_feature_control : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ total_counts_feature_control : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ log10_total_counts_feature_control : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ pct_counts_feature_control : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ total_features_MT : int [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ log10_total_features_MT : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ total_counts_MT : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ log10_total_counts_MT : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ pct_counts_MT : num [1:5586] 0 0 0 0 0 0 0 0 0 0 ...
.. .. .. .. ..$ is_cell_control : logi [1:5586] FALSE FALSE FALSE FALSE FALSE FALSE ...
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ assays :Reference class 'ShallowSimpleListAssays' [package "SummarizedExperiment"] with 1 field
.. .. ..$ data: NULL
.. .. ..and 14 methods.
.. ..@ NAMES : NULL
.. ..@ elementMetadata :Formal class 'DataFrame' [package "S4Vectors"] with 6 slots
.. .. .. ..@ rownames : NULL
.. .. .. ..@ nrows : int 33694
.. .. .. ..@ listData : Named list()
.. .. .. ..@ elementType : chr "ANY"
.. .. .. ..@ elementMetadata: NULL
.. .. .. ..@ metadata : list()
.. ..@ metadata :List of 1
.. .. ..$ name: chr "iMates-1"




Here is one of the four objects.


Could anyone of you help me.



Thank you







r s4






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 22 '18 at 22:49







user1826775

















asked Nov 22 '18 at 15:25









user1826775user1826775

33




33








  • 1





    are you sure your sc_list contains anything? I'm not sure mget works that way...

    – iod
    Nov 22 '18 at 15:32











  • It is not empty.

    – user1826775
    Nov 22 '18 at 15:57











  • Please put the additional information about str(sc_list) from the comment in your question, i.e. edit your question: stackoverflow.com/posts/53434082/edit

    – jogo
    Nov 22 '18 at 18:44











  • @jogo edited the question. Please have a look.

    – user1826775
    Nov 22 '18 at 20:47











  • The object sc_list is a list of S4-objects. The components of a S4-object are slots. The operator to access a slot is @ (not $).

    – jogo
    Nov 22 '18 at 23:02














  • 1





    are you sure your sc_list contains anything? I'm not sure mget works that way...

    – iod
    Nov 22 '18 at 15:32











  • It is not empty.

    – user1826775
    Nov 22 '18 at 15:57











  • Please put the additional information about str(sc_list) from the comment in your question, i.e. edit your question: stackoverflow.com/posts/53434082/edit

    – jogo
    Nov 22 '18 at 18:44











  • @jogo edited the question. Please have a look.

    – user1826775
    Nov 22 '18 at 20:47











  • The object sc_list is a list of S4-objects. The components of a S4-object are slots. The operator to access a slot is @ (not $).

    – jogo
    Nov 22 '18 at 23:02








1




1





are you sure your sc_list contains anything? I'm not sure mget works that way...

– iod
Nov 22 '18 at 15:32





are you sure your sc_list contains anything? I'm not sure mget works that way...

– iod
Nov 22 '18 at 15:32













It is not empty.

– user1826775
Nov 22 '18 at 15:57





It is not empty.

– user1826775
Nov 22 '18 at 15:57













Please put the additional information about str(sc_list) from the comment in your question, i.e. edit your question: stackoverflow.com/posts/53434082/edit

– jogo
Nov 22 '18 at 18:44





Please put the additional information about str(sc_list) from the comment in your question, i.e. edit your question: stackoverflow.com/posts/53434082/edit

– jogo
Nov 22 '18 at 18:44













@jogo edited the question. Please have a look.

– user1826775
Nov 22 '18 at 20:47





@jogo edited the question. Please have a look.

– user1826775
Nov 22 '18 at 20:47













The object sc_list is a list of S4-objects. The components of a S4-object are slots. The operator to access a slot is @ (not $).

– jogo
Nov 22 '18 at 23:02





The object sc_list is a list of S4-objects. The components of a S4-object are slots. The operator to access a slot is @ (not $).

– jogo
Nov 22 '18 at 23:02












1 Answer
1






active

oldest

votes


















0














I'm assuming sc_list is a list of lists, right?
If so, can you check if the following code works?



sc_list=mget(sc)
for (i in 1:5)
sc_list[[i]]$ue <- cF(sc_list[[i]], 2500, 1000, 5)





share|improve this answer
























  • I got this error now. "$ operator is invalid for atomic vectors"

    – user1826775
    Nov 22 '18 at 15:38






  • 1





    can you post the output of str(sc_list)?

    – feebarscevicius
    Nov 22 '18 at 15:58











  • it is a very big output. But what I can see is that it starts with " List of 4". I hope this is what you were trying to confirm. The first line is like sc_1:Formal class 'SingleCellExperiment' [package "SingleCellExperiment"] with 10 slots .. ..@ int_elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots .. .. .. ..@ rownames : NULL .. .. .. ..@ nrows : int 22496 .. .. .. ..@ listData :List of 2

    – user1826775
    Nov 22 '18 at 16:11













  • So it is a list of S4-objects.

    – jogo
    Nov 22 '18 at 16:27











  • @jogo: Yes, indeed. How should I fix this.

    – user1826775
    Nov 22 '18 at 17:51











Your Answer






StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");

StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);

StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});

function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});


}
});














draft saved

draft discarded


















StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434082%2fto-get-rid-of-warning-and-error-non-language-object-in-r%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown

























1 Answer
1






active

oldest

votes








1 Answer
1






active

oldest

votes









active

oldest

votes






active

oldest

votes









0














I'm assuming sc_list is a list of lists, right?
If so, can you check if the following code works?



sc_list=mget(sc)
for (i in 1:5)
sc_list[[i]]$ue <- cF(sc_list[[i]], 2500, 1000, 5)





share|improve this answer
























  • I got this error now. "$ operator is invalid for atomic vectors"

    – user1826775
    Nov 22 '18 at 15:38






  • 1





    can you post the output of str(sc_list)?

    – feebarscevicius
    Nov 22 '18 at 15:58











  • it is a very big output. But what I can see is that it starts with " List of 4". I hope this is what you were trying to confirm. The first line is like sc_1:Formal class 'SingleCellExperiment' [package "SingleCellExperiment"] with 10 slots .. ..@ int_elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots .. .. .. ..@ rownames : NULL .. .. .. ..@ nrows : int 22496 .. .. .. ..@ listData :List of 2

    – user1826775
    Nov 22 '18 at 16:11













  • So it is a list of S4-objects.

    – jogo
    Nov 22 '18 at 16:27











  • @jogo: Yes, indeed. How should I fix this.

    – user1826775
    Nov 22 '18 at 17:51
















0














I'm assuming sc_list is a list of lists, right?
If so, can you check if the following code works?



sc_list=mget(sc)
for (i in 1:5)
sc_list[[i]]$ue <- cF(sc_list[[i]], 2500, 1000, 5)





share|improve this answer
























  • I got this error now. "$ operator is invalid for atomic vectors"

    – user1826775
    Nov 22 '18 at 15:38






  • 1





    can you post the output of str(sc_list)?

    – feebarscevicius
    Nov 22 '18 at 15:58











  • it is a very big output. But what I can see is that it starts with " List of 4". I hope this is what you were trying to confirm. The first line is like sc_1:Formal class 'SingleCellExperiment' [package "SingleCellExperiment"] with 10 slots .. ..@ int_elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots .. .. .. ..@ rownames : NULL .. .. .. ..@ nrows : int 22496 .. .. .. ..@ listData :List of 2

    – user1826775
    Nov 22 '18 at 16:11













  • So it is a list of S4-objects.

    – jogo
    Nov 22 '18 at 16:27











  • @jogo: Yes, indeed. How should I fix this.

    – user1826775
    Nov 22 '18 at 17:51














0












0








0







I'm assuming sc_list is a list of lists, right?
If so, can you check if the following code works?



sc_list=mget(sc)
for (i in 1:5)
sc_list[[i]]$ue <- cF(sc_list[[i]], 2500, 1000, 5)





share|improve this answer













I'm assuming sc_list is a list of lists, right?
If so, can you check if the following code works?



sc_list=mget(sc)
for (i in 1:5)
sc_list[[i]]$ue <- cF(sc_list[[i]], 2500, 1000, 5)






share|improve this answer












share|improve this answer



share|improve this answer










answered Nov 22 '18 at 15:34









feebarsceviciusfeebarscevicius

50426




50426













  • I got this error now. "$ operator is invalid for atomic vectors"

    – user1826775
    Nov 22 '18 at 15:38






  • 1





    can you post the output of str(sc_list)?

    – feebarscevicius
    Nov 22 '18 at 15:58











  • it is a very big output. But what I can see is that it starts with " List of 4". I hope this is what you were trying to confirm. The first line is like sc_1:Formal class 'SingleCellExperiment' [package "SingleCellExperiment"] with 10 slots .. ..@ int_elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots .. .. .. ..@ rownames : NULL .. .. .. ..@ nrows : int 22496 .. .. .. ..@ listData :List of 2

    – user1826775
    Nov 22 '18 at 16:11













  • So it is a list of S4-objects.

    – jogo
    Nov 22 '18 at 16:27











  • @jogo: Yes, indeed. How should I fix this.

    – user1826775
    Nov 22 '18 at 17:51



















  • I got this error now. "$ operator is invalid for atomic vectors"

    – user1826775
    Nov 22 '18 at 15:38






  • 1





    can you post the output of str(sc_list)?

    – feebarscevicius
    Nov 22 '18 at 15:58











  • it is a very big output. But what I can see is that it starts with " List of 4". I hope this is what you were trying to confirm. The first line is like sc_1:Formal class 'SingleCellExperiment' [package "SingleCellExperiment"] with 10 slots .. ..@ int_elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots .. .. .. ..@ rownames : NULL .. .. .. ..@ nrows : int 22496 .. .. .. ..@ listData :List of 2

    – user1826775
    Nov 22 '18 at 16:11













  • So it is a list of S4-objects.

    – jogo
    Nov 22 '18 at 16:27











  • @jogo: Yes, indeed. How should I fix this.

    – user1826775
    Nov 22 '18 at 17:51

















I got this error now. "$ operator is invalid for atomic vectors"

– user1826775
Nov 22 '18 at 15:38





I got this error now. "$ operator is invalid for atomic vectors"

– user1826775
Nov 22 '18 at 15:38




1




1





can you post the output of str(sc_list)?

– feebarscevicius
Nov 22 '18 at 15:58





can you post the output of str(sc_list)?

– feebarscevicius
Nov 22 '18 at 15:58













it is a very big output. But what I can see is that it starts with " List of 4". I hope this is what you were trying to confirm. The first line is like sc_1:Formal class 'SingleCellExperiment' [package "SingleCellExperiment"] with 10 slots .. ..@ int_elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots .. .. .. ..@ rownames : NULL .. .. .. ..@ nrows : int 22496 .. .. .. ..@ listData :List of 2

– user1826775
Nov 22 '18 at 16:11







it is a very big output. But what I can see is that it starts with " List of 4". I hope this is what you were trying to confirm. The first line is like sc_1:Formal class 'SingleCellExperiment' [package "SingleCellExperiment"] with 10 slots .. ..@ int_elementMetadata:Formal class 'DataFrame' [package "S4Vectors"] with 6 slots .. .. .. ..@ rownames : NULL .. .. .. ..@ nrows : int 22496 .. .. .. ..@ listData :List of 2

– user1826775
Nov 22 '18 at 16:11















So it is a list of S4-objects.

– jogo
Nov 22 '18 at 16:27





So it is a list of S4-objects.

– jogo
Nov 22 '18 at 16:27













@jogo: Yes, indeed. How should I fix this.

– user1826775
Nov 22 '18 at 17:51





@jogo: Yes, indeed. How should I fix this.

– user1826775
Nov 22 '18 at 17:51




















draft saved

draft discarded




















































Thanks for contributing an answer to Stack Overflow!


  • Please be sure to answer the question. Provide details and share your research!

But avoid



  • Asking for help, clarification, or responding to other answers.

  • Making statements based on opinion; back them up with references or personal experience.


To learn more, see our tips on writing great answers.




draft saved


draft discarded














StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53434082%2fto-get-rid-of-warning-and-error-non-language-object-in-r%23new-answer', 'question_page');
}
);

Post as a guest















Required, but never shown





















































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown

































Required, but never shown














Required, but never shown












Required, but never shown







Required, but never shown







Popular posts from this blog

"Incorrect syntax near the keyword 'ON'. (on update cascade, on delete cascade,)

Alcedinidae

Origin of the phrase “under your belt”?