{"id":1141,"date":"2019-04-18T11:20:53","date_gmt":"2019-04-18T02:20:53","guid":{"rendered":"http:\/\/141.164.34.82\/?p=1141"},"modified":"2022-02-03T17:19:09","modified_gmt":"2022-02-03T08:19:09","slug":"%ec%97%91%ec%85%80-%ed%8c%8c%ec%9d%bc%ec%9d%98-%eb%aa%a8%eb%93%a0-%ec%8b%9c%ed%8a%b8-%ec%9d%bd%ec%96%b4%ec%98%a4%ea%b8%b0","status":"publish","type":"post","link":"http:\/\/ds.sumeun.org\/?p=1141","title":{"rendered":"\uc5d1\uc140 \ud30c\uc77c\uc758 \ubaa8\ub4e0 \uc2dc\ud2b8 \uc77d\uc5b4\uc624\uae30"},"content":{"rendered":"<h1>\uc5d1\uc140 \ud654\uc77c\uc758 \ubaa8\ub4e0 \uc2dc\ud2b8(sheet) \uc77d\uc5b4\uc624\uae30<\/h1>\n<p>\uc5d1\uc140\uc758 \ud55c \ud654\uc77c \uc548\uc5d0\ub294 \uc5ec\ub7ec \uac1c\uc758 \uc2dc\ud2b8\uac00 \uc874\uc7ac\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<p><code>package:readxl<\/code>\uc758 <code>read_excel(path=filename, sheet=)<\/code>\uc744 \ud1b5\ud574 \uc2dc\ud2b8\ub97c \ud558\ub098\uc529 \uc77d\uc5b4\uc62c \uc218 \uc788\uc2b5\ub2c8\ub2e4\ub9cc, \uc77c\ub2e8 <strong>\ubaa8\ub4e0 \uc2dc\ud2b8\ub97c \uc77d\uc740 \ud6c4<\/strong>\uc5d0 R\uc5d0\uc11c \uc804\ucc98\ub9ac\ud558\ub294\uac8c \ud3b8\ud560 \uc218\ub3c4 \uc788\uc2b5\ub2c8\ub2e4.<\/p>\n<p>\ub2e4\uc74c\uc758 \ucf54\ub4dc\ub294 \ud55c \ud654\uc77c \ub0b4\uc758 \ubaa8\ub4e0 \uc2dc\ud2b8\ub97c <strong>\uc2dc\ud2b8 \uc774\ub984\uacfc \ub3d9\uc77c\ud55c \uac1d\uccb4 \uc774\ub984<\/strong>\uc73c\ub85c \ubd88\ub7ec \uc77d\uc2b5\ub2c8\ub2e4. \ub9cc\uc57d \ub3d9\uc77c\ud55c \uac1d\uccb4\uac00 \uc774\ubbf8 \uc874\uc7ac\ud55c\ub2e4\uba74 \u201c\uc774\ubbf8 \uc874\uc7ac\ud55c\ub2e4&#8221;\ub294 \uba54\uc138\uc9c0\uc640 \ud568\uaed8 \uc911\ub2e8\ud569\ub2c8\ub2e4. (<a href=\"http:\/\/141.164.34.82\/wp-content\/uploads\/2019\/04\/excel_example.xls\"><code>excel_example.xls<\/code><\/a>)<\/p>\n<pre><code class=\"r\">library(readxl)\r\n\r\nrm(list=ls())\r\n\r\nfn = \"excel_example.xls\"\r\nvSh &lt;- excel_sheets(fn)\r\n\r\nif ( length(vSh) &gt; 0 ) {\r\n  for (iSh in 1:(length(vSh))) {\r\n    vname &lt;- vSh[iSh]\r\n    if (exists(vname)) {\r\n      cat('\\b\\b\ubcc0\uc218 ', vname, '\uc774(\uac00) \uc774\ubbf8 \uc874\uc7ac\ud569\ub2c8\ub2e4.\\n')\r\n      break\r\n    }\r\n    assign(vname, read_excel(fn, sheet=vSh[iSh]))\r\n  }\r\n} else {\r\n  cat('No Sheet!!!\\n')\r\n}\r\n\r\nvSh\r\nls()\r\n<\/code><\/pre>\n<pre>## [1] \"FirstSheet\" \"Tomato\"     \"Ketchup\"\r\n<\/pre>\n<pre>## [1] \"FirstSheet\" \"fn\"         \"iSh\"        \"Tomato\"     \"vname\"     \r\n## [6] \"vSh\"\r\n<\/pre>\n<p>\uc2e4\ud589\uc774 \ub05d\ub09c \ud6c4 <code>ls()<\/code>\ub97c \ud558\uac70\ub098, RStudio-Enviornment(<code>[Ctrl]+[8]<\/code>)\uc758 Data\ub97c \ubcf4\uba74 \uc2dc\ud2b8 \uc774\ub984\uacfc \ub3d9\uc77c\ud55c \ub370\uc774\ud130 \ud504\ub808\uc784\uc744 \ud655\uc778\ud560 \uc218 \uc788\ub2e4.<\/p>\n<p><a href=\"https:\/\/stackoverflow.com\/questions\/12945687\/read-all-worksheets-in-an-excel-workbook-into-an-r-list-with-data-frames\">stackoverflow<\/a>\uc5d0\ub294 \ubaa8\ub4e0 \uc2dc\ud2b8\ub97c \ud558\ub098\uc758 \ub9ac\uc2a4\ud2b8\ub85c \ubd88\ub7ec\uc624\ub294 \ud568\uc218\uac00 \uc18c\uac1c\ub418\uc5b4 \uc788\ub124\uc694.<\/p>\n<pre><code class=\"r\">library(readxl)    \r\nread_excel_allsheets &lt;- function(filename, tibble = FALSE) {\r\n    # I prefer straight data.frames\r\n    # but if you like tidyverse tibbles (the default with read_excel)\r\n    # then just pass tibble = TRUE\r\n    sheets &lt;- readxl::excel_sheets(filename)\r\n    x &lt;- lapply(sheets, function(X) readxl::read_excel(filename, sheet = X))\r\n    if(!tibble) x &lt;- lapply(x, as.data.frame)\r\n    names(x) &lt;- sheets\r\n    x\r\n}\r\n\r\nmysheets &lt;- read_excel_allsheets(\"foo.xls\")\r\n<\/code><\/pre>\n<h2>\uc5f0\uc2b5\ubb38\uc81c<\/h2>\n<p><a href=\"http:\/\/141.164.34.82\/wp-content\/uploads\/2019\/04\/%EC%84%9C%EC%9A%B8%EC%8B%9C-%ED%95%9C%EA%B0%95%EA%B3%B5%EC%9B%90-%EC%9D%B4%EC%9A%A9%EA%B0%9D-%ED%98%84%ED%99%A9-2009_2013%EB%85%84.xls\"><code>\uc11c\uc6b8\uc2dc \ud55c\uac15\uacf5\uc6d0 \uc774\uc6a9\uac1d \ud604\ud669 (2009_2013\ub144).xls<\/code><\/a>\uc744 \uc77d\uc5b4\uc624\ub824\uace0 \ud569\ub2c8\ub2e4. \ud558\uc9c0\ub9cc \ubd84\uba85 \ud654\uc77c \uc774\ub984\uc744 \uc815\ud655\ud788 \uc801\uc5c8\uc74c\uc5d0\ub3c4 \uc5d0\ub7ec\uac00 \ub0a9\ub2c8\ub2e4. \ubb34\uc5c7\uc774 \ubb38\uc81c\uc77c\uae4c\uc694?<\/p>\n<pre><code class=\"r\">library(readxl)\r\nreadxl::read_excel('\uc11c\uc6b8\uc2dc \ud55c\uac15\uacf5\uc6d0 \uc774\uc6a9\uac1d \ud604\ud669 (2009_2013\ub144).xls', sheet=1)\r\n<\/code><\/pre>\n<pre>## Error: \r\n##   filepath: D:\\git\\dataanalysiswithr04\\\uc11c\uc6b8\uc2dc \ud55c\uac15\uacf5\uc6d0 \uc774\uc6a9\uac1d \ud604\ud669 (2009_2013\ub144).xls\r\n##   libxls error: Unable to open file\r\n<\/pre>\n<hr \/>\n<p>\uc704\uc758 \uae00\uc740 <a href=\"http:\/\/141.164.34.82\/?p=891\">R\ub85c \ud558\ub294 \ube45\ub370\uc774\ud130 \ubd84\uc11d: \ub370\uc774\ud130 \uc804\ucc98\ub9ac\uc640 \uc2dc\uac01\ud654<\/a>\uc758 \uc77c\ubd80\ub97c \ubc1c\ucdcc, \uac01\uc0c9\ud55c \uac83\uc785\ub2c8\ub2e4.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\uc5d1\uc140 \ud654\uc77c\uc758 \ubaa8\ub4e0 \uc2dc\ud2b8(sheet) \uc77d\uc5b4\uc624\uae30 \uc5d1\uc140\uc758 \ud55c \ud654\uc77c \uc548\uc5d0\ub294 \uc5ec\ub7ec \uac1c\uc758 \uc2dc\ud2b8\uac00 \uc874\uc7ac\ud560 \uc218 \uc788\uc2b5\ub2c8\ub2e4. package:readxl\uc758 read_excel(path=filename, sheet=)\uc744 \ud1b5\ud574 \uc2dc\ud2b8\ub97c \ud558\ub098\uc529 \uc77d\uc5b4\uc62c \uc218 \uc788\uc2b5\ub2c8\ub2e4\ub9cc, \uc77c\ub2e8 \ubaa8\ub4e0 \uc2dc\ud2b8\ub97c \uc77d\uc740 \ud6c4\uc5d0 R\uc5d0\uc11c \uc804\ucc98\ub9ac\ud558\ub294\uac8c \ud3b8\ud560 \uc218\ub3c4 \uc788\uc2b5\ub2c8\ub2e4. \ub2e4\uc74c\uc758 \ucf54\ub4dc\ub294 \ud55c \ud654\uc77c \ub0b4\uc758 \ubaa8\ub4e0 \uc2dc\ud2b8\ub97c \uc2dc\ud2b8 \uc774\ub984\uacfc \ub3d9\uc77c\ud55c \uac1d\uccb4 \uc774\ub984\uc73c\ub85c \ubd88\ub7ec \uc77d\uc2b5\ub2c8\ub2e4. \ub9cc\uc57d \ub3d9\uc77c\ud55c \uac1d\uccb4\uac00 \uc774\ubbf8 \uc874\uc7ac\ud55c\ub2e4\uba74 \u201c\uc774\ubbf8 \uc874\uc7ac\ud55c\ub2e4&#8221;\ub294 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":2452,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[28,248],"tags":[250,249],"jetpack_featured_media_url":"http:\/\/ds.sumeun.org\/wp-content\/uploads\/2019\/04\/autumn-g0afd7b273_640.jpg","_links":{"self":[{"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/posts\/1141"}],"collection":[{"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1141"}],"version-history":[{"count":6,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/posts\/1141\/revisions"}],"predecessor-version":[{"id":2453,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/posts\/1141\/revisions\/2453"}],"wp:featuredmedia":[{"embeddable":true,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=\/wp\/v2\/media\/2452"}],"wp:attachment":[{"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1141"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1141"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/ds.sumeun.org\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1141"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}