I am new to R, and am trying to create an Rmarkdown document that knits to word.
When I run the chunk code my data frame, and thus strata sampling and ggplot work just fine. But when I knit to word, it is not working. The issue it states is that the row lengths differ, but I know this is not the case as I checked.
Error in data.frame(Player = player.id, Age = player.age, Age_Group = player.g) :
arguments imply differing number of rows: 9561, 0
Calls: ... withCallingHandlers -> withVisible -> eval -> eval -> data.frame
Execution halted
player.id <- P$player
player.age <- P$age
player.g <- P$age_group
player.data <- data.frame(
Player = player.id,
Age = player.age,
Age_Group = player.g
)
nrow(player.data)
[1] 9561
length(player.id)
[1] 9561
length(player.age)
[1] 9561
length(player.g)
[1] 9561
Any insight would be great.
Sarah