I cannot order my data to run a oneway anova

I have uploaded my data, and I need to run a one-way anova that compares I to IG and to F. I could run it with just one column, but I need to analyze all the data. Bellow is my dataframe:

data.frame(datar)
Interview.number..ongoing. IG...2 I...3 IG...4 F...5 IG...6 I...7 IG...8 F...9 IG...10
1 134 5 7 5 1 4 2 1 1 7
2 146 4 7 5 1 2 3 2 1 2
3 156 6 5 7 1 3 2 1 1 5
4 159 5 5 4 2 2 1 2 1 5
5 160 6 4 6 1 5 3 4 1 5
6 165 5 3 6 1 5 2 4 1 6
7 183 7 5 6 1 5 3 4 1 5
8 184 7 5 7 1 5 2 3 1 6
9 185 7 2 7 1 6 2 6 1 7
10 187 5 6 6 1 3 3 1 3 5
F...11 I...12 IG...13 I...14 F...15 I...16 IG...17 IG...18 F...19 IG...20 I...21 F...22
1 1 2 6 7 1 5 1 4 1 1 6 1
2 4 3 3 6 1 4 4 3 1 5 3 1
3 1 2 5 3 1 3 2 3 1 2 3 1
4 1 1 1 5 1 6 2 4 1 2 1 1
5 1 3 5 4 1 4 5 5 1 1 4 1
6 1 2 5 3 1 2 4 3 1 5 2 1
7 1 3 6 4 1 3 4 5 1 4 4 1
8 1 2 6 5 1 5 4 4 1 1 5 1
9 1 2 7 2 1 3 7 7 1 7 3 1
10 2 3 4 5 1 5 2 2 1 3 5 1
IG...23 I...24 F...25 F...26 I...27 IG...28 F...29 I...30 I...31 IG...32 I...33 F...34
1 6 6 1 1 6 5 1 1 7 1 7 1
2 5 7 1 1 7 3 1 3 5 1 5 1
3 5 4 1 1 4 4 1 5 3 1 4 1
4 2 3 1 1 3 4 2 4 6 1 1 1
5 6 5 1 1 5 5 1 4 5 1 5 1
6 5 5 1 1 3 7 1 3 2 1 2 1
7 6 3 1 1 3 5 1 6 4 1 4 1
8 5 5 1 1 5 7 1 5 5 1 5 1
9 1 4 1 1 4 7 1 2 2 1 2 1
10 3 5 1 2 4 4 1 5 3 1 3 1
F...35 I...36 F...37 I...38 IG...39 F...40 IG...41 I...42 F...43 F...44 I...45 IG...46
1 1 7 1 5 5 1 5 5 1 1 4 1
2 2 6 2 6 1 1 2 4 1 1 5 1
3 1 6 1 3 3 1 3 3 1 1 2 1
4 3 4 3 3 3 1 5 3 1 1 3 3
5 1 5 1 3 5 1 5 3 1 1 3 1
6 1 6 1 3 5 1 5 3 1 1 5 1
7 1 6 1 3 4 1 3 3 1 1 2 2
8 1 5 1 5 7 1 7 5 1 1 3 2
9 1 5 1 2 7 1 7 2 1 1 1 1
10 1 6 1 2 4 1 3 2 1 1 3 2
I...47 I...48 F...49 IG...50 F...51 F...52 I...53 IG...54 I...55 IG...56 IG...57 F...58
1 4 1 1 4 1 1 4 5 1 6 5 1
2 5 5 1 3 1 1 6 3 6 2 6 1
3 2 2 1 3 1 1 2 5 2 4 5 1
4 4 3 1 3 1 1 1 3 3 4 5 1
5 3 1 1 5 1 1 4 6 3 5 5 1
6 5 5 1 6 1 1 6 6 5 6 6 1
7 2 3 1 4 1 1 2 4 3 3 4 1
8 3 1 1 7 1 1 4 7 1 6 7 1
9 1 1 1 7 1 1 2 7 3 6 7 1
10 3 1 1 3 1 1 3 4 3 4 5 1
I...59 IG...60 IG...61 F...62 F...63 IG...64 I...65 F...66 IG...67 I...68 IG...69 I...70
1 3 4 5 1 1 5 1 1 7 6 4 6
2 5 1 3 2 1 3 4 2 5 7 1 6
3 2 2 3 1 1 3 2 1 6 4 1 4
4 2 2 3 1 1 5 4 2 4 5 1 6
5 4 5 5 1 1 5 3 1 6 4 4 5
6 5 6 3 1 1 5 2 1 7 5 4 5
7 4 5 4 1 1 4 3 1 7 5 3 5
8 5 5 4 1 1 5 3 1 7 1 1 6
9 5 7 4 1 1 7 2 1 7 6 1 5
10 4 3 2 1 1 2 2 1 6 4 1 5
F...71 F...72 I...73 IG...74 F...75 I...76 IG...77 IG...78 F...79 I...80 F...81 F...82
1 1 1 4 1 1 5 6 6 1 1 1 1
2 1 5 5 1 1 5 2 1 1 1 1 1
3 1 1 3 2 1 4 6 4 1 1 1 1
4 1 1 3 1 1 5 4 3 1 1 1 1
5 1 1 3 5 1 4 5 5 1 2 1 1
6 1 1 3 5 1 5 7 6 1 5 1 1
7 1 1 4 1 1 4 5 5 1 3 1 1
8 1 1 4 1 1 3 7 2 1 1 1 1
9 1 1 1 1 1 3 7 7 1 3 1 1
10 1 1 4 1 1 4 5 3 1 1 1 1
I...83 I...84 IG...85 F...86 I...87 IG...88 F...89 IG...90 I...91
1 5 3 5 1 7 7 1 7 6
2 5 5 2 1 5 1 1 2 6
3 4 5 4 1 5 5 1 4 3
4 4 3 6 1 5 6 1 3 5
5 5 3 5 1 5 5 1 5 3
6 5 3 6 1 7 5 1 5 5
7 4 4 5 1 6 5 1 5 4
8 5 4 7 1 7 4 1 5 4
9 4 3 7 1 3 7 1 7 6
10 5 3 4 1 4 3 1 3 3
[ reached 'max' / getOption("max.print") -- omitted 142 rows ]

I could try to manually copy+paste in excel, and then import data, but it seems that there has to be a better way o do it with RSTUDIO (which I've just began to use, sorry).

Hi!

To help us help you, could you please prepare a reproducible example (reprex) illustrating your issue? Please have a look at this guide, to see how to create one:

I tried to do my best. Here it is:

data.frame(
                   check.names = FALSE,
  `Interview number (ongoing)` = c(134, 146, 156, 159, 160),
                        IG...2 = c(5, 4, 6, 5, 6),
                         I...3 = c(7, 7, 5, 5, 4),
                        IG...4 = c(5, 5, 7, 4, 6),
                         F...5 = c(1, 1, 1, 2, 1),
                        IG...6 = c(4, 2, 3, 2, 5),
                         I...7 = c(2, 3, 2, 1, 3),
                        IG...8 = c(1, 2, 1, 2, 4),
                         F...9 = c(1, 1, 1, 1, 1),
                       IG...10 = c(7, 2, 5, 5, 5),
                        F...11 = c(1, 4, 1, 1, 1),
                        I...12 = c(2, 3, 2, 1, 3),
                       IG...13 = c(6, 3, 5, 1, 5),
                        I...14 = c(7, 6, 3, 5, 4),
                        F...15 = c(1, 1, 1, 1, 1),
                        I...16 = c(5, 4, 3, 6, 4),
                       IG...17 = c(1, 4, 2, 2, 5),
                       IG...18 = c(4, 3, 3, 4, 5),
                        F...19 = c(1, 1, 1, 1, 1),
                       IG...20 = c(1, 5, 2, 2, 1),
                        I...21 = c(6, 3, 3, 1, 4),
                        F...22 = c(1, 1, 1, 1, 1),
                       IG...23 = c(6, 5, 5, 2, 6),
                        I...24 = c(6, 7, 4, 3, 5),
                        F...25 = c(1, 1, 1, 1, 1),
                        F...26 = c(1, 1, 1, 1, 1),
                        I...27 = c(6, 7, 4, 3, 5),
                       IG...28 = c(5, 3, 4, 4, 5),
                        F...29 = c(1, 1, 1, 2, 1),
                        I...30 = c(1, 3, 5, 4, 4),
                        I...31 = c(7, 5, 3, 6, 5),
                       IG...32 = c(1, 1, 1, 1, 1),
                        I...33 = c(7, 5, 4, 1, 5),
                        F...34 = c(1, 1, 1, 1, 1),
                        F...35 = c(1, 2, 1, 3, 1),
                        I...36 = c(7, 6, 6, 4, 5),
                        F...37 = c(1, 2, 1, 3, 1),
                        I...38 = c(5, 6, 3, 3, 3),
                       IG...39 = c(5, 1, 3, 3, 5),
                        F...40 = c(1, 1, 1, 1, 1),
                       IG...41 = c(5, 2, 3, 5, 5),
                        I...42 = c(5, 4, 3, 3, 3),
                        F...43 = c(1, 1, 1, 1, 1),
                        F...44 = c(1, 1, 1, 1, 1),
                        I...45 = c(4, 5, 2, 3, 3),
                       IG...46 = c(1, 1, 1, 3, 1),
                        I...47 = c(4, 5, 2, 4, 3),
                        I...48 = c(1, 5, 2, 3, 1),
                        F...49 = c(1, 1, 1, 1, 1),
                       IG...50 = c(4, 3, 3, 3, 5),
                        F...51 = c(1, 1, 1, 1, 1),
                        F...52 = c(1, 1, 1, 1, 1),
                        I...53 = c(4, 6, 2, 1, 4),
                       IG...54 = c(5, 3, 5, 3, 6),
                        I...55 = c(1, 6, 2, 3, 3),
                       IG...56 = c(6, 2, 4, 4, 5),
                       IG...57 = c(5, 6, 5, 5, 5),
                        F...58 = c(1, 1, 1, 1, 1),
                        I...59 = c(3, 5, 2, 2, 4),
                       IG...60 = c(4, 1, 2, 2, 5),
                       IG...61 = c(5, 3, 3, 3, 5),
                        F...62 = c(1, 2, 1, 1, 1),
                        F...63 = c(1, 1, 1, 1, 1),
                       IG...64 = c(5, 3, 3, 5, 5),
                        I...65 = c(1, 4, 2, 4, 3),
                        F...66 = c(1, 2, 1, 2, 1),
                       IG...67 = c(7, 5, 6, 4, 6),
                        I...68 = c(6, 7, 4, 5, 4),
                       IG...69 = c(4, 1, 1, 1, 4),
                        I...70 = c(6, 6, 4, 6, 5),
                        F...71 = c(1, 1, 1, 1, 1),
                        F...72 = c(1, 5, 1, 1, 1),
                        I...73 = c(4, 5, 3, 3, 3),
                       IG...74 = c(1, 1, 2, 1, 5),
                        F...75 = c(1, 1, 1, 1, 1),
                        I...76 = c(5, 5, 4, 5, 4),
                       IG...77 = c(6, 2, 6, 4, 5),
                       IG...78 = c(6, 1, 4, 3, 5),
                        F...79 = c(1, 1, 1, 1, 1),
                        I...80 = c(1, 1, 1, 1, 2),
                        F...81 = c(1, 1, 1, 1, 1),
                        F...82 = c(1, 1, 1, 1, 1),
                        I...83 = c(5, 5, 4, 4, 5),
                        I...84 = c(3, 5, 5, 3, 3),
                       IG...85 = c(5, 2, 4, 6, 5),
                        F...86 = c(1, 1, 1, 1, 1),
                        I...87 = c(7, 5, 5, 5, 5),
                       IG...88 = c(7, 1, 5, 6, 5),
                        F...89 = c(1, 1, 1, 1, 1),
                       IG...90 = c(7, 2, 4, 3, 5),
                        I...91 = c(6, 6, 3, 5, 3)
)

I want all de IG data together, all the F data together, and all de I data together. I'm sorry, but that's all I could get... Thank you!

here is started code then for a reprex.
I extended yours to clean up the names, and order them as you requested into IG and F groups etc.


library(tidyverse)

start_df <- data.frame(
  check.names = FALSE,
  `Interview number (ongoing)` = c(134, 146, 156, 159, 160),
  IG...2 = c(5, 4, 6, 5, 6),
  I...3 = c(7, 7, 5, 5, 4),
  IG...4 = c(5, 5, 7, 4, 6),
  F...5 = c(1, 1, 1, 2, 1),
  IG...6 = c(4, 2, 3, 2, 5),
  I...7 = c(2, 3, 2, 1, 3),
  IG...8 = c(1, 2, 1, 2, 4),
  F...9 = c(1, 1, 1, 1, 1),
  IG...10 = c(7, 2, 5, 5, 5),
  F...11 = c(1, 4, 1, 1, 1),
  I...12 = c(2, 3, 2, 1, 3),
  IG...13 = c(6, 3, 5, 1, 5),
  I...14 = c(7, 6, 3, 5, 4),
  F...15 = c(1, 1, 1, 1, 1),
  I...16 = c(5, 4, 3, 6, 4),
  IG...17 = c(1, 4, 2, 2, 5),
  IG...18 = c(4, 3, 3, 4, 5),
  F...19 = c(1, 1, 1, 1, 1),
  IG...20 = c(1, 5, 2, 2, 1),
  I...21 = c(6, 3, 3, 1, 4),
  F...22 = c(1, 1, 1, 1, 1),
  IG...23 = c(6, 5, 5, 2, 6),
  I...24 = c(6, 7, 4, 3, 5),
  F...25 = c(1, 1, 1, 1, 1),
  F...26 = c(1, 1, 1, 1, 1),
  I...27 = c(6, 7, 4, 3, 5),
  IG...28 = c(5, 3, 4, 4, 5),
  F...29 = c(1, 1, 1, 2, 1),
  I...30 = c(1, 3, 5, 4, 4),
  I...31 = c(7, 5, 3, 6, 5),
  IG...32 = c(1, 1, 1, 1, 1),
  I...33 = c(7, 5, 4, 1, 5),
  F...34 = c(1, 1, 1, 1, 1),
  F...35 = c(1, 2, 1, 3, 1),
  I...36 = c(7, 6, 6, 4, 5),
  F...37 = c(1, 2, 1, 3, 1),
  I...38 = c(5, 6, 3, 3, 3),
  IG...39 = c(5, 1, 3, 3, 5),
  F...40 = c(1, 1, 1, 1, 1),
  IG...41 = c(5, 2, 3, 5, 5),
  I...42 = c(5, 4, 3, 3, 3),
  F...43 = c(1, 1, 1, 1, 1),
  F...44 = c(1, 1, 1, 1, 1),
  I...45 = c(4, 5, 2, 3, 3),
  IG...46 = c(1, 1, 1, 3, 1),
  I...47 = c(4, 5, 2, 4, 3),
  I...48 = c(1, 5, 2, 3, 1),
  F...49 = c(1, 1, 1, 1, 1),
  IG...50 = c(4, 3, 3, 3, 5),
  F...51 = c(1, 1, 1, 1, 1),
  F...52 = c(1, 1, 1, 1, 1),
  I...53 = c(4, 6, 2, 1, 4),
  IG...54 = c(5, 3, 5, 3, 6),
  I...55 = c(1, 6, 2, 3, 3),
  IG...56 = c(6, 2, 4, 4, 5),
  IG...57 = c(5, 6, 5, 5, 5),
  F...58 = c(1, 1, 1, 1, 1),
  I...59 = c(3, 5, 2, 2, 4),
  IG...60 = c(4, 1, 2, 2, 5),
  IG...61 = c(5, 3, 3, 3, 5),
  F...62 = c(1, 2, 1, 1, 1),
  F...63 = c(1, 1, 1, 1, 1),
  IG...64 = c(5, 3, 3, 5, 5),
  I...65 = c(1, 4, 2, 4, 3),
  F...66 = c(1, 2, 1, 2, 1),
  IG...67 = c(7, 5, 6, 4, 6),
  I...68 = c(6, 7, 4, 5, 4),
  IG...69 = c(4, 1, 1, 1, 4),
  I...70 = c(6, 6, 4, 6, 5),
  F...71 = c(1, 1, 1, 1, 1),
  F...72 = c(1, 5, 1, 1, 1),
  I...73 = c(4, 5, 3, 3, 3),
  IG...74 = c(1, 1, 2, 1, 5),
  F...75 = c(1, 1, 1, 1, 1),
  I...76 = c(5, 5, 4, 5, 4),
  IG...77 = c(6, 2, 6, 4, 5),
  IG...78 = c(6, 1, 4, 3, 5),
  F...79 = c(1, 1, 1, 1, 1),
  I...80 = c(1, 1, 1, 1, 2),
  F...81 = c(1, 1, 1, 1, 1),
  F...82 = c(1, 1, 1, 1, 1),
  I...83 = c(5, 5, 4, 4, 5),
  I...84 = c(3, 5, 5, 3, 3),
  IG...85 = c(5, 2, 4, 6, 5),
  F...86 = c(1, 1, 1, 1, 1),
  I...87 = c(7, 5, 5, 5, 5),
  IG...88 = c(7, 1, 5, 6, 5),
  F...89 = c(1, 1, 1, 1, 1),
  IG...90 = c(7, 2, 4, 3, 5),
  I...91 = c(6, 6, 3, 5, 3)
)

(select(start_df,1,
       starts_with("IG"),
       starts_with("F"),
       starts_with("I")) %>% 
as_tibble( .name_repair = ~ gsub("\\...","_",.)) -> final_df)

You mentioned anova, have you written any code towards that goal ?

I get several errors:

library(tidyverse)
#> Error in library(tidyverse): there is no package called 'tidyverse'

From:

imagen

So, obviously I cannot join the data together.

The following is what I tried and it worked fine with two columns (for anova):
one.way <- aov(IG...90 ~ I...91, data = datar)

You need

install.packages("tidyverse")

I got error with that one, so I tried the other... This is the reprex:

imagen

screenshots are very hard to read. These things are text, and are copy and pasteable...

Here is code showing aov for every possible pairing of variables (though it strikes me you may want less than that) minus the interview number.


list_every_pair <- combn(names(final_df)[-1],
                         2,
                         simplify = FALSE)

list_of_aov <- purrr::map (
  list_every_pair,
  ~aov(as.formula(paste(.x,collapse = "~")),
        data = final_df)
)

str(list_of_aov,max.level = 1)

this relies on purrr::map which is part of tidyverse

Here I copy paste

install.packages("tidyverse")
#> Installing package into '/home/ana/R/x86_64-pc-linux-gnu-library/4.0'
#> (as 'lib' is unspecified)
#> also installing the dependencies 'curl', 'openssl', 'httr', 'rvest', 'xml2'
#> Warning in install.packages("tidyverse"): installation of package 'curl' had
#> non-zero exit status
#> Warning in install.packages("tidyverse"): installation of package 'openssl' had
#> non-zero exit status
#> Warning in install.packages("tidyverse"): installation of package 'xml2' had
#> non-zero exit status
#> Warning in install.packages("tidyverse"): installation of package 'httr' had
#> non-zero exit status
#> Warning in install.packages("tidyverse"): installation of package 'rvest' had
#> non-zero exit status
#> Warning in install.packages("tidyverse"): installation of package 'tidyverse'
#> had non-zero exit status
Created on 2021-02-25 by the reprex package (v1.0.0)

I'm copying everything in an .xls file to get 3 columns. Then, I'll run the anova. I know this is not how things are done, but I need a first data. It seems that I'm having a lot of errors while trying to install packages. I would like to solve them, though. Thanks!

hmmm. thats unfortunate, the error messages were not informative.
please try

install.packages("curl")
install.packages("curl")
#> Installing package into '/home/ana/R/x86_64-pc-linux-gnu-library/4.0'
#> (as 'lib' is unspecified)
#> Warning in install.packages("curl"): installation of package 'curl' had non-zero
#> exit status

Created on 2021-02-25 by the reprex package (v1.0.0)

Strange...
What happens when you

require(curl)
require(curl)
#> Loading required package: curl
#> Warning in library(package, lib.loc = lib.loc, character.only = TRUE,
#> logical.return = TRUE, : there is no package called 'curl'

Created on 2021-02-25 by the reprex package (v1.0.0)

sessionInfo()

?

sessionInfo()
#> R version 4.0.4 (2021-02-15)
#> Platform: x86_64-pc-linux-gnu (64-bit)
#> Running under: Ubuntu 20.04.2 LTS
#> 
#> Matrix products: default
#> BLAS:   /usr/lib/x86_64-linux-gnu/blas/libblas.so.3.9.0
#> LAPACK: /usr/lib/x86_64-linux-gnu/lapack/liblapack.so.3.9.0
#> 
#> locale:
#>  [1] LC_CTYPE=es_ES.UTF-8       LC_NUMERIC=C              
#>  [3] LC_TIME=es_UY.UTF-8        LC_COLLATE=es_ES.UTF-8    
#>  [5] LC_MONETARY=es_UY.UTF-8    LC_MESSAGES=es_ES.UTF-8   
#>  [7] LC_PAPER=es_UY.UTF-8       LC_NAME=C                 
#>  [9] LC_ADDRESS=C               LC_TELEPHONE=C            
#> [11] LC_MEASUREMENT=es_UY.UTF-8 LC_IDENTIFICATION=C       
#> 
#> attached base packages:
#> [1] stats     graphics  grDevices utils     datasets  methods   base     
#> 
#> loaded via a namespace (and not attached):
#>  [1] digest_0.6.27     assertthat_0.2.1  magrittr_2.0.1    reprex_1.0.0     
#>  [5] evaluate_0.14     highr_0.8         stringi_1.5.3     rlang_0.4.10     
#>  [9] cli_2.3.1         rstudioapi_0.13   fs_1.5.0          rmarkdown_2.7    
#> [13] tools_4.0.4       stringr_1.4.0     glue_1.4.2        xfun_0.21        
#> [17] yaml_2.2.1        compiler_4.0.4    htmltools_0.5.1.1 knitr_1.31

Created on 2021-02-25 by the reprex package (v1.0.0)

I find it very strange that install.packages only reports non zero exit status, and doesn't give any other complaints. I have to wonder if this could even be a bug in 4.0.4 though that seems super unlikely.
Lets be more explicit

install.packages("curl", type = "source")
install.packages("curl", type = "source")
#> Installing package into '/home/ana/R/x86_64-pc-linux-gnu-library/4.0'
#> (as 'lib' is unspecified)
#> Warning in install.packages("curl", type = "source"): installation of package
#> 'curl' had non-zero exit status

Created on 2021-02-25 by the reprex package (v1.0.0)

I can't think how to help you with this I'm afraid. I'm also concerned that others with expertise in package installation won't see this because the title doesn't represent your key issue.
Perhaps I should split your post to a separate one?