Error In Rdata I Subscript Out Of Bounds
Contents |
here for a quick overview of the site Help Center Detailed answers to any questions you error subscript out of bounds r help might have Meta Discuss the workings and policies of this
Error In Pi[[j]] : Subscript Out Of Bounds Rbind
site About Us Learn more about Stack Overflow the company Business Learn more about hiring developers solving problems of subscript out of bounds in r or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community
Rbind Subscript Out Of Bounds
of 4.7 million programmers, 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 error during wrapup: subscript out of bounds libraries and data library(igraph) library(NetData) 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 ques
here for a quick overview of the site Help Center Detailed answers to any questions you might have Meta Discuss the workings and
Error In * Tmp * Subscript Out Of Bounds
policies of this site About Us Learn more about Stack Overflow the
Options(error=recover)
company Business Learn more about hiring developers or posting ads with us Stack Overflow Questions Jobs Documentation Tags Users subscript out of bounds shiny Badges Ask Question x Dismiss Join the Stack Overflow Community Stack Overflow is a community of 4.7 million programmers, just like you, helping each other. Join them; it only takes http://stackoverflow.com/questions/15031338/subscript-out-of-bounds-general-definition-and-solution a minute: Sign up Error in R: subscript out of bounds up vote 1 down vote favorite So I'm trying to do something very simple. Loop over a data frame and calculate the max corelation coefficient between a pair of columns. I am trying to do this in R. My data frame has been read using fread() Here's my code: I declared http://stackoverflow.com/questions/32528077/error-in-r-subscript-out-of-bounds max=-1, a=0andb=0in the starting. for(i in 2:1933) { for(j in i+1:1934) { if(is.numeric(data[[i]]) && is.numeric(data[[j]])) { if(isTRUE(sd(data[[i]], na.rm=TRUE) !=0) && isTRUE(sd(data[[j]], na.rm=TRUE) !=0)) { c = cor(data[[i]], data[[j]], use="pairwise.complete.obs") if(isTRUE(c>=max)) { max = c a = i b = j } } } } } The error I get is Error in .subset2(x, i, exact = exact) : subscript out of bounds I do have 1934 columns, I can't figure out the problem. Am I missing something fairly obvious? r share|improve this question asked Sep 11 '15 at 16:28 Mallika 17110 6 Should be (i+1) –Alexey Ferapontov Sep 11 '15 at 16:28 3 you can use combn as an alternative, combn(data, 2, function(x) cor(x[[1]], x[[2]], use="pairwise.complete.obs")) –jenesaisquoi Sep 11 '15 at 16:39 Well I ultimately realized I hadn't cleaned up the data properly, it's done now. What should I do now? Will the mods close this question eventually? @bunk –Mallika Sep 12 '15 at 17:26 add a comment| 2 Answers 2 active oldest votes up vote 2 down vote There's a much easier way to do this: cor(
Sign in Pricing Blog Support Search GitHub This repository Watch 51 Star 155 Fork 147 pablobarbera/Rfacebook Code Issues 5 Pull requests 1 Projects 0 Wiki Pulse Graphs New issue Error https://github.com/pablobarbera/Rfacebook/issues/25 in content$data[[1]] : subscript out of bounds in getInsights #25 Closed theclue opened this Issue Feb 23, 2015 · 7 comments Projects None yet Labels None yet Milestone No milestone Assignees No one assigned 8 participants theclue commented Feb 23, 2015 Hello Pablo, first of all, tnx for your work..this package is really a lifeboat, to me! Said that, I must say that subscript out I'm not able to make getInsights working. Whatever parameters I put, I always get this error: Error in content$data[[1]] : subscript out of bounds Some examples -> From a page I own: circle <- getInsights(object_id="9thcirclegames", token = fb.connection, metric = "page_impressions") circle <- getInsights("me", token = fb.connection, metric = "page_impressions") A post by me (not the page): example_post <- circle <- getInsights(object_id="10152670074275267_10152659686895267", token = fb.connection, metric = subscript out of "post_impressions", period='days_28') perhaps I'm using the function in the wrong way? chipoglesby commented Feb 25, 2015 Just to echo @theclue thank you for all of your work! Currently, I'm having the same issues when trying to query getInsights. Example: insights <- getInsights(object_id='xx_pageid_xx', token=fb_oauth, metric='post_impressions', period='days_28') R returns: Error in content$data[[1]] : subscript out of bounds The package does work for getUsers and getPage, which is how I found my page's id. I'm not sure if you have any ideas what could be causing this? Thanks, Chip lbollar commented Mar 5, 2015 Like @theclue, I get the same subscript out of bounds error for getInsights(). I am trying to query this information for a page I was given access to, and by using the Graph API Explorer from developers.facebook.com, I was able to confirm that I do have authority to query this information. I actually get two different errors based on whether I try post_impressions or page_impressions, and this might just be due to stupid user error, but like @theclue I have tried different parameters and cannot get the function to work. insights <- getInsights(object_id="XXXXXXXXXXX", token=fb_oauth, metric='page_impressions') Error in insightsDataToDF(content$data, content$data[[1]]$values) : argument "metric" is missing, with