使用成功终止了EB CLI中的先前环境后 eb terminate,我一直试图将节点应用程序部署在其他区域。当我导航到包含并命中的应用文件夹eb init时,系统提示我
$ eb init
Cannot setup CodeCommit because there is no Source Control setup, continuing with initialization
Run Code Online (Sandbox Code Playgroud)
我可以从这里做什么?
我仔细检查了IAM,用户具有完整的代码提交访问权限
我正在尝试获取纽约地区经纬度坐标的邮政编码
我尝试使用来自 google 的反向地理编码器 API,但它每天限制为 2500 次点击,因此可以批量处理我的数据帧。
接下来,我尝试使用带有数据集邮政编码的库(邮政编码),但无法将纬度经度与火车数据集的坐标相匹配,因为所有经纬度坐标都不在数据集中。
进一步虽然使用 KNN 预测数据集的邮政编码,但无法获得正确的结果。
zipcode_latlon = zipcode[zipcode$state=="NY",c(1,4,5)]
train_latlon = train_data[,c("latitude","longitude")]
zip1 = rep(10007, nrow(train_latlon))
zip1 = as.character(zip1)
train_latlon = cbind(zip1, train_latlon)
colnames(train_latlon) = c("zip","latitude","longitude")
knn_fit = knn(zipcode_latlon, train_latlon,zipcode_latlon$zip, k=1)
Run Code Online (Sandbox Code Playgroud)
需要知道如何从 lat long 批量获取邮政编码,任何方法在 R 中都很好。
我想制作两个并排的饼图,ggplot2但我很难使两个饼图"整体"这里是我的数据样本.
> test
New York Berlin group
1 474 755 Never Visited
2 214 123 Visited Once
3 66 122 Visited > 1
4 142 64 Resided
Run Code Online (Sandbox Code Playgroud)
当我尝试:
pie <- ggplot(data = melted2, aes(x = "", y = Cnt, fill = Type )) +
geom_bar(stat = "identity") +
geom_text(aes(label = Cnt), position = position_stack(vjust = 0.5)) +
coord_polar(theta = "y") +
facet_grid(facets=. ~ City) +
theme(
axis.title.x = element_blank(),
axis.title.y = element_blank()) + theme(legend.position='bottom') + guides(fill=guide_legend(nrow=2,byrow=TRUE))
pie
Run Code Online (Sandbox Code Playgroud)
但这会产生: …
在我的 r markdown 文件中,我输出到 html。在代码中,我包括“
{r, fig.align= "center", message= FALSE, warning= FALSE}
这将删除除此之外的所有警告和消息:
## <environment: R_GlobalEnv>
Run Code Online (Sandbox Code Playgroud)
在代码的某处,我将一个列表转换为环境中的对象:
list2env(a1, envir = .GlobalEnv)
Run Code Online (Sandbox Code Playgroud)
所以我明白消息的来源,但不明白为什么它没有被删除 message = FALSE, warning = FALSE
有什么建议吗?
我有一个样本数据集。我的目标是保留所有user_id 且 其记录plan_id不止一次的记录。据了解,您可以使用
n_occur <- data.frame(table(test$user_id))
Run Code Online (Sandbox Code Playgroud)
但是,如何计算两列变量的出现频率,然后用多次出现的变量过滤原始数据集呢?例如,这是我的测试数据集:
> test
user_id plan_id hour
1 1 10 2
2 2 10 4
3 3 20 23
4 4 20 12
5 5 10 8
6 1 10 10
7 5 20 6
8 1 20 5
9 1 20 18
10 5 10 7
11 1 30 6
Run Code Online (Sandbox Code Playgroud)
这是预期的输出:
> output
user_id plan_id hour
1 1 10 2
2 5 10 8
3 1 10 10
4 …Run Code Online (Sandbox Code Playgroud) 我有一个样本数据集,可以跟踪自行车到不同站点的轨迹.我的目标是找到自行车在特定车站的间隔difftime(),在这种情况下是车站B.
> test
bikeid start_station starttime end_station endtime
1 1 A 2017-09-25 01:00:00 B 2017-09-25 01:30:00
2 1 B 2017-09-25 07:30:00 C 2017-09-25 08:00:00
3 1 C 2017-09-25 10:00:00 A 2017-09-25 10:30:00
4 1 A 2017-09-25 13:00:00 C 2017-09-25 13:30:00
5 1 C 2017-09-25 15:30:00 B 2017-09-25 16:00:00
6 1 B 2017-09-25 18:00:00 B 2017-09-25 18:30:00
7 1 B 2017-09-25 19:00:00 A 2017-09-25 19:30:00
8 1 ? 2017-09-25 20:00:00 B 2017-09-25 20:30:00
9 1 C 2017-09-25 22:00:00 C …Run Code Online (Sandbox Code Playgroud) 对于我的样本数据集,我使用以下代码将数据从系数转换为数值:
sample = as.data.frame(lapply(sample, function(x) as.numeric(as.character(x))))
Run Code Online (Sandbox Code Playgroud)
然后使用此代码将所有NA值替换为0:
sample[is.na(sample)] = 0
Run Code Online (Sandbox Code Playgroud)
但是,当我从系数转换为数值时,列名称会更改并rownames消失。为什么会发生这种情况?在将所有列转换为数值时如何防止这种情况发生?
dput(sample)
structure(list(`2015-10-08 00:05:00` = structure(c(NA, NA, NA,
NA, 2L, NA), .Names = c("72", "79", "82", "83", "116", "120"), .Label = c(" 1",
" 2", " 3", " 5", "2015-10-08 00:05:00"), class = "factor"),
`2015-10-08 00:12:00` = structure(c(NA, 1L, NA, NA, NA, NA
), .Names = c("72", "79", "82", "83", "116", "120"), .Label = c(" 1",
" 2", " 3", "2015-10-08 00:12:00"), class = "factor"), `2015-10-08 00:34:00` = …Run Code Online (Sandbox Code Playgroud) 在我的应用程序中的单击事件中,我返回highlights- 一系列功能(每次都有不同的长度).所以console.log(highlights)产生:
我的目标是返回properties.census2010_Pop2010对象中每个要素所包含的值的总和.到目前为止,我已经尝试了下面的代码,但控制台中没有返回任何内容.任何建议,将不胜感激.
total = Object.create(null);
highlights.feature.properties.forEach(function (a) {
a.census2010_Pop2010.forEach(function (b) {
total = total + b.census2010_Pop2010;
});
});
console.log(total);
Run Code Online (Sandbox Code Playgroud) 我timestamp tz在 PrestoDB 中有一个包含 4 列类型的表 - 没有 NULL 值 - 并且无法获得每行的最小值。这似乎违反直觉,因为:
SELECT
(SELECT MIN(Col) FROM (VALUES (1), (2), (3), (4)) AS X(Col)) AS TheMin
FROM mytable
Run Code Online (Sandbox Code Playgroud)
^ 使用假整数将为所有行返回 1
然而在我的桌子上:
SELECT
(SELECT MIN(Col) FROM (VALUES (_col2), (_col3), (_col4), (_col5)) AS X(Col)) AS TheMin
FROM mytable
Run Code Online (Sandbox Code Playgroud)
返回 Presto query has failed. type cannot be null
当列中的数据类型全部timestamp tz并且有零个 NULL 值时,这怎么可能?
这里使用列作为查找每行的最小时间戳的解决方法是VALUES什么?
我的目标是进行左连接上intervals在bike_id比赛和created_at时间戳records之间start,并end在intervals表
> class(records)
[1] "data.table" "data.frame"
> class(intervals)
[1] "data.table" "data.frame"
> records
bike_id created_at resolved_at
1 28780 2019-05-03 08:29:18 2019-05-03 08:35:37
2 28780 2019-05-03 21:05:28 2019-05-03 21:07:28
3 28780 2019-05-04 21:13:39 2019-05-04 21:15:40
4 28780 2019-05-07 17:24:20 2019-05-07 17:26:39
5 28780 2019-05-08 11:34:32 2019-05-08 12:16:44
6 28780 2019-05-08 23:38:39 2019-05-08 23:40:36
> intervals
bike_id start end id
1: 28780 2019-05-03 04:44:45 2019-05-03 16:58:56 1
2: …Run Code Online (Sandbox Code Playgroud) r ×7
dplyr ×3
data.table ×2
dataframe ×1
foreach ×1
geocoding ×1
ggplot2 ×1
javascript ×1
node.js ×1
numeric ×1
plyr ×1
presto ×1
r-markdown ×1
sql ×1
tidyverse ×1