search for: islistfactor

Displaying 6 results from an estimated 6 matches for "islistfactor".

2018 May 08
2
unlist errors on a nested list of empty lists
...lv, names = nm, class = "factor") > > which is called because unlist() thinks that some entry is a factor, > with NULL levels and NULL names. It's not legal for a factor to have > NULL levels. Probably it should never get here; the earlier test > > if (.Internal(islistfactor(x, recursive))) { > > should have been false, and then the result would have been > > .Internal(unlist(x, recursive, use.names)) > > (with both recursive and use.names being TRUE), which returns NULL. And the problem is in the islistfactor function in src/main/apply.c, which...
2018 May 09
2
unlist errors on a nested list of empty lists
On 08/05/2018 4:50 PM, Steven Nydick wrote: > It also does the same thing if the factor is not on the first level of > the list, which seems to be due to the fact that the islistfactor is > recursive, but if a list is a list-factor, the first level lists are > coerced into character strings. > > > x <- list(list(factor(LETTERS[1]))) > > unlist(x) > Error in as.character.factor(x) : malformed factor > > However, if one of the factors is at th...
2018 May 08
0
unlist errors on a nested list of empty lists
It also does the same thing if the factor is not on the first level of the list, which seems to be due to the fact that the islistfactor is recursive, but if a list is a list-factor, the first level lists are coerced into character strings. > x <- list(list(factor(LETTERS[1]))) > unlist(x) Error in as.character.factor(x) : malformed factor However, if one of the factors is at the top level, and one is nested, then the res...
2018 May 08
2
unlist errors on a nested list of empty lists
Reproducible example: x <- list(list(list(), list())) unlist(x) *> Error in as.character.factor(x) : malformed factor* What should happen: unlist(x) > NULL R.version platform x86_64-apple-darwin15.6.0 arch x86_64 os darwin15.6.0 system x86_64, darwin15.6.0 status major 3 minor 5.0 year 2018 month 04 day
2018 May 09
0
unlist errors on a nested list of empty lists
...ted on r-devel. On Tue, May 8, 2018 at 7:51 PM Duncan Murdoch <murdoch.duncan at gmail.com> wrote: > On 08/05/2018 4:50 PM, Steven Nydick wrote: > > It also does the same thing if the factor is not on the first level of > > the list, which seems to be due to the fact that the islistfactor is > > recursive, but if a list is a list-factor, the first level lists are > > coerced into character strings. > > > > > x <- list(list(factor(LETTERS[1]))) > > > unlist(x) > > Error in as.character.factor(x) : malformed factor > > > > How...
2008 Aug 20
0
unlist on nested lists of factors (PR#12572)
...;a"))) str(unlist(y)) ## Factor w/ 0 levels: NA ## - attr(*, "names")= chr "v" ## Warning message: ## In str.default(unlist(y)) : 'object' does not have valid levels() unlist is defined as unlist <- function(x, recursive=TRUE, use.names=TRUE) { if(.Internal(islistfactor(x, recursive))) { lv <- unique(.Internal(unlist(lapply(x, levels), recursive, FALSE))) nm <- if(use.names) names(.Internal(unlist(x, recursive, use.names))) res <- .Internal(unlist(lapply(x, as.character), recursive, FALSE)) res <- match(res, lv)...