Re: [Rd] Getting error in rbindlist

2019-11-01 Thread Hugh Parsonage
This is (was) a bug in data.table that is similar to one which was
putatively closed. Recommend you update to the latest version and if the
problem persists reopen the issue here
https://github.com/Rdatatable/data.table/issues/3032

This mailing list is for R bugs, which this isn’t. R Core can no more help
you with this bug than with a paper jam in your printer.



Hth

On Sat, 2 Nov 2019 at 3:14 am, Anshul Saravgi <
anshul.sara...@o9solutions.com> wrote:

> Hi All
>
> Can you help me understand the meaning of the below error message then I
> will try to figure out what is going wrong:
>
> *Input Code:*
> > q <- lapply(
> +   lapply(split(lctolc2, lctolc2$Item), function(x) graph.data.frame(x[,
> 2:3])),
> +   function(x) lapply(
> + V(x)[degree(x, mode = "in") == 0],
> + function(s) all_simple_paths(x, from = s,
> +  to = V(x)[degree(x, mode = "out") == 0])
> %>%
> +   lapply(
> + function(y) as.data.table(t(names(y))) %>% setnames(paste0("LC",
> seq_along(.)))
> +   ) %>%
> +   rbindlist(use.names=TRUE,fill = TRUE)
> +   ) %>% rbindlist(use.names=TRUE,fill = TRUE)
> + ) %>% rbindlist(use.names=TRUE,fill = TRUE, idcol = "Item")
>
> *Error message:*
> Error in rbindlist(., use.names = TRUE, fill = TRUE, idcol = "Item") :
>   attempt to set index 8424/8424 in SET_STRING_ELT
> In addition: There were 50 or more warnings (use warnings() to see the
> first 50)
>
> I am not understanding what is in SET_STRING_ELT which it is trying to
> throw an error.
> Please help me
>
>
> *Regards,*
>
> *Anshul Saravgi*
>
> Consulting
> m: 7757030307
>
> 
> AI powered solutions that predict, prescribe, learn and are 100x faster,
> smarter and easier to use
>
> --
> This Electronic Mail (e-mail) contains confidential and privileged
> information intended only for the use of the individual or entity to which
> it is sent.  If the reader of this message is not the intended recipient,
> or the employee or agent responsible for delivery to the intended
> recipient, you are hereby notified that any dissemination, distribution,
> or
> copying of this communication is STRICTLY PROHIBITED.  If you
> have received
> this communication in error, please immediately notify the sender by reply
> e-mail or telephone.
>
> [[alternative HTML version deleted]]
>
> __
> R-devel@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-devel
>

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Getting error in rbindlist

2019-11-01 Thread Tomas Kalibera
On 11/1/19 5:24 PM, Anshul Saravgi wrote:
> Thanks Tomas for identifying the bug.
>
> *How to resolve this bug? Can you please help me here?*

I would recommend you first try to create a complete reproducible 
example (the code below is just a snippet). Then try to minimize it - 
make it do as little as possible but still trigger the bug. Then try to 
reduce the number of packages used. If you ended up with code that used 
only base R (no packages outside R distribution), then submit again to 
R-devel (it is a likely bug in R itself, so if you can't trace the bug 
down yourself, someone here would do it). Base R would not let any user 
code write beyond the end of the string, so if you can reproduce this in 
base R, it is definitely a bug.

If you end up with code that still uses some contributed packages from 
these below, you need to find out/guess which of them is responsible and 
try to ask for help the maintainer of that package. It would more likely 
be a bug in some of those packages, but in principle it could also be a 
problem in how you are using them.

If you haven't done that already, it may be useful to update your 
packages - just in case the problem has already been resolved.

Best
Tomas

> *I am using the below code:*
> library(plyr)
> library(dplyr)
> library(tidyr)
> library(igraph)
> library(magrittr)
> library(reshape2)
> library(tibble)
>
> colnames(lctolc3) <- c("Item","LC","ToLC")
>
> bodlane3 <- lapply(
>   lapply(split(lctolc3, lctolc3$Item), function(x) 
> graph.data.frame(x[, 2:3])),
>   function(x) lapply(
>     V(x)[degree(x, mode = "in") == 0],
>     function(s) all_simple_paths(x, from = s,
>                                  to = V(x)[degree(x, mode = "out") == 
> 0]) %>%
>       lapply(
>         function(y) as.data.table(t(names(y))) %>% 
> setnames(paste0("LC", seq_along(.)))
>       ) %>%
>       rbindlist(use.names=TRUE,fill = TRUE)
>   ) %>% rbindlist(use.names=TRUE,fill = TRUE)
> ) %>% rbindlist(use.names=TRUE,fill = TRUE, idcol = "Item")
>
>
> *Regards,*
>
> *Anshul Saravgi*
>
> Consulting
>
> m: 7757030307
>
> 
> AI powered solutions that predict, prescribe, learn and are 100x 
> faster, smarter and easier to use
>
>
> On Fri, Nov 1, 2019 at 9:51 PM Tomas Kalibera 
> mailto:tomas.kalib...@gmail.com>> wrote:
>
> On 11/1/19 1:11 PM, Anshul Saravgi wrote:
> > Hi All
> >
> > Can you help me understand the meaning of the below error
> message then I
> > will try to figure out what is going wrong:
> >
> > *Input Code:*
> >> bodlane2 <- lapply(
> > +   lapply(split(lctolc2, lctolc2$Item), function(x)
> graph.data.frame(x[,
> > 2:3])),
> > +   function(x) lapply(
> > +     V(x)[degree(x, mode = "in") == 0],
> > +     function(s) all_simple_paths(x, from = s,
> > +                                  to = V(x)[degree(x, mode =
> "out") == 0])
> > %>%
> > +       lapply(
> > +         function(y) as.data.table(t(names(y))) %>%
> setnames(paste0("LC",
> > seq_along(.)))
> > +       ) %>%
> > +       rbindlist(use.names=TRUE,fill = TRUE)
> > +   ) %>% rbindlist(use.names=TRUE,fill = TRUE)
> > + ) %>% rbindlist(use.names=TRUE,fill = TRUE, idcol = "Item")
> >
> > *Error message:*
> > Error in rbindlist(., use.names = TRUE, fill = TRUE, idcol =
> "Item") :
> >    attempt to set index 8424/8424 in SET_STRING_ELT
> > In addition: There were 50 or more warnings (use warnings() to
> see the
> > first 50)
> >
> > I am not understanding what is in SET_STRING_ELT which it is
> trying to
> > throw an error.
> > Please help me
>
> The code is trying to write beyond the end of a string vector (to an
> element the vector does not have). This is typically a bug in native
> code of a package.
>
> Best
> Tomas
>
> >
> >
> > *Regards,*
> >
> > *Anshul Saravgi*
> >
> > Consulting
> > m: 7757030307
> >
> > 
> > AI powered solutions that predict, prescribe, learn and are 100x
> faster,
> > smarter and easier to use
> >
>
>
> This Electronic Mail (e-mail) contains confidential and privileged 
> information intended only for the use of the individual or entity to 
> which it is sent.  If the reader of this message is not the intended 
> recipient, or the employee or agent responsible for delivery to the 
> intended recipient, you are hereby notified that any dissemination, 
> distribution, or copying of this communication is STRICTLY PROHIBITED. 
>  If you have received this communication in error, please immediately 
> notify the sender by reply e-mail or telephone. 



[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


Re: [Rd] Getting error in rbindlist

2019-11-01 Thread Tomas Kalibera

On 11/1/19 1:11 PM, Anshul Saravgi wrote:

Hi All

Can you help me understand the meaning of the below error message then I
will try to figure out what is going wrong:

*Input Code:*

bodlane2 <- lapply(

+   lapply(split(lctolc2, lctolc2$Item), function(x) graph.data.frame(x[,
2:3])),
+   function(x) lapply(
+ V(x)[degree(x, mode = "in") == 0],
+ function(s) all_simple_paths(x, from = s,
+  to = V(x)[degree(x, mode = "out") == 0])
%>%
+   lapply(
+ function(y) as.data.table(t(names(y))) %>% setnames(paste0("LC",
seq_along(.)))
+   ) %>%
+   rbindlist(use.names=TRUE,fill = TRUE)
+   ) %>% rbindlist(use.names=TRUE,fill = TRUE)
+ ) %>% rbindlist(use.names=TRUE,fill = TRUE, idcol = "Item")

*Error message:*
Error in rbindlist(., use.names = TRUE, fill = TRUE, idcol = "Item") :
   attempt to set index 8424/8424 in SET_STRING_ELT
In addition: There were 50 or more warnings (use warnings() to see the
first 50)

I am not understanding what is in SET_STRING_ELT which it is trying to
throw an error.
Please help me


The code is trying to write beyond the end of a string vector (to an 
element the vector does not have). This is typically a bug in native 
code of a package.


Best
Tomas




*Regards,*

*Anshul Saravgi*

Consulting
m: 7757030307


AI powered solutions that predict, prescribe, learn and are 100x faster,
smarter and easier to use



__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel


[Rd] Getting error in rbindlist

2019-11-01 Thread Anshul Saravgi
Hi All

Can you help me understand the meaning of the below error message then I
will try to figure out what is going wrong:

*Input Code:*
> bodlane2 <- lapply(
+   lapply(split(lctolc2, lctolc2$Item), function(x) graph.data.frame(x[,
2:3])),
+   function(x) lapply(
+ V(x)[degree(x, mode = "in") == 0],
+ function(s) all_simple_paths(x, from = s,
+  to = V(x)[degree(x, mode = "out") == 0])
%>%
+   lapply(
+ function(y) as.data.table(t(names(y))) %>% setnames(paste0("LC",
seq_along(.)))
+   ) %>%
+   rbindlist(use.names=TRUE,fill = TRUE)
+   ) %>% rbindlist(use.names=TRUE,fill = TRUE)
+ ) %>% rbindlist(use.names=TRUE,fill = TRUE, idcol = "Item")

*Error message:*
Error in rbindlist(., use.names = TRUE, fill = TRUE, idcol = "Item") :
  attempt to set index 8424/8424 in SET_STRING_ELT
In addition: There were 50 or more warnings (use warnings() to see the
first 50)

I am not understanding what is in SET_STRING_ELT which it is trying to
throw an error.
Please help me


*Regards,*

*Anshul Saravgi*

Consulting
m: 7757030307


AI powered solutions that predict, prescribe, learn and are 100x faster,
smarter and easier to use

-- 
This Electronic Mail (e-mail) contains confidential and privileged 
information intended only for the use of the individual or entity to which 
it is sent.  If the reader of this message is not the intended recipient, 
or the employee or agent responsible for delivery to the intended 
recipient, you are hereby notified that any dissemination, distribution, or 
copying of this communication is STRICTLY PROHIBITED.  If you have received 
this communication in error, please immediately notify the sender by reply 
e-mail or telephone. 

[[alternative HTML version deleted]]

__
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel