Re: [R] Genuine relative paths with R

2018-10-06 Thread Olivier GIVAUDAN
Hi Jeff, Thanks for sharing your workaround. I guess my last answer to Ista answers your question as well. To me this function (an equivalent of 'cd', say) should be platform-independent. Best regards, Olivier De : Jeff Newmiller Envoy� : samedi 6 octobre 201

Re: [R] Genuine relative paths with R

2018-10-06 Thread Jeff Newmiller
Please use reply-all to keep the conversation on the mailing list. I found no enlightenment in your response to Ista. a) I have many years of experience in a variety of operating systems and languages, and there are a variety of approaches taken to handle self-configuration. R is not special i

Re: [R] Genuine relative paths with R

2018-10-06 Thread Jeff Newmiller
I stopped using hardcoded absolute paths inside R scripts years ago, and I suspect that is fairly common practice. That is, I almost never enter a path starting with "/" or "c:/" in an R script. The key concession you have to make is to start your R session in your working directory using OS-sp

Re: [R] Requesting for help on the problem of "subscript out of bounds"

2018-10-06 Thread Rui Barradas
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 mis

Re: [R] Genuine relative paths with R

2018-10-06 Thread Ista Zahn
On Sat, Oct 6, 2018 at 12:40 PM Ista Zahn wrote: > > Hi Olivier, > > Sorry for misspelling your name! Please see inline below. > > On Sat, Oct 6, 2018 at 9:58 AM Olivier GIVAUDAN > wrote: > > > > Hi Ista, > > > > Thank you for your reply. > > > > My motivation is described at the 3rd line of my i

Re: [R] Genuine relative paths with R

2018-10-06 Thread Ista Zahn
Hi Olivier, Sorry for misspelling your name! Please see inline below. On Sat, Oct 6, 2018 at 9:58 AM Olivier GIVAUDAN wrote: > > Hi Ista, > > Thank you for your reply. > > My motivation is described at the 3rd line of my initial message: > "if I move all my scripts related to some project as a w

Re: [R] Strange paradox

2018-10-06 Thread Michael Friendly
Yes-- there's no paradox; the adjusted R^2 and deviance are looking at/testing different things. Also you don't say *what* deviance you are looking at, but your interpretation of the deviance is probably wrong. A significant test for anova(model2, model1) says that x3 & x4 add significantly to p

Re: [R] Requesting for help on the problem of "subscript out of bounds"

2018-10-06 Thread Subhamitra Patra
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 wrote:

Re: [R] Genuine relative paths with R

2018-10-06 Thread Ista Zahn
Hi Oliver, Interesting question. Can you describe your motivation in a little more detail? That is, why do you what this feature? I ask because to my way of thinking you have to know the path to the script in order to call it in the first place. If calling from R, is setwd("/path/to/dir") source(

[R] Genuine relative paths with R

2018-10-06 Thread Olivier GIVAUDAN
Dear R users, I would like to work with genuine relative paths in R for obvious reasons: if I move all my scripts related to some project as a whole to another location of my computer or someone else's computer, if want my scripts to continue to run seamlessly. What I mean by "genuine" is that

Re: [R] Requesting for help on the problem of "subscript out of bounds"

2018-10-06 Thread Rui Barradas
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 j

Re: [R] Requesting for help on the problem of "subscript out of bounds"

2018-10-06 Thread Jim Lemon
The idea of using: cat("i =",i,"\n") is to display the value of i each time the loop executes. Displaying i _before_ the error occurs tells us what value of i is causing the problem. Because the error is occurring when you try to index ts, perhaps adding: cat(dim(ts),"\n") for(i in 1:N) { ... _

Re: [R] Requesting for help on the problem of "subscript out of bounds"

2018-10-06 Thread Subhamitra Patra
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.

Re: [R] Requesting for help on the problem of "subscript out of bounds"

2018-10-06 Thread ruipbarradas
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 Data: 06/10/2018 10:14 (GMT+00:00) Para: drjimle...@gmail.com Cc: r-help@r-project.org Assunto:

Re: [R] Requesting for help on the problem of "subscript out of bounds"

2018-10-06 Thread Jim Lemon
What I would do next is to insert a line to see where it goes wrong: for (i in 1:N){ cat("i =",i,"\n") r[i]<-approx_entropy(ts[i,], edim = 2, r = 0.2*sd(ts[i,]), elag = 1) } The last i that is printed (which may be the first) will reveal what caused the error I hope. Jim On Sat, Oct 6

Re: [R] Requesting for help on the problem of "subscript out of bounds"

2018-10-06 Thread Subhamitra Patra
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,

Re: [R] Requesting for help on the problem of "subscript out of bounds"

2018-10-06 Thread Jim Lemon
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,

[R] Requesting for help on the problem of "subscript out of bounds"

2018-10-06 Thread Subhamitra Patra
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,