Getting "error in object[[name, exact = TRUE]] : subscript out of bounds" when using vader_df() function

I am trying to use the vader package in order to conduct Vader Sentiment Analysis which allows you to understand the sentiment of text beyond the individual word. the vader_df function from the package allows the calculation of multiple texts contained within a vector or column in a
dataframe. The data im putting through the function looks like this:

Specificailly the Text column. I first started by running the entire column into the function. However I got the error mentioned in the title. I wrongly assumed that had something to do with the amount of data being put through it, so I then split the data into 10 dataframes. This time around the function worked for the first of the dataframes but not the next 9. I am not very sure as to what is going on; it doesnt make sense to me that a function would work fine with one portion of the same set of data and not others. This is what I was doing:

n <- 1000
nr <- nrow(data)
data2 = split(data, rep(1:ceiling(nr/n), each=n, length.out=nr))
datavader1 = data2[[1]]
datavader2 = data2[[2]]
datavader3 = data2[[3]]
datavader4 = data2[[4]]
datavader5 = data2[[5]]
datavader6 = data2[[6]]
datavader7 = data2[[7]]
datavader8 = data2[[8]]
datavader9 = data2[[9]]
datavader10 = data2[[10]]

vader1 = vader_df(datavader1$Text)
vader2 = vader_df(datavader2$Text)
vader3 = vader_df(datavader3$Text)
vader4 = vader_df(datavader4$Text)
vader5 = vader_df(datavader5$Text)
vader6 = vader_df(datavader6$Text)
vader7 = vader_df(datavader7$Text)
vader8 = vader_df(datavader8$Text)
vader9 = vader_df(datavader9$Text)
vader10 = vader_df(datavader10$Text)

I also tried subsetting by doing data[1:1000,] for the entirety of the dataset as well as just creating a vector from data$Text and the same error continues to occur. What exactly does this error mean and what are the usual solutions to deal with it?

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

If you have a query related to it or one of the replies, start a new topic and refer back with a link.