仍然习惯于purrr,我有一个我认为应该很容易的问题,但我不知道该怎么做.我想要做的就是将下面的日期时间转换为as.Date()的日期.这是一个数据帧列表.一直在玩,但还没有找到有用的东西...任何帮助赞赏.
df <- data.frame(Date = seq.POSIXt(Sys.time(), Sys.time() + hours(24), by = "hour"),
useless = "ignore me")
df2 <- data.frame(Date = seq.POSIXt(Sys.time(), Sys.time() + hours(1), by = "min"),
useless = "ignore me")
mylist <- list(df,df2)
mylist %<>% map(?????)
Run Code Online (Sandbox Code Playgroud) 我想使用.csl-file 使用 bookdown 来格式化引用。添加csl: some-style.csl到index.Rmd影响输出到gitbook,但不影响到pdf_book。我知道我可以指定biblio-style,但这仅接受一些标准样式而不接受 csl 文件。有适当的解决方法吗?
重现步骤:
.csl从https://www.zotero.org/styles下载一些文件并复制到项目的根目录。csl: my_csl_file.csl到index.Rmd.标题index.Rmd:
---
title: "A Minimal Book Example"
author: "Yihui Xie"
date: "`r Sys.Date()`"
site: bookdown::bookdown_site
documentclass: book
bibliography: [book.bib, packages.bib]
csl: american-sociological-review.csl
link-citations: yes
description: "This is a minimal example of using the bookdown package to write a book. The output …Run Code Online (Sandbox Code Playgroud) 当我跑步时gam.check(my_spline_gam),我得到以下输出.
Method: GCV Optimizer: magic
Smoothing parameter selection converged after 9 iterations.
The RMS GCV score gradiant at convergence was 4.785628e-06 .
The Hessian was positive definite.
The estimated model rank was 25 (maximum possible: 25)
Model rank = 25 / 25
Basis dimension (k) checking results. Low p-value (k-index<1) may
indicate that k is too low, especially if edf is close to k'.
k' edf k-index p-value
s(x) 24.000 22.098 0.849 0.06
Run Code Online (Sandbox Code Playgroud)
我的问题是我是否可以将这个p值分别提取到表中.
以下可能是 Netlogo 的基本编程问题。我想写一篇通用的记者,我可以为他们应该报道的内容提供论据。假设有以下程序:
turtles-own [
houses
cars
]
to setup
clear-all
create-turtles 10
reset-ticks
end
to go
ask turtles [
set houses houses + random 2
set cars cars + random 5
]
tick
end
Run Code Online (Sandbox Code Playgroud)
我可以写一篇关于房屋平均数的记者:
to-report mean-houses
report mean [ houses ] of turtles
end
Run Code Online (Sandbox Code Playgroud)
但我想要一个通用的报告器,我也可以用它来报告汽车的平均值,如下所示:
to-report means [ param ]
report mean [ param ] of turtles
end
Run Code Online (Sandbox Code Playgroud)
然而,这并没有按预期工作:
setup
repeat 15 [go]
show means houses
> ERROR: You can't use HOUSES in an observer context, because HOUSES …Run Code Online (Sandbox Code Playgroud) 这里已经解决了收集多组列的问题:收集多组列,但在我的情况下,列不是唯一的.
我有以下数据:
input <- data.frame(
id = 1:2,
question = c("a", "b"),
points = 0,
max_points = c(3, 5),
question = c("c", "d"),
points = c(0, 20),
max_points = c(5, 20),
check.names = F,
stringsAsFactors = F
)
input
#> id question points max_points question points max_points
#> 1 1 a 0 3 c 0 5
#> 2 2 b 0 5 d 20 20
Run Code Online (Sandbox Code Playgroud)
第一列是id,然后我有很多重复的列(原始数据集有133列):
我想结束这个结构:
expected <- data.frame(
id = c(1, …Run Code Online (Sandbox Code Playgroud)