Re: [R] how to include bar values in a barplot?

2007-08-10 Thread Donatas G.
Quoting Greg Snow <[EMAIL PROTECTED]>:

> My original intent was to get the original posters out of the mode of
> thinking they want to match what the spreadsheet does and into thinking
> about what message they are trying to get across.  To get them (and
> possibly others) thinking I made the statements a bit more bold than my
> actual position (I did include a couple of qualifiers).

As an original poster (and a brand new user of R), I would like to comment on
the educational experience I have just received. ;)

The discussion was interesting and enlightening, and gives some good 
ideas about
the ways (tables, graphs, graphs with numbers etc.) to get the data accross to
the ones one is presenting to. I see some of you guys do feel quite strongly
about it, which is fine for me. I do not. I usually care for barplot 
aesthetics
and informativeness more than for visual simplicity. That may change in 
time :)

I see R graphical capabilities are huge but hard to access at times - that is
when spreadsheet seems preferrable. For example, as a user of Linux I still
cannot figure out why the fonts (and graphics in general) look much more ugly
on R in Linux than they do in R on Windows - no smoothing, sub-pixell hinting,
anything like that. That is what my next free time homework on R will be about
:)

Sincerely

Donatas Glodenis
PhD candidate
Department of Sociology of the Faculty of Philosophy
Vilnius University
Lithuania

__
R-help@stat.math.ethz.ch 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.


Re: [R] how to include bar values in a barplot?

2007-08-08 Thread Donatas G.
On Wednesday 08 August 2007 00:40:56 Donatas G. wrote:
> On Tuesday 07 August 2007 22:09:52 Donatas G. wrote:
> > How do I include bar values in a barplot (or other R graphics, where this
> > could be applicable)?
> >
> > To make sure I am clear I am attaching a barplot created with
> > OpenOffice.org which has barplot values written on top of each barplot.
>
> After more than two hours search I finally found a solution:
> http://tolstoy.newcastle.edu.au/R/help/06/05/27286.html

Hey, the solution happens to be only partiall... If the values are not real 
numbers, and have a lot of digits after the dot, the graph might become 
unreadable... 

see this

vals <- 
c(1,1.1236886,4.77554676,5.3345245,1,1.1236886,4.77554676,5.3345245,5.5345245,5.4345245,1.1236886,4.77554676,5.3345245,1.1236886,4.77554676,5.3345245)
 
names(vals) <- LETTERS[1:16] 
mp <- barplot(vals, ylim = c(0, 6)) 
text(mp, vals, labels = vals, pos = 3) 

Is there any way to round up those numbers?

I tried using 
options(digits=2)
, and it does change the display of a table, but it does not influence the 
barplot...
-- 
Donatas Glodenis
http://dg.lapas.info

__
R-help@stat.math.ethz.ch 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.


Re: [R] how to include bar values in a barplot?

2007-08-07 Thread Donatas G.
On Tuesday 07 August 2007 22:09:52 Donatas G. wrote:
> How do I include bar values in a barplot (or other R graphics, where this
> could be applicable)?
>
> To make sure I am clear I am attaching a barplot created with
> OpenOffice.org which has barplot values written on top of each barplot.

After more than two hours search I finally found a solution:
http://tolstoy.newcastle.edu.au/R/help/06/05/27286.html
and
http://tolstoy.newcastle.edu.au/R/help/05/09/12936.html

However, what about percentage barcharts, such as this:
http://dg.lapas.info/wp-content/barplot-lytys-G07_x_mean.png

And maybe somebody knows how to get the legend of the bars in the barchart 
(again, see the example above)?

-- 
Donatas Glodenis
http://dg.lapas.info

__
R-help@stat.math.ethz.ch 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.


Re: [R] how to include bar values in a barplot?

2007-08-07 Thread Donatas G.
On Tuesday 07 August 2007 22:09:52 Donatas G. wrote:
> How do I include bar values in a barplot (or other R graphics, where this
> could be applicable)?
>
> To make sure I am clear I am attaching a barplot created with
> OpenOffice.org which has barplot values written on top of each barplot.

Here is the barplot mentioned above:
http://dg.lapas.info/wp-content/barplot-with-values.jpg

it appeaars that this list does not allow attachments...

-- 
Donatas Glodenis
http://dg.lapas.info

__
R-help@stat.math.ethz.ch 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.


[R] how to include bar values in a barplot?

2007-08-07 Thread Donatas G.
How do I include bar values in a barplot (or other R graphics, where this 
could be applicable)? 

To make sure I am clear I am attaching a barplot created with OpenOffice.org 
which has barplot values written on top of each barplot. 

-- 
Donatas Glodenis
http://dg.lapas.info

__
R-help@stat.math.ethz.ch 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.


[R] using loops to create multiple images

2007-08-04 Thread Donatas G.
I have a data.frame with ~100 columns and I need a barplot for each column 
produced and saved in some directory.

I am not sure it is possible - so please help me.

this is my loop that does not work...

vars <- list (substitute (G01_01), substitute (G01_02), substitute (G01_03), 
substitute (G01_04))
results <- data.frame ('Variable Name'=rep (NA, length (vars)), 
check.names=FALSE)
for (i in 1:length (vars))  {
barplot(table(i),xlab=i,ylab="Nuomonės")
dev.copy(png, filename="/my/dir/barplot.i.png", height=600, width=600)
dev.off()
}

questions: 

Is it possible to use the i somewhere _within_ a file name? (like it is 
possible in other programming or scripting languages?)

Since I hate to type in all the variables (they go from G01_01 to G01_10 and 
then from G02_01 to G02_10 and so on), is it possible to shorten this list by 
putting there another loop, applying some programming thing or so? 

-- 
Donatas Glodenis
http://dg.lapas.info

__
R-help@stat.math.ethz.ch 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.


[R] how do I draw such a barplot?

2007-07-20 Thread Donatas G.
I did not have much success with ggplot2 and reshape libraries, so finally I 
managed to work out the graph in a rather complicated way. The only thing I 
cannot figure out is, how do I place the legend outside the barplot column 
area?

attach(tolerancija.data)
ateist = table(G09_01)
dvasin = table(G09_02)
gamtos = table(G09_03)
kr_klm = table(G09_04)
musulm = table(G09_05)
na_kri = table(G09_06)
pagoni = table(G09_07)
satani = table(G09_08)
rytų_k = table(G09_08)
satani = table(G09_09)
tradic = table(G09_10)
eilutes=cbind(ateist,dvasin,gamtos,krikšč,musulm,kr_klm,na_kri,pagoni,rytų_k,satani,tradic)
barplot(prop.table(eilutes,2),col=c("red3","red2","cyan","green2","green3"),legend.text=c("visiškai
 
sutinku","nesutinku","abejoju","sutinku","visiškai sutinku"),main="My title")
dettach(tolerancija.data)

However, this is a lot of writing. How do I make into a function to be 
reusable? 


Donatas

On Jul 16, 2007, at 9:06 , Donatas G. wrote:

> Hi,
>
> I cannot figure out how to draw a certain plot: could someone help  
> me out?
>
> I have this data.frame from a survey
> my.data
>
> that looks like something like this:
>
>    col1  col2  col3  col4
> 1     5     5     4     5
> 2     3     5     3     1
> 3     2     3     4     5
> 4     3     1     1     2
> 5     5     5     4     5
> 6     4     2     5     5
> 
>
>
> Each row represents a single questionnaire with someone giving his
> agreement/disagreement with a statement (each column is a  
> statement) that is
> coded from 1 to 5.
>
> I need to draw a barplot giving a visual representation showing  
> differences
> between the five columns: Each bar should represent a single  
> column, and
> should be divided into 5 sections, the thickness of each depending  
> on the
> number of respondents who choose that particular answer.
>
> How do I do that? All I have managed to do so far is to produce a  
> barplot of a
> single column, and that - only with bars side by side...


-- 
Donatas Glodenis
http://dg.lapas.info

__
R-help@stat.math.ethz.ch 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.


[R] how do I draw such a barplot?

2007-07-16 Thread Donatas G.
Hi, 

I cannot figure out how to draw a certain plot: could someone help me out?

I have this data.frame from a survey
my.data

that looks like something like this:

   col1  col2  col3  col4
1 5 5 4 5
2 3 5 3 1
3 2 3 4 5
4 3 1 1 2
5 5 5 4 5
6 4 2 5 5



Each row represents a single questionnaire with someone giving his 
agreement/disagreement with a statement (each column is a statement) that is 
coded from 1 to 5.

I need to draw a barplot giving a visual representation showing differences 
between the five columns: Each bar should represent a single column, and 
should be divided into 5 sections, the thickness of each depending on the 
number of respondents who choose that particular answer.

How do I do that? All I have managed to do so far is to produce a barplot of a 
single column, and that - only with bars side by side...

-- 
Donatas Glodenis
http://dg.lapas.info

__
R-help@stat.math.ethz.ch 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.


Re: [R] charset in graphics

2007-07-13 Thread Donatas G.
On Friday 13 July 2007 17:56:45 Prof Brian Ripley wrote:
> On Fri, 13 Jul 2007, Peter Dalgaard wrote:
> > Prof Brian Ripley wrote:
> >> On Fri, 13 Jul 2007, Peter Dalgaard wrote:
> >>> The correct incantation seems to be
> >>>
> >>> postscript(font="URWHelvetica", encoding="ISOLatin7")
> >>> plot(0,main=tolower("\u104\u116\u0118\u012e\u0172\u016a\u010c\u0160\u01
> >>>7d")) dev.off()
This sequence seems to do the trick, although I do not seem to have a font 
URWHelvetica

Anyway, where do i record these lines to make it permanent?

Maybe the explanation was there in Prof Brian Ripley's first email, but I did 
not get it somehow...

-- 
Donatas Glodenis
http://dg.lapas.info

__
R-help@stat.math.ethz.ch 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.


[R] charset in graphics

2007-07-13 Thread Donatas G.
How do I make Lithuanian characters display correctly in R graphics? 

Instead of the special characters for Lithuanian language I get question 
marks...

I use Ubuntu Feisty, the locale is utf-8 ...

Do I need to specify somewhere the locale for R, or - default font for the 
graphics?
-- 
Donatas Glodenis
http://dg.lapas.info

__
R-help@stat.math.ethz.ch 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.


[R] elementary statistics with R (rkward?)

2007-07-11 Thread Donatas G.
Hi, I am trying to learn some basic statistics stuff but I cannot find any
elementary statistics exercises using R language. Using RKward would be even
better...

I need that in analysing sociological data, obtained through questionnairres -
findind corelations between variables, relations between different types of
data, etc.

Could anyone recommend simple tutorials/exercises, available on www for me to
work on?

I realize it would be much simple to do this introductory stuff with spss, that
everyone around me is using here in Lithuania, but I'd really like to learn to
do it with R instead...

-- 
Donatas G.

__
R-help@stat.math.ethz.ch 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.