Rui Barradas
2018-Oct-06 11:28 UTC
[R] Requesting for help on the problem of "subscript out of bounds"
Hello, I suggested NROW (all uppercase) because it works even if its argument, in your case ts, has only one dimension, nrow needs 2-dim objects. I have now noticed that you are indexing ts as if it has two dimensions, and that r is created with function matrix() but then you index it with just one dimension. r[i] <- approx_entropy(ts[i,], edim = 2, r = 0.2*sd(ts[i,]), elag = 1) Shouldn't it be ts[i] or r[i, ] ? Hope this helps, Rui Barradas ?s 10:34 de 06/10/2018, Subhamitra Patra escreveu:> I am extremely sorry to say that both the suggestions did not work. > > I did not understand the suggestion of Prof. Lemon. So, Sir, Can you > please clarify me your suggestion? > > > ?I tried the suggestion of Ruipbarradas. It does not work. > > > Please help me out for which I shall be always grateful to you. > > Thanks in advance. > > On Sat, Oct 6, 2018 at 2:48 PM ruipbarradas <ruipbarradas at sapo.pt > <mailto:ruipbarradas at sapo.pt>> wrote: > > Hello, > > Instead of nrow try all uppercase: > > N <- NROW (ts) > > > Hope this helps, > > Rui Barradas > > > > > Enviado a partir do meu smartphone Samsung Galaxy. > -------- Mensagem original -------- > De: Subhamitra Patra <subhamitra.patra at gmail.com > <mailto:subhamitra.patra at gmail.com>> > Data: 06/10/2018 10:14 (GMT+00:00) > Para: drjimlemon at gmail.com <mailto:drjimlemon at gmail.com> > Cc: r-help at r-project.org <mailto:r-help at r-project.org> > Assunto: Re: [R] Requesting for help on the problem of "subscript > out of bounds" > > Hello Sir, > > I tried by defining mat, but still facing the same problem. > > Hence, mat represents the time series. This time, I defined it as ts and > tried, but still having the same problem. > > In particular, the problem is coming in the following line > *for (i in 1:N){* > *+???? r[i]<-approx_entropy(ts[i,], edim = 2, r = 0.2*sd(ts[i,]), elag > 1) * > > where i is unable to synchronize with the no. of rows i.e. rows and > thus I > am getting the error of > > *Error in `[<-`(`*tmp*`, i, , value = ts[i:(N - m + i)]) : > subscript out > of bounds* > > For your reference, I am providing my full code with an explanation as > follows. > > The function > > approx_entropy(ts, edim = 2, r = 0.2*sd(ts), elag = 1) > > from the package,pracma I am calculating the approximate entropy of time > series.ts > > I have a matrix of time series (one series per row i.e. 51 rows and 1 > column)? and I would estimate the approximate entropy for each of > the rows, > storing the results in a vector. So, I have written a code > > library(pracma) > > N<-nrow(ts) > r<-matrix(0, nrow = N, ncol = 1)for (i in 1:N){ > ???? r[i]<-approx_entropy(ts[i,], edim = 2, r = 0.2*sd(ts[i,]), > elag = 1)} > > * After calculating for 1 series, I need to calculate the same > things for > the multiple series by changing the dimension of the ncol.* > > Please help me in this regard. > > Thanks in advance. > > On Sat, Oct 6, 2018 at 2:22 PM Jim Lemon <drjimlemon at gmail.com > <mailto:drjimlemon at gmail.com>> wrote: > > > Hi Subhamitra, > > Where I think the error arises is in the line: > > > >? N<-nrow(mat) > > > > Since we don't know what "mat" is, we don't know what nrow(mat) will > > return. If "mat" is not a matrix or data frame, it is likely to be > > NULL. Try this: > > > > print(N) > > > > after defining it and see what it is. > > > > Jim > > > > On Sat, Oct 6, 2018 at 5:51 PM Subhamitra Patra > > <subhamitra.patra at gmail.com <mailto:subhamitra.patra at gmail.com>> > wrote: > > > > > > Hello friends, > > > > > > I am very new in this R world. But, still doing some programming by > > > learning. While running one code, I found the problem of > "subscript out > > of > > > bounds". Please suggest me how to overcome this problem? For your > > > reference, I am uploading my code here. > > > > > > The function > > > > > > approx_entropy(ts, edim =2, r = 0.2*sd(ts), elag = 1) > > > > > > library(pracma) > > > > > > N<-nrow(mat) > > > r<-matrix(0, nrow = N, ncol = 1)for (i in 1:N){ > > >????? r[i]<-approx_entropy(mat[i,], edim = 2, r > 0.2*sd(mat[i,]), elag > > 1)} > > > > > > After running this code, I am getting the error of > > > > > > *"subscript out of bounds"* > > > > > > Please help me for which I shall be always grateful to you. > > > > > > Thanks in advance. > > > > > > > > > > > > -- > > > *Best Regards,* > > > *Subhamitra Patra* > > > *Phd. Research Scholar* > > > *Department of Humanities and Social Sciences* > > > *Indian Institute of Technology, Kharagpur* > > > *INDIA* > > > > > >???????? [[alternative HTML version deleted]] > > > > > > ______________________________________________ > > > R-help at r-project.org <mailto:R-help at r-project.org> mailing list > -- To UNSUBSCRIBE and more, see > > > https://stat.ethz.ch/mailman/listinfo/r-help > > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html > > > and provide commented, minimal, self-contained, reproducible code. > > > > > -- > *Best Regards,* > *Subhamitra Patra* > *Phd. Research Scholar* > *Department of Humanities and Social Sciences* > *Indian Institute of Technology, Kharagpur* > *INDIA* > > [[alternative HTML version deleted]] > > ______________________________________________ > R-help at r-project.org <mailto:R-help at r-project.org> mailing list -- > To UNSUBSCRIBE and more, see > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > > > > -- > *Best Regards,* > *Subhamitra Patra* > *Phd. Research Scholar* > *Department of Humanities and Social Sciences* > *Indian Institute of Technology, Kharagpur* > *INDIA*
Subhamitra Patra
2018-Oct-06 14:45 UTC
[R] Requesting for help on the problem of "subscript out of bounds"
Yes, I tried as per your suggestion, but not getting any results. I think, there is some dimension mismatch in the data matrix and result matrix. I have to compute the particular model yearly for each series. Please help. Thanks in advance. On Sat, Oct 6, 2018 at 4:58 PM Rui Barradas <ruipbarradas at sapo.pt> wrote:> Hello, > > I suggested NROW (all uppercase) because it works even if its argument, > in your case ts, has only one dimension, nrow needs 2-dim objects. > > I have now noticed that you are indexing ts as if it has two dimensions, > and that r is created with function matrix() but then you index it with > just one dimension. > > > r[i] <- approx_entropy(ts[i,], edim = 2, r = 0.2*sd(ts[i,]), elag = 1) > > > Shouldn't it be ts[i] or r[i, ] ? > > Hope this helps, > > Rui Barradas > > ?s 10:34 de 06/10/2018, Subhamitra Patra escreveu: > > I am extremely sorry to say that both the suggestions did not work. > > > > I did not understand the suggestion of Prof. Lemon. So, Sir, Can you > > please clarify me your suggestion? > > > > > > I tried the suggestion of Ruipbarradas. It does not work. > > > > > > Please help me out for which I shall be always grateful to you. > > > > Thanks in advance. > > > > On Sat, Oct 6, 2018 at 2:48 PM ruipbarradas <ruipbarradas at sapo.pt > > <mailto:ruipbarradas at sapo.pt>> wrote: > > > > Hello, > > > > Instead of nrow try all uppercase: > > > > N <- NROW (ts) > > > > > > Hope this helps, > > > > Rui Barradas > > > > > > > > > > Enviado a partir do meu smartphone Samsung Galaxy. > > -------- Mensagem original -------- > > De: Subhamitra Patra <subhamitra.patra at gmail.com > > <mailto:subhamitra.patra at gmail.com>> > > Data: 06/10/2018 10:14 (GMT+00:00) > > Para: drjimlemon at gmail.com <mailto:drjimlemon at gmail.com> > > Cc: r-help at r-project.org <mailto:r-help at r-project.org> > > Assunto: Re: [R] Requesting for help on the problem of "subscript > > out of bounds" > > > > Hello Sir, > > > > I tried by defining mat, but still facing the same problem. > > > > Hence, mat represents the time series. This time, I defined it as ts > and > > tried, but still having the same problem. > > > > In particular, the problem is coming in the following line > > *for (i in 1:N){* > > *+ r[i]<-approx_entropy(ts[i,], edim = 2, r = 0.2*sd(ts[i,]), > elag > > 1) * > > > > where i is unable to synchronize with the no. of rows i.e. rows and > > thus I > > am getting the error of > > > > *Error in `[<-`(`*tmp*`, i, , value = ts[i:(N - m + i)]) : > > subscript out > > of bounds* > > > > For your reference, I am providing my full code with an explanation > as > > follows. > > > > The function > > > > approx_entropy(ts, edim = 2, r = 0.2*sd(ts), elag = 1) > > > > from the package,pracma I am calculating the approximate entropy of > time > > series.ts > > > > I have a matrix of time series (one series per row i.e. 51 rows and 1 > > column) and I would estimate the approximate entropy for each of > > the rows, > > storing the results in a vector. So, I have written a code > > > > library(pracma) > > > > N<-nrow(ts) > > r<-matrix(0, nrow = N, ncol = 1)for (i in 1:N){ > > r[i]<-approx_entropy(ts[i,], edim = 2, r = 0.2*sd(ts[i,]), > > elag = 1)} > > > > * After calculating for 1 series, I need to calculate the same > > things for > > the multiple series by changing the dimension of the ncol.* > > > > Please help me in this regard. > > > > Thanks in advance. > > > > On Sat, Oct 6, 2018 at 2:22 PM Jim Lemon <drjimlemon at gmail.com > > <mailto:drjimlemon at gmail.com>> wrote: > > > > > Hi Subhamitra, > > > Where I think the error arises is in the line: > > > > > > N<-nrow(mat) > > > > > > Since we don't know what "mat" is, we don't know what nrow(mat) > will > > > return. If "mat" is not a matrix or data frame, it is likely to be > > > NULL. Try this: > > > > > > print(N) > > > > > > after defining it and see what it is. > > > > > > Jim > > > > > > On Sat, Oct 6, 2018 at 5:51 PM Subhamitra Patra > > > <subhamitra.patra at gmail.com <mailto:subhamitra.patra at gmail.com>> > > wrote: > > > > > > > > Hello friends, > > > > > > > > I am very new in this R world. But, still doing some > programming by > > > > learning. While running one code, I found the problem of > > "subscript out > > > of > > > > bounds". Please suggest me how to overcome this problem? For > your > > > > reference, I am uploading my code here. > > > > > > > > The function > > > > > > > > approx_entropy(ts, edim =2, r = 0.2*sd(ts), elag = 1) > > > > > > > > library(pracma) > > > > > > > > N<-nrow(mat) > > > > r<-matrix(0, nrow = N, ncol = 1)for (i in 1:N){ > > > > r[i]<-approx_entropy(mat[i,], edim = 2, r > > 0.2*sd(mat[i,]), elag > > > 1)} > > > > > > > > After running this code, I am getting the error of > > > > > > > > *"subscript out of bounds"* > > > > > > > > Please help me for which I shall be always grateful to you. > > > > > > > > Thanks in advance. > > > > > > > > > > > > > > > > -- > > > > *Best Regards,* > > > > *Subhamitra Patra* > > > > *Phd. Research Scholar* > > > > *Department of Humanities and Social Sciences* > > > > *Indian Institute of Technology, Kharagpur* > > > > *INDIA* > > > > > > > > [[alternative HTML version deleted]] > > > > > > > > ______________________________________________ > > > > R-help at r-project.org <mailto:R-help at r-project.org> mailing list > > -- To UNSUBSCRIBE and more, see > > > > https://stat.ethz.ch/mailman/listinfo/r-help > > > > PLEASE do read the posting guide > > > http://www.R-project.org/posting-guide.html > > > > and provide commented, minimal, self-contained, reproducible > code. > > > > > > > > > -- > > *Best Regards,* > > *Subhamitra Patra* > > *Phd. Research Scholar* > > *Department of Humanities and Social Sciences* > > *Indian Institute of Technology, Kharagpur* > > *INDIA* > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help at r-project.org <mailto:R-help at r-project.org> mailing list -- > > To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > > > > > > > -- > > *Best Regards,* > > *Subhamitra Patra* > > *Phd. Research Scholar* > > *Department of Humanities and Social Sciences* > > *Indian Institute of Technology, Kharagpur* > > *INDIA* >-- *Best Regards,* *Subhamitra Patra* *Phd. Research Scholar* *Department of Humanities and Social Sciences* *Indian Institute of Technology, Kharagpur* *INDIA* [[alternative HTML version deleted]]
Rui Barradas
2018-Oct-06 17:16 UTC
[R] Requesting for help on the problem of "subscript out of bounds"
Hello, Can you post the output of dput(head(ts, 20)) # paste the output of this in a mail dim(ts) # and this Rui Barradas ?s 15:45 de 06/10/2018, Subhamitra Patra escreveu:> Yes, I tried as per your suggestion, but not getting any results. I > think, there is some dimension mismatch in the data matrix and result > matrix. > > I have to compute the particular model yearly for each series. > > Please help. > > Thanks in advance. > > > On Sat, Oct 6, 2018 at 4:58 PM Rui Barradas <ruipbarradas at sapo.pt > <mailto:ruipbarradas at sapo.pt>> wrote: > > Hello, > > I suggested NROW (all uppercase) because it works even if its argument, > in your case ts, has only one dimension, nrow needs 2-dim objects. > > I have now noticed that you are indexing ts as if it has two > dimensions, > and that r is created with function matrix() but then you index it with > just one dimension. > > > r[i] <- approx_entropy(ts[i,], edim = 2, r = 0.2*sd(ts[i,]), elag = 1) > > > Shouldn't it be ts[i] or r[i, ] ? > > Hope this helps, > > Rui Barradas > > ?s 10:34 de 06/10/2018, Subhamitra Patra escreveu: > > I am extremely sorry to say that both the suggestions did not work. > > > > I did not understand the suggestion of Prof. Lemon. So, Sir, Can you > > please clarify me your suggestion? > > > > > >? ? ? ? ?I tried the suggestion of Ruipbarradas. It does not work. > > > > > > Please help me out for which I shall be always grateful to you. > > > > Thanks in advance. > > > > On Sat, Oct 6, 2018 at 2:48 PM ruipbarradas <ruipbarradas at sapo.pt > <mailto:ruipbarradas at sapo.pt> > > <mailto:ruipbarradas at sapo.pt <mailto:ruipbarradas at sapo.pt>>> wrote: > > > >? ? ?Hello, > > > >? ? ?Instead of nrow try all uppercase: > > > >? ? ?N <- NROW (ts) > > > > > >? ? ?Hope this helps, > > > >? ? ?Rui Barradas > > > > > > > > > >? ? ?Enviado a partir do meu smartphone Samsung Galaxy. > >? ? ?-------- Mensagem original -------- > >? ? ?De: Subhamitra Patra <subhamitra.patra at gmail.com > <mailto:subhamitra.patra at gmail.com> > >? ? ?<mailto:subhamitra.patra at gmail.com > <mailto:subhamitra.patra at gmail.com>>> > >? ? ?Data: 06/10/2018 10:14 (GMT+00:00) > >? ? ?Para: drjimlemon at gmail.com <mailto:drjimlemon at gmail.com> > <mailto:drjimlemon at gmail.com <mailto:drjimlemon at gmail.com>> > >? ? ?Cc: r-help at r-project.org <mailto:r-help at r-project.org> > <mailto:r-help at r-project.org <mailto:r-help at r-project.org>> > >? ? ?Assunto: Re: [R] Requesting for help on the problem of "subscript > >? ? ?out of bounds" > > > >? ? ?Hello Sir, > > > >? ? ?I tried by defining mat, but still facing the same problem. > > > >? ? ?Hence, mat represents the time series. This time, I defined > it as ts and > >? ? ?tried, but still having the same problem. > > > >? ? ?In particular, the problem is coming in the following line > >? ? ?*for (i in 1:N){* > >? ? ?*+???? r[i]<-approx_entropy(ts[i,], edim = 2, r > 0.2*sd(ts[i,]), elag > >? ? ?1) * > > > >? ? ?where i is unable to synchronize with the no. of rows i.e. > rows and > >? ? ?thus I > >? ? ?am getting the error of > > > >? ? ?*Error in `[<-`(`*tmp*`, i, , value = ts[i:(N - m + i)]) : > >? ? ?subscript out > >? ? ?of bounds* > > > >? ? ?For your reference, I am providing my full code with an > explanation as > >? ? ?follows. > > > >? ? ?The function > > > >? ? ?approx_entropy(ts, edim = 2, r = 0.2*sd(ts), elag = 1) > > > >? ? ?from the package,pracma I am calculating the approximate > entropy of time > >? ? ?series.ts > > > >? ? ?I have a matrix of time series (one series per row i.e. 51 > rows and 1 > >? ? ?column)? and I would estimate the approximate entropy for each of > >? ? ?the rows, > >? ? ?storing the results in a vector. So, I have written a code > > > >? ? ?library(pracma) > > > >? ? ?N<-nrow(ts) > >? ? ?r<-matrix(0, nrow = N, ncol = 1)for (i in 1:N){ > >? ? ? ???? r[i]<-approx_entropy(ts[i,], edim = 2, r = 0.2*sd(ts[i,]), > >? ? ?elag = 1)} > > > >? ? ?* After calculating for 1 series, I need to calculate the same > >? ? ?things for > >? ? ?the multiple series by changing the dimension of the ncol.* > > > >? ? ?Please help me in this regard. > > > >? ? ?Thanks in advance. > > > >? ? ?On Sat, Oct 6, 2018 at 2:22 PM Jim Lemon > <drjimlemon at gmail.com <mailto:drjimlemon at gmail.com> > >? ? ?<mailto:drjimlemon at gmail.com <mailto:drjimlemon at gmail.com>>> > wrote: > > > >? ? ? > Hi Subhamitra, > >? ? ? > Where I think the error arises is in the line: > >? ? ? > > >? ? ? >? N<-nrow(mat) > >? ? ? > > >? ? ? > Since we don't know what "mat" is, we don't know what > nrow(mat) will > >? ? ? > return. If "mat" is not a matrix or data frame, it is > likely to be > >? ? ? > NULL. Try this: > >? ? ? > > >? ? ? > print(N) > >? ? ? > > >? ? ? > after defining it and see what it is. > >? ? ? > > >? ? ? > Jim > >? ? ? > > >? ? ? > On Sat, Oct 6, 2018 at 5:51 PM Subhamitra Patra > >? ? ? > <subhamitra.patra at gmail.com > <mailto:subhamitra.patra at gmail.com> > <mailto:subhamitra.patra at gmail.com <mailto:subhamitra.patra at gmail.com>>> > >? ? ?wrote: > >? ? ? > > > >? ? ? > > Hello friends, > >? ? ? > > > >? ? ? > > I am very new in this R world. But, still doing some > programming by > >? ? ? > > learning. While running one code, I found the problem of > >? ? ?"subscript out > >? ? ? > of > >? ? ? > > bounds". Please suggest me how to overcome this problem? > For your > >? ? ? > > reference, I am uploading my code here. > >? ? ? > > > >? ? ? > > The function > >? ? ? > > > >? ? ? > > approx_entropy(ts, edim =2, r = 0.2*sd(ts), elag = 1) > >? ? ? > > > >? ? ? > > library(pracma) > >? ? ? > > > >? ? ? > > N<-nrow(mat) > >? ? ? > > r<-matrix(0, nrow = N, ncol = 1)for (i in 1:N){ > >? ? ? > >????? r[i]<-approx_entropy(mat[i,], edim = 2, r > >? ? ?0.2*sd(mat[i,]), elag > >? ? ? > 1)} > >? ? ? > > > >? ? ? > > After running this code, I am getting the error of > >? ? ? > > > >? ? ? > > *"subscript out of bounds"* > >? ? ? > > > >? ? ? > > Please help me for which I shall be always grateful to you. > >? ? ? > > > >? ? ? > > Thanks in advance. > >? ? ? > > > >? ? ? > > > >? ? ? > > > >? ? ? > > -- > >? ? ? > > *Best Regards,* > >? ? ? > > *Subhamitra Patra* > >? ? ? > > *Phd. Research Scholar* > >? ? ? > > *Department of Humanities and Social Sciences* > >? ? ? > > *Indian Institute of Technology, Kharagpur* > >? ? ? > > *INDIA* > >? ? ? > > > >? ? ? > >???????? [[alternative HTML version deleted]] > >? ? ? > > > >? ? ? > > ______________________________________________ > >? ? ? > > R-help at r-project.org <mailto:R-help at r-project.org> > <mailto:R-help at r-project.org <mailto:R-help at r-project.org>> mailing list > >? ? ?-- To UNSUBSCRIBE and more, see > >? ? ? > > https://stat.ethz.ch/mailman/listinfo/r-help > >? ? ? > > PLEASE do read the posting guide > >? ? ? > http://www.R-project.org/posting-guide.html > >? ? ? > > and provide commented, minimal, self-contained, > reproducible code. > >? ? ? > > > > > > >? ? ?-- > >? ? ?*Best Regards,* > >? ? ?*Subhamitra Patra* > >? ? ?*Phd. Research Scholar* > >? ? ?*Department of Humanities and Social Sciences* > >? ? ?*Indian Institute of Technology, Kharagpur* > >? ? ?*INDIA* > > > >? ? ?[[alternative HTML version deleted]] > > > >? ? ?______________________________________________ > > R-help at r-project.org <mailto:R-help at r-project.org> > <mailto:R-help at r-project.org <mailto:R-help at r-project.org>> mailing > list -- > >? ? ?To UNSUBSCRIBE and more, see > > https://stat.ethz.ch/mailman/listinfo/r-help > >? ? ?PLEASE do read the posting guide > > http://www.R-project.org/posting-guide.html > >? ? ?and provide commented, minimal, self-contained, reproducible > code. > > > > > > > > -- > > *Best Regards,* > > *Subhamitra Patra* > > *Phd. Research Scholar* > > *Department of Humanities and Social Sciences* > > *Indian Institute of Technology, Kharagpur* > > *INDIA* > > > > -- > *Best Regards,* > *Subhamitra Patra* > *Phd. Research Scholar* > *Department of Humanities and Social Sciences* > *Indian Institute of Technology, Kharagpur* > *INDIA*
Subhamitra Patra
2018-Oct-07 10:03 UTC
[R] Requesting for help on the problem of "subscript out of bounds"
Thanks a lot, Sir. I'll check them out. But, I have 1 more query that in which package "b" and "l" functions are available? Can you please educate me about the usage of "b" and "I" in my code. For your reference, I am writing my code here again. N<-ncol(ts)> r<-matrix(0, ncol = N, nrow = 1) > for (i in 1:N){r[i]<-approx_entropy(ts[,i], edim = 2, r = 0.2*sd(ts[,i]), elag = 1) } plot (r) Here how to add "b" and "l" function? Please help me. Thanks in advance. On Sun, Oct 7, 2018 at 3:19 PM Jim Lemon <drjimlemon at gmail.com> wrote:> plot(r) will give you a set of points with the values of r on the y > axis and 1:N on the x axis. If you want to add more series, look at > "points" or "lines". Also look at the options "b" and "l" for plot if > you want points and lines or just lines respectively. > > Jim > > On Sun, Oct 7, 2018 at 6:03 PM Subhamitra Patra > <subhamitra.patra at gmail.com> wrote: > > > > Hello friends, > > > > Finally, I became able to compute APEn values for each series. > > > > Actually, there was a small mistake in the code for the arguments of row > and columns. Now, after rectifying my mistakes as well as by taking the > suggestions from Rui Barradas and Jim, It became possible. Therefore, I > would like to say thanks to both of you. > > > > One small help (if possible) that I want to plot that particular APEn > values for each series. > > Only, I will write the code "plot (r)" or any other code is there? > > > > Please help. > > > > Thanks in advance. >-- *Best Regards,* *Subhamitra Patra* *Phd. Research Scholar* *Department of Humanities and Social Sciences* *Indian Institute of Technology, Kharagpur* *INDIA* [[alternative HTML version deleted]]
Subhamitra Patra
2018-Oct-07 11:29 UTC
[R] Requesting for help on the problem of "subscript out of bounds"
Dear Friends, Further, I want to compute the APEn values for the multiple files in a folder. In particular, along with the loop for the columns in one data file (through the code that I mentioned above), I have to write a loop for the multiple files (having same dimensions) in a folder. But, I am not getting a proper idea for writing the double loop (i.e. one for the multiple columns of one excel sheet and other for the multiple excel sheets of a folder). Please help me in this regard. Thanks in advance. On Sun, Oct 7, 2018 at 3:33 PM Subhamitra Patra <subhamitra.patra at gmail.com> wrote:> Thanks a lot, Sir. I'll check them out. > > But, I have 1 more query that in which package "b" and "l" functions > are available? > > Can you please educate me about the usage of "b" and "I" in my code. > > For your reference, > > I am writing my code here again. > > N<-ncol(ts) > > r<-matrix(0, ncol = N, nrow = 1) > > for (i in 1:N){ > r[i]<-approx_entropy(ts[,i], edim = 2, r = 0.2*sd(ts[,i]), elag = 1) > } > plot (r) > > Here how to add "b" and "l" function? > > Please help me. > > Thanks in advance. > > On Sun, Oct 7, 2018 at 3:19 PM Jim Lemon <drjimlemon at gmail.com> wrote: > >> plot(r) will give you a set of points with the values of r on the y >> axis and 1:N on the x axis. If you want to add more series, look at >> "points" or "lines". Also look at the options "b" and "l" for plot if >> you want points and lines or just lines respectively. >> >> Jim >> >> On Sun, Oct 7, 2018 at 6:03 PM Subhamitra Patra >> <subhamitra.patra at gmail.com> wrote: >> > >> > Hello friends, >> > >> > Finally, I became able to compute APEn values for each series. >> > >> > Actually, there was a small mistake in the code for the arguments of >> row and columns. Now, after rectifying my mistakes as well as by taking the >> suggestions from Rui Barradas and Jim, It became possible. Therefore, I >> would like to say thanks to both of you. >> > >> > One small help (if possible) that I want to plot that particular APEn >> values for each series. >> > Only, I will write the code "plot (r)" or any other code is there? >> > >> > Please help. >> > >> > Thanks in advance. >> > > > -- > *Best Regards,* > *Subhamitra Patra* > *Phd. Research Scholar* > *Department of Humanities and Social Sciences* > *Indian Institute of Technology, Kharagpur* > *INDIA* >-- *Best Regards,* *Subhamitra Patra* *Phd. Research Scholar* *Department of Humanities and Social Sciences* *Indian Institute of Technology, Kharagpur* *INDIA* [[alternative HTML version deleted]]
Michael Dewey
2018-Oct-07 12:46 UTC
[R] Requesting for help on the problem of "subscript out of bounds"
If you look at the documentation for plot() you will see a type parameter which can take a number of values including plot = "l" to get lines, and so on. On 07/10/2018 11:03, Subhamitra Patra wrote:> Thanks a lot, Sir. I'll check them out. > > But, I have 1 more query that in which package "b" and "l" functions are > available? > > Can you please educate me about the usage of "b" and "I" in my code. > > For your reference, > > I am writing my code here again. > > N<-ncol(ts) >> r<-matrix(0, ncol = N, nrow = 1) >> for (i in 1:N){ > r[i]<-approx_entropy(ts[,i], edim = 2, r = 0.2*sd(ts[,i]), elag = 1) > } > plot (r) > > Here how to add "b" and "l" function? > > Please help me. > > Thanks in advance. > > On Sun, Oct 7, 2018 at 3:19 PM Jim Lemon <drjimlemon at gmail.com> wrote: > >> plot(r) will give you a set of points with the values of r on the y >> axis and 1:N on the x axis. If you want to add more series, look at >> "points" or "lines". Also look at the options "b" and "l" for plot if >> you want points and lines or just lines respectively. >> >> Jim >> >> On Sun, Oct 7, 2018 at 6:03 PM Subhamitra Patra >> <subhamitra.patra at gmail.com> wrote: >>> >>> Hello friends, >>> >>> Finally, I became able to compute APEn values for each series. >>> >>> Actually, there was a small mistake in the code for the arguments of row >> and columns. Now, after rectifying my mistakes as well as by taking the >> suggestions from Rui Barradas and Jim, It became possible. Therefore, I >> would like to say thanks to both of you. >>> >>> One small help (if possible) that I want to plot that particular APEn >> values for each series. >>> Only, I will write the code "plot (r)" or any other code is there? >>> >>> Please help. >>> >>> Thanks in advance. >> > >-- Michael http://www.dewey.myzen.co.uk/home.html