[R] strings plots
Jim Lemon
jim at bitwrit.com.au
Mon Feb 1 12:27:08 CET 2010
On 02/01/2010 08:50 PM, A Z wrote:
> Hi all !
>
> I'm new in this list and newbie about R
> I'm trying to use R scripts (as in the attached file) for creating some distributions plots of data retrieved by a workflow(with Rserve, to be precise).
>
> I was able to do it (even if not in a beatiful way, I have to improve it especially about labels and coordinates) with number inputs like :
> 110,248,245,151,175,165,163,52,213,315,164,276,273,273,175,220,284,216,213,278,245,157,278,248
>
> My problem appear when I want to create such plots with inputs composed by strings like:
> CORPUS,CORPUS,CORPUS,CORPUS,CORPUS,CORPUS,CORPUS,CORPUS,OVARY,OVARY,OVARY,OVARY,PERITONEUM,PERITONEUM,PERITONEUM,PERITONEUM,PERITONEUM,PERITONEUM,PERITONEUM,PERITONEUM,PERITONEUM,UTERUS,UTERUS,UTERUS
> for creating plots of the distributions of the different 'words'.
> (e.g. bar named corpus that tell me how many time it is repeated, and so on).
>
Hi A Z,
Try this:
input_strings<-sample(c("CORPUS","OVARY","PERITONEUM"),100,TRUE)
input_table<-table(input_strings)
barplot(input_table,names.arg=names(input_table))
Jim
More information about the R-help
mailing list