It's not desperately important, but it would seem more consistent to me if sQuote(character(0)) or sQuote(NULL) returned character(0) rather than "??" . This could easily be achieved by putting if (length(x)==0) return(character(0)) at the beginning ... Ben Bolker