Legend
Legend

Reputation: 1

how to delete one number in R

As the image shows, I calculate the pt value and rank it. Then I used which function to find the index of the largest value pt. Since there are two values of 1, I need to find the first index, so I use min function, and it does give me value of 4. Then I want to delete the 4th value in pt, and I suppose to see 0.85, 0.713, 0.666, and 1, because I only want to delete one number. However, it somehow deletes two number stead. What is the reason, and how can I fix it?

sample code

Upvotes: 0

Views: 147

Answers (1)

Shrikant Soni
Shrikant Soni

Reputation: 21

After i is calculated, just do

pt <- pt[-i]

Then type pt in the console and you will have the desired output.

Upvotes: 2

Related Questions