小编Par*_*ark的帖子

如何提取连续字母的单词中的唯一字母?

例如,有字符x = "AAATTTGGAA"

我想要实现的是,从,由连续字母x分割, 。x"AAA", "TTT", "GG", "AA"

然后,每个块的唯一字母是"A", "T", "G", "A",因此预期输出是ATGA

我应该如何得到这个?

string r unique

4
推荐指数
1
解决办法
78
查看次数

R 错误:未使用的参数(measures = list("f1", FALSE, etc)

我正在尝试使用 R 中的“mlr”库和 iris 数据集上的“c50”算法(使用 F1 分数作为指标):

library(mlr)
library(C50)
data(iris)

zooTask <- makeClassifTask(data = iris, target = "Species")
forest <- makeLearner("classif.C50")

forestParamSpace <- makeParamSet(
makeIntegerParam("minCases", lower = 1, upper = 100))


randSearch <- makeTuneControlRandom(maxit = 100)


cvForTuning <- makeResampleDesc("CV", iters = 5,  measures = f1)


tunedForestPars <- tuneParams(forest, task = zooTask,
resampling = cvForTuning,
par.set = forestParamSpace,
control = randSearch)



tunedForestPars
Run Code Online (Sandbox Code Playgroud)

但这会导致以下错误:

Error in makeResampleDescCV(iters = 5, measures = list(id = "f1", minimize = FALSE,  : 
  unused argument (measures = …
Run Code Online (Sandbox Code Playgroud)

r classification mlr

3
推荐指数
1
解决办法
123
查看次数

是否有 R 函数可以调整条形图轴的比例?

我有一个名为 crashes_deaths_injuries_TA_pop 的数据框,如下所示:

TA_姓名 人口
血块 34466
布勒 444444
克鲁斯 34455

我试图用条形图显示数据,但是,x 轴的比例混乱,我不知道如何。我知道这一定很容易,但我是编码新手,所以我很挣扎。

这是我的条形图代码:

ggplot(crashes_deaths_injuries_TA_pop, aes(x = reorder(TA_name, Population), y = Population, fill = Population)) +
  geom_col(alpha = 0.7) +
  scale_fill_distiller(palette = "Reds", direction = 1) +
  coord_flip() +
  labs(x = "", y = "Population", fill = "Population",
       title = "Populations of South Island TA's | 2018",
       caption = "Data: Census 2018, StatsNZ") +
  theme_minimal() +
  theme(legend.position = "none") 
Run Code Online (Sandbox Code Playgroud)

我还想知道如何在每个 TA_name 的每个栏末尾添加人口作为数字

条形图

r bar-chart ggplot2

2
推荐指数
1
解决办法
234
查看次数

如何反转 Y 轴值 (GGPLOT2 R)

我正在尝试反转 Y 轴的值。我基本上希望 Y 轴随着上升而减小,因此应该是 16,而不是 24。我该怎么做?

ggplot(data=data_diff, aes(Sum.of.Diff, Sum.of.Against.Total) + 
geom_point(alpha=1) + 
ggtitle("Data Diff") + 
geom_label_repel(data=subset(data_diff, Sum.of.Against.Total> 0 | Sum.of.Diff > 0 | Sum.of.Diff < 0), aes(label=Name), box.padding = 0.5, point.padding = .11, segment.color = 'black') + 
xlab("Sum of Diff") + ylab("Sum of Against Stats Total")
Run Code Online (Sandbox Code Playgroud)

示例图:

单击此处查看示例图

这是我的数据集:

                    Name Sum.of.Against.Total Sum.of.Diff
1                Aurorus                26.00      185.66
2               Parasect                25.00      155.66
3               Leavanny                25.00      115.66
4              Abomasnow                25.00      115.66
5               Frosmoth                24.50      115.66
6              Rhyperior                24.25      115.66
7                  Golem                24.25      115.66 …
Run Code Online (Sandbox Code Playgroud)

r ggplot2

1
推荐指数
1
解决办法
2404
查看次数

标签 统计

r ×4

ggplot2 ×2

bar-chart ×1

classification ×1

mlr ×1

string ×1

unique ×1