{"action":"created","issue":{"url":"https://api.github.com/repos/klmr/modules/issues/80","repository_url":"https://api.github.com/repos/klmr/modules","labels_url":"https://api.github.com/repos/klmr/modules/issues/80/labels{/name}","comments_url":"https://api.github.com/repos/klmr/modules/issues/80/comments","events_url":"https://api.github.com/repos/klmr/modules/issues/80/events","html_url":"https://github.com/klmr/modules/issues/80","id":130339834,"number":80,"title":"interactions with data.table","user":{"login":"jpetterson","id":4271713,"avatar_url":"https://avatars.githubusercontent.com/u/4271713?v=3","gravatar_id":"","url":"https://api.github.com/users/jpetterson","html_url":"https://github.com/jpetterson","followers_url":"https://api.github.com/users/jpetterson/followers","following_url":"https://api.github.com/users/jpetterson/following{/other_user}","gists_url":"https://api.github.com/users/jpetterson/gists{/gist_id}","starred_url":"https://api.github.com/users/jpetterson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpetterson/subscriptions","organizations_url":"https://api.github.com/users/jpetterson/orgs","repos_url":"https://api.github.com/users/jpetterson/repos","events_url":"https://api.github.com/users/jpetterson/events{/privacy}","received_events_url":"https://api.github.com/users/jpetterson/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/klmr/modules/labels/bug","name":"bug","color":"f7c6c7"},{"url":"https://api.github.com/repos/klmr/modules/labels/in%20progress","name":"in progress","color":"bfe5bf"}],"state":"open","locked":false,"assignee":{"login":"klmr","id":38931,"avatar_url":"https://avatars.githubusercontent.com/u/38931?v=3","gravatar_id":"","url":"https://api.github.com/users/klmr","html_url":"https://github.com/klmr","followers_url":"https://api.github.com/users/klmr/followers","following_url":"https://api.github.com/users/klmr/following{/other_user}","gists_url":"https://api.github.com/users/klmr/gists{/gist_id}","starred_url":"https://api.github.com/users/klmr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klmr/subscriptions","organizations_url":"https://api.github.com/users/klmr/orgs","repos_url":"https://api.github.com/users/klmr/repos","events_url":"https://api.github.com/users/klmr/events{/privacy}","received_events_url":"https://api.github.com/users/klmr/received_events","type":"User","site_admin":false},"assignees":[{"login":"klmr","id":38931,"avatar_url":"https://avatars.githubusercontent.com/u/38931?v=3","gravatar_id":"","url":"https://api.github.com/users/klmr","html_url":"https://github.com/klmr","followers_url":"https://api.github.com/users/klmr/followers","following_url":"https://api.github.com/users/klmr/following{/other_user}","gists_url":"https://api.github.com/users/klmr/gists{/gist_id}","starred_url":"https://api.github.com/users/klmr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/klmr/subscriptions","organizations_url":"https://api.github.com/users/klmr/orgs","repos_url":"https://api.github.com/users/klmr/repos","events_url":"https://api.github.com/users/klmr/events{/privacy}","received_events_url":"https://api.github.com/users/klmr/received_events","type":"User","site_admin":false}],"milestone":null,"comments":8,"created_at":"2016-02-01T11:45:13Z","updated_at":"2016-07-16T07:53:51Z","closed_at":null,"body":"Great package Konrad, that's something I've been looking for a long time.\r\n\r\nI'm having some issues when importing modules that make use of the data.table package though. Here's a MWE:\r\n\r\nFile test.R:\r\n\r\n```\r\nlibrary(data.table)\r\n\r\ntest_fn <- function() {\r\n\tdt <- data.table(a = 1:10)\r\n\tdt[a==1]\r\n}\r\n```\r\n\r\nThen run with:\r\n\r\n```\r\nlibrary(modules)\r\nb = import('test')\r\nb$test_fn()\r\n```\r\n\r\nI get this error message:\r\n```\r\nError in `[.data.frame'(x, i) : object 'a' not found\r\n```\r\n\r\nAny idea of what could be causing this? \r\nThanks.\r\n\r\n\r\n```\r\n> sessionInfo()\r\nR version 3.2.1 (2015-06-18)\r\nPlatform: x86_64-apple-darwin13.4.0 (64-bit)\r\nRunning under: OS X 10.9.5 (Mavericks)\r\n\r\nother attached packages:\r\n[1] modules_0.9.3   data.table_1.9.6\r\n\r\n```\r\n(package 'modules' installed from github today)"},"comment":{"url":"https://api.github.com/repos/klmr/modules/issues/comments/233118502","html_url":"https://github.com/klmr/modules/issues/80#issuecomment-233118502","issue_url":"https://api.github.com/repos/klmr/modules/issues/80","id":233118502,"user":{"login":"jpetterson","id":4271713,"avatar_url":"https://avatars.githubusercontent.com/u/4271713?v=3","gravatar_id":"","url":"https://api.github.com/users/jpetterson","html_url":"https://github.com/jpetterson","followers_url":"https://api.github.com/users/jpetterson/followers","following_url":"https://api.github.com/users/jpetterson/following{/other_user}","gists_url":"https://api.github.com/users/jpetterson/gists{/gist_id}","starred_url":"https://api.github.com/users/jpetterson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jpetterson/subscriptions","organizations_url":"https://api.github.com/users/jpetterson/orgs","repos_url":"https://api.github.com/users/jpetterson/repos","events_url":"https://api.github.com/users/jpetterson/events{/privacy}","received_events_url":"https://api.github.com/users/jpetterson/received_events","type":"User","site_admin":false},"created_at":"2016-07-16T07:53:51Z","updated_at":"2016-07-16T07:53:51Z","body":"Hi Konrad,\r\n\r\nNot sure if you intend to act on this, but FYI the patch above (on import.r) no longer works with R 3.3.1. Here's a MWE:\r\n\r\nFile test.R:\r\n```\r\ntest_fn <- function() {\r\n\tforeach(a = 1:10) %do% { a }\r\n}\r\n```\r\n\r\nFile go.R:\r\n```\r\nlibrary(modules)\r\nlibrary(foreach)\r\n\r\nm = import('test')\r\nm$test_fn()\r\n```\r\n\r\nAnd here's the error:\r\n```\r\n$ R --vanilla < go.R\r\n\r\nR version 3.3.1 (2016-06-21) -- \"Bug in Your Hair\"\r\nCopyright (C) 2016 The R Foundation for Statistical Computing\r\nPlatform: x86_64-apple-darwin13.4.0 (64-bit)\r\n\r\nR is free software and comes with ABSOLUTELY NO WARRANTY.\r\nYou are welcome to redistribute it under certain conditions.\r\nType 'license()' or 'licence()' for distribution details.\r\n\r\n  Natural language support but running in an English locale\r\n\r\nR is a collaborative project with many contributors.\r\nType 'contributors()' for more information and\r\n'citation()' on how to cite R or R packages in publications.\r\n\r\nType 'demo()' for some demos, 'help()' for on-line help, or\r\n'help.start()' for an HTML browser interface to help.\r\nType 'q()' to quit R.\r\n\r\n> library(modules)\r\n\r\nAttaching package: ‘modules’\r\n\r\nThe following objects are masked from ‘package:utils’:\r\n\r\n    ?, help\r\n\r\n> library(foreach)\r\n>\r\n> m = import('test')\r\n> m$test_fn()\r\nError in frameTypes(env) : namespace found within global environments\r\nCalls: <Anonymous> ... <Anonymous> -> comp -> makeCenv -> structure -> frameTypes\r\nExecution halted\r\n```\r\n\r\nThis is with the latest version of `module` as of today (e626dd3a).\r\n\r\nThe same issue didn't happen with R-3.2.1, which didn't have the test above:\r\n\r\nR-3.2.1, src/library/compiler/R:\r\n```\r\nframeTypes <- function(env) {\r\n    top <- topenv(env)\r\n    empty <- emptyenv()\r\n    nl <- 0\r\n    while (! identical(env, top)) {\r\n        env <- parent.env(env)\r\n        nl <- nl + 1\r\n        if (identical(env, empty))\r\n            stop(\"not a proper evaluation environment\")\r\n    }\r\n    nn <- 0\r\n    if (isNamespace(env)) {\r\n        while (! identical(env, .GlobalEnv)) {\r\n            env <- parent.env(env)\r\n            nn <- nn + 1\r\n            if (identical(env, empty))\r\n                stop(\"not a proper evaluation environment\")\r\n        }\r\n    }\r\n    ng <- 0\r\n    while (! identical(env, empty)) {\r\n        env <- parent.env(env)\r\n        ng <- ng + 1\r\n    }\r\n    rep(c(\"local\", \"namespace\", \"global\"), c(nl, nn, ng))\r\n}\r\n```\r\n\r\nSame file in R-3.3.1:\r\n```\r\nframeTypes <- function(env) {\r\n    top <- topenv(env)\r\n    empty <- emptyenv()\r\n    base <- baseenv()\r\n    nl <- 0\r\n    while (! identical(env, top)) {\r\n        if (isNamespace(env))\r\n            stop(\"namespace found within local environments\")\r\n        env <- parent.env(env)\r\n        nl <- nl + 1\r\n        if (identical(env, empty))\r\n            stop(\"not a proper evaluation environment\")\r\n    }\r\n    nn <- 0\r\n    if (isNamespace(env)) {\r\n        while (! identical(env, .GlobalEnv)) {\r\n            if (!isNamespace(env)) {\r\n                name <- attr(env, \"name\")\r\n                if (!is.character(name) || !startsWith(name, \"imports:\"))\r\n                    stop(\"non-namespace found within namespace environments\")\r\n            }\r\n            env <- parent.env(env)\r\n            nn <- nn + 1\r\n            if (identical(env, empty))\r\n                stop(\"not a proper evaluation environment\")\r\n        }\r\n    }\r\n    ng <- 0\r\n    while (! identical(env, empty)) {\r\n        if (isNamespace(env))\r\n            stop(\"namespace found within global environments\")\r\n        env <- parent.env(env)\r\n        ng <- ng + 1\r\n    }\r\n    rep(c(\"local\", \"namespace\", \"global\"), c(nl, nn, ng))\r\n}\r\n```\r\n\r\nFor the moment, as a workaround I'm using this:\r\n```\r\nassignInNamespace(\"cedta.pkgEvalsUserCode\", c(data.table:::cedta.pkgEvalsUserCode,\"base\"), \"data.table\")\r\n```\r\n... but I imagine that can potentially break other things.\r\n\r\n\r\n"}}
{"actor":{"display_login":"jpetterson"}}