unstack(dat,V2~V1)
name.a name.b name.c
1 5 2 1
2 4 3 5
3 1 2 6
using other libraries:
library(tidyverse)
dat%>%group_by(V1)%>%mutate(id2=1:n())%>%spread(id2,V2)
# A tibble: 3 x 4
# Groups: V1 [3]
V1 `1` `2` `3`
*
1 name.a 5 4 1
2 name.b 2 3 2
3 name.c 1 5 6
data:
dat=read.table(h=F,sep=",",stringsAsFactors = F,strip.white = T,text=' "name.a", 5
"name.a", 4
"name.a", 1
"name.b", 2
"name.b", 3
"name.b", 2
"name.c", 1
"name.c", 5
"name.c", 6')