{"action":"created","issue":{"url":"https://api.github.com/repos/dankelley/oce/issues/775","labels_url":"https://api.github.com/repos/dankelley/oce/issues/775/labels{/name}","comments_url":"https://api.github.com/repos/dankelley/oce/issues/775/comments","events_url":"https://api.github.com/repos/dankelley/oce/issues/775/events","html_url":"https://github.com/dankelley/oce/issues/775","id":115257290,"number":775,"title":"read.table() should always use stringsAsFactors=FALSE","user":{"login":"dankelley","id":99469,"avatar_url":"https://avatars.githubusercontent.com/u/99469?v=3","gravatar_id":"","url":"https://api.github.com/users/dankelley","html_url":"https://github.com/dankelley","followers_url":"https://api.github.com/users/dankelley/followers","following_url":"https://api.github.com/users/dankelley/following{/other_user}","gists_url":"https://api.github.com/users/dankelley/gists{/gist_id}","starred_url":"https://api.github.com/users/dankelley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dankelley/subscriptions","organizations_url":"https://api.github.com/users/dankelley/orgs","repos_url":"https://api.github.com/users/dankelley/repos","events_url":"https://api.github.com/users/dankelley/events{/privacy}","received_events_url":"https://api.github.com/users/dankelley/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/dankelley/oce/labels/I/O","name":"I/O","color":"fbca04"}],"state":"closed","locked":false,"assignee":{"login":"dankelley","id":99469,"avatar_url":"https://avatars.githubusercontent.com/u/99469?v=3","gravatar_id":"","url":"https://api.github.com/users/dankelley","html_url":"https://github.com/dankelley","followers_url":"https://api.github.com/users/dankelley/followers","following_url":"https://api.github.com/users/dankelley/following{/other_user}","gists_url":"https://api.github.com/users/dankelley/gists{/gist_id}","starred_url":"https://api.github.com/users/dankelley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dankelley/subscriptions","organizations_url":"https://api.github.com/users/dankelley/orgs","repos_url":"https://api.github.com/users/dankelley/repos","events_url":"https://api.github.com/users/dankelley/events{/privacy}","received_events_url":"https://api.github.com/users/dankelley/received_events","type":"User","site_admin":false},"milestone":null,"comments":1,"created_at":"2015-11-05T10:44:21Z","updated_at":"2015-11-05T19:32:50Z","closed_at":"2015-11-05T19:32:50Z","body":"A progress checklist from ``git grep -n read.table|grep -v stringsAsFactors``. I won't bother documenting speedups except perhaps for ``ctd`` and ``coastline``, because these files tend not to be terribly large, and I am of the impression that ``stringsAsFactors`` will always slow things down. Also, there is no risk in changing this because I know for sure that we never use factors in the present code.\r\n* [ ] adv.sontek.R:622:    hdt <-  read.table(hd)\r\n* [ ] bremen.R:134:    data <- read.table(text=lines[-seq.int(1, headerLength)], header=FALSE, col.names=names)\r\n* [x] coastline.R:351:        data <- read.table(file, col.names=c(\"longitude\", \"latitude\")) **NOTE**: does not speed up ... I think the setting only matters when we actually *have* strings\r\n* [ ] colors.R:173:    d <- read.table(text=textData, col.names=c(\"x0\", \"r0\", \"g0\", \"b0\", \"x1\", \"r1\", \"g1\", \"b1\"))\r\n* [ ] ctd.R:1836:        data <- as.list(read.table(textConnection(dataLines), header=FALSE, sep=\",\", col.names=names))\r\n* [ ] ctd.R:2074:    data <- read.table(file, skip=6, header=FALSE)\r\n* [ ] ctd.R:2465:        data <- as.list(read.table(text=lines[seq.int(iline, length(lines))],\r\n* [ ] ctd.R:2481:        dataAll <- read.table(text=lines[seq.int(iline, length(lines))],\r\n* [ ] ctd.R:3607:        d <- read.table(text=lines[4:nlines])\r\n* [ ] gps.R:305:    latlon <- read.table(text=latlonCleaned)\r\n* [ ] index.R:25:    d <- as.matrix(read.table(text=lines, header=FALSE))\r\n* [ ] lisst.R:149:    data <- read.table(file, header=FALSE)\r\n* [ ] lobo.R:208:    d <- read.table(file, sep='\\t', header=TRUE)\r\n* [ ] oce.R:922:        d <- read.table(text=data, header=FALSE, col.names=c(\"time\",\"temperature\",\"ptotal\",\"psea\",\"depth\"))\r\n* [x] odf.R:350:    pushBack(lines, file) # we used to read.table(text=lines, ...) but it is VERY slow\r\n* [x] rsk.R:390:        ##OLD rv <- read.table(pipe(cmd), sep=\"|\")[1,2]\r\n* [ ] tidem.R:637:    triangles <- read.table(filename, col.names=c(\"triangle\",\"longitude\",\"latitude\"))\r\n* [ ] tidem.R:693:            cone <- read.table(paste(subdir,constituentse[i],sep=\"/\"), skip=3)[node,]\r\n* [ ] tidem.R:696:            conuv <- read.table(paste(subdir,constituentsuv[i],sep=\"/\"), skip=3)[node,]\r\n* [ ] topo.R:404:        zz <- as.matrix(read.table(file, header=FALSE, skip=nh), byrow=TRUE)\r\n"},"comment":{"url":"https://api.github.com/repos/dankelley/oce/issues/comments/154165846","html_url":"https://github.com/dankelley/oce/issues/775#issuecomment-154165846","issue_url":"https://api.github.com/repos/dankelley/oce/issues/775","id":154165846,"user":{"login":"dankelley","id":99469,"avatar_url":"https://avatars.githubusercontent.com/u/99469?v=3","gravatar_id":"","url":"https://api.github.com/users/dankelley","html_url":"https://github.com/dankelley","followers_url":"https://api.github.com/users/dankelley/followers","following_url":"https://api.github.com/users/dankelley/following{/other_user}","gists_url":"https://api.github.com/users/dankelley/gists{/gist_id}","starred_url":"https://api.github.com/users/dankelley/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dankelley/subscriptions","organizations_url":"https://api.github.com/users/dankelley/orgs","repos_url":"https://api.github.com/users/dankelley/repos","events_url":"https://api.github.com/users/dankelley/events{/privacy}","received_events_url":"https://api.github.com/users/dankelley/received_events","type":"User","site_admin":false},"created_at":"2015-11-05T19:32:50Z","updated_at":"2015-11-05T19:32:50Z","body":"I am going to close this, because I've found from ``read.coastline()`` tests that it doesn't improve the speed for numerical data, so I don't see the point in altering code that works now."}}