Q:

How to concatenate the percentage of a row in a single value?

I would like to concatenate the percentage of that value across the single row. Let say I have:
dat<-data.frame(x1=c(1), x2=c(4), x3=c(5), stringsAsFactors = FALSE) 

I would like to have a concatenate value in the dat$concat column like this: [10,40,50] (each value is the percentage now) 
I previously asked how I can concatenate, and the command works pretty well:
dat$conc <- paste0("[",apply(dat,1,paste,collapse=","),"]")

How can I do it?

A:

If we're assuming that 5 stands for 50%, then it's as easy as replacing dat with dat*.1, Like this:
dat <- data.frame(x1=c(1), x2=c(4), x3=c(5), stringsAsFactors = FALSE) 

dat$conc <- paste0("[",apply(dat*.1,1,paste,collapse=","),"]")

  x1 x2 x3          conc
1  1  4  5 [0.1,0.4,0.5]  

But I do want to note that if 5 is meant to signify 5%, not 50%, then you would want to replace dat with dat/100, like this: 
dat <- data.frame(x1=c(1), x2=c(4), x3=c(5), stringsAsFactors = FALSE)

dat$conc <- paste0("[",apply(dat/100,1,paste,collapse=","),"]")

  x1 x2 x3             conc
1  1  4  5 [0.01,0.04,0.05]

EDIT:
To get the percentage of each value relative to its row (i.e. value/rowSums(x)), try this:
dat <- data.frame(x1=c(7),x2=c(4),x3=c(5),stringsAsFactors=FALSE)

dat$conc <- paste0("[",apply(dat/rowSums(dat),1,paste,collapse=","),"]")

Output:
  x1 x2 x3                 conc
1  7  4  5 [0.4375,0.25,0.3125]

