R dataframe create -


i have data frame in r, f1. want create data frame f2 has column names(header) in f1 f2's row names. know there 300 names in f1, , want assign color "#ff0000" first 200 , color "#0000ff" last 100. how can this? result should looks like,

name1   "#ff0000" name2   "#ff0000" ... name201 "#0000ff" name202 "#0000ff" ... 

the rbinds , cbinds in answer unnecessary. one-liner, using data.frame.

f2 = data.frame(color = c(rep("#ff0000", 200), rep("#0000ff", 100)),     row.names = names(f1),     stringsasfactors = false) 

Comments

Popular posts from this blog

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

html - How to style widget with post count different than without post count -

url rewriting - How to redirect a http POST with urlrewritefilter -