-2

Edited*

I need to make a loop or a function that can make this code much more faster and easier without dobbelt working.

d1<-cbind(c("Age","Height","Weight"), c("Age","Weight","Score"), 
  c("Height","Score","Income"))

d2<-cbind(c(24,187,75), c(46,172,10),c(177,7,50000))

c1d1<-t(d1[,1])
c1d2<-t(d2[,1])
colnames(c1d2)<-c1d1

c2d1<-t(d1[,2])
c2d2<-t(d2[,2])
colnames(c2d2)<-c2d1

c3d1<-t(d1[,3])
c3d2<-t(d2[,3])
colnames(c3d2)<-c3d1

dataset<-smartbind(data.frame(c1d2),data.frame(c2d2),data.frame(c3d2))
AAAR92
  • 1
  • 1
  • 5
    When asking for help, you should include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. Pictures of data are not helpful (we do not want to re-type all those values). – MrFlick Mar 12 '18 at 18:00
  • I have edited my question and added my codes, – AAAR92 Mar 13 '18 at 11:46

1 Answers1

0

it's hard for me to understand exactly what you're seeking to accomplish; some examples with code would help greatly, as @MrFlick suggested. I think, though, that you may benefit from investigating the map_df function from the purrr library.

simitpatel
  • 641
  • 5
  • 9