Hello absolute noob here so apologies if I don't know exactly what you are telling me first without a bit of a google to help me understand!
I have a data frame with 6 cols, four of which contain the word qPCR, i.e
sample..id...mean_qPCR..sd_qPCR..sem_qPCR..total_qPCR
Data <- data.frame(
    sample = sample(1:10),
    id = sample(1:10),
    mean_qPCR =sample(1:10),
    sd_qPCR = sample(1:10),
    sem_qPCR = sample(1:10),
    total_qPCR = sample(1:10))
I have multiple dataframes like this looking at different genes so I want to prefix the columns with qPCR in them with the gene name, i.e
sample..id...gene_mean_qPCR..gene_sd_qPCR..gene_sem_qPCR..gene_total_qPCR
Data <- data.frame(
    sample = sample(1:10),
    id = sample(1:10),
    gene_mean_qPCR = sample(1:10),
    gene_sd_qPCR = sample(1:10),
    gene_sem_qPCR = sample(1:10),
    gene_total_qPCR = sample(1:10)
    )
I had thought about using rename, but could only change one column title at a time. was then thinking grepl and rename might do it, but not sure how to implement these together?
any help would be much appreciated.
 
    