Я сомневаюсь, что есть предел.Работает с созданием как минимум 1000 новых столбцов:
# Attach the dplyr package for tibble() and mutate()
library(dplyr)
# Create a dummy tibble
example_data <- tibble(x = 1:100)
# We'll do the mutate call by creating a text string and using eval()
# (saves some typing)
call_text <- paste(paste0("x", 1:1000, " = x * ", 1:1000), collapse = ", ")
call_text <- paste0("example_data %>% mutate(", call_text, ")")
# Sanity check on the call:
substr(call_text, 1, 60)
# [1] "example_data %>% mutate(x1 = x * 1, x2 = x * 2, x3 = x * 3, " # looks OK
example_data <- eval(parse(text = call_text))
# Examine the result
example_data
# A tibble: 100 x 1,001
x x1 x2 x3 x4 x5 x6 x7 x8 x9 x10 x11 x12
<int> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
1 1 1 2 3 4 5 6 7 8 9 10 11 12
2 2 2 4 6 8 10 12 14 16 18 20 22 24
3 3 3 6 9 12 15 18 21 24 27 30 33 36
4 4 4 8 12 16 20 24 28 32 36 40 44 48
5 5 5 10 15 20 25 30 35 40 45 50 55 60
6 6 6 12 18 24 30 36 42 48 54 60 66 72
7 7 7 14 21 28 35 42 49 56 63 70 77 84
8 8 8 16 24 32 40 48 56 64 72 80 88 96
9 9 9 18 27 36 45 54 63 72 81 90 99 108
10 10 10 20 30 40 50 60 70 80 90 100 110 120
# … with 90 more rows, and 988 more variables: x13 <dbl>, x14 <dbl>, x15 <dbl>,
# x16 <dbl>, x17 <dbl>, x18 <dbl>, x19 <dbl>, x20 <dbl>, x21 <dbl>, x22 <dbl>,
# x23 <dbl>, x24 <dbl>, x25 <dbl>, x26 <dbl>, x27 <dbl>, x28 <dbl>, x29 <dbl>,
# x30 <dbl>, x31 <dbl>, x32 <dbl>, x33 <dbl>, x34 <dbl>, x35 <dbl>, x36 <dbl>,
# x37 <dbl>, x38 <dbl>, x39 <dbl>, x40 <dbl>, x41 <dbl>, x42 <dbl>, x43 <dbl>,
# x44 <dbl>, x45 <dbl>, x46 <dbl>, x47 <dbl>, x48 <dbl>, x49 <dbl>, x50 <dbl>,
# x51 <dbl>, x52 <dbl>, x53 <dbl>, x54 <dbl>, x55 <dbl>, x56 <dbl>, x57 <dbl>,
# x58 <dbl>, x59 <dbl>, x60 <dbl>, x61 <dbl>, x62 <dbl>, x63 <dbl>, x64 <dbl>,
# x65 <dbl>, x66 <dbl>, x67 <dbl>, x68 <dbl>, x69 <dbl>, x70 <dbl>, x71 <dbl>,
# x72 <dbl>, x73 <dbl>, x74 <dbl>, x75 <dbl>, x76 <dbl>, x77 <dbl>, x78 <dbl>,
# x79 <dbl>, x80 <dbl>, x81 <dbl>, x82 <dbl>, x83 <dbl>, x84 <dbl>, x85 <dbl>,
# x86 <dbl>, x87 <dbl>, x88 <dbl>, x89 <dbl>, x90 <dbl>, x91 <dbl>, x92 <dbl>,
# x93 <dbl>, x94 <dbl>, x95 <dbl>, x96 <dbl>, x97 <dbl>, x98 <dbl>, x99 <dbl>,
# x100 <dbl>, x101 <dbl>, x102 <dbl>, x103 <dbl>, x104 <dbl>, x105 <dbl>,
# x106 <dbl>, x107 <dbl>, x108 <dbl>, x109 <dbl>, x110 <dbl>, x111 <dbl>,
# x112 <dbl>, …