Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/actionscript-3/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/asp.net-core/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
使用mutate和purrr';s地图 如何在列表中的TIBLE中添加列 数据如下所示,我只想在末尾添加一列,检查第2列是否与第3列相同 [[1]] # A tibble: 620 x 4 DataName `Technischer Platz...4` `Technischer Platz...5` `Technischer Platz...307` <chr> <chr> <chr> <lgl> 1 WrW_SAPP17_VIAUFKAFVC 1202362-001 1202362-001 NA 2 WrW_SAPP17_VIAUFKAFVC 1202362-002 037 1202362-002 037 NA 3 WrW_SAPP17_VIAUFKAFVC 1202362-011 1202362-011 NA 4 WrW_SAPP17_VIAUFKAFVC 1202362 1202362 NA 5 WrW_SAPP17_VIAUFKAFVC 1202362-004 052 1202362-004 052 NA 6 WrW_SAPP17_VIAUFKAFVC 1202362-018 005 1202362-018 005 NA 7 WrW_SAPP17_VIAUFKAFVC 1202362-017 1202362-017 NA 8 WrW_SAPP17_VIAUFKAFVC 1202362-012 1202362-012 NA 9 WrW_SAPP17_VIAUFKAFVC 1202362-002 002 1202362-002 002 NA 10 WrW_SAPP17_VIAUFKAFVC 1202362-002 039 1202362-002 039 NA [[1]] #A tibble:620x4 DataName`Technischer Platz…4``Technischer Platz…5``Technischer Platz…307` 1 WrW_SAPP17_VIAUFKAFVC 1202362-001 1202362-001 NA 2 WrW_SAPP17_VIAUFKAFVC 1202362-002 037 1202362-002 037 NA 3 WrW_SAPP17_VIAUFKAFVC 1202362-011 1202362-011 NA 4 WrW_SAPP17_VIAUFKAFVC 1202362 1202362 NA 5 WrW_SAPP17_VIAUFKAFVC 1202362-004 052 1202362-004 052 NA 6 WrW_SAPP17_VIAUFKAFVC 1202362-018 005 1202362-018 005 NA 7 WrW_SAPP17_VIAUFKAFVC 1202362-017 1202362-017 NA 8 WrW_SAPP17_VIAUFKAFVC 1202362-012 1202362-012 NA 9 WrW_SAPP17_VIAUFKAFVC 1202362-002 1202362-002 NA 10 WrW_SAPP17_VIAUFKAFVC 1202362-002 039 1202362-002 039 NA_R_Purrr_Tibble - Fatal编程技术网

使用mutate和purrr';s地图 如何在列表中的TIBLE中添加列 数据如下所示,我只想在末尾添加一列,检查第2列是否与第3列相同 [[1]] # A tibble: 620 x 4 DataName `Technischer Platz...4` `Technischer Platz...5` `Technischer Platz...307` <chr> <chr> <chr> <lgl> 1 WrW_SAPP17_VIAUFKAFVC 1202362-001 1202362-001 NA 2 WrW_SAPP17_VIAUFKAFVC 1202362-002 037 1202362-002 037 NA 3 WrW_SAPP17_VIAUFKAFVC 1202362-011 1202362-011 NA 4 WrW_SAPP17_VIAUFKAFVC 1202362 1202362 NA 5 WrW_SAPP17_VIAUFKAFVC 1202362-004 052 1202362-004 052 NA 6 WrW_SAPP17_VIAUFKAFVC 1202362-018 005 1202362-018 005 NA 7 WrW_SAPP17_VIAUFKAFVC 1202362-017 1202362-017 NA 8 WrW_SAPP17_VIAUFKAFVC 1202362-012 1202362-012 NA 9 WrW_SAPP17_VIAUFKAFVC 1202362-002 002 1202362-002 002 NA 10 WrW_SAPP17_VIAUFKAFVC 1202362-002 039 1202362-002 039 NA [[1]] #A tibble:620x4 DataName`Technischer Platz…4``Technischer Platz…5``Technischer Platz…307` 1 WrW_SAPP17_VIAUFKAFVC 1202362-001 1202362-001 NA 2 WrW_SAPP17_VIAUFKAFVC 1202362-002 037 1202362-002 037 NA 3 WrW_SAPP17_VIAUFKAFVC 1202362-011 1202362-011 NA 4 WrW_SAPP17_VIAUFKAFVC 1202362 1202362 NA 5 WrW_SAPP17_VIAUFKAFVC 1202362-004 052 1202362-004 052 NA 6 WrW_SAPP17_VIAUFKAFVC 1202362-018 005 1202362-018 005 NA 7 WrW_SAPP17_VIAUFKAFVC 1202362-017 1202362-017 NA 8 WrW_SAPP17_VIAUFKAFVC 1202362-012 1202362-012 NA 9 WrW_SAPP17_VIAUFKAFVC 1202362-002 1202362-002 NA 10 WrW_SAPP17_VIAUFKAFVC 1202362-002 039 1202362-002 039 NA

使用mutate和purrr';s地图 如何在列表中的TIBLE中添加列 数据如下所示,我只想在末尾添加一列,检查第2列是否与第3列相同 [[1]] # A tibble: 620 x 4 DataName `Technischer Platz...4` `Technischer Platz...5` `Technischer Platz...307` <chr> <chr> <chr> <lgl> 1 WrW_SAPP17_VIAUFKAFVC 1202362-001 1202362-001 NA 2 WrW_SAPP17_VIAUFKAFVC 1202362-002 037 1202362-002 037 NA 3 WrW_SAPP17_VIAUFKAFVC 1202362-011 1202362-011 NA 4 WrW_SAPP17_VIAUFKAFVC 1202362 1202362 NA 5 WrW_SAPP17_VIAUFKAFVC 1202362-004 052 1202362-004 052 NA 6 WrW_SAPP17_VIAUFKAFVC 1202362-018 005 1202362-018 005 NA 7 WrW_SAPP17_VIAUFKAFVC 1202362-017 1202362-017 NA 8 WrW_SAPP17_VIAUFKAFVC 1202362-012 1202362-012 NA 9 WrW_SAPP17_VIAUFKAFVC 1202362-002 002 1202362-002 002 NA 10 WrW_SAPP17_VIAUFKAFVC 1202362-002 039 1202362-002 039 NA [[1]] #A tibble:620x4 DataName`Technischer Platz…4``Technischer Platz…5``Technischer Platz…307` 1 WrW_SAPP17_VIAUFKAFVC 1202362-001 1202362-001 NA 2 WrW_SAPP17_VIAUFKAFVC 1202362-002 037 1202362-002 037 NA 3 WrW_SAPP17_VIAUFKAFVC 1202362-011 1202362-011 NA 4 WrW_SAPP17_VIAUFKAFVC 1202362 1202362 NA 5 WrW_SAPP17_VIAUFKAFVC 1202362-004 052 1202362-004 052 NA 6 WrW_SAPP17_VIAUFKAFVC 1202362-018 005 1202362-018 005 NA 7 WrW_SAPP17_VIAUFKAFVC 1202362-017 1202362-017 NA 8 WrW_SAPP17_VIAUFKAFVC 1202362-012 1202362-012 NA 9 WrW_SAPP17_VIAUFKAFVC 1202362-002 1202362-002 NA 10 WrW_SAPP17_VIAUFKAFVC 1202362-002 039 1202362-002 039 NA,r,purrr,tibble,R,Purrr,Tibble,我们可以使用: library(dplyr) library(purrr) list_df <- map(list_df, ~.x %>% mutate(is_2_same_as_3 = `Technischer Platz...4` == `Technischer Platz...5`)) 让我们用一个更简单的例子 库(tidyverse) 本田#A tibble:3 x 4 #>品牌显示hp检查 #> #>1本田3 3真实 #>2本田8

我们可以使用:

library(dplyr)
library(purrr)

list_df <- map(list_df, ~.x %>% 
            mutate(is_2_same_as_3 = `Technischer Platz...4` == `Technischer Platz...5`))

让我们用一个更简单的例子

库(tidyverse)
本田#A tibble:3 x 4
#>品牌显示hp检查
#>      
#>1本田3 3真实
#>2本田8 90假
#>3本田20 115虚假
#> 
#> [[2]]
#>#tibble:3 x 4
#>品牌显示hp检查
#>      
#>1.3.3正确
#>2.8 34错误
#>3沃尔沃20 115错误

由(v1.0.0)于2021-02-18创建

非常感谢您的快速响应。
list_df <- map(list_df, ~.x %>% 
                          mutate(is_2_same_as_3 = .[[2]] == .[[3]]))
list_df <- lapply(list_df, function(x) transform(x, is_2_same_as_3 = `Technischer Platz...4` == `Technischer Platz...5`))
list_df <- lapply(list_df, function(x) transform(x, is_2_same_as_3 = x[[2]] == x[[3]]))