{"id":10883,"date":"2021-03-09T11:04:12","date_gmt":"2021-03-09T19:04:12","guid":{"rendered":"https:\/\/www.couchbase.com\/blog\/?p=10883"},"modified":"2023-05-24T03:31:55","modified_gmt":"2023-05-24T10:31:55","slug":"couchbase-r-programming-with-query-maps-leaflet","status":"publish","type":"post","link":"https:\/\/www.couchbase.com\/blog\/es\/couchbase-r-programming-with-query-maps-leaflet\/","title":{"rendered":"Programaci\u00f3n en R con Coucbhase NoSQL Queries &amp; Maps"},"content":{"rendered":"<p><span style=\"font-weight: 400\">Muchos analistas de datos estad\u00edsticos y cient\u00edficos de datos utilizan la <\/span><a href=\"https:\/\/r-project.org\"><span style=\"font-weight: 400\">Lenguaje de programaci\u00f3n R<\/span><\/a><span style=\"font-weight: 400\"> para hacer sus n\u00fameros fuera de una base de datos. Del mismo modo, los analistas de bases de datos intentan hacer todo en la misma base de datos siempre que sea posible para mantener una \u00fanica fuente. Couchbase proporciona una base com\u00fan para tender puentes entre conjuntos de datos JSON, potentes lenguajes de consulta y herramientas anal\u00edticas como R.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">Su naturaleza distribuida y tolerante a fallos y su esquema flexible son s\u00f3lo algunas de las razones por las que las empresas recurren a Couchbase. M\u00e1s informaci\u00f3n <a href=\"https:\/\/www.couchbase.com\/blog\/es\/resources\/why-nosql\/\">Por qu\u00e9 las empresas utilizan NoSQL<\/a> para ofrecer productos de nueva generaci\u00f3n.<\/span><\/p>\n<p><span style=\"font-weight: 400\">En <a href=\"https:\/\/www.couchbase.com\/blog\/es\/products\/developer-sdk\/\">SDK de Couchbase<\/a> cubre los lenguajes de programaci\u00f3n m\u00e1s populares: Java, .NET, Node.js, Go y m\u00e1s. Pero no necesita proporcionar una unidad espec\u00edfica para R porque puede utilizar f\u00e1cilmente la API REST.<\/span><\/p>\n<p><span style=\"font-weight: 400\">En este post, resucito un tutorial de programaci\u00f3n en R de un blog anterior y veo c\u00f3mo funciona R con la \u00faltima versi\u00f3n de Couchbase. Los ejemplos muestran c\u00f3mo ejecutar una consulta tabular N1QL\/SQL sobre los datos JSON, as\u00ed como mapear las ubicaciones resultantes de algunos de los <a href=\"https:\/\/www.couchbase.com\/blog\/es\/geospatial-basics-spatial-databases-and-nosql-examples\/\">datos geoespaciales<\/a>.\u00a0<\/span><\/p>\n<h2><span style=\"font-weight: 400\">\u00bfQu\u00e9 es R?<\/span><\/h2>\n<p><span style=\"font-weight: 400\">R satisface la necesidad de disponer de un conjunto de herramientas gr\u00e1ficas y de c\u00e1lculo estad\u00edstico de c\u00f3digo abierto similar a productos patentados como SAS y SPSS. Abarca el an\u00e1lisis estad\u00edstico y la visualizaci\u00f3n gr\u00e1fica, y est\u00e1 especialmente indicado para gr\u00e1ficos de documentaci\u00f3n cient\u00edfica listos para su publicaci\u00f3n.<\/span><\/p>\n<p><span style=\"font-weight: 400\">\u00bfEs R mejor que Python para el an\u00e1lisis estad\u00edstico? Eso est\u00e1 abierto a debate, y sin embargo hay muchos defensores. De hecho, para muchos desarrolladores, puede ser el entorno anal\u00edtico m\u00e1s popular que hayan <em>nunca<\/em> utilizado. En <\/span><a href=\"https:\/\/r4stats.com\/articles\/popularity\/\"><span style=\"font-weight: 400\">un proyecto global de b\u00fasqueda de empleo en programaci\u00f3n R<\/span><\/a><span style=\"font-weight: 400\">el autor encontr\u00f3 la programaci\u00f3n en R en 5\u00ba lugar detr\u00e1s de Python, SQL, Java y Amazon ML. Se situ\u00f3 moderadamente por encima de C\/C++, Tableau, Hadoop e incluso SAS en cuanto a conjuntos de herramientas de an\u00e1lisis estad\u00edstico de datos.<\/span><\/p>\n<p><span style=\"font-weight: 400\">El ecosistema que gener\u00f3 proporciona decenas de miles de paquetes que a\u00f1aden potentes capacidades de an\u00e1lisis, an\u00e1lisis de series temporales, visualizaci\u00f3n y mucho m\u00e1s. Existen varios IDE para crear soluciones; en este art\u00edculo utilizar\u00e9 <\/span><a href=\"https:\/\/rstudio.com\/\"><span style=\"font-weight: 400\">Estudio R<\/span><\/a><span style=\"font-weight: 400\"> (que he utilizado f\u00e1cilmente por primera vez mientras escrib\u00eda este art\u00edculo).<\/span><\/p>\n<h2><span style=\"font-weight: 400\">Configuraci\u00f3n de Couchbase<\/span><\/h2>\n<p><span style=\"font-weight: 400\">La instalaci\u00f3n por defecto del servidor Couchbase tiene todo lo necesario para este tutorial. Sugiero instalarlo en un \u00fanico nodo, idealmente el PC que est\u00e9s usando con R Studio para que la URL de conexi\u00f3n sea <\/span><i><span style=\"font-weight: 400\">localhost<\/span><\/i><span style=\"font-weight: 400\">. Estoy usando la versi\u00f3n beta de Couchbase 7.x.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Una vez instalado, configure un <\/span><a href=\"https:\/\/docs.couchbase.com\/server\/current\/manage\/manage-settings\/install-sample-buckets.html\"><span style=\"font-weight: 400\">nuevo cubo con el <\/span><i><span style=\"font-weight: 400\">viaje-muestra<\/span><\/i><span style=\"font-weight: 400\"> conjunto de datos<\/span><\/a><span style=\"font-weight: 400\"> y crear un nuevo usuario que tenga acceso a ese bucket.<\/span><\/p>\n<h2><span style=\"font-weight: 400\">Configuraci\u00f3n de R Studio<\/span><\/h2>\n<p><span style=\"font-weight: 400\">Siguiente, <\/span><a href=\"https:\/\/mirror.rcg.sfu.ca\/mirror\/CRAN\/\"><span style=\"font-weight: 400\">instalar R<\/span><\/a><span style=\"font-weight: 400\"> y luego <\/span><a href=\"https:\/\/rstudio.com\/\"><span style=\"font-weight: 400\">R Studio Desktop<\/span><\/a><span style=\"font-weight: 400\"> (versi\u00f3n gratuita) con todas las opciones predeterminadas. Una vez finalizada la instalaci\u00f3n, inicie R Studio y seleccione<\/span><span style=\"font-weight: 400\"> Herramientas -&gt; Instalar paquetes<\/span><span style=\"font-weight: 400\"> e instalar estos cuatro:<\/span><em><span style=\"font-weight: 400\"> httr, jsonlite, ggplot2, leaflet<\/span><\/em><span style=\"font-weight: 400\">.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Alternativamente, puede ejecutar el siguiente c\u00f3digo en la consola de codificaci\u00f3n de R:<\/span><\/p>\n<pre class=\"lang:r decode:true\">install.packages(c(\"httr\", \"jsonlite\", \"ggplot2\", \"leaflet\"))<\/pre>\n<p><span style=\"font-weight: 400\">R Studio se ir\u00e1 e instalar\u00e1 un mont\u00f3n de dependencias subyacentes para usted. Mientras tanto, contin\u00faa con el siguiente paso mientras eso se ejecuta.<\/span><\/p>\n<h2><span style=\"font-weight: 400\">Prueba de consulta N1QL en Couchbase<\/span><\/h2>\n<p><span style=\"font-weight: 400\">Antes de empezar con el c\u00f3digo de programaci\u00f3n en R, vamos a probar la consulta utilizando la pesta\u00f1a Consulta de la ventana <\/span><a href=\"https:\/\/docs.couchbase.com\/server\/current\/manage\/manage-ui\/manage-ui.html#console-query\"><span style=\"font-weight: 400\">Consola web de Couchbase<\/span><\/a><span style=\"font-weight: 400\">.<\/span><\/p>\n<pre class=\"lang:mysql decode:true\">SELECT a.name, count(*) as total_flights\r\nFROM `travel-sample` r \r\nJOIN `travel-sample` a \r\nON KEYS r.airlineid \r\nWHERE r.type =\"route\" \r\nAND a.type=\"airline\" \r\nGROUP BY a.name \r\nORDER BY total_flights DESC \r\nLIMIT 20<\/pre>\n<p>Si has tenido que trabajar con JSON antes, ver\u00e1s lo sencillo que puede ser consultar documentos en Couchbase usando una sintaxis familiar.<\/p>\n<p><span style=\"font-weight: 400\">El resultado muestra las 20 principales compa\u00f1\u00edas a\u00e9reas y el n\u00famero de vuelos que tiene cada una en la base de datos de la muestra.<\/span><\/p>\n<h2><span style=\"font-weight: 400\">R Codificaci\u00f3n Consulta N1QL<\/span><\/h2>\n<p><span style=\"font-weight: 400\">Configure su proyecto R estableciendo los requisitos de la biblioteca en la parte superior del script en la consola:<\/span><\/p>\n<pre class=\"lang:r decode:true\">library(httr) \r\nlibrary(jsonlite) \r\nlibrary(ggplot2) \r\nlibrary(leaflet)<\/pre>\n<p><span style=\"font-weight: 400\">Para construir la consulta y manejar las respuestas de datos, creamos algunas variables.<\/span><\/p>\n<p><span style=\"font-weight: 400\">En primer lugar, se proporciona la informaci\u00f3n de conexi\u00f3n para Couchbase, incluyendo la URL, el puerto y el nombre de usuario y la contrase\u00f1a que cre\u00f3 anteriormente:<\/span><\/p>\n<pre class=\"lang:r decode:true\">cbServer &lt;- \"https:\/\/localhost:8093\/query\/service\"<\/pre>\n<p><span style=\"font-weight: 400\">A continuaci\u00f3n, codifique tambi\u00e9n la consulta en su propia variable. Tenga en cuenta las comillas dobles escapadas que son necesarias (\\\").<\/span><\/p>\n<pre class=\"lang:r decode:true\">query &lt;- \"SELECT a.name, count(*) as total_flights FROM `travel-sample` r JOIN `travel-sample` a ON KEYS r.airlineid WHERE r.type =\\\"route\\\" AND a.type=\\\"airline\\\" GROUP BY a.name ORDER BY total_flights DESC LIMIT 20\"<\/pre>\n<p><span style=\"font-weight: 400\">Lo siguiente es configurar la petici\u00f3n HTTP:<\/span><\/p>\n<pre class=\"lang:r decode:true\">req &lt;- httr::POST(cbServer, httr::add_headers(\"Content-Type\" = \"application\/x-www-form-urlencoded;charset=UTF-8\"), body = paste(\"statement=\", query), authentication(\"public\",\"public\"))<\/pre>\n<p><span style=\"font-weight: 400\">Y luego recibir la respuesta real de la solicitud y asignarla a una variable para contener los datos:<\/span><\/p>\n<pre class=\"lang:r decode:true\">res &lt;- fromJSON(httr::content(req, \"text\")) \r\nairlineFlights &lt;- res$results<\/pre>\n<p>&nbsp;<\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/03\/couchbase_r_coding_airlines_cmd.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-10884\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/03\/couchbase_r_coding_airlines_cmd-267x300.jpg\" alt=\"Couchbase R Programming SQL Query output\" width=\"267\" height=\"300\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/couchbase_r_coding_airlines_cmd-267x300.jpg 267w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/couchbase_r_coding_airlines_cmd-18x20.jpg 18w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/couchbase_r_coding_airlines_cmd.jpg 300w\" sizes=\"auto, (max-width: 267px) 100vw, 267px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">\u00a1Eso es!\u00a0<\/span><\/p>\n<h2><span style=\"font-weight: 400\">Visualizaci\u00f3n de resultados de consultas desde Couchbase<\/span><\/h2>\n<p><span style=\"font-weight: 400\">Ahora podemos ver los resultados de la consulta introduciendo la variable de datos:<\/span><\/p>\n<p><span style=\"font-weight: 400\">R-Studio, con la extensi\u00f3n ggplot y unos pocos ajustes, es una forma sencilla de visualizar r\u00e1pidamente los datos de una variable:<\/span><\/p>\n<pre class=\"lang:r decode:true\">ggplot(data=airlineFlights, aes(x=name, y=total_flights)) + theme(axis.text.x=element_text(angle=90,hjust=1)) + geom_bar(stat=\"identity\")<\/pre>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/03\/cb_r_programming_n1ql_query1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-10885 size-large\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/03\/cb_r_programming_n1ql_query1-1024x832.png\" alt=\"Couchbase R Programming SQL Query chart\" width=\"900\" height=\"731\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/cb_r_programming_n1ql_query1-1024x832.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/cb_r_programming_n1ql_query1-300x244.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/cb_r_programming_n1ql_query1-768x624.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/cb_r_programming_n1ql_query1-20x16.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/cb_r_programming_n1ql_query1.png 1280w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">Ahora puedes modificar la consulta o el c\u00f3digo ggplot y experimentar con otros enfoques.<\/span><\/p>\n<h2><span style=\"font-weight: 400\">Mapear datos geoespaciales desde Couchbase usando R Coding<\/span><\/h2>\n<p><span style=\"font-weight: 400\">La potencia de algunos de los otros paquetes es incre\u00edble. Para el siguiente ejemplo, utilizamos la codificaci\u00f3n R que aprovecha el paquete <\/span><a href=\"https:\/\/leafletjs.com\/\"><span style=\"font-weight: 400\">Biblioteca cartogr\u00e1fica en l\u00ednea Leaflet<\/span><\/a><span style=\"font-weight: 400\">.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">Modifiquemos la consulta para listar los hoteles que admiten mascotas. Como los datos del hotel incluyen un objeto geogr\u00e1fico de latitud y longitud (\"geo\"), podemos hacer f\u00e1cilmente una consulta de tipo <a href=\"https:\/\/www.couchbase.com\/blog\/es\/geospatial-basics-spatial-databases-and-nosql-examples\/\">mapa<\/a> de los resultados.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Ajusta tu consulta para incluir el nombre, la latitud y la longitud junto con un par de filtros sencillos:<\/span><\/p>\n<pre class=\"lang:mysql decode:true\">SELECT name,geo.lat as lat,geo.lon as long \r\nFROM `travel-sample` \r\nWHERE type=\"hotel\" AND city=\"London\" AND pets_ok=true<\/pre>\n<p><span style=\"font-weight: 400\">Pru\u00e9balo en la consola web de Couchbase y obtendr\u00e1s 37 resultados. Luego pon la consulta en las variables como antes:<\/span><\/p>\n<pre class=\"lang:r decode:true\">query &lt;- \"SELECT name, geo.lat as lat, geo.lon as long FROM `travel-sample` WHERE type=\\\"hotel\\\" AND city=\\\"London\\\" AND pets_ok=true\" \r\nreq &lt;- httr::POST(cbServer, httr::add_headers(\"Content-Type\" = \"application\/x-www-form-urlencoded;charset=UTF-8\"), body = paste(\"statement=\", query), authentication(\"public\",\"public\")) res &lt;- fromJSON(httr::content(req, \"text\")) \r\npetFriendlyHotelsLondon &lt;- res$results<\/pre>\n<p><span style=\"font-weight: 400\">Los resultados ser\u00e1n similares a los siguientes:<\/span><\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/03\/couchbase_r_coding_hotels.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-medium wp-image-10886\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/03\/couchbase_r_coding_hotels-274x300.jpg\" alt=\"Couchbase R Programming SQL Query output\" width=\"274\" height=\"300\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/couchbase_r_coding_hotels-274x300.jpg 274w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/couchbase_r_coding_hotels-300x328.jpg 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/couchbase_r_coding_hotels-18x20.jpg 18w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/couchbase_r_coding_hotels.jpg 768w\" sizes=\"auto, (max-width: 274px) 100vw, 274px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">Para hacer el mapa, utilizamos el paquete de folletos y proporcionamos algunos ajustes para identificar los campos que se utilizar\u00e1n para ubicar los s\u00edmbolos de los marcadores en el mapa.<\/span><\/p>\n<pre class=\"lang:r decode:true\">leaflet(data = petFriendlyHotelsLondon) %&gt;% addTiles() %&gt;% addMarkers(~long, ~lat, popup = ~as.character(name), label = ~as.character(name)) %&gt;% addProviderTiles(providers$OpenStreetMap)<\/pre>\n<p><span style=\"font-weight: 400\">R Studio es un gran IDE rico en informaci\u00f3n que permite la edici\u00f3n de c\u00f3digo, consola interactiva, y componentes de visualizaci\u00f3n incorporados, incluyendo el mapa, al igual que ggplot hizo con el gr\u00e1fico anterior.\u00a0<\/span><\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/03\/couchbase_r_programming_n1ql_query_map1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-10887\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/03\/couchbase_r_programming_n1ql_query_map1-1024x832.png\" alt=\"Couchbase R Programming SQL Query Mapping in Leaflet web map\" width=\"900\" height=\"731\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/couchbase_r_programming_n1ql_query_map1-1024x832.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/couchbase_r_programming_n1ql_query_map1-300x244.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/couchbase_r_programming_n1ql_query_map1-768x624.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/couchbase_r_programming_n1ql_query_map1-20x16.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/couchbase_r_programming_n1ql_query_map1.png 1280w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<p><span style=\"font-weight: 400\">Naturalmente, puede ampliar cualquiera de los cristales en consecuencia:<\/span><\/p>\n<p><a href=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/03\/couchbase_r_coding_leaflet_mapping.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-large wp-image-10888\" src=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2021\/03\/couchbase_r_coding_leaflet_mapping-1024x768.png\" alt=\"Couchbase R Programming with Map and Leaflet Web Map\" width=\"900\" height=\"675\" srcset=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/couchbase_r_coding_leaflet_mapping-1024x768.png 1024w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/couchbase_r_coding_leaflet_mapping-300x225.png 300w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/couchbase_r_coding_leaflet_mapping-768x576.png 768w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/couchbase_r_coding_leaflet_mapping-20x15.png 20w, https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2021\/03\/couchbase_r_coding_leaflet_mapping.png 1064w\" sizes=\"auto, (max-width: 900px) 100vw, 900px\" \/><\/a><\/p>\n<h2><span style=\"font-weight: 400\">Conclusi\u00f3n<\/span><\/h2>\n<p><span style=\"font-weight: 400\">La flexibilidad de Couchbase y R, con su potente conjunto de paquetes de terceros, son una gran combinaci\u00f3n. Los desarrolladores de aplicaciones pueden dejar los datos en la base de datos central y aprovechar la conmutaci\u00f3n por error, el procesamiento distribuido, la b\u00fasqueda de texto completo y la anal\u00edtica SQL.\u00a0<\/span><\/p>\n<p><span style=\"font-weight: 400\">Mientras tanto, la misma base de datos puede servir a los analistas que necesitan una API f\u00e1cil de usar para acceder a los datos sin tener que hacer m\u00faltiples copias fuera de l\u00ednea.<\/span><\/p>\n<p><span style=\"font-weight: 400\">Este enfoque integral de la plataforma de datos sigue atrayendo a empresas de todos los tama\u00f1os que necesitan simplificar su arquitectura y, al mismo tiempo, hacerla m\u00e1s estable y escalable.<\/span><\/p>\n<h2><span style=\"font-weight: 400\">Lecturas complementarias<\/span><\/h2>\n<ul>\n<li style=\"font-weight: 400\"><a href=\"https:\/\/www.couchbase.com\/blog\/es\/resources\/why-nosql\/\"><span style=\"font-weight: 400\">Bases de datos NoSQL: Por qu\u00e9 las empresas de \u00e9xito conf\u00edan en NoSQL<\/span><\/a><\/li>\n<li><a href=\"https:\/\/www.couchbase.com\/blog\/es\/geospatial-basics-spatial-databases-and-nosql-examples\/\">\u00bfQu\u00e9 es una base de datos geoespacial?<\/a><\/li>\n<li style=\"font-weight: 400\"><span style=\"font-weight: 400\">Libro Blanco: <\/span><a href=\"https:\/\/resources.couchbase.com\/c\/relational-no-sql-wp?x=Y7B0ca\"><span style=\"font-weight: 400\">Pasar de Relational a NoSQL: C\u00f3mo empezar<\/span><\/a><\/li>\n<li style=\"font-weight: 400\"><a href=\"https:\/\/developer.couchbase.com\/documentation\/server\/current\/n1ql\/n1ql-rest-api\/index.html\"><span style=\"font-weight: 400\">Referencia de la API REST de N1QL<\/span><\/a><\/li>\n<\/ul>","protected":false},"excerpt":{"rendered":"<p>Many statistical data analysts and data scientists use the R programming language to crunch their numbers outside of a database. Likewise, database analysts try to do everything in the same database whenever possible to maintain a single source. Couchbase provides [&hellip;]<\/p>\n","protected":false},"author":75185,"featured_media":3865,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_acf_changed":false,"inline_featured_image":false,"footnotes":""},"categories":[2242,1816,8683],"tags":[2013,2403],"ppma_author":[9163],"class_list":["post-10883","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-connectors","category-couchbase-server","category-geospatial","tag-r","tag-statistics"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v27.3 (Yoast SEO v27.3) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>What is R Programming Language? NoSQL &amp; Maps Guide<\/title>\n<meta name=\"description\" content=\"What is R programming language? Use this expert guide from Couchbase to utilize NoSQL query and map data in R. \u2713 Get started with R coding statistics now!\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.couchbase.com\/blog\/es\/couchbase-r-programming-with-query-maps-leaflet\/\" \/>\n<meta property=\"og:locale\" content=\"es_MX\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"R Programming With Coucbhase NoSQL Queries &amp; Maps\" \/>\n<meta property=\"og:description\" content=\"What is R programming language? Use this expert guide from Couchbase to utilize NoSQL query and map data in R. \u2713 Get started with R coding statistics now!\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.couchbase.com\/blog\/es\/couchbase-r-programming-with-query-maps-leaflet\/\" \/>\n<meta property=\"og:site_name\" content=\"The Couchbase Blog\" \/>\n<meta property=\"article:published_time\" content=\"2021-03-09T19:04:12+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2023-05-24T10:31:55+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/07\/featuredR.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"2036\" \/>\n\t<meta property=\"og:image:height\" content=\"1264\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Tyler Mitchell - Senior Product Marketing Manager\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@1tylermitchell\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Tyler Mitchell - Senior Product Marketing Manager\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"7 minutos\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-r-programming-with-query-maps-leaflet\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-r-programming-with-query-maps-leaflet\\\/\"},\"author\":{\"name\":\"Tyler Mitchell - Senior Product Marketing Manager\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/684cc0e5c60cd2e4b591db9621494ed0\"},\"headline\":\"R Programming With Coucbhase NoSQL Queries &amp; Maps\",\"datePublished\":\"2021-03-09T19:04:12+00:00\",\"dateModified\":\"2023-05-24T10:31:55+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-r-programming-with-query-maps-leaflet\\\/\"},\"wordCount\":1009,\"commentCount\":2,\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-r-programming-with-query-maps-leaflet\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2017\\\/07\\\/featuredR.jpg\",\"keywords\":[\"R\",\"statistics\"],\"articleSection\":[\"Connectors\",\"Couchbase Server\",\"Geospatial\"],\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-r-programming-with-query-maps-leaflet\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-r-programming-with-query-maps-leaflet\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-r-programming-with-query-maps-leaflet\\\/\",\"name\":\"What is R Programming Language? NoSQL & Maps Guide\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-r-programming-with-query-maps-leaflet\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-r-programming-with-query-maps-leaflet\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2017\\\/07\\\/featuredR.jpg\",\"datePublished\":\"2021-03-09T19:04:12+00:00\",\"dateModified\":\"2023-05-24T10:31:55+00:00\",\"description\":\"What is R programming language? Use this expert guide from Couchbase to utilize NoSQL query and map data in R. \u2713 Get started with R coding statistics now!\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-r-programming-with-query-maps-leaflet\\\/#breadcrumb\"},\"inLanguage\":\"es\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-r-programming-with-query-maps-leaflet\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-r-programming-with-query-maps-leaflet\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2017\\\/07\\\/featuredR.jpg\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/sites\\\/1\\\/2017\\\/07\\\/featuredR.jpg\",\"width\":2036,\"height\":1264},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/couchbase-r-programming-with-query-maps-leaflet\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"R Programming With Coucbhase NoSQL Queries &amp; Maps\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"name\":\"The Couchbase Blog\",\"description\":\"Couchbase, the NoSQL Database\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"es\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#organization\",\"name\":\"The Couchbase Blog\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/admin-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/wp-content\\\/uploads\\\/2023\\\/04\\\/admin-logo.png\",\"width\":218,\"height\":34,\"caption\":\"The Couchbase Blog\"},\"image\":{\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"}},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/#\\\/schema\\\/person\\\/684cc0e5c60cd2e4b591db9621494ed0\",\"name\":\"Tyler Mitchell - Senior Product Marketing Manager\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"es\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ebec3213e756f2e1f7118fcb5722e2cd1484c9256ae34ceb8f77054b986f21ce?s=96&d=mm&r=gd8a7c532bf2b94b7a2fe7a8439aafd75\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ebec3213e756f2e1f7118fcb5722e2cd1484c9256ae34ceb8f77054b986f21ce?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/ebec3213e756f2e1f7118fcb5722e2cd1484c9256ae34ceb8f77054b986f21ce?s=96&d=mm&r=g\",\"caption\":\"Tyler Mitchell - Senior Product Marketing Manager\"},\"description\":\"Works as Senior Product Marketing Manager at Couchbase, helping bring knowledge about products into the public limelight while also supporting our field teams with valuable content.\",\"sameAs\":[\"https:\\\/\\\/linkedin.com\\\/in\\\/tylermitchell\",\"https:\\\/\\\/x.com\\\/1tylermitchell\",\"https:\\\/\\\/www.youtube.com\\\/channel\\\/UCBZFuoiTcg0f3lGSQwLjeTg\"],\"url\":\"https:\\\/\\\/www.couchbase.com\\\/blog\\\/es\\\/author\\\/tylermitchell\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"What is R Programming Language? NoSQL & Maps Guide","description":"\u00bfQu\u00e9 es el lenguaje de programaci\u00f3n R? Utiliza esta gu\u00eda experta de Couchbase para utilizar consultas NoSQL y mapear datos en R. \u2713 \u00a1Comienza ahora con las estad\u00edsticas de codificaci\u00f3n en R!","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:\/\/www.couchbase.com\/blog\/es\/couchbase-r-programming-with-query-maps-leaflet\/","og_locale":"es_MX","og_type":"article","og_title":"R Programming With Coucbhase NoSQL Queries &amp; Maps","og_description":"What is R programming language? Use this expert guide from Couchbase to utilize NoSQL query and map data in R. \u2713 Get started with R coding statistics now!","og_url":"https:\/\/www.couchbase.com\/blog\/es\/couchbase-r-programming-with-query-maps-leaflet\/","og_site_name":"The Couchbase Blog","article_published_time":"2021-03-09T19:04:12+00:00","article_modified_time":"2023-05-24T10:31:55+00:00","og_image":[{"width":2036,"height":1264,"url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2017\/07\/featuredR.jpg","type":"image\/jpeg"}],"author":"Tyler Mitchell - Senior Product Marketing Manager","twitter_card":"summary_large_image","twitter_creator":"@1tylermitchell","twitter_misc":{"Written by":"Tyler Mitchell - Senior Product Marketing Manager","Est. reading time":"7 minutos"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-r-programming-with-query-maps-leaflet\/#article","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-r-programming-with-query-maps-leaflet\/"},"author":{"name":"Tyler Mitchell - Senior Product Marketing Manager","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/684cc0e5c60cd2e4b591db9621494ed0"},"headline":"R Programming With Coucbhase NoSQL Queries &amp; Maps","datePublished":"2021-03-09T19:04:12+00:00","dateModified":"2023-05-24T10:31:55+00:00","mainEntityOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-r-programming-with-query-maps-leaflet\/"},"wordCount":1009,"commentCount":2,"publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-r-programming-with-query-maps-leaflet\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/07\/featuredR.jpg","keywords":["R","statistics"],"articleSection":["Connectors","Couchbase Server","Geospatial"],"inLanguage":"es","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.couchbase.com\/blog\/couchbase-r-programming-with-query-maps-leaflet\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-r-programming-with-query-maps-leaflet\/","url":"https:\/\/www.couchbase.com\/blog\/couchbase-r-programming-with-query-maps-leaflet\/","name":"What is R Programming Language? NoSQL & Maps Guide","isPartOf":{"@id":"https:\/\/www.couchbase.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-r-programming-with-query-maps-leaflet\/#primaryimage"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-r-programming-with-query-maps-leaflet\/#primaryimage"},"thumbnailUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/07\/featuredR.jpg","datePublished":"2021-03-09T19:04:12+00:00","dateModified":"2023-05-24T10:31:55+00:00","description":"\u00bfQu\u00e9 es el lenguaje de programaci\u00f3n R? Utiliza esta gu\u00eda experta de Couchbase para utilizar consultas NoSQL y mapear datos en R. \u2713 \u00a1Comienza ahora con las estad\u00edsticas de codificaci\u00f3n en R!","breadcrumb":{"@id":"https:\/\/www.couchbase.com\/blog\/couchbase-r-programming-with-query-maps-leaflet\/#breadcrumb"},"inLanguage":"es","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.couchbase.com\/blog\/couchbase-r-programming-with-query-maps-leaflet\/"]}]},{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-r-programming-with-query-maps-leaflet\/#primaryimage","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/07\/featuredR.jpg","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/sites\/1\/2017\/07\/featuredR.jpg","width":2036,"height":1264},{"@type":"BreadcrumbList","@id":"https:\/\/www.couchbase.com\/blog\/couchbase-r-programming-with-query-maps-leaflet\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.couchbase.com\/blog\/"},{"@type":"ListItem","position":2,"name":"R Programming With Coucbhase NoSQL Queries &amp; Maps"}]},{"@type":"WebSite","@id":"https:\/\/www.couchbase.com\/blog\/#website","url":"https:\/\/www.couchbase.com\/blog\/","name":"El blog de Couchbase","description":"Couchbase, la base de datos NoSQL","publisher":{"@id":"https:\/\/www.couchbase.com\/blog\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.couchbase.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"es"},{"@type":"Organization","@id":"https:\/\/www.couchbase.com\/blog\/#organization","name":"El blog de Couchbase","url":"https:\/\/www.couchbase.com\/blog\/","logo":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","contentUrl":"https:\/\/www.couchbase.com\/blog\/wp-content\/uploads\/2023\/04\/admin-logo.png","width":218,"height":34,"caption":"The Couchbase Blog"},"image":{"@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/logo\/image\/"}},{"@type":"Person","@id":"https:\/\/www.couchbase.com\/blog\/#\/schema\/person\/684cc0e5c60cd2e4b591db9621494ed0","name":"Tyler Mitchell - Director de Marketing de Producto","image":{"@type":"ImageObject","inLanguage":"es","@id":"https:\/\/secure.gravatar.com\/avatar\/ebec3213e756f2e1f7118fcb5722e2cd1484c9256ae34ceb8f77054b986f21ce?s=96&d=mm&r=gd8a7c532bf2b94b7a2fe7a8439aafd75","url":"https:\/\/secure.gravatar.com\/avatar\/ebec3213e756f2e1f7118fcb5722e2cd1484c9256ae34ceb8f77054b986f21ce?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/ebec3213e756f2e1f7118fcb5722e2cd1484c9256ae34ceb8f77054b986f21ce?s=96&d=mm&r=g","caption":"Tyler Mitchell - Senior Product Marketing Manager"},"description":"Trabaja como gerente s\u00e9nior de mercadotecnia de productos en Couchbase, donde ayuda a dar a conocer los productos al p\u00fablico y apoya a nuestros equipos de campo con contenido valioso.","sameAs":["https:\/\/linkedin.com\/in\/tylermitchell","https:\/\/x.com\/1tylermitchell","https:\/\/www.youtube.com\/channel\/UCBZFuoiTcg0f3lGSQwLjeTg"],"url":"https:\/\/www.couchbase.com\/blog\/es\/author\/tylermitchell\/"}]}},"acf":[],"authors":[{"term_id":9163,"user_id":75185,"is_guest":0,"slug":"tylermitchell","display_name":"Tyler Mitchell - Senior Product Marketing Manager","avatar_url":"https:\/\/secure.gravatar.com\/avatar\/876da1e4284f1832c871b3514caf7867357744b8c0a370ef6f53a79dee2f379e?s=96&d=mm&r=g","0":null,"1":"","2":"","3":"","4":"","5":"","6":"","7":"","8":""}],"_links":{"self":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/10883","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/users\/75185"}],"replies":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/comments?post=10883"}],"version-history":[{"count":0,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/posts\/10883\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media\/3865"}],"wp:attachment":[{"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/media?parent=10883"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/categories?post=10883"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/tags?post=10883"},{"taxonomy":"author","embeddable":true,"href":"https:\/\/www.couchbase.com\/blog\/es\/wp-json\/wp\/v2\/ppma_author?post=10883"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}