Имя переменной lme4 не отображается в цикле for при использовании get (i) - PullRequest
0 голосов
/ 11 марта 2019

После моего предыдущего вопроса о циклах (нажмите здесь, чтобы увидеть его) , у меня теперь еще одно сомнение: я пытаюсь запустить более мелкие модели нескольких ответов в цикле.Набор данных тот же, что и в моем предыдущем примере (и опять же, фактический содержит гораздо больше переменных).Итак, вот что я произвел:

library(dplyr)
library(purrr)
library(lme4)


lmer_test_list <- test2[c("IA_DWELL_TIME", "IA_MEAN_FIXATION_DURATION", "IA_FIRST_FIXATION_DURATION")] %>% colnames() %>% set_names(.,.)

Lmer_test_FN <- function(test2, na.rm = TRUE, ...){

  for (i in lmer_test_list) {
    # create plot for each text in paired dataset 

    model <- lmer(log(get(i)) ~ Modified +
           Position_line +
           Page +
           Trial +
           (1|Text) +
           (1|Participant),
         data = test2,
         REML=FALSE) %>%
      summary() %>%
      print()

    assign(paste(lmer_test_list[i], "_lmer", sep = ""), model) %>%
      summary() %>%
      print()

  }
}

Lmer_test_FN(test2)

Мне удалось, чтобы цикл работал идеально, с единственной проблемой, что мое имя переменной отображается в сводке, а печать выводится как «get (i)», что означаетЯ не знаю, какой из них я смотрю.

    Linear mixed model fit by maximum likelihood . t-tests use Satterthwaite's method ['lmerModLmerTest']
Formula: log(get(i)) ~ Modified + Position_line + Page + Trial + (1 |      Text) + (1 | Participant)
   Data: test2

есть идеи, как сохранить имя переменной?Кроме того, как вы могли заметить, я пытался сохранить свою модель в среде с помощью функции assign, которая тоже не работала.

В соответствии с просьбой, я добавляю сюда небольшой воспроизводимый пример моего набора данных:

test2 <- structure(list(Modified = structure(c(2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 
2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2L, 2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L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 
    6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L, 6L), .Label = c("1", 
    "2", "3", "4", "5", "6", "7", "8"), class = "factor"), Participant = structure(c(1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 
    1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 1L, 58L, 58L, 58L, 58L, 58L, 
    58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 
    58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 
    58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 
    58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 
    58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 
    58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 
    58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 
    58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L, 58L
    ), .Label = c("101", "102", "103", "104", "105", "106", "107", 
    "108", "109", "110", "111", "113", "114", "115", "116", "117", 
    "118", "119", "120", "121", "122", "123", "124", "125", "126", 
    "127", "128", "129", "130", "201", "202", "203", "204", "205", 
    "206", "207", "208", "209", "210", "211", "212", "213", "214", 
    "215", "216", "217", "218", "219", "220", "221", "222", "224", 
    "225", "226", "227", "228", "229", "230"), class = "factor"), 
    IA_LABEL = c("Dear", "Clarissa", "exclaimed", "Mrs", "Hilbery", 
    "you", "look", "to-night", "so", "like", "your", "mother", 
    "as", "I", "first", "saw", "her", "walking", "in", "a", "garden", 
    "in", "a", "grey", "hat", "she", "said", "And", "Clarissas", 
    "eyes", "filled", "with", "tears", "My", "mother", "walking", 
    "in", "a", "garden", "But", "alas", "I", "must", "go", "There", 
    "was", "Professor", "Brierly", "who", "lectured", "on", "Milton", 
    "talking", "to", "little", "Jim", "Hutton", "He", "is", "unable", 
    "even", "for", "a", "party", "like", "this", "to", "compass", 
    "both", "tie", "and", "waistcoat", "or", "make", "his", "hair", 
    "lie", "flat", "and", "even", "at", "this", "distance", "they", 
    "are", "quarrelling", "I", "can", "see", "Professor", "Brierly", 
    "is", "a", "very", "queer", "fish", "with", "all", "those", 
    "degrees", "People", "seemed", "to", "come", "in", "a", "rush", 
    "Dear", "Clarissa", "exclaimed", "Mrs", "Hilbery", "She", 
    "looked", "to-night", "she", "said", "so", "like", "her", 
    "mother", "as", "she", "first", "saw", "her", "walking", 
    "in", "a", "garden", "in", "a", "grey", "hat", "And", "Clarissas", 
    "eyes", "filled", "with", "tears", "Her", "mother", "walking", 
    "in", "a", "garden", "But", "alas", "she", "must", "go", 
    "there", "was", "Professor", "Brierly", "who", "lectured", 
    "on", "Milton", "talking", "to", "little", "Jim", "Hutton", 
    "who", "was", "unable", "even", "for", "a", "party", "like", 
    "this", "to", "compass", "both", "tie", "and", "waistcoat", 
    "or", "make", "his", "hair", "lie", "flat", "and", "even", 
    "at", "this", "distance", "they", "were", "quarrelling", 
    "she", "could", "see", "Professor", "Brierly", "was", "a", 
    "very"), Line_on_page = c(1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 
    2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 4, 4, 4, 
    4, 4, 4, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 
    6, 6, 6, 6, 6, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7, 1, 1, 1, 1, 1, 
    1, 1, 1, 1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 
    2, 2, 2, 2, 3, 3, 3, 3, 3, 4, 4, 4, 4, 4, 4, 4, 4, 4, 5, 
    5, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 6, 6, 6, 7, 7, 7, 
    7, 7, 7, 7, 7, 7, 7, 7, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 
    1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3), 
    IA_MEAN_FIXATION_DURATION = c(NaN, 241, 254.5, NaN, 281, 
    NaN, 463, 487, NaN, 315, 248, NaN, NaN, 293, 270.666666666667, 
    NaN, 271, NaN, NaN, NaN, NaN, NaN, NaN, NaN, 504, 264, NaN, 
    NaN, 236, 342, 209, NaN, 196, NaN, 148, 294, NaN, NaN, NaN, 
    150, 387, NaN, 213, NaN, 479, 204, 280.666666666667, 295.5, 
    225, 291, NaN, 321, 341, NaN, 269.5, NaN, 348, NaN, NaN, 
    NaN, 598, 298, NaN, 105, 250, 190, NaN, 459, 333, NaN, NaN, 
    233, NaN, 285, NaN, 319, NaN, 224, 165, 272.5, NaN, NaN, 
    NaN, 179, NaN, NaN, NaN, NaN, NaN, 320, 332, NaN, 304, 305, 
    338, NaN, 359, 335, NaN, 220, 246.5, 205, NaN, 264, 203, 
    NaN, 337.666666666667, 144, 232.5, 209.5, 179, 191, NaN, 
    216, 311.666666666667, 162, 299.666666666667, 179, 498.5, 
    235.666666666667, 246, 199, 228.5, 261, 249, 284.5, 150.333333333333, 
    188, 143, 181.666666666667, 171.666666666667, NaN, 204, NaN, 
    NaN, 177.5, NaN, 192, 156, NaN, 229, 223, NaN, NaN, NaN, 
    348, NaN, 219, NaN, 150, 210, 273, 175, 230.5, 565, NaN, 
    181, NaN, 201, 199, NaN, 291.666666666667, NaN, 201, 205.5, 
    156, 253, 178, NaN, 494, 215, 533, 229, 228, 188.333333333333, 
    238.666666666667, 181.5, NaN, 237.666666666667, NaN, 245, 
    184, 252, NaN, NaN, 153, 221, NaN, 287.5, 156, NaN, 186, 
    264, 268, 470.5, NaN, 228.5, 166, 231, NaN, 284), IA_DWELL_TIME = c(NA, 
    241, 509, NA, 281, NA, 463, 487, NA, 315, 248, NA, NA, 293, 
    812, NA, 271, NA, NA, NA, NA, NA, NA, NA, 504, 264, NA, NA, 
    236, 342, 209, NA, 196, NA, 148, 294, NA, NA, NA, 150, 387, 
    NA, 213, NA, 479, 204, 842, 591, 225, 291, NA, 321, 341, 
    NA, 539, NA, 696, NA, NA, NA, 598, 298, NA, 105, 250, 190, 
    NA, 459, 333, NA, NA, 233, NA, 285, NA, 319, NA, 224, 165, 
    545, NA, NA, NA, 179, NA, NA, NA, NA, NA, 320, 332, NA, 304, 
    305, 338, NA, 359, 335, NA, 220, 493, 205, NA, 264, 203, 
    NA, 1013, 144, 465, 419, 179, 715, NA, 1277, 1323, 162, 1539, 
    179, 997, 707, 492, 199, 457, 951, 249, 569, 843, 188, 143, 
    952, 515, NA, 408, NA, NA, 355, NA, 384, 156, NA, 229, 223, 
    NA, NA, NA, 348, NA, 219, NA, 150, 210, 819, 175, 461, 565, 
    NA, 362, NA, 402, 398, NA, 875, NA, 201, 411, 156, 253, 534, 
    NA, 988, 215, 533, 458, 456, 565, 716, 363, NA, 713, NA, 
    245, 184, 252, NA, NA, 153, 221, NA, 575, 156, NA, 186, 264, 
    268, 941, NA, 457, 166, 231, NA, 852), IA_FIRST_FIXATION_DURATION = c(NA, 
    241, 258, NA, 281, NA, 463, 487, NA, 315, 248, NA, NA, 293, 
    175, NA, 271, NA, NA, NA, NA, NA, NA, NA, 504, 264, NA, NA, 
    236, 342, 209, NA, 196, NA, 148, 294, NA, NA, NA, 150, 387, 
    NA, 213, NA, 479, 204, 191, 345, 225, 291, NA, 321, 341, 
    NA, 274, NA, 425, NA, NA, NA, 598, 298, NA, 105, 250, 190, 
    NA, 459, 333, NA, NA, 233, NA, 285, NA, 319, NA, 224, 165, 
    241, NA, NA, NA, 179, NA, NA, NA, NA, NA, 320, 332, NA, 304, 
    305, 338, NA, 359, 335, NA, 220, 293, 205, NA, 264, 203, 
    NA, 527, 144, 225, 224, 179, 163, NA, 181, 183, 162, 292, 
    179, 600, 253, 194, 199, 209, 449, 249, 346, 143, 188, 143, 
    171, 164, NA, 236, NA, NA, 194, NA, 184, 156, NA, 229, 223, 
    NA, NA, NA, 348, NA, 219, NA, 150, 210, 145, 175, 204, 565, 
    NA, 203, NA, 225, 196, NA, 435, NA, 201, 226, 156, 253, 166, 
    NA, 493, 215, 533, 263, 215, 183, 332, 185, NA, 178, NA, 
    245, 184, 252, NA, NA, 153, 221, NA, 418, 156, NA, 186, 264, 
    268, 373, NA, 273, 166, 231, NA, 216)), row.names = c(NA, 
-201L), groups = structure(list(Text = structure(c(5L, 6L, 6L
), .Label = c("1", "2", "3", "4", "5", "6", "7", "8"), class = "factor"), 
    Modified = structure(c(1L, 1L, 2L), .Label = c("Original", 
    "Modified"), class = "factor"), .rows = list(101:107, 108:201, 
        1:100)), row.names = c(NA, -3L), class = c("tbl_df", 
"tbl", "data.frame"), .drop = TRUE), class = c("grouped_df", 
"tbl_df", "tbl", "data.frame"))

1 Ответ

0 голосов
/ 12 марта 2019

Чтобы получить правильные имена в формуле, вам следует избегать get() и фактически построить правильный объект формулы.Вы можете использовать bquote() для вставки имен символов (созданных из символов) в выражения.Здесь мы изменяем функцию на использование lapply, чтобы возвращать список моделей

Lmer_test_FN <- function(test2, na.rm = TRUE, ...){
  lapply(lmer_test_list, function(i) {
    model_formula <- bquote(log(.(as.name(i))) ~ Modified +
                  Position_line +
                  Page +
                  Trial +
                  (1|Text) +
                  (1|Participant))
    lmer(model_formula, data = test2, REML=FALSE)
  })
}
models <- Lmer_test_FN(test2)

Затем, если вы хотите просмотреть сводку моделей, вы можете просто применить сводку к этому списку

lapply(models, summary)

Как правило, не стоит создавать группу переменных в R в вашем глобальном пространстве имен, содержащую данные в своих именах.Все проще, если вы работаете с именованными списками.Вы можете извлечь отдельные модели, используя индексирование

models[[1]]
models$IA_DWELL_TIME
...