r

How to convert SOAP request curl to RCurl

不想你离开。 提交于 2021-02-09 00:21:51
问题 How should I convert this one liner: curl -d @request.xml -o response.xml http://www.sample.com/soap It is accessing request xml which looks like this: <?xml version="1.0" encoding="utf-8"?> <soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/" xmlns:req="http://sample.com/"> <soap:Body> <req:getEvents> <start>2014-12-12T00:00:00+0100</start> <end>2014-12-13T00:00:00+0100</end> <type>TYPE</type> </req:getEvents> </soap:Body> </soap:Envelope> The response is written into

Sum/count between two dates in R

ⅰ亾dé卋堺 提交于 2021-02-08 22:56:27
问题 I have a data frame with two columns - one is the Start date the other is the End date. I need to get a new data frame with two columns - a Date column and a column which is the count of observations from the first data frame where the date is between Start and End. Have: dates<-data.frame("Start"=seq(as.Date("2017/1/1"),by="day", length.out = 5),"End"=seq(as.Date("2017/1/3"),by="day", length.out = 5)) Start End 2017-01-01 2017-01-03 2017-01-02 2017-01-04 2017-01-03 2017-01-05 2017-01-04 2017

Querying SQL Server geospatial data from R

狂风中的少年 提交于 2021-02-08 20:52:47
问题 Edited: I have added login details to a demo SQL Server 2017. I am querying an SQL Server from R using the FreeTDS driver (preferred over the Microsoft odbc driver as it supports Windows authentication in Linux). I'm struggling to interpret the geometry column with st_read . The connection is initiated as such: library(odbc) library(DBI) library(sf) username <- 'SO-user' sql_server_ip <- '35.214.169.110' password <- 'SQLaskingfortrouble?!' con <- dbConnect(odbc(), Driver = "FreeTDS", Server =

How to zoom out page using RSelenium library in R?

痴心易碎 提交于 2021-02-08 20:38:29
问题 I am trying to write a web-scraper using RSelenium Library in R. The last step of my work includes taking screenshot of a table on web page. To fit the whole table into the window I should zoom out the web browser (in that case it's firefox). I tried to use: webElem <- remDR$findElement("css", "body") webElem$clickElement() webElem$sendKeysToElement(list(key = "control", "-")) however it doesn't work. I saw also this thread: Zoom out shiny app at default in browser and found there promising

remove mapedit features programmatically

依然范特西╮ 提交于 2021-02-08 20:33:39
问题 With mapedit it is possible to clear drawn features using the 'trash' icon built into the drawbar UI. It is also possible to clear features associated with the leaflet map using clearMarkers() and leafletProxy() , as laid out in this issue. However, leafletProxy does not clear any features drawn by the user. How do I programmatically clear these features? (e.g. after clicking an actionButton). Here is a simple shiny app and more explanation: library(mapedit) library(mapview) library(shiny) ui

remove mapedit features programmatically

喜你入骨 提交于 2021-02-08 20:29:31
问题 With mapedit it is possible to clear drawn features using the 'trash' icon built into the drawbar UI. It is also possible to clear features associated with the leaflet map using clearMarkers() and leafletProxy() , as laid out in this issue. However, leafletProxy does not clear any features drawn by the user. How do I programmatically clear these features? (e.g. after clicking an actionButton). Here is a simple shiny app and more explanation: library(mapedit) library(mapview) library(shiny) ui

Finding most frequent combinations

孤者浪人 提交于 2021-02-08 20:01:52
问题 I have a data frame with 2 columns, ID number and brand: X1 X2 1234 A89 1234 A87 1234 A87 1234 A32 1234 A27 1234 A27 1235 A12 1235 A14 1235 A14 1236 A32 1236 A32 1236 A27 1236 A12 1236 A12 1236 A14 1236 A89 1236 A87 1237 A99 1237 A98 I want to find the top 3 brand combinations that occur together most frequently with regard to id number: A89, A87 A32, A27 A12, A14 I tried: library(dplyr) df %>% group_by(X1,X2) %>% mutate(n = n()) %>% group_by(X1) %>% slice(which.max(n)) %>% select(-n) But it

Text in barplot in R

回眸只為那壹抹淺笑 提交于 2021-02-08 20:01:26
问题 I have a problem when adding values in a barplot in R. The problem is that I cannot place the values in the middle of each bar balance<- c(-4.3963714,0.2335795,-0.2777250,-2.0037130,-1.2526801, -6.4556516) barnames<-c("E1","E11","E12","E5","E7","E9") barplot(balance,ylim=c(-8,2),col=c(if ((balance[1])>0) "blue" else "red",(if ((balance[2])>0) "blue" else "red"),(if ((balance[3])>0) "blue" else "red"), (if ((balance[4])>0) "blue" else "red"),(if ((balance[5])>0) "blue" else "red"), (if (

Text in barplot in R

生来就可爱ヽ(ⅴ<●) 提交于 2021-02-08 20:01:16
问题 I have a problem when adding values in a barplot in R. The problem is that I cannot place the values in the middle of each bar balance<- c(-4.3963714,0.2335795,-0.2777250,-2.0037130,-1.2526801, -6.4556516) barnames<-c("E1","E11","E12","E5","E7","E9") barplot(balance,ylim=c(-8,2),col=c(if ((balance[1])>0) "blue" else "red",(if ((balance[2])>0) "blue" else "red"),(if ((balance[3])>0) "blue" else "red"), (if ((balance[4])>0) "blue" else "red"),(if ((balance[5])>0) "blue" else "red"), (if (

Finding most frequent combinations

 ̄綄美尐妖づ 提交于 2021-02-08 20:01:00
问题 I have a data frame with 2 columns, ID number and brand: X1 X2 1234 A89 1234 A87 1234 A87 1234 A32 1234 A27 1234 A27 1235 A12 1235 A14 1235 A14 1236 A32 1236 A32 1236 A27 1236 A12 1236 A12 1236 A14 1236 A89 1236 A87 1237 A99 1237 A98 I want to find the top 3 brand combinations that occur together most frequently with regard to id number: A89, A87 A32, A27 A12, A14 I tried: library(dplyr) df %>% group_by(X1,X2) %>% mutate(n = n()) %>% group_by(X1) %>% slice(which.max(n)) %>% select(-n) But it