Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the astra-sites domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/statplace/public_html/site/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the jetpack domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/statplace/public_html/site/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wpforms-lite domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/statplace/public_html/site/wp-includes/functions.php on line 6114

Notice: Function _load_textdomain_just_in_time was called incorrectly. Translation loading for the wordpress-seo domain was triggered too early. This is usually an indicator for some code in the plugin or theme running too early. Translations should be loaded at the init action or later. Please see Debugging in WordPress for more information. (This message was added in version 6.7.0.) in /home/statplace/public_html/site/wp-includes/functions.php on line 6114

Notice: A função _load_textdomain_just_in_time foi chamada incorretamente. O carregamento da tradução para o domínio astra foi ativado muito cedo. Isso geralmente é um indicador de que algum código no plugin ou tema está sendo executado muito cedo. As traduções devem ser carregadas na ação init ou mais tarde. Leia como Depurar o WordPress para mais informações. (Esta mensagem foi adicionada na versão 6.7.0.) in /home/statplace/public_html/site/wp-includes/functions.php on line 6114

Warning: Cannot modify header information - headers already sent by (output started at /home/statplace/public_html/site/wp-includes/functions.php:6114) in /home/statplace/public_html/site/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/statplace/public_html/site/wp-includes/functions.php:6114) in /home/statplace/public_html/site/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/statplace/public_html/site/wp-includes/functions.php:6114) in /home/statplace/public_html/site/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/statplace/public_html/site/wp-includes/functions.php:6114) in /home/statplace/public_html/site/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/statplace/public_html/site/wp-includes/functions.php:6114) in /home/statplace/public_html/site/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/statplace/public_html/site/wp-includes/functions.php:6114) in /home/statplace/public_html/site/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/statplace/public_html/site/wp-includes/functions.php:6114) in /home/statplace/public_html/site/wp-includes/rest-api/class-wp-rest-server.php on line 1893

Warning: Cannot modify header information - headers already sent by (output started at /home/statplace/public_html/site/wp-includes/functions.php:6114) in /home/statplace/public_html/site/wp-includes/rest-api/class-wp-rest-server.php on line 1893
{"id":6807,"date":"2020-08-06T13:00:04","date_gmt":"2020-08-06T16:00:04","guid":{"rendered":"https:\/\/site.statplace.com.br\/?p=6807"},"modified":"2024-10-07T15:56:30","modified_gmt":"2024-10-07T15:56:30","slug":"data-table-como-usar-pacote-no-r","status":"publish","type":"post","link":"https:\/\/site.statplace.com.br\/blog\/data-table-como-usar-pacote-no-r\/","title":{"rendered":"Como usar pacote Data Table no R?"},"content":{"rendered":"\n

Artigo escrito com a colabora\u00e7\u00e3o de Larisse Annie Saldanha<\/p>\n\n\n\n

Quando usamos tabelas para as mais diferentes finalidades, podemos criar desde tabelas elaborados no Excel<\/a> at\u00e9 data frames no R<\/a>. Mas como deixar essas tabelas mais interativas e f\u00e1ceis de usar quando estiverem em p\u00e1ginas HTML? \u00c9 para ajudar nessa tarefa que usamos o pacote data table. <\/p>\n\n\n\n

O pacote DT fornece uma interface em JavaScript para a biblioteca DataTable<\/em>. Os objetos de dados do R (matrizes ou data frames) podem ser exibidos como tabelas em p\u00e1ginas HTML, e o DataTables<\/em> fornece filtragem, pagina\u00e7\u00e3o, classifica\u00e7\u00e3o e muitos outros recursos nas tabelas. Os argumentos s\u00e3o:<\/p>\n\n\n\n

datatable(data, options = list(), class = \"display\",\ncallback = JS(\"return table;\"), rownames, colnames, container,\ncaption = NULL, filter = c(\"none\", \"bottom\", \"top\"), escape = TRUE,\nstyle = \"default\", width = NULL, height = NULL, elementId = NULL,\nfillContainer = getOption(\"DT.fillContainer\", NULL),\nautoHideNavigation = getOption(\"DT.autoHideNavigation\", NULL),\nselection = c(\"multiple\", \"single\", \"none\"), extensions = list(),\nplugins = NULL, editable = FALSE)<\/code><\/pre>\n\n\n\n

Editando Tabelas no data table<\/h2>\n\n\n\n

Pode-se editar uma tabela via argumento\u00a0editable<\/code>\u00a0do pacote. Depois de finalizar as edi\u00e7\u00f5es, pode-se obter os \u00edndices da coluna e linha e os novos valores das c\u00e9lulas onde foram editadas via\u00a0input$tableId_cell_info<\/code>.<\/p>\n\n\n\n

De modo geral, cria-se um observeEvent()<\/code> da seguinte maneira:<\/p>\n\n\n\n

observeEvent(input$table_cell_edit, {\ninfo = input$table_cell_edit\nproxy4 = dataTableProxy(\"table\")\n\nstr(info)\ni = info$row\nj = info$col + 1  # column index offset by 1\nv = info$value\n\ndados[i, j] <<- DT::coerceValue(v, dados[i, j]) \nreplaceData(proxy4, dados , resetPaging = FALSE, rownames = FALSE) })<\/code><\/pre>\n\n\n\n

Algumas Extens\u00f5es \u00dateis do pacote data table<\/h2>\n\n\n\n

AutoFill<\/h3>\n\n\n\n

Com essa extens\u00e3o, voc\u00ea ver\u00e1 um quadrado azul no canto direito que te permite preencher toda a coluna ou a linha.<\/p>\n\n\n\n

library(DT)\ndatatable(iris, extensions = c('AutoFill','KeyTable'), editable = TRUE, options = list(\n    autoFill = TRUE, keys= TRUE))<\/code><\/pre>\n\n\n\n

Bot\u00f5es<\/h3>\n\n\n\n
datatable(\n  iris, extensions = 'Buttons', options = list(\n    dom = 'Bfrtip',\n    buttons = c('copy', 'csv', 'excel', 'pdf', 'print')\n  )\n)<\/code><\/pre>\n\n\n\n

Visibilidade<\/h3>\n\n\n\n
datatable(\n  iris, rownames = FALSE,\n  extensions = 'Buttons', options = list(dom = 'Bfrtip', buttons = I('colvis'))\n)<\/code><\/pre>\n\n\n\n

KeyTable<\/h3>\n\n\n\n
datatable(iris, extensions = 'KeyTable', options = list(keys = TRUE))<\/code><\/pre>\n\n\n\n

Pain\u00e9is de Busca<\/h3>\n\n\n\n
datatable(\n  iris,\n  options = list(dom = 'Pfrtip', columnDefs = list(list(\n    searchPanes = list(show = FALSE), targets = 1:4\n  ))),\n  extensions = c('Select', 'SearchPanes'),\n  selection = 'none'\n)<\/code><\/pre>\n\n\n\n

Voc\u00ea j\u00e1 usa o Data Table para editar as suas tabelas no R? Tem alguma dica extra? Diz pra gente aqui nos coment\u00e1rios. E n\u00e3o esque\u00e7a de seguir a Oper nas redes sociais, estamos no Instagram<\/a>, Facebook<\/a> e LinkedIn<\/a>! <\/p>\n","protected":false},"excerpt":{"rendered":"

Os objetos de dados do R podem ser exibidos como tabelas em HTM o Data Table fornece diferentes recursos para tornar essas tabelas mais interessantes.<\/p>\n","protected":false},"author":8,"featured_media":6809,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"site-sidebar-layout":"","site-content-layout":"","ast-main-header-display":"","ast-hfb-above-header-display":"","ast-hfb-below-header-display":"","ast-hfb-mobile-header-display":"","site-post-title":"","ast-breadcrumbs-content":"","ast-featured-img":"","footer-sml-layout":"","theme-transparent-header-meta":"","adv-header-id-meta":"","stick-header-meta":"","header-above-stick-meta":"","header-main-stick-meta":"","header-below-stick-meta":"","spay_email":"","footnotes":""},"categories":[445],"tags":[235,252,247,253],"class_list":["post-6807","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-ferramentas-e-tecnologias","tag-rstats","tag-data-table","tag-pacote","tag-software"],"yoast_head":"\nComo usar pacote Data Table no R? - Statplace<\/title>\n<meta name=\"description\" content=\"Descubra como usar o pacote Data Table no R para manipular e processar grandes volumes de dados de forma eficiente nas suas an\u00e1lises.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/statplace.com.br\/blog\/data-table-como-usar-pacote-no-r\/\" \/>\n<meta property=\"og:locale\" content=\"pt_BR\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Como usar pacote Data Table no R? - Statplace\" \/>\n<meta property=\"og:description\" content=\"Descubra como usar o pacote Data Table no R para manipular e processar grandes volumes de dados de forma eficiente nas suas an\u00e1lises.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/statplace.com.br\/blog\/data-table-como-usar-pacote-no-r\/\" \/>\n<meta property=\"og:site_name\" content=\"Statplace\" \/>\n<meta property=\"article:published_time\" content=\"2020-08-06T16:00:04+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2024-10-07T15:56:30+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/statplace.com.br\/wp-content\/uploads\/2020\/08\/artigosdatatable-18-scaled.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2560\" \/>\n\t<meta property=\"og:image:height\" content=\"920\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Escrito por\" \/>\n\t<meta name=\"twitter:data1\" content=\"Adilane Ribeiro da Silva\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. tempo de leitura\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\/\/schema.org\",\"@graph\":[{\"@type\":\"WebSite\",\"@id\":\"https:\/\/statplace.com.br\/#website\",\"url\":\"https:\/\/statplace.com.br\/\",\"name\":\"Statplace\",\"description\":\"A Estat\u00edstica ao alcance de todos.\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\/\/statplace.com.br\/?s={search_term_string}\"},\"query-input\":\"required name=search_term_string\"}],\"inLanguage\":\"pt-BR\"},{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/statplace.com.br\/blog\/data-table-como-usar-pacote-no-r\/#primaryimage\",\"inLanguage\":\"pt-BR\",\"url\":\"https:\/\/site.statplace.com.br\/wp-content\/uploads\/2020\/08\/artigosdatatable-18-scaled.jpg\",\"contentUrl\":\"https:\/\/site.statplace.com.br\/wp-content\/uploads\/2020\/08\/artigosdatatable-18-scaled.jpg\",\"width\":2560,\"height\":920},{\"@type\":\"WebPage\",\"@id\":\"https:\/\/statplace.com.br\/blog\/data-table-como-usar-pacote-no-r\/#webpage\",\"url\":\"https:\/\/statplace.com.br\/blog\/data-table-como-usar-pacote-no-r\/\",\"name\":\"Como usar pacote Data Table no R? - Statplace\",\"isPartOf\":{\"@id\":\"https:\/\/statplace.com.br\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\/\/statplace.com.br\/blog\/data-table-como-usar-pacote-no-r\/#primaryimage\"},\"datePublished\":\"2020-08-06T16:00:04+00:00\",\"dateModified\":\"2024-10-07T15:56:30+00:00\",\"author\":{\"@id\":\"https:\/\/statplace.com.br\/#\/schema\/person\/4e381a96f090496264e98c9be9afddc9\"},\"description\":\"Descubra como usar o pacote Data Table no R para manipular e processar grandes volumes de dados de forma eficiente nas suas an\u00e1lises.\",\"breadcrumb\":{\"@id\":\"https:\/\/statplace.com.br\/blog\/data-table-como-usar-pacote-no-r\/#breadcrumb\"},\"inLanguage\":\"pt-BR\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\/\/statplace.com.br\/blog\/data-table-como-usar-pacote-no-r\/\"]}]},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\/\/statplace.com.br\/blog\/data-table-como-usar-pacote-no-r\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"In\u00edcio\",\"item\":\"https:\/\/statplace.com.br\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Como usar pacote Data Table no R?\"}]},{\"@type\":\"Person\",\"@id\":\"https:\/\/statplace.com.br\/#\/schema\/person\/4e381a96f090496264e98c9be9afddc9\",\"name\":\"Adilane Ribeiro da Silva\",\"image\":{\"@type\":\"ImageObject\",\"@id\":\"https:\/\/statplace.com.br\/#personlogo\",\"inLanguage\":\"pt-BR\",\"url\":\"https:\/\/secure.gravatar.com\/avatar\/cba8d3cd5f938f2bda6868e657a95cb7?s=96&d=mm&r=g\",\"contentUrl\":\"https:\/\/secure.gravatar.com\/avatar\/cba8d3cd5f938f2bda6868e657a95cb7?s=96&d=mm&r=g\",\"caption\":\"Adilane Ribeiro da Silva\"},\"url\":\"https:\/\/site.statplace.com.br\/blog\/author\/adilane\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Como usar pacote Data Table no R? - Statplace","description":"Descubra como usar o pacote Data Table no R para manipular e processar grandes volumes de dados de forma eficiente nas suas an\u00e1lises.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/statplace.com.br\/blog\/data-table-como-usar-pacote-no-r\/","og_locale":"pt_BR","og_type":"article","og_title":"Como usar pacote Data Table no R? - Statplace","og_description":"Descubra como usar o pacote Data Table no R para manipular e processar grandes volumes de dados de forma eficiente nas suas an\u00e1lises.","og_url":"https:\/\/statplace.com.br\/blog\/data-table-como-usar-pacote-no-r\/","og_site_name":"Statplace","article_published_time":"2020-08-06T16:00:04+00:00","article_modified_time":"2024-10-07T15:56:30+00:00","og_image":[{"width":2560,"height":920,"url":"https:\/\/statplace.com.br\/wp-content\/uploads\/2020\/08\/artigosdatatable-18-scaled.jpg","type":"image\/jpeg"}],"twitter_card":"summary_large_image","twitter_misc":{"Escrito por":"Adilane Ribeiro da Silva","Est. tempo de leitura":"2 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"WebSite","@id":"https:\/\/statplace.com.br\/#website","url":"https:\/\/statplace.com.br\/","name":"Statplace","description":"A Estat\u00edstica ao alcance de todos.","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/statplace.com.br\/?s={search_term_string}"},"query-input":"required name=search_term_string"}],"inLanguage":"pt-BR"},{"@type":"ImageObject","@id":"https:\/\/statplace.com.br\/blog\/data-table-como-usar-pacote-no-r\/#primaryimage","inLanguage":"pt-BR","url":"https:\/\/site.statplace.com.br\/wp-content\/uploads\/2020\/08\/artigosdatatable-18-scaled.jpg","contentUrl":"https:\/\/site.statplace.com.br\/wp-content\/uploads\/2020\/08\/artigosdatatable-18-scaled.jpg","width":2560,"height":920},{"@type":"WebPage","@id":"https:\/\/statplace.com.br\/blog\/data-table-como-usar-pacote-no-r\/#webpage","url":"https:\/\/statplace.com.br\/blog\/data-table-como-usar-pacote-no-r\/","name":"Como usar pacote Data Table no R? - Statplace","isPartOf":{"@id":"https:\/\/statplace.com.br\/#website"},"primaryImageOfPage":{"@id":"https:\/\/statplace.com.br\/blog\/data-table-como-usar-pacote-no-r\/#primaryimage"},"datePublished":"2020-08-06T16:00:04+00:00","dateModified":"2024-10-07T15:56:30+00:00","author":{"@id":"https:\/\/statplace.com.br\/#\/schema\/person\/4e381a96f090496264e98c9be9afddc9"},"description":"Descubra como usar o pacote Data Table no R para manipular e processar grandes volumes de dados de forma eficiente nas suas an\u00e1lises.","breadcrumb":{"@id":"https:\/\/statplace.com.br\/blog\/data-table-como-usar-pacote-no-r\/#breadcrumb"},"inLanguage":"pt-BR","potentialAction":[{"@type":"ReadAction","target":["https:\/\/statplace.com.br\/blog\/data-table-como-usar-pacote-no-r\/"]}]},{"@type":"BreadcrumbList","@id":"https:\/\/statplace.com.br\/blog\/data-table-como-usar-pacote-no-r\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"In\u00edcio","item":"https:\/\/statplace.com.br\/"},{"@type":"ListItem","position":2,"name":"Como usar pacote Data Table no R?"}]},{"@type":"Person","@id":"https:\/\/statplace.com.br\/#\/schema\/person\/4e381a96f090496264e98c9be9afddc9","name":"Adilane Ribeiro da Silva","image":{"@type":"ImageObject","@id":"https:\/\/statplace.com.br\/#personlogo","inLanguage":"pt-BR","url":"https:\/\/secure.gravatar.com\/avatar\/cba8d3cd5f938f2bda6868e657a95cb7?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/cba8d3cd5f938f2bda6868e657a95cb7?s=96&d=mm&r=g","caption":"Adilane Ribeiro da Silva"},"url":"https:\/\/site.statplace.com.br\/blog\/author\/adilane\/"}]}},"jetpack_featured_media_url":"https:\/\/site.statplace.com.br\/wp-content\/uploads\/2020\/08\/artigosdatatable-18-scaled.jpg","_links":{"self":[{"href":"https:\/\/site.statplace.com.br\/wp-json\/wp\/v2\/posts\/6807","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/site.statplace.com.br\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/site.statplace.com.br\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/site.statplace.com.br\/wp-json\/wp\/v2\/users\/8"}],"replies":[{"embeddable":true,"href":"https:\/\/site.statplace.com.br\/wp-json\/wp\/v2\/comments?post=6807"}],"version-history":[{"count":1,"href":"https:\/\/site.statplace.com.br\/wp-json\/wp\/v2\/posts\/6807\/revisions"}],"predecessor-version":[{"id":27874,"href":"https:\/\/site.statplace.com.br\/wp-json\/wp\/v2\/posts\/6807\/revisions\/27874"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/site.statplace.com.br\/wp-json\/wp\/v2\/media\/6809"}],"wp:attachment":[{"href":"https:\/\/site.statplace.com.br\/wp-json\/wp\/v2\/media?parent=6807"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/site.statplace.com.br\/wp-json\/wp\/v2\/categories?post=6807"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/site.statplace.com.br\/wp-json\/wp\/v2\/tags?post=6807"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}