distm
您能完整解释一下R中使用函数或distVincentyEllipsoid
函数计算测地坐标距离的巨大差异吗?
我注意到使用 distm 进行此计算需要更长的时间。您能否向我解释一下除了差异之外,为什么会发生这种情况?
谢谢你!
你能帮我减少 Shiny 中 fileInput 和文本之间的空间吗?我想留下与我所附的图类似的东西。可执行代码如下。
谢谢你!
runApp(
list(ui = fluidPage(
fileInput("data", h3("Excel database import")), uiOutput("tab"),
),
server = function(input, output, session){
url <- a("Google Homepage", href="https://www.google.com/")
output$tab <- renderUI({
tagList("Access the page:", url)
})
})
)
Run Code Online (Sandbox Code Playgroud)
我编写了一个代码来使用该函数生成树状图,如图所示hclust
。所以,我需要帮助解释这个树状图。请注意,这些点的位置很接近。我得到的这个树状图结果意味着什么,你能帮我吗?我真的很想对生成的输出进行更完整的分析。
library(geosphere)
Points_properties<-structure(list(Propertie=c(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29), Latitude = c(-24.781624, -24.775017, -24.769196,
-24.761741, -24.752019, -24.748008, -24.737312, -24.744718, -24.751996,
-24.724589, -24.8004, -24.796899, -24.795041, -24.780501, -24.763376,
-24.801715, -24.728005, -24.737845, -24.743485, -24.742601, -24.766422,
-24.767525, -24.775631, -24.792703, -24.790994, -24.787275, -24.795902,
-24.785587, -24.787558), Longitude = c(-49.937369,
-49.950576, -49.927608, -49.92762, -49.920608, -49.927707, -49.922095,
-49.915438, -49.910843, -49.899478, -49.901775, -49.89364, -49.925657,
-49.893193, -49.94081, -49.911967, -49.893358, -49.903904, -49.906435,
-49.927951, -49.939603, -49.941541, -49.94455, -49.929797, -49.92141,
-49.915141, -49.91042, -49.904772, -49.894034)), row.names = c(NA, -29L), class = c("tbl_df", "tbl",
"data.frame"))
coordinates<-subset(Points_properties,select=c("Latitude","Longitude"))
plot(coordinates[,2:1]) …
Run Code Online (Sandbox Code Playgroud) 我有一个数据库,一个函数,从中我可以获得coef
值(它是通过lm
函数计算的)。有两种计算方法:第一种是如果我想要一个取决于 的特定系数ID
,date
另Category
一种方法是coef
根据计算所有可能的系数subset_df1
。
该代码正在运行。对于第一种方式,它是立即计算的,但是对于 all 的计算coefs
,它需要合理的时间,如您所见。我使用该tictoc
函数只是为了向您展示计算时间,它给出了633.38 sec elapsed
. 需要强调的重要一点是,这df1
不是一个如此小的数据库,而是用于所有 I 过滤器的计算coef
,在本例中是subset_df1
.
我在代码中做了解释,以便您可以更好地理解我在做什么。这个想法是为所有日期生成coef
值 \xe2\x80\x8b\xe2\x80\x8b 。>=
date1
最后,我想尝试合理地减少计算所有coef
值的处理时间。
library(dplyr)\nlibrary(tidyr)\nlibrary(lubridate)\nlibrary(tictoc)\n\n#database\ndf1 <- data.frame( Id = rep(1:5, length=900),\n date1 = as.Date( "2021-12-01"),\n date2= rep(seq( as.Date("2021-01-01"), length.out=450, by=1), each = 2),\n Category = rep(c("ABC", "EFG"), length.out = 900),\n Week = rep(c("Monday", "Tuesday", …
Run Code Online (Sandbox Code Playgroud)