Dear list, I'm trying to run the following for loop:
I have two list, the first one is
$'5684'
CFISCALE        "5684"   

RAGSOCB        "Brembo"


$'4532'
CFISCALE        "4532"  

RAGSOCB        "Stella"


which is this one in terms of dput:

dput(kk)
structure(list(`5684` = structure(c("5684", "Brembo", 
"5684", "Brembo", "5684", "Brembo"), .Dim = 2:3, .Dimnames = list(
    c("CFISCALE", "RAGSOCB"), c("1", "3", "2"))), `4532` = 
structure(c("450155", 
"Stella"), .Names = c("CFISCALE", "RAGSOCB"
))), .Names = c("5684", "4532"))




The second one is:
$'5684'
ANNO            1986           1987      1988

var1                  45              23            87


$'4532'
ANNO            1986          


var1                  35
In terms of dput:
dput(kk1)
structure(list(`5684` = structure(c("1986", "45", "1987", 
 " 23", "1988", "87"), .Dim = 2:3, .Dimnames = list(c("ANNO", 
 "var1"), c("1", "3", "2"))), `4532` = structure(c("1986", "35"
 ), .Names = c("ANNO", "var1"))), .Names = c("5684", "4532"
 ))



This is my loop:
mate: function(x,y){
for (i in x){
for (i in y){
ifelse(names(x)==names(y),print(xtable(i)) & print(xtable(l)),NULL)}}}
     
This is the error message I get:
Errore in print(xtable(i)) & print(xtable(l)) : 
  operations are possible only for numeric, logical or complex types
Anyone KNows How to solve it???
Moreover there is a way to use the structure of the first list object for the 
second one?
I mean:
turn 
$'4532'

ANNO            1986         

var1                  35
 
into:
$'4532'

ANNO            1986      1987      1988   


var1                  35        NA         NA



Thanks a lot for your attention!


 
        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to