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.
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.
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
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.
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: