\documentclass[a4paper,11pt]{article}

\begin{document}
\title{An simple Sweave document}
\maketitle

Some R code:
<<>>=
d <- data.frame(a=1:10, b='xxx')
print(d$a)
print(d$b)
@

Dataframe has \Sexpr{nrow(d)} rows. In the last row, column a is 
\Sexpr{tail(d, 1)$a} and column b is \Sexpr{tail(d, 1)$b}.

\end{document}

