Q:

Convert matched column from long to wide

I have df.1
ID     B 
006007 M
123456 F
987654 F

And df.2
ID     B C
006007 M N
006007 M S
123456 F S
987654 F W

I'm trying to essentially look up ID to match from df.2 and return C into df.1, but creating a separate column for each possible answer if there are duplications in df.2$ID (i.e. convert C from long to wide). So I would end up with:
ID     B C1 C2 C3
006007 M N   S NA
123456 F NA  S NA
987654 F NA  NA W

Just to re-iterate I need one row for each ID, with each result for each ID in seperate columns. 
Please let me know if you need more clarification and I really appreciate your help, guys.

A:

# merge the data
m = merge(df.1, df.2)

# convert it to wide
library(data.table)
dcast(m, ID + B ~ C, value.var = "C")
#       ID B    N    S    W
# 1   6007 M    N    S <NA>
# 2 123456 F <NA>    S <NA>
# 3 987654 F <NA> <NA>    W

I'll let you rename the columns to C1, C2, ..., if you really want to.

Using this data:
df.1 = read.table(text = "ID     B 
006007 M
123456 F
987654 F", stringsAsFactors = FALSE, header = T)

df.2 = read.table(text = "ID     B C
006007 M N
006007 M S
123456 F S
987654 F W", stringsAsFactors = FALSE, header = T)

