How to import excel data into R using column name and row name

Viewed 35500

I am a R novice and was wondering how to import excel data into R using row names and column names. Specifically i require a subset of the data in a number of worksheet within one excel file. Can i use row names and column names to identify and extract certain cells of data to R ?

Worksheet 1
----------
* X Y Z 
A 1 2 2
B 1 1 1
C 1 3 4
D 4 2 2
E 2 2 2 
----------
Worksheet 2
----------
*  X Y1 Z1 
A 1  2  2
B 1  2  3
C 1  3  4
D 4  1  1
E 2  1  1 

For example in the above spreadsheet how could i extract the data (2,2,2,2) using the row and column names (D,Y) (D,Z) (E,Y) (E,Z) in worksheet 1

how could i extract the data (1,1,1,1) using the row and column names (D,Y1) (D,Z1) (E,Y1) (E,Z1) in worksheet 2 ?

Thanks for any help provided

Barry

2 Answers
Related