[R] xtable with ifelse statement

vivi84 cipullussa at hotmail.com
Wed Jul 21 09:23:32 CEST 2010


Hi there,
I'm very new on R and I hope someone can help me to solve the problem in
using the ifelse statement with the xtable function(library xtable). 
I'm trying to get the printing of the elements of two lists in a sorted way.
These two list have in common the their names.
I will try to give an example:
the first list looks like this:

$code1

Code              code1
Nation             Usa

$code2

Code              code2
Nation             Spain


the second one is like this

$code 1
var1                    87 
var2                   73

$code2  
var1                    34
var2                    23


As you can see the two list have the same names.I tried to implement the
following ifelse statement but it doesn't work
orde2=function(x,y){
ifelse(names(x)==names(y),list(print(xtable(x)),print(xtable(y))),NULL)

What I want is the xtable of this first:
$code1

Code              code1
Nation             Usa


and after this:

$code 1
var1                    87 
var2                   73


And as the first case, the xtable of this;
$code2

Code              code2
Nation             Spain


and after this:

$code2  
var1                    34
var2                    23

Someone Knows if it possible to do this and how??
Thanks a lot!

-- 
View this message in context: http://r.789695.n4.nabble.com/xtable-with-ifelse-statement-tp2296694p2296694.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list