[R] Scale y-labels based on a value with 'lattice'

K. Elo maillists at pp.inet.fi
Thu May 26 16:51:46 CEST 2016

Dear R-helpers!

I have a data frame storing data for word co-occurrences, average 
distances and co-occurence frequency:

       Group.1    Group.2     x Freq
1 deutschland  achtziger  2.00    1
2 deutschland        alt  1.25    4
3 deutschland     anfang -2.00    1
4 deutschland    ansehen  1.00    2
5 deutschland     arbeit  0.50    2
6 deutschland arbeitslos -2.00    1

Now I want to plot a lattice 'dotplot' with the formula 'Group.2~x'. 
This works fine.

However, I would like to scale the y-label (based on 'Group.2' according 
the 'Freq' value using a log-scaled value (log(Freq+.5)). In other 
words: the higher the 'Freq' value of a term, the bigger its label 
should be printed in my dotplot.

The problem is that I cannot figure out how to tell lattice to scale 
each y-label with according 'Freq' value. I am quite sure I should build 
a function for scales=list(y=...), but I don't know how to it.

Many thanks in advance for your help!

Kimmo Elo

Åbo Akademi University / German studies
Turku, Finland

More information about the R-help mailing list