Error In As.vectordata Subscript Out Of Bounds
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you might
R Subscript Out Of Bounds In Matrices
have Meta Discuss the workings and policies of this site About error in pi[[j]] : subscript out of bounds rbind Us Learn more about Stack Overflow the company Business Learn more about hiring developers or posting ads
Solving Problems Of Subscript Out Of Bounds In R
with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, error during wrapup: subscript out of bounds just like you, helping each other. Join them; it only takes a minute: Sign up Subscript out of bounds - general definition and solution? up vote 16 down vote favorite 18 When working with R I frequently get the error message "subscript out of bounds". For example: # Load necessary libraries and data library(igraph) library(NetData) error in * tmp * subscript out of bounds data(kracknets, package = "NetData") # Reduce dataset to nonzero edges krack_full_nonzero_edges <- subset(krack_full_data_frame, (advice_tie > 0 | friendship_tie > 0 | reports_to_tie > 0)) # convert to graph data farme krack_full <- graph.data.frame(krack_full_nonzero_edges) # Set vertex attributes for (i in V(krack_full)) { for (j in names(attributes)) { krack_full <- set.vertex.attribute(krack_full, j, index=i, attributes[i+1,j]) } } # Calculate reachability for each vertix reachability <- function(g, m) { reach_mat = matrix(nrow = vcount(g), ncol = vcount(g)) for (i in 1:vcount(g)) { reach_mat[i,] = 0 this_node_reach <- subcomponent(g, (i - 1), mode = m) for (j in 1:(length(this_node_reach))) { alter = this_node_reach[j] + 1 reach_mat[i, alter] = 1 } } return(reach_mat) } reach_full_in <- reachability(krack_full, 'in') reach_full_in This generates the following error Error in reach_mat[i, alter] = 1 : subscript out of bounds. However, my question is not about this particular piece of code (even though it would be helpful to solve that too), but my question is more general: What is the definition of a subscript-out-of-bounds er
5.4 years ago by Valerie Obenchain ♦♦ 5.6k United States Valerie Obenchain ♦♦ 5.6k wrote: Hi Andrea, I think your problem is with the min.obs argument. See ?p.vector. Given the dimensions below, you don't have 20 observations for each gene in Data. Valerie On 05/30/11
Rbind Subscript Out Of Bounds
07:34, andrea.grilli at ior.it wrote: > Hi all, > I'm performing time series experiment with maSigPro package. options(error=recover) When I > compute regression fit to find significant genes with "p.vector" > function, I receive this output: > Error: subscript out of bounds >
Subscript Out Of Bounds Shiny
> Here you can find a resume of my script: > library("maSigPro") > parameters <- as.matrix(read.table("./Parameters.txt", header = TRUE)) > # design object > design <- make.design.matrix (parameters, degree = 3) > Data <- read.table("./Data_RMAnorm.txt") # expression object > fit <- p.vector(Data, http://stackoverflow.com/questions/15031338/subscript-out-of-bounds-general-definition-and-solution design, Q = 0.05, MT.adjust = "BH", min.obs = 20) >> Error: subscript out of bounds > > It looks like no right dimension of either design or array objects, > but both input files look ok for me. > >> parameters > Time Replicates Transfectant wt22 wt36 Saos1 Saos2 > CD99wt22_g21 21 1 1 1 0 0 0 > CD99wt22_g7 7 2 1 1 0 0 0 > CD99wt22_g0 0 5 1 1 0 0 0 > CD99wt22_g14 14 5 1 1 0 0 https://support.bioconductor.org/p/39734/ 0 > CD99wt36_g21 21 1 1 0 1 0 0 > CD99wt36_g7 7 2 1 0 1 0 0 > CD99wt36_g0 0 6 1 0 1 0 0 > CD99wt36_g14 14 6 1 0 1 0 0 > Saos_g21_1 21 3 0 0 0 1 0 > Saos_g7_1 7 4 0 0 0 1 0 > Saos_g0_1 0 7 0 0 0 1 0 > Saos_g14_1 14 8 0 0 0 1 0 > Saos_g21_2 21 3 0 0 0 0 1 > Saos_g7_2 7 4 0 0 0 0 1 > Saos_g0_2 0 7 0 0 0 0 1 > Saos_g14_2 14 8 0 0 0 0 1 > >> ncol(parameters) > [1] 7 >> nrow(parameters) > [1] 16 >> typeof(parameters) > [1] "integer >> str(parameters) > int [1:16, 1:7] 21 7 0 14 21 7 0 14 21 7 ... > - attr(*, "dimnames")=List of 2 > ..$ : chr [1:16] "CD99wt22_g21" "CD99wt22_g7" "CD99wt22_g0" > "CD99wt22_g14" ... > ..$ : chr [1:7] "Time" "Replicates" "Transfectant" "wt22" ... >> rownames(parameters) > [1] "CD99wt22_g21" "CD99wt22_g7" "CD99wt22_g0" "CD99wt22_g14" > "CD99wt36_g21" > [6] "CD99wt36_g7" "CD99wt36_g0" "CD99wt36_g14" "Saos_g21_1" > "Saos_g7_1" > [11] "Saos_g0_1" "Saos_g14_1" "Saos_g21_2" "Saos_g7_2" > "Saos_g0_2" > [16] "Saos_g14_2" > > >> head(Data) > CD99wt22_g21 CD99wt22_g7 CD99wt22_g0 CD99wt22_g14 CD99wt36_g21 > 1007_s_at 8.700365 9.270211 9.430757 9.538669 8.745657 > 1053_at 9.147460 9.271868 9.313653 9.474059 9.070484 > 117_at 5.525772 5.295018 5.324190 5.616462 5.426015 > 121_at 7.677000 7.969068 7.808228 8.013086 7.710776 > 1255_g_at 3.006305 3.081713 2.978214 2.996469 2.962183 > 1294_at 6.062574 6.479575 6.162924 6.582346 6.189861 > CD99wt36_g7 CD99wt
5.4 years ago by Andrea Grilli • 240 Italy, Bologna, Rizzoli Orthopaedic Institute Andrea Grilli • 240 wrote: Hi all, I'm performing time series experiment with maSigPro package. When I compute https://support.bioconductor.org/p/39680/ regression fit to find significant genes with "p.vector" function, I receive this output: Error: subscript out of bounds Here you can find a resume of my script: library("maSigPro") parameters <- as.matrix(read.table("./Parameters.txt", header = TRUE)) # design object design <- make.design.matrix (parameters, degree = 3) Data <- read.table("./Data_RMAnorm.txt") # expression object fit <- p.vector(Data, design, Q = 0.05, MT.adjust = "BH", min.obs = 20) > Error: subscript out of bounds It looks subscript out like no right dimension of either design or array objects, but both input files look ok for me. > parameters Time Replicates Transfectant wt22 wt36 Saos1 Saos2 CD99wt22_g21 21 1 1 1 0 0 0 CD99wt22_g7 7 2 1 1 0 0 0 CD99wt22_g0 0 5 1 1 0 0 0 CD99wt22_g14 14 5 1 1 0 0 0 CD99wt36_g21 21 1 1 0 1 0 0 CD99wt36_g7 7 2 1 subscript out of 0 1 0 0 CD99wt36_g0 0 6 1 0 1 0 0 CD99wt36_g14 14 6 1 0 1 0 0 Saos_g21_1 21 3 0 0 0 1 0 Saos_g7_1 7 4 0 0 0 1 0 Saos_g0_1 0 7 0 0 0 1 0 Saos_g14_1 14 8 0 0 0 1 0 Saos_g21_2 21 3 0 0 0 0 1 Saos_g7_2 7 4 0 0 0 0 1 Saos_g0_2 0 7 0 0 0 0 1 Saos_g14_2 14 8 0 0 0 0 1 > ncol(parameters) [1] 7 > nrow(parameters) [1] 16 > typeof(parameters) [1] "integer > str(parameters) int [1:16, 1:7] 21 7 0 14 21 7 0 14 21 7 ... - attr(*, "dimnames")=List of 2 ..$ : chr [1:16] "CD99wt22_g21" "CD99wt22_g7" "CD99wt22_g0" "CD99wt22_g14" ... ..$ : chr [1:7] "Time" "Replicates" "Transfectant" "wt22" ... > rownames(parameters) [1] "CD99wt22_g21" "CD99wt22_g7" "CD99wt22_g0" "CD99wt22_g14" "CD99wt36_g21" [6] "CD99wt36_g7" "CD99wt36_g0" "CD99wt36_g14" "Saos_g21_1" "Saos_g7_1" [11] "Saos_g0_1" "Saos_g14_1" "Saos_g21_2" "Saos_g7_2" "Saos_g0_2" [16] "Saos_g14_2" > head(Data) CD99wt22_g21 CD99wt22_g7 CD99wt22_g0 CD99wt22_g14 CD99wt36_g21 1007_s_at 8.700365 9.270211 9.430757 9.538669 8.745657 1053_at 9.147460 9.271868 9.313653 9.474059 9.070484 117_at 5.525772 5.295018 5.324190 5.616462 5.426015 121_at 7.677000 7.969068 7.808228 8.013086 7.710776 1255_g_at 3.006305 3.081713 2.978214 2.996469 2.962183 1294_at 6.062574 6.479575 6.162924 6.582346 6.189861 CD99wt36_g7 CD99wt36_g0 CD99wt36_g14 Saos_g21_1 Saos_g7_1 Saos_g0_1 1007_s_at 9.467785 9.496628 9.481157