0

I am trying to add single quotes to a value in a dataframe in the first row of columns containing in their name a string intensity.

Change:

A     B     C    IntensityA ssIntensityB

asa   adf   df   123      183
as    sd    sd   121      41

to:

A     B     C    IntensityA ssIntensityB

asa   adf   df   '123'      '183'
as    sd    sd   121        41

I have tried the following:

int_col <- grep("intensity", colnames(tab), value=TRUE, invert=FALSE)
int_c <- colnames(tab) %in% int_col
q <- sQuote(subset(Access.protein.input,int_c))

Thanks for any advise.

Cettt
  • 11,460
  • 7
  • 35
  • 58
JaB
  • 1
  • Instead of just the first row it is ok to modify the whole intensity column. – JaB May 02 '19 at 12:37
  • `dplyr::mutate_at` is designed for modifying certain columns (selected by name using various methods) by applying a function to them – divibisan May 02 '19 at 20:54
  • Possible duplicate of [Using functions of multiple columns in a dplyr mutate\_at call](https://stackoverflow.com/questions/39209987/using-functions-of-multiple-columns-in-a-dplyr-mutate-at-call) – divibisan May 02 '19 at 20:54

0 Answers0