I have a dataframe and I would add double quotes to the values which have a length > 6 (i.e.: the length of one ID)
Name ID
John a105BD;f648FE
Alice t487EF
Bob l984MQ;x204ER;p674WS
Tom y549JJ
Clem h852KF;o195TV
... ...
I would have this :
Name ID
John "a105BD;f648FE"
Alice t487EF
Bob "l984MQ;x204ER;p674WS"
Tom y549JJ
Clem "h852KF;o195TV"
... ...
So I've tried
for (nchar(as.character(annot3$GO))>6) {
annot3$GO <- dQuote(annot3$GO)
}
But I have the following message :
Error: unexpected '}' in "}"
If you have an explanation or a solution, I'll be grateful.