{"action":"created","issue":{"url":"https://api.github.com/repos/sjewo/readstata13/issues/42","repository_url":"https://api.github.com/repos/sjewo/readstata13","labels_url":"https://api.github.com/repos/sjewo/readstata13/issues/42/labels{/name}","comments_url":"https://api.github.com/repos/sjewo/readstata13/issues/42/comments","events_url":"https://api.github.com/repos/sjewo/readstata13/issues/42/events","html_url":"https://github.com/sjewo/readstata13/issues/42","id":178334658,"number":42,"title":"convert.underscore=TRUE \"too aggressive\"","user":{"login":"luke-m-olson","id":18049962,"avatar_url":"https://avatars.githubusercontent.com/u/18049962?v=3","gravatar_id":"","url":"https://api.github.com/users/luke-m-olson","html_url":"https://github.com/luke-m-olson","followers_url":"https://api.github.com/users/luke-m-olson/followers","following_url":"https://api.github.com/users/luke-m-olson/following{/other_user}","gists_url":"https://api.github.com/users/luke-m-olson/gists{/gist_id}","starred_url":"https://api.github.com/users/luke-m-olson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luke-m-olson/subscriptions","organizations_url":"https://api.github.com/users/luke-m-olson/orgs","repos_url":"https://api.github.com/users/luke-m-olson/repos","events_url":"https://api.github.com/users/luke-m-olson/events{/privacy}","received_events_url":"https://api.github.com/users/luke-m-olson/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2016-09-21T12:38:01Z","updated_at":"2016-09-21T13:51:27Z","closed_at":null,"body":"Issue:\r\n`save.dta13(test_df, \"testdf.dta\", convert.underscore=TRUE)` appears to convert all non-alphabetical characters in variable names to \"_\".  It seems that it should leave valid characters alone. This would be consistent with the help file entry: \r\n\r\n> convert.underscore logica. If TRUE, in variable names dots will be converted to underscores.\r\n\r\nBut seems different than the note in the NEWS file:\r\n\r\n> convert.underscore=T will convert all non-literal characters to underscores\r\n\r\nHere is a reproducible example:\r\n\r\n```\r\ntest_df <- data.frame(var.1=1:3, var_2=1:3)\r\nlibrary(readstata13)\r\nsave.dta13(\"testdf.dta\", convert.underscore=TRUE)\r\n\r\n```\r\nIn Stata 14.1, the variable names are identical:  \r\n> var__ var__\r\n\r\nas the final 1 and 2 of each has been converted to an underscore. It seems like they should be\r\n\r\n> var_1 var_2\r\n\r\n*Notes*:\r\n\r\n1. Currently using version 0.8.2. \r\n2. My understanding of the variable name rules for Stata are \"[a-zA-Z0-9_]\" (alphanumeric characters and \"_\") are valid characters, with the caveat that the first character cannot be numeric."},"comment":{"url":"https://api.github.com/repos/sjewo/readstata13/issues/comments/248618519","html_url":"https://github.com/sjewo/readstata13/issues/42#issuecomment-248618519","issue_url":"https://api.github.com/repos/sjewo/readstata13/issues/42","id":248618519,"user":{"login":"luke-m-olson","id":18049962,"avatar_url":"https://avatars.githubusercontent.com/u/18049962?v=3","gravatar_id":"","url":"https://api.github.com/users/luke-m-olson","html_url":"https://github.com/luke-m-olson","followers_url":"https://api.github.com/users/luke-m-olson/followers","following_url":"https://api.github.com/users/luke-m-olson/following{/other_user}","gists_url":"https://api.github.com/users/luke-m-olson/gists{/gist_id}","starred_url":"https://api.github.com/users/luke-m-olson/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/luke-m-olson/subscriptions","organizations_url":"https://api.github.com/users/luke-m-olson/orgs","repos_url":"https://api.github.com/users/luke-m-olson/repos","events_url":"https://api.github.com/users/luke-m-olson/events{/privacy}","received_events_url":"https://api.github.com/users/luke-m-olson/received_events","type":"User","site_admin":false},"created_at":"2016-09-21T13:51:26Z","updated_at":"2016-09-21T13:51:26Z","body":"Thank you for your quick response.\nThat is great to hear. Unfortunately, I can't test it work, as we are \"stuck\" with and earlier version due to \"company policies.\"\nThe commit that you sent would fix the var.1 naming issue. I wonder if it should be\nnames(data) <- gsub(\"[^a-zA-Z0-9_]\", \"_\", names(data))\nrather than\nnames(data) <- gsub(\"[^a-zA-Z0-9:]\", \"_\", names(data))Since \":\" is not in the set of valid characters.\nIn fact, I might be tempted to add an additional line here to make sure that the first character is not numeric:\nnames(data) <- gsub(\"[^a-zA-Z0-9_]\", \"_\", names(data))names(data) <- sub(\"^[^a-zA-Z_]\", \"_\", names(data))\n      From: Jan Marvin Garbuszus <notifications@github.com>\n To: sjewo/readstata13 <readstata13@noreply.github.com> \nCc: luke <lukemolson@yahoo.com>; Author <author@noreply.github.com>\n Sent: Wednesday, September 21, 2016 9:03 AM\n Subject: Re: [sjewo/readstata13] convert.underscore=TRUE \"too aggressive\" (#42)\n   \nThe commit that contains the fix is bd1a781Could you please confirm if this fixes your problem? Thanks—\nYou are receiving this because you authored the thread.\nReply to this email directly, view it on GitHub, or mute the thread.  \n\n   "}}
{"actor":{"display_login":"luke-m-olson"}}