r - Adding a special column to an existing data frame -


this question has answer here:

i add column containing 3 values existing data frame in loop, each time appending existing row:

existing data frame mktdata many rows this:

    bidprice askprice  last volume xlu    39.14    39.15 39.15   9242 

and new column consists of 3 values called weights 100, 200, 300

so final data frame should be

    bidprice askprice  last volume      weights xlu    39.14    39.15 39.15   9242 100,200,300 

thank help.

you can use paste.

df$weights<-paste0(c(100,200,300),collapse=",") 

Comments

Popular posts from this blog

ios - iPhone/iPad different view orientations in different views , and apple approval process -

java Extracting Zip file -

C# WinForm - loading screen -