1

I need to select a range of observations from variable "position" and keep getting errors.

Here is what I have been trying:

newfile <- myfile[which(myfile$position (18300000:18400000), ]

and this error comes up:

Error: unexpected numeric constant in "newfile <- myfile[which(myfile$position 18300000"
Simon O'Hanlon
  • 58,647
  • 14
  • 142
  • 184
Gen
  • 27
  • 5
  • 1
    please give more information on what you want to do and on the variable `position`. Is it logical, do you want to simply select the rows 183.. to 184... from the dataframe? – Mark Heckmann Jan 07 '14 at 11:22

2 Answers2

0

Maybe you can try

newfile <- myfile [myfile$position] [18300000:18400000, ]

if its the vertical position

Keniajin
  • 1,649
  • 2
  • 20
  • 43
0

Almost there, you have to specify that you want the varaible %in% the range:

newfile <- myfile[myfile$position %in% (18300000:18400000), ]

Note that you don't need to use which for this.

James
  • 65,548
  • 14
  • 155
  • 193