I tried it using the commented out code without success. Can somebody help?
\documentclass[a4paper]{article}
%\usepackage[english,greek]{babel}
%\latintext
\title{Sweave Example 1}
\author{George Dontas}
\begin{document}
\maketitle
In this example we embed parts of the examples from the
\texttt{kruskal.test} help page into a \LaTeX{} document:
%\greektext
Αυτό είναι κείμενο στα Ελληνικά
%\latintext
<<eval=TRUE,echo=TRUE,warning=FALSE,message=FALSE,error=FALSE>>=
data(airquality)
kruskal.test(Ozone ~ Month, data = airquality)
@
which shows that the location parameter of the Ozone distribution varies significantly from month to month. Finally we
include a boxplot of the data:
\begin{center}
<<eval=TRUE,echo=FALSE,results='hide',warning=FALSE,message=FALSE,error=FALSE>>=
boxplot(Ozone ~ Month, data = airquality)
@
\end{center}
\end{document}
The problem here is not the R but matter of getting latex to play well with Greek. With hat tip to this answer, perhaps the easiest solution is to switch to XeLaTeX compilation and rewrite your file as
\documentclass[a4paper]{article}
\usepackage{fontspec}
\setmainfont{Times New Roman}
\setsansfont{Arial}
\newfontfamily\greekfont[Script=Greek]{Linux Libertine O}
\newfontfamily\greekfontsf[Script=Greek]{Linux Libertine O}
\usepackage{polyglossia}
\setdefaultlanguage{english}
\setotherlanguage{greek}
\title{Sweave Example 1}
\author{George Dontas}
\begin{document}
\maketitle
Ελληνικό κείμενο
In this example we embed parts of the examples from the
\texttt{kruskal.test} help page into a \LaTeX{} document:
...
and so on as before. Then compile with XeLaTeX (latexmk -xelatex file.Rnw
will do that).