{"action":"created","issue":{"url":"https://api.github.com/repos/IALSA/ialsa-2015-portland-stencil/issues/16","repository_url":"https://api.github.com/repos/IALSA/ialsa-2015-portland-stencil","labels_url":"https://api.github.com/repos/IALSA/ialsa-2015-portland-stencil/issues/16/labels{/name}","comments_url":"https://api.github.com/repos/IALSA/ialsa-2015-portland-stencil/issues/16/comments","events_url":"https://api.github.com/repos/IALSA/ialsa-2015-portland-stencil/issues/16/events","html_url":"https://github.com/IALSA/ialsa-2015-portland-stencil/issues/16","id":132250804,"number":16,"title":"developing Syntax Creator","user":{"login":"andkov","id":2608073,"avatar_url":"https://avatars.githubusercontent.com/u/2608073?v=3","gravatar_id":"","url":"https://api.github.com/users/andkov","html_url":"https://github.com/andkov","followers_url":"https://api.github.com/users/andkov/followers","following_url":"https://api.github.com/users/andkov/following{/other_user}","gists_url":"https://api.github.com/users/andkov/gists{/gist_id}","starred_url":"https://api.github.com/users/andkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andkov/subscriptions","organizations_url":"https://api.github.com/users/andkov/orgs","repos_url":"https://api.github.com/users/andkov/repos","events_url":"https://api.github.com/users/andkov/events{/privacy}","received_events_url":"https://api.github.com/users/andkov/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"andkov","id":2608073,"avatar_url":"https://avatars.githubusercontent.com/u/2608073?v=3","gravatar_id":"","url":"https://api.github.com/users/andkov","html_url":"https://github.com/andkov","followers_url":"https://api.github.com/users/andkov/followers","following_url":"https://api.github.com/users/andkov/following{/other_user}","gists_url":"https://api.github.com/users/andkov/gists{/gist_id}","starred_url":"https://api.github.com/users/andkov/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andkov/subscriptions","organizations_url":"https://api.github.com/users/andkov/orgs","repos_url":"https://api.github.com/users/andkov/repos","events_url":"https://api.github.com/users/andkov/events{/privacy}","received_events_url":"https://api.github.com/users/andkov/received_events","type":"User","site_admin":false},"milestone":null,"comments":14,"created_at":"2016-02-08T20:38:40Z","updated_at":"2016-02-22T15:55:53Z","closed_at":null,"body":"Objective flow: template Mplus script is fed to R, which produces modified Mplus scripts, designed for optimized parsing. The parser will reference this Syntax Creator, getting instructions on what to look for in the text output. \r\n\r\n"},"comment":{"url":"https://api.github.com/repos/IALSA/ialsa-2015-portland-stencil/issues/comments/187242236","html_url":"https://github.com/IALSA/ialsa-2015-portland-stencil/issues/16#issuecomment-187242236","issue_url":"https://api.github.com/repos/IALSA/ialsa-2015-portland-stencil/issues/16","id":187242236,"user":{"login":"wibeasley","id":1372890,"avatar_url":"https://avatars.githubusercontent.com/u/1372890?v=3","gravatar_id":"","url":"https://api.github.com/users/wibeasley","html_url":"https://github.com/wibeasley","followers_url":"https://api.github.com/users/wibeasley/followers","following_url":"https://api.github.com/users/wibeasley/following{/other_user}","gists_url":"https://api.github.com/users/wibeasley/gists{/gist_id}","starred_url":"https://api.github.com/users/wibeasley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wibeasley/subscriptions","organizations_url":"https://api.github.com/users/wibeasley/orgs","repos_url":"https://api.github.com/users/wibeasley/repos","events_url":"https://api.github.com/users/wibeasley/events{/privacy}","received_events_url":"https://api.github.com/users/wibeasley/received_events","type":"User","site_admin":false},"created_at":"2016-02-22T15:55:53Z","updated_at":"2016-02-22T15:55:53Z","body":"Thanks @annierobi, that experience is helpful.\r\n\r\n@andkov, my interpretation of the following links is consistent with @annierobi's advice\r\n\r\nhttp://www.inside-r.org/packages/cran/stringr/docs/str_wrap\r\nhttp://www.statmodel.com/discussion/messages/9/9765.html?1409244035\r\nhttp://www.ats.ucla.edu/stat/mplus/faq/faqs.htm (see \"Can a command span over more than one line?\") \r\n\r\n```r\r\nrequireNamespace(\"stringr\")\r\n\r\nwaves <- c(1:13, 16)\r\n\r\na <- paste(paste0(\"a\", waves), collapse=\" \")\r\ntimes <-  paste(paste0(\"time\", waves), collapse=\" \")\r\nmodel_long <- paste(\"ia sa |\", a, \"AT\", times, \";\", collapse=\" \")\r\nmodel_wrap <- stringr::str_wrap(\r\n  str = model_long, \r\n  width  = 35,   #Probably increase this to 85 in the real code\r\n  exdent = 4\r\n)\r\n```\r\n\r\nThe string looks like this:\r\n```r\r\n> model_wrap\r\n[1] \"ia sa | a1 a2 a3 a4 a5 a6 a7 a8 a9\\n    a10 a11 a12 a13 a16 AT time1 time2\\n    time3 time4 time5 time6 time7 time8\\n    time9 time10 time11 time12 time13\\n    time16 ;\"\r\n```\r\n\r\nWhile the rendered text in the .inp file should look like this:\r\n```r\r\n> cat(model_wrap)\r\nia sa | a1 a2 a3 a4 a5 a6 a7 a8 a9\r\n    a10 a11 a12 a13 a16 AT time1 time2\r\n    time3 time4 time5 time6 time7 time8\r\n    time9 time10 time11 time12 time13\r\n    time16 ;\r\n```\r\n\r\nIf you wanted to make it a little more readable/debuggable, put the pipe and \"AT\" are on their own line.  This call to `gsub()` requires several escape sequences.\r\n```r\r\n> model_wrap_pretty <- gsub(\"(AT|\\\\|)\", \"\\n    \\\\1\\n   \", model_wrap)\r\n> cat(model_wrap_pretty)\r\nia sa \r\n    |\r\n    a1 a2 a3 a4 a5 a6 a7 a8 a9\r\n    a10 a11 a12 a13 a16 \r\n    AT\r\n    time1 time2\r\n    time3 time4 time5 time6 time7 time8\r\n    time9 time10 time11 time12 time13\r\n    time16 ;\r\n```"}}