-
Notifications
You must be signed in to change notification settings - Fork 986
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
[Support] Efficient reshaping with melt - Error: measure variables not found in data #2270
Comments
you've tried to call a data.table method on a data.frame. please try stackoverflow
if you'd like programming help
…On Jul 13, 2017 8:45 PM, "Brian G. Barkley" ***@***.***> wrote:
I want to "efficiently reshape" my data using the new list functionality.
But I can't even get a simple example to work with the list notation.
I'm starting with a clean environment in an RMarkdown script in a package
I'm working on. Note that I'm running R 3.2.3.
library(data.table)
# data.table 1.10.4
# The fastest way to learn (by data.table authors): https://www.datacamp.com/courses/data-analysis-the-data-table-way
# Documentation: ?data.table, example(data.table) and browseVignettes("data.table")
# Release notes, videos and slides: http://r-datatable.com
#Warning message:
#package ‘data.table’ was built under R version 3.2.5
toy dataset, and it works fine in the usual case
toy <- data.frame(aa = 3:4, ab= 5:6)
t1 <- melt(data = toy, measure.vars=1:2)
t1
# variable value
#1 aa 3
#2 aa 4
#3 ab 5
#4 ab 6
But this fails with the list notation
t2 <- melt(data = toy,measure.vars = list(1:2))
#Error: measure variables not found in data: 1:2
t2
#Error: object 't2' not found
t3 <- melt(data = toy,measure.vars = patterns("^a_"))
#Error in melt_check(data, id.vars, measure.vars, variable.name, value.name) :
could not find function "patterns"
t3
#Error: object 't3' not found
fwiw
> sessionInfo()
R version 3.2.3 (2015-12-10)
Platform: x86_64-w64-mingw32/x64 (64-bit)
Running under: Windows 7 x64 (build 7601) Service Pack 1
locale:
[1] LC_COLLATE=English_United States.1252 LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] data.table_1.10.4
loaded via a namespace (and not attached):
[1] magrittr_1.5 plyr_1.8.4 tools_3.2.3 reshape2_1.4.1 Rcpp_0.12.4 stringi_1.1.2
[7] stringr_1.2.0
Thanks for your help!
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#2270>, or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHQQdfEoIGs3K_CMUeHmVSX-4qQ9S7boks5sNuRGgaJpZM4OXy6A>
.
|
And indeed, what a silly mistake it is
|
you can just declare it with data.table to start, or use setDT if the
object exists
…On Jul 13, 2017 9:07 PM, "Brian G. Barkley" ***@***.***> wrote:
Closed #2270 <#2270>.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#2270 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AHQQdUhfaNnT0zP3AXQWVYlR9O8Z0x1Dks5sNumHgaJpZM4OXy6A>
.
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I want to "efficiently reshape" my data using the new list functionality. But I can't even get a simple example to work with the list notation.
I'm starting with a clean environment in an RMarkdown script in a package I'm working on. Note that I'm running R 3.2.3.
toy dataset, and it works fine in the usual case
But this fails with the list notation
I'm also having troubles with the patterns. Should I load
reshape2
first? I tried that and it didn't seem to work.fwiw
Thanks for your help!
The text was updated successfully, but these errors were encountered: