我有一个混合效果模型,我想看到R²-和p值.我认为这可以通过summary()获得,但事实并非如此.或者至少我没有意识到这一点.
> summary(fit1.lme <- lmer(log(log(Amplification)) ~ poly(Voltage, 3) + (1 | Serial_number), data = bdf))
Linear mixed model fit by REML ['lmerMod']
Formula: log(log(Amplification)) ~ poly(Voltage, 3) + (1 | Serial_number)
Data: bdf
REML criterion at convergence: -253237.6
Scaled residuals:
Min 1Q Median 3Q Max
-14.8183 -0.4863 -0.0681 0.2941 9.3292
Random effects:
Groups Name Variance Std.Dev.
Serial_number (Intercept) 0.008435 0.09184
Residual 0.001985 0.04456
Number of obs: 76914, groups: Serial_number, 1270
Fixed effects:
Estimate Std. Error t value
(Intercept) 0.826745 0.002582 …Run Code Online (Sandbox Code Playgroud) 我想在我的降价文档中包含一张来自网络的图片,但我只想要图片的左侧部分。我搜索了如何使用 rmarkdown 修剪图片,但我什么也没找到......
这是一个例子
---
title: "How to trim?"
output: html_document
---
```{r setup, include=FALSE}
library(knitr)
knitr::opts_chunk$set(echo = TRUE, fig.align = 'center')
```
Include picture
```{r pic}
include_graphics("http://ggplot2.tidyverse.org/README-example-1.png")
```
Run Code Online (Sandbox Code Playgroud)
这给了我这个 HTML 输出。
如果我想修剪图例(右侧约 20% 的部分),我该怎么做?
我接受任何类型的答案:相对或绝对规范、rmarkdown 或 html 解决方案,...
谢谢!
我知道如何使用该函数获取CRAN上所有可用软件包的列表(R的可用软件包的名称以及列出CRAN上可用的所有软件包以进行控制台)available.packages()。
但是如何获得Bioconductor上可用的软件包列表?
谢谢
我尝试在 Quarto 文档中从 Python 调用 R 对象:
---
title: "pandas"
format: html
jupyter: python3
---
```{r}
data("penguins", package = "palmerpenguins")
```
```{python}
penguins=r.penguins
penguins
```
Run Code Online (Sandbox Code Playgroud)
当我在 RStudio 中一一执行块时,一切正常:
> data("penguins", package = "palmerpenguins")
> reticulate::repl_python() # automatically executed by RStudio
Python 3.10.4 (/Users/.../3.10.4/bin/python3.10)
Reticulate 1.24 REPL -- A Python interpreter in R.
Enter 'exit' or 'quit' to exit the REPL and return to R.
>>> penguins=r.penguins
>>> penguins
species island bill_length_mm ... body_mass_g sex year
0 Adelie Torgersen 39.1 ... …Run Code Online (Sandbox Code Playgroud) 我想在其中创建一个带有居中的传单小部件的html文档.
---
title: "Exemple"
author: "Antoine Bichat"
date: "31/08/2018"
output: html_document
---
```{r leaflet, fig.align="center"}
library(leaflet)
leaflet() %>%
addTiles() %>%
addMarkers(lng=174.768, lat=-36.852, popup="The birthplace of R")
```
Run Code Online (Sandbox Code Playgroud)
第一个想法fig.align="center"不起作用.
我找到了这个问题,并根据我的情况进行了调整:
<style>
/* resize the widget container */
.leaflet {
width: 80% !important;
}
/* center the widget */
div.leaflet-control-container {
margin: auto !important;
}
</style>
Run Code Online (Sandbox Code Playgroud)
但如果我不想拥有out.width100%(而且我不想),它就不起作用.
或许我做错了......其实我更喜欢100%R/ Rmarkdown解决方案,但我对一切都开放:)
我有一个带有分组变量的数据框,我想按组对它们求和.这很简单dplyr.
library(dplyr)
library(magrittr)
data <- data.frame(group = c("a", "a", "b", "c", "c"), n1 = 1:5, n2 = 2:6)
data %>% group_by(group) %>%
summarise_all(sum)
# A tibble: 3 x 3
group n1 n2
<fctr> <int> <int>
1 a 3 5
2 b 3 4
3 c 9 11
Run Code Online (Sandbox Code Playgroud)
但现在我想要一个新的列total,其中包含n1和n2按组的总和.像这样:
# A tibble: 3 x 3
group n1 n2 ttl
<fctr> <int> <int> <int>
1 a 3 5 8
2 b 3 4 7 …Run Code Online (Sandbox Code Playgroud) r ×6
r-markdown ×3
html ×2
bioconductor ×1
css ×1
dataframe ×1
dplyr ×1
image ×1
leaflet ×1
lme4 ×1
package ×1
python ×1
quarto ×1
reticulate ×1
tidyverse ×1