r - compare column names and make plots -


i want compare 2 columnnames 2 data frames , create graphs matched columnnames original data frames.

a<-data.frame(a1=c(1,2,3,4,5),a2=c(2,3,4,5,6),b1=c(3,4,5,6,7),c1=c(4,5,6,7,8)) b<-data.frame(c1=c(10,20,30,40,50),b1=c(20,30,40,50,60),d1=c(30,40,50,60,70)) 

output should like: plot (b$c1,a$c1) plot (b$b1,a$b1)

i can create plots above codes, need automated because dataframe large.

here's 1 way:

shared.names <- intersect(names(a), names(b)) par(mfrow=n2mfrow(length(shared.names))) (name in shared.names) plot(a[[name]], b[[name]], main=name) 

enter image description here


Comments

Popular posts from this blog

c# - DetailsView in ASP.Net - How to add another column on the side/add a control in each row? -

javascript - firefox memory leak -

Trying to import CSV file to a SQL Server database using asp.net and c# - can't find what I'm missing -