Skip to content

layout: Error in unclass(x) : cannot unclass an environment #254

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
chriddyp opened this issue Aug 11, 2015 · 3 comments
Closed

layout: Error in unclass(x) : cannot unclass an environment #254

chriddyp opened this issue Aug 11, 2015 · 3 comments
Labels

Comments

@chriddyp
Copy link
Member

reported by a user:

> d <- diamonds[sample(nrow(diamonds),1000),]
> p <- plot_ly(d, x=carat, y=price)
> p
Success! Created a new plotly here ->  ....
> p %>% layout(title = "diamond price")
Error in unclass(x) : cannot unclass an environment

Windows 7
R Version: R version 3.1.3 (2015-03-09)

@chriddyp chriddyp added the bug label Aug 11, 2015
@chriddyp
Copy link
Member Author

I can't replicate, but I'm trying with R 3.1.3 and R on Windows 8

@chriddyp
Copy link
Member Author

OK, replicated on R 3.1.3:

> p %>% layout(title = "diamond price")
Error in unclass(x) : cannot unclass an environment

@chriddyp
Copy link
Member Author

> layout(p, title = "diamond price")
Error in unclass(x) : cannot unclass an environment
> traceback()
19: matchSignature(signature, fdef)
18: getMethod(f, signature, optional = TRUE)
17: existsMethod("asJSON", class(unclass(x)))
16: .local(x, ...)
15: FUN(X[[1L]], ...)
14: FUN(X[[1L]], ...)
13: vapply(x, asJSON, character(1), na = na, auto_unbox = auto_unbox, 
        indent = indent + 2L, ...)
12: .local(x, ...)
11: FUN(X[[1L]], ...)
10: FUN(X[[1L]], ...)
9: vapply(x, asJSON, character(1), na = na, auto_unbox = auto_unbox, 
       indent = indent + 2L, ...)
8: .local(x, ...)
7: asJSON(x, dataframe = dataframe, Date = Date, POSIXt = POSIXt, 
       factor = factor, complex = complex, raw = raw, matrix = matrix, 
       auto_unbox = auto_unbox, digits = digits, na = na, null = null, 
       force = force, indent = indent, ...)
6: asJSON(x, dataframe = dataframe, Date = Date, POSIXt = POSIXt, 
       factor = factor, complex = complex, raw = raw, matrix = matrix, 
       auto_unbox = auto_unbox, digits = digits, na = na, null = null, 
       force = force, indent = indent, ...)
5: jsonlite::toJSON(x, digits = 50, auto_unbox = TRUE, force = TRUE, 
       ...)
4: to_JSON(kwargs)
3: plotly_POST(x)
2: print.plotly(list())
1: print(list())

chriddyp added a commit that referenced this issue Aug 14, 2015
Sanitize kwargs from class "environment" before posting - Fixes #254
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant