I want to fill the value of pca.data$Type with 'DMSO' but the condition is that if the 'DMSO' is present in the column of pca.data$sample in R.
pca.data$Type[pca.data$sample %in% "DMSO"]='DMSO'
The following is my sample data:
Sample | Type |
BEL5438.DMSO.1 | DMSO |
BEL5438.DMSO.2 | DMSO |
BEL5438.DMSO.3 | DMSO |
BEL5438.JQ1.1 | JQ1 |
BEL5438.JQ1.2 | JQ1 |
BEL5438.JQ1.3 | JQ1 |
HCCC6478.DMSO.1 | DMSO |
HCCC6478.DMSO.2 | DMSO |
HCCC6478.DMSO.3 | DMSO |