Example data desk=data.frame( deskchoice=c('mid','mid','left','bookdrop','mid','bookdrop') )
-- I like doing stuff like the line below, especially when I'm using Sweave. print(paste('Within the observation period,',nrow(desk), 'patrons approached the circulation desk.')) -- But what if I want to put it at the beginning of a sentence? print(sum(desk$deskchoice=='bookdrop'),'persons', 'used the book drop. Everyone else interacted with a staff member.') Is there a pretty way to change the result of sum(desk$deskchoice=='bookdrop') from "2" to "Two"? -- And what if the number is one? print(sum(desk$deskchoice=='bookdrop'), c('person','persons')[as.numeric(sum(desk$deskchoice=='bookdrop')!=1)+1], 'used the book drop. Everyone else interacted with a staff member.') Is there a prettier way of choosing between "person" and "persons"? -- Thanks Tom ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.