r - Error in sample(1:17260(E), 20) : attempt to apply non-function -
it's possibly stupid question, i'm getting error message simple piece of code in r:
s20_1 = e[sample(1:17260(e), 20),] the error message is:
error in sample(1:17260(e), 20) : attempt apply non-function
e dataframe 17260 rows. code based on 1 found here: sample random rows in dataframe.
any appreciated. cheers!
the error message tells wrong. try change line this:
s20_1 = e[sample(nrow(e), 20),] or, since know size of e
s20_1 = e[sample(1:17260, 20),] though recommend first method of course.
hope helps.
Comments
Post a Comment