Is there a way to combine row and column names from an existing data.frame into a new data frame. For example, I have column names (A, B, C) and row names (1, 2, 3), and I would like to combine them into a 3x3 matrix [A1, B1, C1; A2, B2, C2; A2, B2, C2]. Thanks for your help.
The outer() function can help:
outer()
> cn <- c("A","B","C") > rn <- c("1","2","3") > outer(cn, rn, function(x,y) paste(x,y,sep="")) [,1] [,2] [,3] [1,] "A1" "A2" "A3" [2,] "B1" "B2" "B3" [3,] "C1" "C2" "C3" >
Source: https://habr.com/ru/post/1309468/More articles:How to import XML files into WEKA - xmlUnable to disable index during PL / SQL procedure - oracleHow to create 3 equally wide TextView that fills the parent screen - androidCreate a beveled edge for a two-dimensional polygon - geometryRelative path problem in Sinatra view - ruby | fooobar.comThere @interface in my @implementation - why? - objective-cHow to lock SharePoint list / items in processes / machines? - list.Net Com Interop Create Slow Instance - .netjQuery: add border on hover element but NOT parents - jqueryReal-time multiple data series - pythonAll Articles