我有这个图表。
g <- retention_cohorts %>%
ggplot(aes(relative_week, round(percent,2), label=relative_week)) +
geom_line() +
scale_y_continuous(labels = percent) +
scale_x_continuous(breaks = seq(1,24,4),
labels = seq(1,6)
) +
geom_text(nudge_y = .02) +
labs(
title = "Purchasing Retention Analysis",
subtitle = "Customers who order at least one item each week",
y = "Customers with at least One Purchase",
x = "Relative Month"
) + theme_light()
Run Code Online (Sandbox Code Playgroud)
这是一个很棒的图表,我想让它具有交互性。当我使用 时ggplotly(g),它几乎完美地重新创建了它,只是它删除了副标题。有没有办法强制它保留副标题或plotly在创建实体后添加新文本作为副标题?
我正在尝试提取一个二维数组。该nodes物体看起来像这样
我试图用这个得到它,但它没有用。
var array_nodes = nodes.forEach(function(d) {
return {
x: d.x,
y: d.y
}
})
Run Code Online (Sandbox Code Playgroud)
我还尝试了地图功能。
const mappy = nodes.map(d => {d.x, d.y})
Run Code Online (Sandbox Code Playgroud)
我想得到一个包含两列的数组的输出,每个节点的 x 和 y 值。
0: Object { id: "node1", x: 329, y: 20.71054741336845, … }
??
1: Object { id: "node2", x: 457, y: 20.500184787737467, … }
??
2: Object { id: "node3", x: 456, y: 20.046762733706277, … }
??
3: Object { id: "node4", x: 223, y: 20.233158455720663, … }
??
4: Object …Run Code Online (Sandbox Code Playgroud) 我想每周一次对 redshift postgres 数据库中的数据运行机器学习模型。
我将我的 R 脚本设置为 rest api 使用plumbr,然后我将它设置为由pm2. 我有它,所以任务在ec2实例启动时启动,然后继续运行。
要让 R 脚本运行并从机器学习模型上传新数据,我所需要做的就是运行一个简单的 curl 请求 curl http://localhost:4208/main
模型的整个过程大约需要 10 分钟。
如何自动执行启动 ec2 实例、运行 curl 请求然后关闭它的过程?这可以通过 AWS Beanstalk 完成吗?
r amazon-ec2 amazon-web-services amazon-elastic-beanstalk aws-lambda
我正在构建一个 KNN 模型来预测房价。我将检查我的数据和我的模型,然后是我的问题。
数据 -
# A tibble: 81,334 x 4
latitude longitude close_date close_price
<dbl> <dbl> <dttm> <dbl>
1 36.4 -98.7 2014-08-05 06:34:00 147504.
2 36.6 -97.9 2014-08-12 23:48:00 137401.
3 36.6 -97.9 2014-08-09 04:00:40 239105.
Run Code Online (Sandbox Code Playgroud)
模型 -
library(caret)
training.samples <- data$close_price %>%
createDataPartition(p = 0.8, list = FALSE)
train.data <- data[training.samples, ]
test.data <- data[-training.samples, ]
model <- train(
close_price~ ., data = train.data, method = "knn",
trControl = trainControl("cv", number = 10),
preProcess = c("center", "scale"),
tuneLength …Run Code Online (Sandbox Code Playgroud) 我正在将我的ggplot2图表转换为情节。我想手动添加标题,因为我想留出空间以便之后添加副标题 - 这ggplotly本身是行不通的。
g <- retention_cohorts %>%
ggplot(aes(relative_week, round(percent,2), label=relative_week)) +
geom_line() +
scale_y_continuous(labels = percent) +
scale_x_continuous(breaks = seq(1,24,4),
labels = seq(1,6)
) +
geom_text(nudge_y = .02) +
# geom_text_repel() +
labs(
# title = "Purchasing Retention Analysis",
subtitle = "Customers who order at least one item each week",
y = "Ratio of Customers",
x = "Relative Month"
) + theme_light()
Run Code Online (Sandbox Code Playgroud)
文档说我可以使用 pad 设置填充,但是当我将其添加到函数中时,它会出现错误,指出它是无效参数。layout
ggplotly(g) %>%
layout(
title = "My Title",
pad = …Run Code Online (Sandbox Code Playgroud) 我有此页面,我希望能够在页面上包含一个弹出窗口。
如果单击发现,您将看到三个标题下方的弹出窗口。
标题位于一个容器中,该容器是弹出窗口的同级容器。
//pop up
<section id="header" class ="collapsed">
<h3>About</h3>
<div id="dismiss">OK</div>
</section>
//titles
<div id="visual">
<h3 id="channel"> Which channel brought the most customers? </h3>
<h3 id="performance"> Which channel offered the best performance?</h3>
</div>
Run Code Online (Sandbox Code Playgroud)
我将弹出窗口设置为position absolute。我还设置了标题absolute,left: 52%以便它们停留在屏幕左侧的正确位置。
是否可以让一个绝对div覆盖另一个绝对div?
r ×4
ggplot2 ×2
plotly ×2
amazon-ec2 ×1
aws-lambda ×1
css ×1
html ×1
javascript ×1
knn ×1
r-caret ×1