[R] Extracting vectors from a matrix (err, I think) in RMySQL

Wells Oliver
Wed, 02 Dec 2009 21:01:13 -0000

I have a query which returns a data set like so:

> salaries
   yearID POS pct
1    2009  RF 203
2    2009  DH 200
3    2009  1B 198
4    2009  3B 180
5    2009  LF 169
6    2009  SS 156
7    2009  CF 148
8    2009  2B  97
9    2009   C  86
10   2008  DH 234
11   2008  1B 199
12   2008  RF 197
13   2008  3B 191
14   2008  SS 180
15   2008  CF 164
16   2008  LF 156
17   2008  2B 104
18   2008   C  98

I'd like to make a vector for all data for a given position, so for example
here I'd like all yearID and pct for POS 'RF which should look like:

   yearID pct
1 2009 203
2 2008 197

Apologies if I'm mangling terminology here.

--
Wells Oliver
wells@submute.net

	[[alternative HTML version deleted]]