r

Xpath to extract text between specific div tag and next div

江枫思渺然 提交于 2021-02-11 14:21:04
问题 I want to extract text in <p> between the div tag 'Heading1' and the next div tag, in the example below. I can't used 'heading2 to isolate the next div as this text may change. library(XML) # create example html html <- ' <div class="AAA"> <div class="AAA">Heading1</div> </div> <p>text1 I want</p> <p>text2 I want</p> <p>text3 I want</p> <div class="AAA"> <div class="AAA">Heading2</div> <!-- Do not always know what this heading is --> </div> <p>more text</p> <p>more text</p> <p>more text</p>

Combining renderUI, dataTableOutput, and renderDataTable

孤者浪人 提交于 2021-02-11 14:17:23
问题 Suppose I have the following shiny app that renders a data table from the package DT: library(shiny) ui <- fluidPage(uiOutput("abc")) server <- function(input, output, session) { output$abc <- renderUI({DT::dataTableOutput("dt_output")}) # line 4 output$dt_output <- DT::renderDataTable({data.table(a = 1:3, b = 4:6)}) # line 5 } runApp(list(ui = ui, server = server)) How would you combine lines 4 and 5, with the constraint that output$abc must remain a uiOutput ? My attempt at combining (the

How to manually calculate Cook's distance

这一生的挚爱 提交于 2021-02-11 14:16:41
问题 I calculated Cook's distance manually and with the function cooks.distance and I got two different results. Can someone please help me understand why? Below is how I manually calculate Cook's distance: j=rnorm(100) o=rexp(100) p=runif(100) model=lm(j~o+p) O=model.matrix(model) P = O%*% solve(t(O) %*% O) %*% t(O) lev=diag(P) b<-solve(t(O)%*%O)%*%t(O)%*%j RSS <- sum((j-O%*%b)^2) s2<- RSS/97 #three predictors (including intercept (100-3=97)) residuals(model)^2/(4*s2)*(lev/(1-lev)^2) The above

Query for R Machine Learning Services - Filtering Categories in Where Clause

江枫思渺然 提交于 2021-02-11 14:14:06
问题 I am trying to run a query in SQL Server using the Machine Learning Services extension. So this is the problem I am having; DECLARE @query NVARCHAR(MAX) = ' SELECT CATEGORY1,CATEGORY2 FROM TABLE WHERE CATEGORY1 = 'A' AND CATEGORY2 = 'B' ' EXEC sp_execute_external_script @language = N'R', @script = N'data <- Rscript' ,@input_data_1 = @query ,@input_data_1_name= N'data' You see I am creating a variable with a string value, which is the SQL Query. This query is then passed into the stored

Coin tossing and generating graphs

半城伤御伤魂 提交于 2021-02-11 14:11:23
问题 Could someone generate those graphs or at least help me with that ? I want to generate that probability of getting heads and tails in a undetermined number of flips. Actually its not like that but consider pthetaGivenData like this and check my code. Probably you´ll know what I want to get. This is what I´ve done so far: The while wasnt working. I couldnt store my results of each coin result in add, so then, pthetaGivenData in storage as well. I was trying to generate the first five data

Using RSelenium to open chrome browser, getting “Unable to create new service: ChromeDriverService” message and error

℡╲_俬逩灬. 提交于 2021-02-11 14:11:21
问题 As the title says, I've got a script written using RSelenium to automate web navigation, using chrome as the browser. This script has worked fine for months now, but today when I tried to run it, I got the following message: Selenium message:Unable to create new service: ChromeDriverService Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08- 02T20:13:22.693Z' System info: host: 'LAPTOP-22QM8890', ip: '192.168.133.65', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0

Coin tossing and generating graphs

坚强是说给别人听的谎言 提交于 2021-02-11 14:10:51
问题 Could someone generate those graphs or at least help me with that ? I want to generate that probability of getting heads and tails in a undetermined number of flips. Actually its not like that but consider pthetaGivenData like this and check my code. Probably you´ll know what I want to get. This is what I´ve done so far: The while wasnt working. I couldnt store my results of each coin result in add, so then, pthetaGivenData in storage as well. I was trying to generate the first five data

Using RSelenium to open chrome browser, getting “Unable to create new service: ChromeDriverService” message and error

淺唱寂寞╮ 提交于 2021-02-11 14:10:37
问题 As the title says, I've got a script written using RSelenium to automate web navigation, using chrome as the browser. This script has worked fine for months now, but today when I tried to run it, I got the following message: Selenium message:Unable to create new service: ChromeDriverService Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08- 02T20:13:22.693Z' System info: host: 'LAPTOP-22QM8890', ip: '192.168.133.65', os.name: 'Windows 10', os.arch: 'amd64', os.version: '10.0

How to embed weather API into shinydashboards

允我心安 提交于 2021-02-11 14:06:52
问题 I am creating shiny dashboard that will have various information. One of the things that I am trying to implement is to have a section in the app for weather. I am learning shiny dashboard on the go. This in fact is my first shiny app. So in order to learn this I googled how to get weather into shiny dashboards. I came upon on a similar question here on stack overflow here and found out how a guy got boston weather into his app. I was able to mimic his code and in my shiny dashboard get the

R shiny - insertUI()'s “immediate” argument does not work with images

风格不统一 提交于 2021-02-11 14:06:46
问题 I am trying to update divs while in a loop, some of which contain images. Using removeUI(..., immediate = TRUE) I can remove them and then replace them by new divs, with insertUI(..., immediate = TRUE). Although the texts appear in real time, the images do not load until we are out of the loop (see example below, you don't even have to load an image, a question mark will appear after the loop ends). In my browser I can see the img tags are created in HTML, but still no images appear live.