call row names

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

call row names

Ana Quitério
Hi R users.

 

I have a table like that:

 

table


 

var

A1

A2

A3


v1

41203

3.69

2.31


v2

20577

4.51

8.60


v3

20625

2.87

3.50


v4

6115

8.92

2.97


v5

3160

1.49

2.21


v6

2954

2.62

5.98


v7

4731

1.83

7.53


v8

2435

7.68

3.50


v9

2296

3.03

4.84


v10

6153

1.06

4.28


v11

3157

1.07

1.15


v12

2996

1.06

1.01


v13

6084

2.65

2.63


v14

3115

2.42

5.70


v15

2969

2.92

7.53

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

* If  I want column A1 I do this: table$A1
* And if I want row v4 how can I do? (probably the problem happens
because the column var is not considered as row names, but in the reality
was with this purpose that was created by me)

 

Thanks in advance

 

Ana Quiterio

 

 

 

 

 

 

 

 


 

 

 

 


 

 

 

 


 

 

 

 


 

 

 

 


 

 

 

 


 

 

 

 


 

 

 

 


 

 

 

 


 

 

 

 


 

 

 

 


 

 

 

 


 

 

 

 


 

 

 

 


 

 

 

 


 

 

 

 


 

 

 

 

 

 

 


        [[alternative HTML version deleted]]

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
Reply | Threaded
Open this post in threaded view
|

Re: call row names

Adaikalavan Ramasamy
1) It is not good practice to call your objects after existing R
functions (e.g. table)

2) I think you are getting rows and columns confused. If you want to
extract the rows/column of a matrix or dataframe, then try subsetting it
by mat["A1", ] or mat[ , "v4"]. See help(subset) for more information.

3) It looks to me that your object is a list. Try doing class(table).

Regards, Adai


On Tue, 2006-02-21 at 11:56 +0000, Ana Quitério wrote:

> Hi R users.
>
>  
>
> I have a table like that:
>
>  
>
> table
>
>
>  
>
> var
>
> A1
>
> A2
>
> A3
>
>
> v1
>
> 41203
>
> 3.69
>
> 2.31
>
>
> v2
>
> 20577
>
> 4.51
>
> 8.60
>
>
> v3
>
> 20625
>
> 2.87
>
> 3.50
>
>
> v4
>
> 6115
>
> 8.92
>
> 2.97
>
>
> v5
>
> 3160
>
> 1.49
>
> 2.21
>
>
> v6
>
> 2954
>
> 2.62
>
> 5.98
>
>
> v7
>
> 4731
>
> 1.83
>
> 7.53
>
>
> v8
>
> 2435
>
> 7.68
>
> 3.50
>
>
> v9
>
> 2296
>
> 3.03
>
> 4.84
>
>
> v10
>
> 6153
>
> 1.06
>
> 4.28
>
>
> v11
>
> 3157
>
> 1.07
>
> 1.15
>
>
> v12
>
> 2996
>
> 1.06
>
> 1.01
>
>
> v13
>
> 6084
>
> 2.65
>
> 2.63
>
>
> v14
>
> 3115
>
> 2.42
>
> 5.70
>
>
> v15
>
> 2969
>
> 2.92
>
> 7.53
>
>  
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> * If  I want column A1 I do this: table$A1
> * And if I want row v4 how can I do? (probably the problem happens
> because the column var is not considered as row names, but in the reality
> was with this purpose that was created by me)
>
>  
>
> Thanks in advance
>
>  
>
> Ana Quiterio
>
>  
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [hidden email] mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>

______________________________________________
[hidden email] mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html