Displaying 2 results from an estimated 2 matches for "newfish".
2012 Mar 22
2
Randomly select elements based on criteria
...on in the day of spawn between fish born the
same day but that are unrelated (not from the same family).
I want to randomly select two rows but they have to be from different fam.
The fist part (random selection), I got it by doing:
> ran <- sample(nrow (fish), size=2); ran
[1] 9 12
> newfish <- fish [ran,]; newfish
fam born spawn
103 136 46 50
106 142 46 85
In this example I got two individuals from different families (good) but I
will repeat the process many times and there's a chance that I get two fish
from the same family (bad):
> ran<-sample (nrow(...
2001 Sep 11
2
data frames
...ated to these rows (fishes #4 and #1).
With subset(fish.dat,reg==1) I can display all records from
fish 1. My first question is:
How can I list all records from fishes 1 and 4 at once?
Now I want to create a new data frame without the records from
fishes 1 and 4.
The only way I know is to type
newfish.dat <- fish.dat[-c(2,4,6,10,11,15, ... ),]
Probably there's an easier way that I couldn't find out. I've
already made some trials, all with syntax problems.
Thanks,
Antonio Olinto
Fisheries Institute
Sao Paulo - Brasil
Fish Ring Radius
1 2 1 0.36
2 4 1 0.37
3 3 1 0.44
4 1 1 0.4...