You can just access the data from the list: result <- lapply(output, function(.data){ lettermatch(creator, .data) })
You can then take the "result" and possibly 'cbind' back into the matrix you want. On Mon, Mar 8, 2010 at 10:59 AM, Laetitia Schmid <laetitia.sch...@gmx.ch>wrote: > Hi! > I need some help to finish my script. > > I have two tables that I combine randomly to produce a third table. > This I do for hundreds of iterations. In the output file I get all the > simulated tables after each other. It looks like this (in this case 3 > iterations): > > output file: > > [[1]] > [,1] [,2] [,3] > [1,] "GM030005" "WI920024" "CCCC" > [2,] "GM930026" "WI920362" "CCCC" > [3,] "GM980051" "WI920007" "CGCC" > [4,] "GM970009" "WI920417" "CCCC" > [5,] "GM920089" "WI920023" "CCCC" > [6,] "GM930109" "WI920359" "CCCC" > [7,] "GM980007" "WI920428" "CGCC" > [8,] "GM940039" "WI920430" "CCCC" > [9,] "GM990027" "WI920349" "CCCC" > [10,] "GM920222" "WI920410" "CGCC" > [11,] "GM930029" "WI920001" "CGCC" > [12,] "GM990105" "WI920431" "CCCC" > [13,] "GM050009" "WI920430" "CCCC" > [14,] "GM920224" "WI920369" "CCCC" > [15,] "GM920224" "WI920352" "CCCC" > [16,] "GM960028" "WI920427" "CCCC" > [17,] "GM940031" "WI920004" "CCCC" > [18,] "GM930040" "WI920441" "CCCC" > [19,] "GM930040" "WI920441" "CCCC" > [20,] "GM050099" "WI920417" "CCCC" > [21,] "GM050099" "WI920423" "CCCG" > [22,] "GM920096" "WI920370" "CCCC" > [23,] "GM920034" "WI920437" "CCCC" > [24,] "GM960023" "WI920017" "CCCC" > [25,] "GM920031" "WI920430" "CCCC" > [26,] "GM920202" "WI920367" "CCCG" > [27,] "GM990066" "WI920410" "CCCC" > > [[2]] > [,1] [,2] [,3] > [1,] "GM030005" "WI920017" "CCCC" > [2,] "GM930026" "WI920415" "CCCC" > [3,] "GM980051" "WI920028" "CGCC" > [4,] "GM970009" "WI920017" "CCCC" > [5,] "GM920089" "WI920028" "CCCC" > [6,] "GM930109" "WI920353" "CCCC" > [7,] "GM980007" "WI920009" "CGCT" > [8,] "GM940039" "WI920415" "CCCC" > [9,] "GM990027" "WI920423" "CCCG" > [10,] "GM920222" "WI920423" "CGCG" > [11,] "GM930029" "WI920363" "CGCC" > [12,] "GM990105" "WI920362" "CCCC" > [13,] "GM050009" "WI920365" "CCCC" > [14,] "GM920224" "WI920362" "CCCC" > [15,] "GM920224" "WI920410" "CCCC" > [16,] "GM960028" "WI920355" "CCCG" > [17,] "GM940031" "WI920361" "CCCC" > [18,] "GM930040" "WI920356" "CCCC" > [19,] "GM930040" "WI920353" "CCCC" > [20,] "GM050099" "WI920360" "CCCC" > [21,] "GM050099" "WI920353" "CCCC" > [22,] "GM920096" "WI920023" "CCCC" > [23,] "GM920034" "WI920426" "CCCC" > [24,] "GM960023" "WI920024" "CCCC" > [25,] "GM920031" "WI920022" "CCCC" > [26,] "GM920202" "WI920009" "CCCG" > [27,] "GM990066" "WI920001" "CCCC" > > [[3]] > [,1] [,2] [,3] > [1,] "GM030005" "WI920433" "CCCC" > [2,] "GM930026" "WI920408" "CCCC" > [3,] "GM980051" "WI920352" "CGCC" > [4,] "GM970009" "WI920416" "CCCC" > [5,] "GM920089" "WI920022" "CCCC" > [6,] "GM930109" "WI920369" "CCCC" > [7,] "GM980007" "WI920415" "CGCC" > [8,] "GM940039" "WI920022" "CCCC" > [9,] "GM990027" "WI920361" "CCCC" > [10,] "GM920222" "WI920024" "CGCC" > [11,] "GM930029" "WI920437" "CGCC" > [12,] "GM990105" "WI920423" "CCCG" > [13,] "GM050009" "WI920416" "CCCC" > [14,] "GM920224" "WI920423" "CCCG" > [15,] "GM920224" "WI920427" "CCCC" > [16,] "GM960028" "WI920437" "CCCC" > [17,] "GM940031" "WI920441" "CCCC" > [18,] "GM930040" "WI920417" "CCCC" > [19,] "GM930040" "WI920370" "CCCC" > [20,] "GM050099" "WI920015" "CCCC" > [21,] "GM050099" "WI920428" "CCCC" > [22,] "GM920096" "WI920007" "CCCC" > [23,] "GM920034" "WI920009" "CCCG" > [24,] "GM960023" "WI920410" "CCCC" > [25,] "GM920031" "WI920430" "CCCC" > [26,] "GM920202" "WI920015" "CCCC" > [27,] "GM990066" "WI920415" "CCCC" > > Now I would like to compare one of the tables used to create the > output tables with every output table, one after the other. In detail, > I am comparing row 1 of the "creator" table with row 1 of the first > output table and then row 2 of the "creator" table with row 2 of the > first output table and so on until row 27 and each row for all > columns. Then, when the first output table is finished I go on > comparing the first "creator" table with the second table in the > output, row for row for all columns. I do this for all iterations. > > The first "creator" table is called "data_mc". > > # apply similarity function (lettermatch) to my data > for (i in 1:(nrow(data_mc))){ > for (y in 1:(ncol(data_mc))) { > creator_table <- data_mc[data_mc$Status=="mother",y] > output_tables <- ??? > output[i,y]<-(lettermatch(creator_table, output_tables)) > } > } > > Could you please help me how I have to call up the output tables in > the way I need them (described above) for the function "lettermatch"? > Maybe I need to change the format of the output file? > > Thank you. > Laetitia > > > > > > > > > > > > > > > > [[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<http://www.r-project.org/posting-guide.html> > and provide commented, minimal, self-contained, reproducible code. > -- Jim Holtman Cincinnati, OH +1 513 646 9390 What is the problem that you are trying to solve? [[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.