Importando dados no R

  install.packages("readxl")

Como trazer um arquivo para o R

#   setwd("~/Dropbox (Personal)/AF_SEM/exercicios_2019")
  
  library(readxl)
  bd_sal_senna <- read_excel("bd_sal_senna.xlsx", sheet = "ex2")
  
  library(haven)
  bd_ie <-read_sav("ex1_ie_bpr_16pf_avdes.sav")
  save.image(file = "ex2.RData")
  load("ex2.RData")

Estrutura de dados (objetos) no R

Estruturas de dados no R

Estruturas de dados no R

Explorando os dados nos objetos

  names(bd_ie)
##  [1] "id"       "idade"    "sexo"     "ai_br"    "nf_br"    "aq_br"   
##  [7] "a_br"     "b_br"     "c_br"     "e_br"     "f_br"     "g_br"    
## [13] "h_br"     "i_br"     "l_br"     "m_br"     "n_br"     "o_br"    
## [19] "q1_br"    "q2_br"    "q3_br"    "q4_br"    "fatoe_i"  "fator_ii"
## [25] "fato_iii" "fator_iv" "fator_v"  "ra"       "rv"       "rm"      
## [31] "re"       "rn"       "eg"       "epn_ra"   "epn_rv"   "epn_rm"  
## [37] "epn_re"   "epn_rn"   "epn_eg"   "av_des1"  "av_des2"  "av_des"  
## [43] "etnia"    "percep"   "usofaci"  "conemo"   "regemo"   "experi"  
## [49] "etrateg"  "ie1"      "ie2"      "ie"       "ra_1"     "rv_1"    
## [55] "rm_1"     "re_1"     "rn_1"     "faces"    "paisag"   "facilit" 
## [61] "sensa"    "transi"   "mistur"   "gerenc"   "relac"
  names(bd_sal_senna)
##  [1] "...1"             "banco"            "cod_suj"         
##  [4] "Data de sc."      "data.aplic"       "Idade0"          
##  [7] "idade1"           "Termo"            "sujeito"         
## [10] "serie"            "escola"           "turma"           
## [13] "Sexo"             "Esc. M√£e"        "port"            
## [16] "mat"              "cloze"            "A_o"             
## [19] "C_o"              "E_o"              "N_o"             
## [22] "O_o"              "A_c"              "C_c"             
## [25] "E_c"              "N_c"              "O_c"             
## [28] "antonym.rc"       "antonym.cntrst_A" "antonym.cntrst_C"
## [31] "antonym.cntrst_E" "antonym.cntrst_N" "antonym.cntrst_O"
## [34] "mean_A"           "mean_C"           "mean_E"          
## [37] "mean_N"           "mean_O"           "sd_A"            
## [40] "sd_C"             "sd_E"             "sd_N"            
## [43] "sd_O"             "antonym.rc_A"     "antonym.rc_C"    
## [46] "antonym.rc_E"     "antonym.rc_N"     "antonym.rc_O"    
## [49] "nse"              "A_1_o"            "C_1_o"           
## [52] "E_1_o"            "N_1_o"            "O_1_o"           
## [55] "A_1_c"            "C_1_c"            "E_1_c"           
## [58] "N_1_c"            "O_1_c"            "A_0_o"           
## [61] "C_0_o"            "E_0_o"            "N_0_o"           
## [64] "O_0_o"            "A_0_c"            "C_0_c"           
## [67] "E_0_c"            "N_0_c"            "O_0_c"           
## [70] "cexp_o"           "comlrn_o"         "coplrn_o"        
## [73] "cstrat_o"         "effper_o"         "elab_o"          
## [76] "insmot_o"         "intmat_o"         "intrea_o"        
## [79] "memor_o"          "scacad_o"         "scmath_o"        
## [82] "scverb_o"         "selfef_o"         "cexp_c"          
## [85] "comlrn_c"         "coplrn_c"         "cstrat_c"        
## [88] "effper_c"         "elab_c"           "insmot_c"        
## [91] "intmat_c"         "intrea_c"         "memor_c"         
## [94] "scacad_c"         "scmath_c"         "scverb_c"        
## [97] "selfef_c"         "means"            "sd"
        str(bd_ie)
## Classes 'tbl_df', 'tbl' and 'data.frame':    159 obs. of  65 variables:
##  $ id      : chr  "a001" "a002" "a003" "a004" ...
##   ..- attr(*, "format.spss")= chr "A5"
##   ..- attr(*, "display_width")= int 4
##  $ idade   : num  46 49 NA 38 42 36 31 52 39 NA ...
##   ..- attr(*, "label")= chr "Questionário de Identificação - idade"
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ sexo    : 'haven_labelled' num  1 1 2 1 1 1 1 1 1 1 ...
##   ..- attr(*, "label")= chr "sexo"
##   ..- attr(*, "format.spss")= chr "F11.0"
##   ..- attr(*, "labels")= Named num  1 2
##   .. ..- attr(*, "names")= chr  "masculino" "feminino"
##  $ ai_br   : num  14 11 12 13 12 20 18 13 14 14 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ nf_br   : num  7 11 0 3 0 0 0 0 0 0 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ aq_br   : num  44 47 57 49 50 49 69 60 55 54 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ a_br    : num  13 15 20 12 10 12 12 15 8 18 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ b_br    : num  5 5 7 8 5 5 11 6 11 9 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ c_br    : num  12 10 5 11 18 20 16 15 14 12 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ e_br    : num  18 14 13 14 10 18 14 14 14 14 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ f_br    : num  5 4 12 7 4 4 18 11 10 12 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ g_br    : num  17 17 18 22 14 18 20 20 20 20 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ h_br    : num  12 5 18 4 18 20 18 12 14 16 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ i_br    : num  9 7 15 7 7 8 8 9 7 14 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ l_br    : num  7 15 13 15 10 8 14 17 14 8 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ m_br    : num  4 10 6 6 4 2 8 5 8 6 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ n_br    : num  16 11 11 11 16 14 16 14 18 2 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ o_br    : num  10 14 14 17 6 8 16 14 8 14 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ q1_br   : num  16 17 23 16 6 24 16 12 24 22 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ q2_br   : num  4 4 3 6 2 2 2 2 12 2 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ q3_br   : num  15 16 14 14 12 18 20 18 16 18 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ q4_br   : num  11 11 14 13 6 12 12 8 14 12 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ fatoe_i : num  4.1 4.6 7.5 4.1 4.5 5.3 6.6 5.9 2.8 8.2 ...
##   ..- attr(*, "format.spss")= chr "F11.1"
##  $ fator_ii: num  3.5 6.2 7.1 7 1.3 1.8 5.4 5.3 4.6 4.6 ...
##   ..- attr(*, "format.spss")= chr "F11.1"
##  $ fato_iii: num  7.1 6.3 3.3 7.8 10 6.1 7.5 7.4 5.9 4.2 ...
##   ..- attr(*, "format.spss")= chr "F11.1"
##  $ fator_iv: num  6.1 5.6 6.9 5 3.5 8.4 6.5 5.8 7.4 6.3 ...
##   ..- attr(*, "format.spss")= chr "F11.1"
##  $ fator_v : num  7.45 6.85 6.85 8.05 6.65 8.95 7.95 8.65 7.55 8.45 ...
##   ..- attr(*, "format.spss")= chr "F11.2"
##  $ ra      : num  8 6 14 11 13 12 17 13 17 20 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ rv      : num  9 12 14 11 18 19 17 12 21 21 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ rm      : num  9 5 10 14 11 8 11 10 17 10 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ re      : num  7 1 10 5 7 10 16 3 13 8 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ rn      : num  4 5 6 11 12 13 14 7 7 13 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ eg      : num  37 29 54 52 61 62 75 45 75 72 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ epn_ra  : num  72 68 82 74 79 78 94 79 94 109 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ epn_rv  : num  72 79 85 77 99 105 95 79 117 117 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ epn_rm  : num  90 76 93 104 96 88 96 93 112 93 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ epn_re  : num  80 64 88 74 80 88 107 65 96 84 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ epn_rn  : num  75 78 81 93 96 98 103 83 83 98 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ epn_eg  : num  72 63 81 80 87 87 96 75 96 95 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##  $ av_des1 : num  4.5 2.2 4.5 4.1 2.9 5 3.4 3.3 5 4 ...
##   ..- attr(*, "format.spss")= chr "F8.2"
##  $ av_des2 : num  3.1 4.1 5.1 2.8 4.6 3.8 3.5 4 3.8 4.5 ...
##   ..- attr(*, "format.spss")= chr "F8.2"
##  $ av_des  : num  3.8 3.15 4.8 3.45 3.75 4.4 3.45 3.65 4.4 4.25 ...
##   ..- attr(*, "format.spss")= chr "F8.2"
##  $ etnia   : num  NA NA 2 1 NA 1 1 3 1 1 ...
##   ..- attr(*, "format.spss")= chr "F6.0"
##   ..- attr(*, "display_width")= int 6
##  $ percep  : num  21.4 26.5 40.4 33.9 40.8 ...
##   ..- attr(*, "format.spss")= chr "F8.2"
##  $ usofaci : num  18.2 21.2 26.3 33.5 37.4 ...
##   ..- attr(*, "format.spss")= chr "F8.2"
##  $ conemo  : num  35.4 29 38.3 31.6 38.4 ...
##   ..- attr(*, "format.spss")= chr "F8.2"
##  $ regemo  : num  39.8 15.4 43.9 37 49.1 ...
##   ..- attr(*, "format.spss")= chr "F8.2"
##  $ experi  : num  19.8 23.9 33.4 33.7 39.1 ...
##   ..- attr(*, "format.spss")= chr "F8.2"
##  $ etrateg : num  37.6 22.2 41.1 34.3 43.7 ...
##   ..- attr(*, "format.spss")= chr "F8.2"
##  $ ie1     : num  31.7 30.2 36 33 43.5 ...
##   ..- attr(*, "format.spss")= chr "F8.2"
##  $ ie2     : num  25.7 15.8 38.4 35 39.3 ...
##   ..- attr(*, "format.spss")= chr "F8.2"
##  $ ie      : num  28.7 23 37.2 34 41.4 ...
##   ..- attr(*, "format.spss")= chr "F8.2"
##  $ ra_1    : num  8 6 14 11 13 12 17 13 17 20 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##   ..- attr(*, "display_width")= int 13
##  $ rv_1    : num  9 12 14 11 18 19 17 12 21 21 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##   ..- attr(*, "display_width")= int 13
##  $ rm_1    : num  9 5 10 14 11 8 11 10 17 10 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##   ..- attr(*, "display_width")= int 13
##  $ re_1    : num  7 1 10 5 7 10 16 3 13 8 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##   ..- attr(*, "display_width")= int 13
##  $ rn_1    : num  4 5 6 11 12 13 14 7 7 13 ...
##   ..- attr(*, "format.spss")= chr "F11.0"
##   ..- attr(*, "display_width")= int 13
##  $ faces   : num  27.1 38.3 39.7 24 29.7 ...
##   ..- attr(*, "format.spss")= chr "F8.2"
##   ..- attr(*, "display_width")= int 10
##  $ paisag  : num  15.7 14.8 41.1 43.8 51.9 ...
##   ..- attr(*, "format.spss")= chr "F8.2"
##   ..- attr(*, "display_width")= int 10
##  $ facilit : num  25.1 24.8 17.7 31.3 47.8 ...
##   ..- attr(*, "format.spss")= chr "F8.2"
##   ..- attr(*, "display_width")= int 10
##  $ sensa   : num  11.2 17.6 34.9 35.6 26.9 ...
##   ..- attr(*, "format.spss")= chr "F8.2"
##   ..- attr(*, "display_width")= int 10
##  $ transi  : num  38.3 38.5 37.7 39.1 46.6 ...
##   ..- attr(*, "format.spss")= chr "F8.2"
##   ..- attr(*, "display_width")= int 10
##  $ mistur  : num  32.4 19.5 38.9 24.2 30.2 ...
##   ..- attr(*, "format.spss")= chr "F8.2"
##   ..- attr(*, "display_width")= int 10
##  $ gerenc  : num  36.2 19.4 49 37.6 50.1 ...
##   ..- attr(*, "format.spss")= chr "F8.2"
##   ..- attr(*, "display_width")= int 10
##  $ relac   : num  43.4 11.4 38.8 36.3 48.1 ...
##   ..- attr(*, "label")= chr "SMEAN(relac)"
##   ..- attr(*, "format.spss")= chr "F8.2"
##   ..- attr(*, "display_width")= int 10
        str(bd_sal_senna)
## Classes 'tbl_df', 'tbl' and 'data.frame':    168 obs. of  99 variables:
##  $ ...1            : num  1 2 3 4 5 6 7 8 9 10 ...
##  $ banco           : chr  "josi" "josi" "josi" "josi" ...
##  $ cod_suj         : num  1 2 3 4 5 6 7 8 9 10 ...
##  $ Data de sc.     : POSIXct, format: "2002-11-09" NA ...
##  $ data.aplic      : POSIXct, format: "2016-07-01" "2016-07-01" ...
##  $ Idade0          : num  13.6 NA 14.2 14.4 14.1 ...
##  $ idade1          : num  14 NA 14 14 14 15 14 14 14 14 ...
##  $ Termo           : num  0 1 1 0 0 0 0 0 1 0 ...
##  $ sujeito         : num  47 48 49 50 51 52 53 54 55 56 ...
##  $ serie           : num  9 9 9 9 9 9 9 9 9 9 ...
##  $ escola          : num  0 0 0 0 0 0 0 0 0 0 ...
##  $ turma           : num  91 91 91 91 91 91 91 91 91 91 ...
##  $ Sexo            : num  2 2 1 1 1 1 2 1 2 2 ...
##  $ Esc. M√£e       : num  NA 6 6 1 4 5 6 6 3 3 ...
##  $ port            : num  35 50 65 65 30 80 55 25 80 70 ...
##  $ mat             : num  40 30 80 45 55 65 35 45 75 85 ...
##  $ cloze           : num  NA NA NA NA NA NA NA NA NA NA ...
##  $ A_o             : num  2.3 3.18 3.18 3 4.45 ...
##  $ C_o             : num  2.36 2.45 3.09 3.18 3.09 ...
##  $ E_o             : num  3 2.82 2.91 3.27 4.27 ...
##  $ N_o             : num  2.67 2.92 3.33 3 2.67 ...
##  $ O_o             : num  2.27 2.08 2.83 2.92 3.42 ...
##  $ A_c             : num  -0.156 0.402 0.378 0.147 1.577 ...
##  $ C_c             : num  -0.204 -0.325 0.287 0.329 0.213 ...
##  $ E_c             : num  0.3091 -0.0245 0.049 0.3776 1.3601 ...
##  $ N_c             : num  -0.1067 0.0321 0.4359 0.0769 -0.2692 ...
##  $ O_c             : num  -0.2945 -0.6859 0.0385 0.0705 0.5449 ...
##  $ antonym.rc      : num  0.471 0.294 0.53 -0.385 -0.651 ...
##  $ antonym.cntrst_A: num  NA 0.302 0.577 0.707 0.98 ...
##  $ antonym.cntrst_C: num  -0.302 -0.577 0.577 1 -0.707 ...
##  $ antonym.cntrst_E: num  0 0 -0.218 0.243 0.742 ...
##  $ antonym.cntrst_N: num  -0.405 -0.152 0.801 0.5 -0.729 ...
##  $ antonym.cntrst_O: num  0 -0.457 -0.577 0.577 0.816 ...
##  $ mean_A          : num  2 2.25 2.5 3 2.75 3 2.75 4 3 3 ...
##  $ mean_C          : num  2.75 4.25 2.75 2.5 3 3 3.25 1.25 2.5 4.25 ...
##  $ mean_E          : num  3 2.67 3.5 3.17 2.83 ...
##  $ mean_N          : num  2.12 2.25 2.12 2.5 2.62 ...
##  $ mean_O          : num  1.5 2.25 2.75 2.75 3 ...
##  $ sd_A            : num  0 0.957 1 0.816 2.062 ...
##  $ sd_C            : num  0.957 1.5 0.5 0.577 0.816 ...
##  $ sd_E            : num  1.095 1.862 0.837 0.753 1.722 ...
##  $ sd_N            : num  0.991 1.753 0.835 0.535 0.916 ...
##  $ sd_O            : num  0.577 1.893 0.5 0.5 1.414 ...
##  $ antonym.rc_A    : num  1 1 NA -1 -0.949 ...
##  $ antonym.rc_C    : num  0.707 0.316 NA NA 0 ...
##  $ antonym.rc_E    : num  NA 1 1 -0.707 -0.68 ...
##  $ antonym.rc_N    : num  0.167 -0.316 0.632 0 -0.289 ...
##  $ antonym.rc_O    : num  1 0.316 NA NA -0.707 ...
##  $ nse             : num  1.33 1.73 2.27 1.55 1.78 ...
##  $ A_1_o           : num  2 2.4 2.8 2.6 4.2 3.6 3 3.8 4.2 3.8 ...
##  $ C_1_o           : num  2.4 2.4 3 3 3.6 3.6 2.6 3.8 4 3.6 ...
##  $ E_1_o           : num  2.8 2.2 3 3.2 4 3.2 4 2.8 3.4 3.2 ...
##  $ N_1_o           : num  2.6 3 2.8 2.4 2.6 2.8 1.8 3.4 2.6 1 ...
##  $ O_1_o           : num  2 2 2.6 2.8 3 3.4 1.4 2.4 3.6 3 ...
##  $ A_1_c           : num  -0.37 -0.35 0.193 -0.186 1.45 ...
##  $ C_1_c           : num  0.0296 -0.35 0.3929 0.2143 0.85 ...
##  $ E_1_c           : num  0.43 -0.55 0.393 0.414 1.25 ...
##  $ N_1_c           : num  0.23 0.25 0.193 -0.386 -0.15 ...
##  $ O_1_c           : num  -0.37037 -0.75 -0.00714 0.01429 0.25 ...
##  $ A_0_o           : num  2.6 3.83 3.5 3.33 4.67 ...
##  $ C_0_o           : num  2.33 2.5 3.17 3.33 2.67 ...
##  $ E_0_o           : num  3.17 3.33 2.83 3.33 4.5 ...
##  $ N_0_o           : num  2.71 2.86 3.71 3.43 2.71 ...
##  $ O_0_o           : num  2.43 2.14 3 3 3.71 ...
##  $ A_0_c           : num  -0.0222 0.9167 0.631 0.4048 1.75 ...
##  $ C_0_c           : num  -0.457 -0.417 0.298 0.405 -0.25 ...
##  $ E_0_c           : num  0.167 0.333 -0.167 0.333 1.5 ...
##  $ N_0_c           : num  -0.376 -0.179 0.658 0.398 -0.321 ...
##  $ O_0_c           : num  -0.3016 -0.75 0.1684 0.0918 0.8214 ...
##  $ cexp_o          : num  2 2.25 2.5 2 3.25 ...
##  $ comlrn_o        : num  3 1.5 3 3.75 4 3.75 2.25 4.25 1.5 2.25 ...
##  $ coplrn_o        : num  3.33 2 3.6 3.2 4.6 ...
##  $ cstrat_o        : num  3.25 4.2 2 2 3.4 2.4 2 3.4 4.8 3.4 ...
##  $ effper_o        : num  3.5 2.25 2.5 2.5 4.25 ...
##  $ elab_o          : num  3 2.75 2 2 2.5 3.5 4 2.5 4.25 2.5 ...
##  $ insmot_o        : num  3.5 4 4 3.33 2.67 ...
##  $ intmat_o        : num  2.67 1.33 3.33 4 4 ...
##  $ intrea_o        : num  1.33 2.33 1.67 1.33 5 ...
##  $ memor_o         : num  1.67 1.75 2.25 2 3 ...
##  $ scacad_o        : num  2 2.67 3.33 2 2.67 ...
##  $ scmath_o        : num  2.33 1 4.33 2.67 2.67 ...
##  $ scverb_o        : num  3.33 2.67 3 4.67 2.67 ...
##  $ selfef_o        : num  2.5 1.75 3 2.5 3.5 3.75 2.75 3.75 5 3.5 ...
##  $ cexp_c          : num  -0.37 -0.5 -0.107 -0.786 0.5 ...
##  $ comlrn_c        : num  0.63 -1.25 0.393 0.964 1.25 ...
##  $ coplrn_c        : num  0.963 -0.75 0.993 0.414 1.85 ...
##  $ cstrat_c        : num  0.88 1.45 -0.607 -0.786 0.65 ...
##  $ effper_c        : num  1.13 -0.5 -0.107 -0.286 1.5 ...
##  $ elab_c          : num  0.63 0 -0.607 -0.786 -0.25 ...
##  $ insmot_c        : num  1.1296 1.25 1.3929 0.5476 -0.0833 ...
##  $ intmat_c        : num  0.296 -1.417 0.726 1.214 1.25 ...
##  $ intrea_c        : num  -1.037 -0.417 -0.94 -1.452 2.25 ...
##  $ memor_c         : num  -0.704 -1 -0.357 -0.786 0.25 ...
##  $ scacad_c        : num  -0.3704 -0.0833 0.7262 -0.7857 -0.0833 ...
##  $ scmath_c        : num  -0.037 -1.75 1.7262 -0.119 -0.0833 ...
##  $ scverb_c        : num  0.543 -0.25 0.131 1.738 -0.25 ...
##  $ selfef_c        : num  0.13 -1 0.393 -0.286 0.75 ...
##  $ means           : num  2.37 2.75 2.61 2.79 2.75 ...
##  $ sd              : num  1.006 1.669 0.916 0.833 1.266 ...
    library(tidyverse)
    
    bd_ie %>% names
##  [1] "id"       "idade"    "sexo"     "ai_br"    "nf_br"    "aq_br"   
##  [7] "a_br"     "b_br"     "c_br"     "e_br"     "f_br"     "g_br"    
## [13] "h_br"     "i_br"     "l_br"     "m_br"     "n_br"     "o_br"    
## [19] "q1_br"    "q2_br"    "q3_br"    "q4_br"    "fatoe_i"  "fator_ii"
## [25] "fato_iii" "fator_iv" "fator_v"  "ra"       "rv"       "rm"      
## [31] "re"       "rn"       "eg"       "epn_ra"   "epn_rv"   "epn_rm"  
## [37] "epn_re"   "epn_rn"   "epn_eg"   "av_des1"  "av_des2"  "av_des"  
## [43] "etnia"    "percep"   "usofaci"  "conemo"   "regemo"   "experi"  
## [49] "etrateg"  "ie1"      "ie2"      "ie"       "ra_1"     "rv_1"    
## [55] "rm_1"     "re_1"     "rn_1"     "faces"    "paisag"   "facilit" 
## [61] "sensa"    "transi"   "mistur"   "gerenc"   "relac"
    vars <- names(bd_ie)
        
    vars <- bd_ie %>% names
        
    class( bd_ie )
## [1] "tbl_df"     "tbl"        "data.frame"
    class(vars)
## [1] "character"
       bd_ie
## # A tibble: 159 x 65
##    id    idade    sexo ai_br nf_br aq_br  a_br  b_br  c_br  e_br  f_br
##    <chr> <dbl> <dbl+l> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl> <dbl>
##  1 a001     46 1 [mas…    14     7    44    13     5    12    18     5
##  2 a002     49 1 [mas…    11    11    47    15     5    10    14     4
##  3 a003     NA 2 [fem…    12     0    57    20     7     5    13    12
##  4 a004     38 1 [mas…    13     3    49    12     8    11    14     7
##  5 a005     42 1 [mas…    12     0    50    10     5    18    10     4
##  6 a006     36 1 [mas…    20     0    49    12     5    20    18     4
##  7 a007     31 1 [mas…    18     0    69    12    11    16    14    18
##  8 a008     52 1 [mas…    13     0    60    15     6    15    14    11
##  9 a009     39 1 [mas…    14     0    55     8    11    14    14    10
## 10 a010     NA 1 [mas…    14     0    54    18     9    12    14    12
## # … with 149 more rows, and 54 more variables: g_br <dbl>, h_br <dbl>,
## #   i_br <dbl>, l_br <dbl>, m_br <dbl>, n_br <dbl>, o_br <dbl>,
## #   q1_br <dbl>, q2_br <dbl>, q3_br <dbl>, q4_br <dbl>, fatoe_i <dbl>,
## #   fator_ii <dbl>, fato_iii <dbl>, fator_iv <dbl>, fator_v <dbl>,
## #   ra <dbl>, rv <dbl>, rm <dbl>, re <dbl>, rn <dbl>, eg <dbl>,
## #   epn_ra <dbl>, epn_rv <dbl>, epn_rm <dbl>, epn_re <dbl>, epn_rn <dbl>,
## #   epn_eg <dbl>, av_des1 <dbl>, av_des2 <dbl>, av_des <dbl>, etnia <dbl>,
## #   percep <dbl>, usofaci <dbl>, conemo <dbl>, regemo <dbl>, experi <dbl>,
## #   etrateg <dbl>, ie1 <dbl>, ie2 <dbl>, ie <dbl>, ra_1 <dbl>, rv_1 <dbl>,
## #   rm_1 <dbl>, re_1 <dbl>, rn_1 <dbl>, faces <dbl>, paisag <dbl>,
## #   facilit <dbl>, sensa <dbl>, transi <dbl>, mistur <dbl>, gerenc <dbl>,
## #   relac <dbl>

Seleção de variáveis e observações em dataframes.

      1:6
## [1] 1 2 3 4 5 6
      c(1:6)
## [1] 1 2 3 4 5 6
      c(1, 3, 10:20)
##  [1]  1  3 10 11 12 13 14 15 16 17 18 19 20
      names(bd_ie) 
##  [1] "id"       "idade"    "sexo"     "ai_br"    "nf_br"    "aq_br"   
##  [7] "a_br"     "b_br"     "c_br"     "e_br"     "f_br"     "g_br"    
## [13] "h_br"     "i_br"     "l_br"     "m_br"     "n_br"     "o_br"    
## [19] "q1_br"    "q2_br"    "q3_br"    "q4_br"    "fatoe_i"  "fator_ii"
## [25] "fato_iii" "fator_iv" "fator_v"  "ra"       "rv"       "rm"      
## [31] "re"       "rn"       "eg"       "epn_ra"   "epn_rv"   "epn_rm"  
## [37] "epn_re"   "epn_rn"   "epn_eg"   "av_des1"  "av_des2"  "av_des"  
## [43] "etnia"    "percep"   "usofaci"  "conemo"   "regemo"   "experi"  
## [49] "etrateg"  "ie1"      "ie2"      "ie"       "ra_1"     "rv_1"    
## [55] "rm_1"     "re_1"     "rn_1"     "faces"    "paisag"   "facilit" 
## [61] "sensa"    "transi"   "mistur"   "gerenc"   "relac"
       names(bd_ie[c(1, 28:33)])
## [1] "id" "ra" "rv" "rm" "re" "rn" "eg"
      vars <- names(bd_ie[c(1, 28:33)])
      
      # Subset de variáveis
      dt <- bd_ie[ , vars]
      
      # ou com dplyr
      dt <- bd_ie %>% select(vars)
      
      # Elimina
      dt <- bd_ie[ , -1]
      
      bd_16pf <-  bd_ie %>% select(-c(28:65))
      
      # removendo da área de trabalho
      rm(dt, bd_16pf, vars)
# Seleção usando números
  names(bd_ie)
##  [1] "id"       "idade"    "sexo"     "ai_br"    "nf_br"    "aq_br"   
##  [7] "a_br"     "b_br"     "c_br"     "e_br"     "f_br"     "g_br"    
## [13] "h_br"     "i_br"     "l_br"     "m_br"     "n_br"     "o_br"    
## [19] "q1_br"    "q2_br"    "q3_br"    "q4_br"    "fatoe_i"  "fator_ii"
## [25] "fato_iii" "fator_iv" "fator_v"  "ra"       "rv"       "rm"      
## [31] "re"       "rn"       "eg"       "epn_ra"   "epn_rv"   "epn_rm"  
## [37] "epn_re"   "epn_rn"   "epn_eg"   "av_des1"  "av_des2"  "av_des"  
## [43] "etnia"    "percep"   "usofaci"  "conemo"   "regemo"   "experi"  
## [49] "etrateg"  "ie1"      "ie2"      "ie"       "ra_1"     "rv_1"    
## [55] "rm_1"     "re_1"     "rn_1"     "faces"    "paisag"   "facilit" 
## [61] "sensa"    "transi"   "mistur"   "gerenc"   "relac"
  bd_ie[1:10 , 1:3]  
## # A tibble: 10 x 3
##    id    idade          sexo
##    <chr> <dbl>     <dbl+lbl>
##  1 a001     46 1 [masculino]
##  2 a002     49 1 [masculino]
##  3 a003     NA 2 [feminino] 
##  4 a004     38 1 [masculino]
##  5 a005     42 1 [masculino]
##  6 a006     36 1 [masculino]
##  7 a007     31 1 [masculino]
##  8 a008     52 1 [masculino]
##  9 a009     39 1 [masculino]
## 10 a010     NA 1 [masculino]
# Seleção usando lógica
  bd_ie$sexo == 2
##   [1] FALSE FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
##  [12] FALSE FALSE    NA FALSE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE FALSE
##  [23]  TRUE  TRUE  TRUE  TRUE  TRUE FALSE  TRUE  TRUE  TRUE FALSE FALSE
##  [34]  TRUE FALSE FALSE FALSE    NA FALSE FALSE FALSE FALSE FALSE  TRUE
##  [45]  TRUE  TRUE  TRUE FALSE FALSE  TRUE  TRUE  TRUE FALSE  TRUE  TRUE
##  [56] FALSE  TRUE FALSE FALSE  TRUE FALSE  TRUE  TRUE  TRUE  TRUE FALSE
##  [67] FALSE  TRUE  TRUE  TRUE FALSE FALSE  TRUE  TRUE FALSE FALSE  TRUE
##  [78]  TRUE FALSE  TRUE FALSE  TRUE FALSE FALSE  TRUE  TRUE  TRUE FALSE
##  [89] FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
## [100] FALSE FALSE  TRUE  TRUE  TRUE  TRUE  TRUE FALSE    NA    NA    NA
## [111]    NA    NA    NA  TRUE  TRUE  TRUE FALSE FALSE FALSE  TRUE  TRUE
## [122] FALSE  TRUE FALSE FALSE  TRUE FALSE FALSE  TRUE FALSE FALSE FALSE
## [133] FALSE FALSE FALSE FALSE FALSE FALSE  TRUE FALSE FALSE FALSE FALSE
## [144] FALSE  TRUE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE FALSE
## [155]  TRUE FALSE FALSE FALSE FALSE
  s <-  bd_ie$sexo == 2
  bd_ie[s, 1:3]
## # A tibble: 67 x 3
##    id    idade          sexo
##    <chr> <dbl>     <dbl+lbl>
##  1 a003     NA  2 [feminino]
##  2 <NA>     NA NA           
##  3 a016     21  2 [feminino]
##  4 a017     19  2 [feminino]
##  5 a018     24  2 [feminino]
##  6 a019     24  2 [feminino]
##  7 a020     25  2 [feminino]
##  8 a023     29  2 [feminino]
##  9 a024     19  2 [feminino]
## 10 a025     25  2 [feminino]
## # … with 57 more rows
# seleção usando dplyr   
   bd_ie %>% filter(sexo == 2) %>% select(1:3)
## # A tibble: 59 x 3
##    id    idade         sexo
##    <chr> <dbl>    <dbl+lbl>
##  1 a003     NA 2 [feminino]
##  2 a016     21 2 [feminino]
##  3 a017     19 2 [feminino]
##  4 a018     24 2 [feminino]
##  5 a019     24 2 [feminino]
##  6 a020     25 2 [feminino]
##  7 a023     29 2 [feminino]
##  8 a024     19 2 [feminino]
##  9 a025     25 2 [feminino]
## 10 a026     29 2 [feminino]
## # … with 49 more rows

Análises estatísticas descritivas e figuras

# devtools::install_github("strengejacke/sjPlot")

# usando R classico
  names(bd_ie)
##  [1] "id"       "idade"    "sexo"     "ai_br"    "nf_br"    "aq_br"   
##  [7] "a_br"     "b_br"     "c_br"     "e_br"     "f_br"     "g_br"    
## [13] "h_br"     "i_br"     "l_br"     "m_br"     "n_br"     "o_br"    
## [19] "q1_br"    "q2_br"    "q3_br"    "q4_br"    "fatoe_i"  "fator_ii"
## [25] "fato_iii" "fator_iv" "fator_v"  "ra"       "rv"       "rm"      
## [31] "re"       "rn"       "eg"       "epn_ra"   "epn_rv"   "epn_rm"  
## [37] "epn_re"   "epn_rn"   "epn_eg"   "av_des1"  "av_des2"  "av_des"  
## [43] "etnia"    "percep"   "usofaci"  "conemo"   "regemo"   "experi"  
## [49] "etrateg"  "ie1"      "ie2"      "ie"       "ra_1"     "rv_1"    
## [55] "rm_1"     "re_1"     "rn_1"     "faces"    "paisag"   "facilit" 
## [61] "sensa"    "transi"   "mistur"   "gerenc"   "relac"
  table(bd_ie$sexo)
## 
##  1  2 
## 92 59
  table(bd_ie$idade)
## 
## 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 38 39 40 41 42 
##  1  3  4 11 12  9  9  9 15  8  5  5  5  2  6  4  4  1  4  2  2  1  5  3  1 
## 43 44 45 46 49 50 51 52 55 60 64 
##  1  3  1  2  3  1  3  1  1  1  1
  table(bd_ie$idade, bd_ie$sexo)
##     
##      1 2
##   17 1 0
##   18 0 3
##   19 0 4
##   20 7 4
##   21 4 8
##   22 6 3
##   23 5 4
##   24 6 3
##   25 6 9
##   26 4 4
##   27 2 3
##   28 5 0
##   29 2 3
##   30 1 1
##   31 5 1
##   32 4 0
##   33 3 1
##   34 1 0
##   35 4 0
##   36 2 0
##   38 2 0
##   39 1 0
##   40 4 1
##   41 2 1
##   42 1 0
##   43 1 0
##   44 2 1
##   45 1 0
##   46 2 0
##   49 2 1
##   50 1 0
##   51 0 3
##   52 1 0
##   55 1 0
##   60 1 0
##   64 1 0
# usando dplyr 
  bd_ie %>% select(idade, sexo) %>% table
##      sexo
## idade 1 2
##    17 1 0
##    18 0 3
##    19 0 4
##    20 7 4
##    21 4 8
##    22 6 3
##    23 5 4
##    24 6 3
##    25 6 9
##    26 4 4
##    27 2 3
##    28 5 0
##    29 2 3
##    30 1 1
##    31 5 1
##    32 4 0
##    33 3 1
##    34 1 0
##    35 4 0
##    36 2 0
##    38 2 0
##    39 1 0
##    40 4 1
##    41 2 1
##    42 1 0
##    43 1 0
##    44 2 1
##    45 1 0
##    46 2 0
##    49 2 1
##    50 1 0
##    51 0 3
##    52 1 0
##    55 1 0
##    60 1 0
##    64 1 0
# usando sJlot  
  
  library(sjPlot)
  library(sjmisc)
  
  frq(bd_ie$sexo)
## 
## # sexo (x) <numeric> 
## # total N=159  valid N=151  mean=1.39  sd=0.49
##  
##  val     label frq raw.prc valid.prc cum.prc
##    1 masculino  92   57.86     60.93   60.93
##    2  feminino  59   37.11     39.07  100.00
##   NA        NA   8    5.03        NA      NA
  sjt.xtab(bd_ie$idade,  bd_ie$sexo, show.row.prc = TRUE)
Questionário de
Identificação -
idade
sexo Total
masculino feminino
17 1
100 %
0
0 %
1
100 %
18 0
0 %
3
100 %
3
100 %
19 0
0 %
4
100 %
4
100 %
20 7
63.6 %
4
36.4 %
11
100 %
21 4
33.3 %
8
66.7 %
12
100 %
22 6
66.7 %
3
33.3 %
9
100 %
23 5
55.6 %
4
44.4 %
9
100 %
24 6
66.7 %
3
33.3 %
9
100 %
25 6
40 %
9
60 %
15
100 %
26 4
50 %
4
50 %
8
100 %
27 2
40 %
3
60 %
5
100 %
28 5
100 %
0
0 %
5
100 %
29 2
40 %
3
60 %
5
100 %
30 1
50 %
1
50 %
2
100 %
31 5
83.3 %
1
16.7 %
6
100 %
32 4
100 %
0
0 %
4
100 %
33 3
75 %
1
25 %
4
100 %
34 1
100 %
0
0 %
1
100 %
35 4
100 %
0
0 %
4
100 %
36 2
100 %
0
0 %
2
100 %
38 2
100 %
0
0 %
2
100 %
39 1
100 %
0
0 %
1
100 %
40 4
80 %
1
20 %
5
100 %
41 2
66.7 %
1
33.3 %
3
100 %
42 1
100 %
0
0 %
1
100 %
43 1
100 %
0
0 %
1
100 %
44 2
66.7 %
1
33.3 %
3
100 %
45 1
100 %
0
0 %
1
100 %
46 2
100 %
0
0 %
2
100 %
49 2
66.7 %
1
33.3 %
3
100 %
50 1
100 %
0
0 %
1
100 %
51 0
0 %
3
100 %
3
100 %
52 1
100 %
0
0 %
1
100 %
55 1
100 %
0
0 %
1
100 %
60 1
100 %
0
0 %
1
100 %
64 1
100 %
0
0 %
1
100 %
Total 91
61.1 %
58
38.9 %
149
100 %
χ2=46.712 · df=35 · Cramer’s V=0.560 · Fisher’s p=0.065
  library(jmv)

  
  
  descriptives(data = bd_ie , 
    vars = c("epn_ra" , "epn_rv",  "epn_rm",  "epn_re", "epn_rn", "epn_eg"),
    hist = TRUE)
## 
##  DESCRIPTIVES
## 
##  Descriptives                                                            
##  ─────────────────────────────────────────────────────────────────────── 
##               epn_ra    epn_rv    epn_rm    epn_re    epn_rn    epn_eg   
##  ─────────────────────────────────────────────────────────────────────── 
##    N             152       153       152       152       152       151   
##    Missing         7         6         7         7         7         8   
##    Mean         89.6      91.2      95.5      86.9      91.8      87.1   
##    Median       92.0      91.0      96.0      86.0      90.0      87.0   
##    Minimum      60.0      65.0      70.0      60.0      70.0      61.0   
##    Maximum       131       141       141       124       146       117   
##  ───────────────────────────────────────────────────────────────────────

  corrMatrix(data = bd_ie , vars = c("epn_ra" , "epn_rv",  "epn_rm",  "epn_re", "epn_rn", "epn_eg"))
## 
##  CORRELATION MATRIX
## 
##  Correlation Matrix                                                                    
##  ───────────────────────────────────────────────────────────────────────────────────── 
##                             epn_ra    epn_rv    epn_rm    epn_re    epn_rn    epn_eg   
##  ───────────────────────────────────────────────────────────────────────────────────── 
##    epn_ra    Pearson's r         —     0.464     0.531     0.559     0.492     0.788   
##              p-value             —    < .001    < .001    < .001    < .001    < .001   
##                                                                                        
##    epn_rv    Pearson's r                   —     0.324     0.417     0.532     0.684   
##              p-value                       —    < .001    < .001    < .001    < .001   
##                                                                                        
##    epn_rm    Pearson's r                             —     0.552     0.456     0.767   
##              p-value                                 —    < .001    < .001    < .001   
##                                                                                        
##    epn_re    Pearson's r                                       —     0.540     0.799   
##              p-value                                           —    < .001    < .001   
##                                                                                        
##    epn_rn    Pearson's r                                                 —     0.773   
##              p-value                                                     —    < .001   
##                                                                                        
##    epn_eg    Pearson's r                                                           —   
##              p-value                                                               —   
##  ─────────────────────────────────────────────────────────────────────────────────────
    library(d3heatmap)
    
    vars <- names(bd_ie)[c(23:32, 40:41, 44:47)]
   
     bd_ie %>%  select(vars) %>% cor(use="pair") %>%
      d3heatmap( 
        symn= TRUE, 
        symm = TRUE, 
        k_row = 5, 
        k_col = 5
        )
  ggplot(data = bd_ie, aes(x = epn_eg)) + geom_histogram()

  ggplot(bd_ie, aes(x = epn_eg)) + 
      geom_histogram( 
        binwidth = 5, alpha = 1/2, 
        color = "gray", fill = "blue")

    library(LaCroixColoR)
  
   ggplot(bd_ie, aes(x = epn_eg, y =av_des, color = ie)) + 
      geom_point( ) +
      geom_smooth() +
      scale_color_gradientn(colours=lacroix_palette("PeachPear", type = "continuous", n=10)) +
     theme_minimal() +
       scale_x_continuous(breaks = seq(60, 120, 5), limits = c(60, 120))  

Regressão múltipla

     linReg(data= bd_ie,
        dep =  av_des1 ,
      covs = vars(ra,rv, rm, re, rn, percep, usofaci, conemo, regemo),
      blocks = list(list( "ra", "rv", "rm", "re", "rn", "percep","usofaci", "conemo", "regemo")),
       stdEst = TRUE,
       modelTest = TRUE,
      anova = TRUE
       )
## 
##  LINEAR REGRESSION
## 
##  Model Fit Measures                                         
##  ────────────────────────────────────────────────────────── 
##    Model    R        R²       F       df1    df2    p       
##  ────────────────────────────────────────────────────────── 
##        1    0.458    0.209    3.00      9    102    0.003   
##  ────────────────────────────────────────────────────────── 
## 
## 
##  MODEL SPECIFIC RESULTS
## 
##  MODEL 1
## 
##  Omnibus ANOVA Test                                                       
##  ──────────────────────────────────────────────────────────────────────── 
##                 Sum of Squares    df     Mean Square    F         p       
##  ──────────────────────────────────────────────────────────────────────── 
##    ra                   0.0186      1         0.0186    0.0230    0.880   
##    rv                   0.4239      1         0.4239    0.5246    0.471   
##    rm                   0.0842      1         0.0842    0.1042    0.748   
##    re                   2.4841      1         2.4841    3.0743    0.083   
##    rn                   0.3346      1         0.3346    0.4141    0.521   
##    percep               0.4837      1         0.4837    0.5986    0.441   
##    usofaci              0.2219      1         0.2219    0.2746    0.601   
##    conemo               1.1565      1         1.1565    1.4313    0.234   
##    regemo               2.9383      1         2.9383    3.6364    0.059   
##    Residuals           82.4182    102         0.8080                      
##  ──────────────────────────────────────────────────────────────────────── 
##    Note. Type 3 sum of squares
## 
## 
##  Model Coefficients                                                        
##  ───────────────────────────────────────────────────────────────────────── 
##    Predictor    Estimate    SE        t         p        Stand. Estimate   
##  ───────────────────────────────────────────────────────────────────────── 
##    Intercept     2.01019    0.8128     2.473    0.015                      
##    ra            0.00425    0.0280     0.152    0.880             0.0189   
##    rv           -0.02127    0.0294    -0.724    0.471            -0.0819   
##    rm            0.00808    0.0250     0.323    0.748             0.0390   
##    re            0.04797    0.0274     1.753    0.083             0.2146   
##    rn            0.01861    0.0289     0.643    0.521             0.0756   
##    percep       -0.01240    0.0160    -0.774    0.441            -0.0823   
##    usofaci       0.00844    0.0161     0.524    0.601             0.0587   
##    conemo        0.02765    0.0231     1.196    0.234             0.1420   
##    regemo        0.02402    0.0126     1.907    0.059             0.2026   
##  ─────────────────────────────────────────────────────────────────────────
  linReg(data= bd_ie,
        dep =  av_des1 ,
      covs = vars(ra,rv, rm, re, rn, percep, usofaci, conemo, regemo),
      blocks = list(
        m1 = list( "ra", "rv", "rm", "re", "rn"),
        m2 = list("percep","usofaci", "conemo", "regemo")
        ),
       stdEst = TRUE,
       modelTest = TRUE,
       )
## 
##  LINEAR REGRESSION
## 
##  Model Fit Measures                                         
##  ────────────────────────────────────────────────────────── 
##    Model    R        R²       F       df1    df2    p       
##  ────────────────────────────────────────────────────────── 
##        1    0.362    0.131    3.19      5    106    0.010   
##        2    0.458    0.209    3.00      9    102    0.003   
##  ────────────────────────────────────────────────────────── 
## 
## 
##  Model Comparisons                                                
##  ──────────────────────────────────────────────────────────────── 
##    Model         Model    ΔR²       F       df1    df2    p       
##  ──────────────────────────────────────────────────────────────── 
##        1    -        2    0.0786    2.53      4    102    0.045   
##  ──────────────────────────────────────────────────────────────── 
## 
## 
##  MODEL SPECIFIC RESULTS
## 
##  MODEL 1
## 
##  Model Coefficients                                                        
##  ───────────────────────────────────────────────────────────────────────── 
##    Predictor    Estimate    SE        t        p         Stand. Estimate   
##  ───────────────────────────────────────────────────────────────────────── 
##    Intercept     3.38551    0.3961    8.546    < .001                      
##    ra            0.00986    0.0269    0.366     0.715             0.0438   
##    rv            0.00325    0.0291    0.112     0.911             0.0125   
##    rm            0.00334    0.0243    0.138     0.891             0.0161   
##    re            0.06149    0.0264    2.331     0.022             0.2751   
##    rn            0.01828    0.0293    0.623     0.534             0.0743   
##  ───────────────────────────────────────────────────────────────────────── 
## 
## 
##  MODEL 2
## 
##  Model Coefficients                                                        
##  ───────────────────────────────────────────────────────────────────────── 
##    Predictor    Estimate    SE        t         p        Stand. Estimate   
##  ───────────────────────────────────────────────────────────────────────── 
##    Intercept     2.01019    0.8128     2.473    0.015                      
##    ra            0.00425    0.0280     0.152    0.880             0.0189   
##    rv           -0.02127    0.0294    -0.724    0.471            -0.0819   
##    rm            0.00808    0.0250     0.323    0.748             0.0390   
##    re            0.04797    0.0274     1.753    0.083             0.2146   
##    rn            0.01861    0.0289     0.643    0.521             0.0756   
##    percep       -0.01240    0.0160    -0.774    0.441            -0.0823   
##    usofaci       0.00844    0.0161     0.524    0.601             0.0587   
##    conemo        0.02765    0.0231     1.196    0.234             0.1420   
##    regemo        0.02402    0.0126     1.907    0.059             0.2026   
##  ─────────────────────────────────────────────────────────────────────────

Pacote APA tables

https://cran.r-project.org/web/packages/apaTables/vignettes/apaTables.html

 library(apaTables)
 vars <- c("av_des1", "ra", "rv", "rm", "re", "rn", "percep","usofaci", "conemo", "regemo")
  
  apa.cor.table(data = bd_ie[ , vars], filename="t1_desfr.doc", table.number=1)
## 
## 
## Table 1 
## 
## Means, standard deviations, and correlations with confidence intervals
##  
## 
##   Variable   M     SD   1           2          3          4          
##   1. av_des1 4.38  0.98                                              
##                                                                      
##   2. ra      14.98 4.27 .25**                                        
##                         [.08, .41]                                   
##                                                                      
##   3. rv      15.20 3.81 .22*        .51**                            
##                         [.05, .38]  [.38, .62]                       
##                                                                      
##   4. rm      11.00 4.57 .20*        .51**      .32**                 
##                         [.02, .36]  [.39, .62] [.17, .46]            
##                                                                      
##   5. re      9.54  4.38 .37**       .51**      .41**      .55**      
##                         [.20, .51]  [.38, .62] [.27, .54] [.43, .66] 
##                                                                      
##   6. rn      10.07 4.11 .27**       .49**      .53**      .41**      
##                         [.10, .43]  [.35, .60] [.40, .63] [.27, .54] 
##                                                                      
##   7. percep  41.61 6.40 .05         .32**      .21*       .06        
##                         [-.13, .23] [.16, .47] [.03, .37] [-.12, .24]
##                                                                      
##   8. usofaci 40.21 6.71 .19*        .26**      .22*       -.01       
##                         [.01, .36]  [.09, .42] [.04, .38] [-.20, .17]
##                                                                      
##   9. conemo  40.13 5.04 .30**       .29**      .37**      .19*       
##                         [.13, .45]  [.12, .45] [.21, .52] [.01, .35] 
##                                                                      
##   10. regemo 40.00 8.14 .28**       .25**      .32**      .12        
##                         [.11, .44]  [.08, .41] [.15, .47] [-.06, .29]
##                                                                      
##   5           6           7          8          9         
##                                                           
##                                                           
##                                                           
##                                                           
##                                                           
##                                                           
##                                                           
##                                                           
##                                                           
##                                                           
##                                                           
##                                                           
##                                                           
##                                                           
##   .51**                                                   
##   [.38, .62]                                              
##                                                           
##   .29**       .26**                                       
##   [.12, .45]  [.09, .42]                                  
##                                                           
##   .08         .14         .38**                           
##   [-.10, .26] [-.05, .31] [.22, .53]                      
##                                                           
##   .36**       .29**       .38**      .49**                
##   [.19, .50]  [.12, .45]  [.22, .52] [.34, .62]           
##                                                           
##   .27**       .22*        .25**      .37**      .48**     
##   [.09, .42]  [.05, .39]  [.07, .41] [.20, .52] [.33, .60]
##                                                           
## 
## Note. M and SD are used to represent mean and standard deviation, respectively.
## Values in square brackets indicate the 95% confidence interval.
## The confidence interval is a plausible range of population correlations 
## that could have caused the sample correlation (Cumming, 2014).
## * indicates p < .05. ** indicates p < .01.
## 
  fit <- lm(data = bd_ie, formula = av_des1 ~ ra + rv + rm + re + rn + percep + usofaci + conemo + regemo)
  apa.reg.table( fit, filename = "t2_lm.doc", table.number = 2)
## 
## 
## Table 2 
## 
## Regression results using av_des1 as the criterion
##  
## 
##    Predictor     b      b_95%_CI  beta   beta_95%_CI sr2  sr2_95%_CI     r
##  (Intercept) 2.01*  [0.40, 3.62]                                          
##           ra  0.00 [-0.05, 0.06]  0.02 [-0.23, 0.27] .00 [-.00, .00]  .23*
##           rv -0.02 [-0.08, 0.04] -0.08 [-0.31, 0.14] .00 [-.02, .03]   .18
##           rm  0.01 [-0.04, 0.06]  0.04 [-0.20, 0.28] .00 [-.01, .01]  .22*
##           re  0.05 [-0.01, 0.10]  0.21 [-0.03, 0.46] .02 [-.03, .07] .35**
##           rn  0.02 [-0.04, 0.08]  0.08 [-0.16, 0.31] .00 [-.02, .02] .26**
##       percep -0.01 [-0.04, 0.02] -0.08 [-0.29, 0.13] .00 [-.02, .03]   .12
##      usofaci  0.01 [-0.02, 0.04]  0.06 [-0.16, 0.28] .00 [-.01, .02]  .20*
##       conemo  0.03 [-0.02, 0.07]  0.14 [-0.09, 0.38] .01 [-.02, .05] .34**
##       regemo  0.02 [-0.00, 0.05]  0.20 [-0.01, 0.41] .03 [-.03, .08] .33**
##                                                                           
##                                                                           
##                                                                           
##              Fit
##                 
##                 
##                 
##                 
##                 
##                 
##                 
##                 
##                 
##                 
##      R2 = .209**
##  95% CI[.03,.28]
##                 
## 
## Note. A significant b-weight indicates the beta-weight and semi-partial correlation are also significant.
## b represents unstandardized regression weights. beta indicates the standardized regression weights. 
## sr2 represents the semi-partial correlation squared. r represents the zero-order correlation.
## Square brackets are used to enclose the lower and upper limits of a confidence interval.
## * indicates p < .05. ** indicates p < .01.
## 

Exercício 2