Help with Error: Unknown or uninitialised column

I am trying to use a "match" function and I keep getting the same error "Unknown or uninitialised column". I am not sure what is happening or why I keep getting this error. I have tried some setting changing (as suggested by the other online help forums) and nothing has helped.

Practice_performance_measures <- read_csv("~/Practice_performance_measures.csv", 
                                          +     na = "NA")
Practice_EM <- read_csv("~/Practice_EM.csv", 
                        +     na = "NA")

diagnostics supress =Practice_performance_measures$AveragePerf
AveragePerf <- Practice_performance_measures$`Average Perf`
Average <- Practice_performance_measures$`Average Perf`
Practice_EM$Peformance <- Practice_performance_measures$Average[match(Practice_EM$Participant, Practice_performance_measures$Participant)]

Which line of code does the error appear?

Also, what are the dimensions and column names of the two data sets?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.

Warning message:
Unknown or uninitialised column: 'Average'.

This means that the column Average doesn't exist in Practice_performance_measures, which based on the screenshot, there is no column called Average. Just change to the column needed.

Also, in general, it is best to not have spaces in column names. I use an underscore instead of spaces

It is this line of code:
Practice_EM$Peformance <- Practice_performance_measures$Average[match(Practice_EM$Participant, Practice_performance_measures$Participant)]

Warning message:
Unknown or uninitialised column: 'Average'.

I have attached a photo of one data set (Practice_Performance_measures), the other is FAR to large (hundreds of columns and thousands of rows) to begin to lay all of that out for you.

Those two lines do not rename the columns, but create vectors called AveragePerf and Average. To check, look at names(Practice_performance_measures) after that line and the names will not have changed. Also if using RStudio, in the environment a vector called Average will appear. To rename the columns of the data set, I typically use the tidyverse such as:

Practice_performance_measures <- Practice_performance_measures %>% 
  rename(Average = `Average Perf`)

without the tidyverse you could do something like this:

names(Practice_performance_measures)[which(names(Practice_performance_measures)=="Average Perf")] <- c("Average")

I have renamed that column the code above already:

AveragePerf <- Practice_performance_measures$Average Perf
Average <- Practice_performance_measures$Average Perf

I typically do not have spaces either and would use the underscores as well. In this, I did makeshift names since I am working with a smaller subset of the overall dataframe.