Re: [R] Error:'subscript out of bounds'

2016-07-12 Thread William Dunlap via R-help
Include the levels argument in your calls to factor so the tables all have the same dimensions. > table(factor((1:4)>2), factor( (1:4)>0 )) TRUE FALSE2 TRUE 2 > table(factor((1:4)>2, levels=c(FALSE,TRUE)), factor( (1:4)>0, levels=c(FALSE,TRUE) )) FALSE TRUE FALSE

Re: [R] Error:'subscript out of bounds'

2016-07-12 Thread Sarah Goslee
You don't provide a reproducible example - what does your data look like? If this were my problem, I would start by working through the function step by step with one of my files data <- filelist[[1]] dataodd <- data[-(1:18),] and so on, examining the result at every step with tools like dim()

[R] Error:'subscript out of bounds'

2016-07-12 Thread Samsad Afrin Himi
Dear R-team, I have written this code for calculation my data file. But there shows 'subscript out of bounds’. > computeResponse <- function(data){ + dataodd <- data[-(1:18),] + dataodd <- dataodd[seq(1,nrow(dataodd), 2),] + hitsodd <- table(factor(dataodd[,5]),

[R] Error ! Subscript out of bounds

2012-05-29 Thread Rantony
Hi, i have a function like this, *GetCsv[GetCsv[,ColHdr]ArrMinMax[iCol,1] | GetCsv[,ColHdr]ArrMinMax[iCol,2],ColHdr_QF]-RC* Here, *GetCsv* -- It contain a matrix *ColHdr* -- Is a column Header *ArrMinMax* - It is a array of 2 columns -

[R] Error subscript out of bounds

2012-03-13 Thread Houhou Li
Hello, R-users,   I have a datafile with 37313 records and each record has 5 different measurements on the same variables. The format looks like this: treeID, VIG0, VIG1, VIG2, VIG3, VIG4 I was trying to convert the one row record to 5 rows record with format like this (treeID, MEASUREMENT,

Re: [R] Error subscript out of bounds

2012-03-13 Thread David Winsemius
On Mar 13, 2012, at 12:18 PM, Houhou Li wrote: Hello, R-users, I have a datafile with 37313 records and each record has 5 different measurements on the same variables. The format looks like this: treeID, VIG0, VIG1, VIG2, VIG3, VIG4 I was trying to convert the one row record to 5 rows

Re: [R] Error subscript out of bounds

2012-03-13 Thread Houhou Li
Thank you very much David. I should realize myslef that operator precedence cause the problem. Sorry about this:-) I solved the problem. --- On Tue, 3/13/12, David Winsemius dwinsem...@comcast.net wrote: From: David Winsemius dwinsem...@comcast.net Subject: Re: [R] Error subscript out

[R] Error : subscript out of bounds

2011-09-10 Thread avinash barnwal
m-matrix(byrow=FALSE) t-as.list(na.exclude(x)) j-0 o-0 for(i in 1:998) { d- 5*(i-1)+3 if(t[[d]][[1]]80) { j-j+1 e[j]-d l-length(t[[d]]) u-t[[d]] price_rand-t[[d-1]] n-0 for(k in 1:l) { if((u[k]49)(u[k]51)) { n-n+1 m[n,j]-price_rand[k] } } } } I am getting error in assigning the values to a

Re: [R] Error : subscript out of bounds

2011-09-10 Thread R. Michael Weylandt
Take a look at m. Your error should be quite clear More generally: we don't do homework help on this list. Michael Weylandt On Sat, Sep 10, 2011 at 12:59 PM, avinash barnwal avinashbarnwal...@gmail.com wrote: m-matrix(byrow=FALSE) t-as.list(na.exclude(x)) j-0 o-0 for(i in 1:998) { d-

Re: [R] Error : subscript out of bounds

2011-09-10 Thread jim holtman
?debug ?browser Read up on debugging your script. On Saturday, September 10, 2011, avinash barnwal avinashbarnwal...@gmail.com wrote: m-matrix(byrow=FALSE) t-as.list(na.exclude(x))_ j-0 o-0 for(i in 1:998) { d- 5*(i-1)+3 if(t[[d]][[1]]80) { j-j+1 e[j]-d l-length(t[[d]]) u-t[[d]]

Re: [R] Error : subscript out of bounds

2011-09-10 Thread avinash barnwal
Hi , I appreciate ur help, i do my homework carefully but here the problem is i m declaring a m as null matrix to be filled by columns not by rows and afterwards i m storing the values directly into the matrix and i had gone through same above mentioned error in previous r-help queries. I am not

Re: [R] Error : subscript out of bounds

2011-09-10 Thread David Winsemius
On Sep 10, 2011, at 4:33 PM, avinash barnwal wrote: Hi , I appreciate ur help, i do my homework carefully but here the problem is i m declaring a m as null matrix Yes. That IS the problem. to be filled by columns not by rows and afterwards i m storing the values directly into the

Re: [R] Error Subscript out of bounds in ca

2011-05-14 Thread Uwe Ligges
On 13.05.2011 13:44, annekatrin...@gmx.de wrote: Hello, I want to do a simple correspondence analysis in R, using the ca package. First, I create and define a 2-by-2-table (table=table(var1,var2)), which looks like this: Low(var1) high(var1) Low(var2) 35 28 High(var2)

[R] Error Subscript out of bounds in ca

2011-05-13 Thread annekatrin . st
Hello, I want to do a simple correspondence analysis in R, using the ca package. First, I create and define a 2-by-2-table (table=table(var1,var2)), which looks like this: Low(var1) high(var1) Low(var2) 35 28 High(var2) 26 32 Var1 and Var2 are categorical factors.

[R] Error: subscript out of bounds

2010-10-18 Thread IRD
Dear All I have problem with this: IWJR.temp -IWJR.missing[sample(1:length(IWJR.missing),1),] Error: subscript out of bounds How I can solved this. Thanks IRD __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help

Re: [R] Error: subscript out of bounds

2010-10-18 Thread Adrienne Wootten
IRD, It would certainly be more helpful to us if you showed more of your code or what the dataset IWJR.missing is. Here's a couple of suggestions though. I can see what you are doing is picking a random sample of this dataset. Is the IWJR.missing object a data frame or a vector or what?

[R] error: subscript out of bounds?

2010-06-14 Thread Yesha Patel
Hi all, I want to get results for cox proportional hazards on SNP data. I'm trying to get HRs, CI's, p-values for each individual SNP - this is represented by cov[,i]. When I run my code, I get the following error: subscript out of bounds. I don't know why I am getting this error. I have looked

Re: [R] error: subscript out of bounds?

2010-06-14 Thread jim holtman
You need to learn how to debug your program. When the error occurs, look at the value of the indices in the offending statement -- you will find that the problem is subscript out of bounds. Put the following statement in your code: options(error=utils::recover) and then do ?browser to learn

Re: [R] error: subscript out of bounds?

2010-06-14 Thread David Winsemius
On Jun 14, 2010, at 6:48 PM, Yesha Patel wrote: Hi all, I want to get results for cox proportional hazards on SNP data. I'm trying to get HRs, CI's, p-values for each individual SNP - this is represented by cov[,i]. When I run my code, I get the following error: subscript out of

[R] error : subscript out of bounds

2010-05-25 Thread Ayesha Khan
Hi, I'm trying to calculate euclidean distance for my matrix rx1. Its a big matrix with 947 elements. However when i do the following, for(k in 1:947) for(m in (k+1):947){ A =rbind(A,c(k,m,ED(rx1[,k], rx1[,m]))) } I get the following error: ED(rx1[,k], rx1[,m]) : subscript out of bounds I

Re: [R] error : subscript out of bounds

2010-05-25 Thread jim holtman
Take a look at what happens when k=947 (last time through the loop). You are then indexing 'm in 948:947' so m==948 which is outside your matrix. On Tue, May 25, 2010 at 2:49 PM, Ayesha Khan ayesha.diamond...@gmail.com wrote: Hi, I'm trying to calculate euclidean distance for my matrix rx1.  

Re: [R] error : subscript out of bounds

2010-05-25 Thread Jannis
just a guess as i do not have your data: with k=947 (last outer loop) m starts from 948 and runs backwards to 947. As your matrix probably only has 947 columns you get this error Ayesha Khan schrieb: Hi, I'm trying to calculate euclidean distance for my matrix rx1. Its a big matrix with

[R] Error: subscript out of bounds

2008-12-01 Thread Alex99
Hi All, I am trying to replace the NA values in a matrix by using the following function: it gets a name of the matrix or list or vector and turns it to a matrix called m. then checks the elements of the matrix and if any of them is NA replace them with 0. rep=function(name){ m=as.matrix(name)

Re: [R] Error: subscript out of bounds

2008-12-01 Thread Jagat.K.Sheth
Note that length(m) = 16, but your m is only 4x4. Try this m[is.na(m)] - 0 -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Alex99 Sent: Monday, December 01, 2008 9:06 AM To: r-help@r-project.org Subject: [R] Error: subscript out of bounds Hi All, I

Re: [R] Error: subscript out of bounds.

2008-09-23 Thread Patrick Burns
There is a good reason for the error in the matrix case. Consider what would need to happen for: m[3, 5] - 100 to work. Consistency might be a good thing here, but if so I think it should be an error for the 1-D case. This might be a useful difference between 1-D arrays and vectors.

[R] Error: subscript out of bounds.

2008-09-22 Thread Rolf Turner
Consider: x - array(1:12,dim=12) x[13] [1] NA] m - array(1:12,dim=c(3,4)) m[3,5] Error: subscript out of bounds Can anyone tell me it there is a Good Reason for the difference in behaviour between 1 dimensional and higher dimensional