Mark Lee wrote:

Sorry if this is a silly question. I'm trying to extract all elements
of a dataframe at a particular row. I can find no mention of this in
any documentation and it may be naivety of dataframe on my part as I'm
very green at this. Thankyou,

Mark

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help



dat <- data.frame(var1 = c(1:10), var2 = c(31:40), var3 = c(6:15))


dat[1, ] #extract 1st row

dat[1:4, ] #extract rows 1 through 4

dat[c(1,3,5,7,9), ] #extract named non-consecutive rows

dat[ ,1] # extract 1st column

... etc

It's in 'An Introduction to R' that should have come with your distribution, or in the manuals section of the r website:

http://www.r-project.org

HTH
--
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%
Gavin Simpson                     [T] +44 (0)20 7679 5522
ENSIS Research Fellow             [F] +44 (0)20 7679 7565
ENSIS Ltd. & ECRC                 [E] [EMAIL PROTECTED]
UCL Department of Geography       [W] http://www.ucl.ac.uk/~ucfagls/cv/
26 Bedford Way                    [W] http://www.ucl.ac.uk/~ucfagls/
London.  WC1H 0AP.
%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%~%

______________________________________________
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to