{"action":"created","issue":{"url":"https://api.github.com/repos/dankelley/oce/issues/1443","repository_url":"https://api.github.com/repos/dankelley/oce","labels_url":"https://api.github.com/repos/dankelley/oce/issues/1443/labels{/name}","comments_url":"https://api.github.com/repos/dankelley/oce/issues/1443/comments","events_url":"https://api.github.com/repos/dankelley/oce/issues/1443/events","html_url":"https://github.com/dankelley/oce/issues/1443","id":361384060,"node_id":"MDU6SXNzdWUzNjEzODQwNjA=","number":1443,"title":"Appending data to a list of oce objects","user":{"login":"jamesdemayo","id":25108699,"node_id":"MDQ6VXNlcjI1MTA4Njk5","avatar_url":"https://avatars1.githubusercontent.com/u/25108699?v=4","gravatar_id":"","url":"https://api.github.com/users/jamesdemayo","html_url":"https://github.com/jamesdemayo","followers_url":"https://api.github.com/users/jamesdemayo/followers","following_url":"https://api.github.com/users/jamesdemayo/following{/other_user}","gists_url":"https://api.github.com/users/jamesdemayo/gists{/gist_id}","starred_url":"https://api.github.com/users/jamesdemayo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jamesdemayo/subscriptions","organizations_url":"https://api.github.com/users/jamesdemayo/orgs","repos_url":"https://api.github.com/users/jamesdemayo/repos","events_url":"https://api.github.com/users/jamesdemayo/events{/privacy}","received_events_url":"https://api.github.com/users/jamesdemayo/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-09-18T16:23:00Z","updated_at":"2018-09-18T17:50:45Z","closed_at":null,"author_association":"NONE","body":"### Short summary of problem\r\n\r\nFor a list of CTD cast files, I have added a data column for density gradients to each to be able to plot as a section contour. Density gradient is calculated as `diff(x[[\"density\"]]/diff(x[[\"depth\"]]`. This sufficiently provides a data vector for each cast file, with one less value than the remaining data vectors. In order to plot it as a section, however, all lengths x and y must be equal. \r\n\r\nIs there another way to either plot the density gradient that I haven't found or to append the data so that all lengths are equal?\r\n\r\n\r\n### What you did\r\n\r\nI attempt to edit the new column using `oceEdit` nested among `lapply`, but fail to append the vector.  The code is as follows:\r\n\r\n`Cast.jns.files <- lapply(Cast.jns.files, \r\n                           function (x) oceEdit(x, #each cast file`\r\n`action = append(x[[\"dRho_dz\"]],` \r\n                                                           `min(x[[\"dRho_dz\"]])))) #value to add`\r\n### What you expected to happen\r\n\r\nI expect the new `dRho_dz` vector to contain a length equal to that of the other data vectors\r\n\r\n### What happened\r\n\r\nNothing. Vector remained the original length and no section grid was created. Error message using `Cast.jns.files.section <- as.section(Cast.jns.files)`\r\n`Cast.jns.sg <- sectionGrid(Cast.jns.files.section)`\r\n `Error in xy.coords(x, y, setLab = FALSE) : 'x' and 'y' lengths differ`\r\n\r\n### How urgent is this?\r\n\r\nThis is needed for data analysis completed by Thursday.\r\n\r\n### Output from sessionInfo()\r\n\r\nR version 3.4.1 (2017-06-30)\r\nPlatform: x86_64-w64-mingw32/x64 (64-bit)\r\nRunning under: Windows >= 8 x64 (build 9200)\r\n\r\nMatrix products: default\r\n\r\nlocale:\r\n[1] LC_COLLATE=English_United States.1252  LC_CTYPE=English_United States.1252   \r\n[3] LC_MONETARY=English_United States.1252 LC_NUMERIC=C                          \r\n[5] LC_TIME=English_United States.1252    \r\n\r\nattached base packages:\r\n[1] stats     graphics  grDevices utils     datasets  methods   base     \r\n\r\nother attached packages:\r\n[1] zoo_1.8-3      oce_0.9-23     gsw_1.0-5      testthat_2.0.0\r\n\r\nloaded via a namespace (and not attached):\r\n [1] Rcpp_0.12.18     lattice_0.20-35  crayon_1.3.4     dplyr_0.7.6      assertthat_0.2.0 grid_3.4.1      \r\n [7] plyr_1.8.4       R6_2.2.2         gtable_0.2.0     magrittr_1.5     scales_1.0.0     ggplot2_3.0.0   \r\n[13] pillar_1.3.0     rlang_0.2.1      lazyeval_0.2.1   bindrcpp_0.2.2   tools_3.4.1      glue_1.3.0      \r\n[19] purrr_0.2.5      munsell_0.5.0    compiler_3.4.1   pkgconfig_2.0.2  colorspace_1.3-2 tidyselect_0.2.4\r\n[25] bindr_0.1.1      tibble_1.4.2\r\n"},"comment":{"url":"https://api.github.com/repos/dankelley/oce/issues/comments/422486966","html_url":"https://github.com/dankelley/oce/issues/1443#issuecomment-422486966","issue_url":"https://api.github.com/repos/dankelley/oce/issues/1443","id":422486966,"node_id":"MDEyOklzc3VlQ29tbWVudDQyMjQ4Njk2Ng==","user":{"login":"dankelley","id":99469,"node_id":"MDQ6VXNlcjk5NDY5","avatar_url":"https://avatars1.githubusercontent.com/u/99469?v=4","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":"2018-09-18T17:50:45Z","updated_at":"2018-09-18T17:50:45Z","author_association":"OWNER","body":"Also, notice that I check for `is.finite()` because with raw CTD data you can get zero values for `diff(z)`, which yields `Inf` for the derivative, which can mess up plotting."}}
{"actor":{"display_login":"dankelley"}}