Displaying 20 results from an estimated 5000 matches similar to: "Integration with LaTex and LyX"
2011 Jan 03
7
Saving objects inside a list
Hello there,
any ideas on how to save all the objects on my workspace inside a list
object?
For example, say my workspace is as follows
ls()
[1] "x" "y" "z"
and suppose I want to put these objects inside a list object, say
object.list <- list()
without having to explicitly write down their names as in
object.list$x = x
object.list$y = y
object.list$z = z
Is
2010 Nov 17
2
Numerical integration
Hi!
I was wondering if there are any other functions for numerical integration,
besides 'integrate' from the stats package, but which wouldn't require the
integrand to be vectorized. Oh, and must be capable of integrating over
(-inf,+inf).
Thanks in advance,
Eduardo Horta
[[alternative HTML version deleted]]
2010 Nov 16
2
Vectors out of lists?
Hello there
I have a list, Y, and each component of that list is a real-valued function
(that is, Y[[i]](u) returns a number).
I was wishing to build the mean function and the first thing I thought of
was
Ybar<-function(u){
mean(Y[[1:n]](u))
}
but obviously this doesn't work, since Y[[1:n]] is not allowed at all.
Any elegant suggestions? I really would like to avoid something like
2010 Nov 27
3
Two time measures
Hello!
I have a csv file of intra-day financial data (5-min closing prices) that
looks like this: (obs - the dates are formated as day/month/year, as is
usual here in Brazil)
Date;Time;Close
01/09/2009;10:00;56567
01/09/2009;10:05;56463
01/09/2009;10:10;56370
##(goes on all day)
01/09/2009;16:45;55771
01/09/2009;16:50;55823
01/09/2009;16:55;55814
##(jumps to the subsequent day)
2011 Jan 05
3
Adding lines in ggplot2
Hello,
this is probably a recurrent question, but I couldn't find any answers that
didn't involve the expression "data frame"... so perhaps I'm looking for
something new here.
I wanted to find a code equivalent to
> x=sqrt(1:10)
> y=log(1:10)
> plot(1:10, x, type="lines", col="darkgreen")
> lines(1:10, y, col="red")
to use with
2010 Dec 23
1
Removing elements of a list object
Hello,
say I have an object
> x = list(first = 10, second = 20, third = "Yeah!")
and want to remove the $second element of that list. My first try was, of
course,
> rm(x$second)
which gave me the following error message
> Error in rm(x$second) : ... must contain names or character strings
Any ideas here, folks?
Best regards, and Merry Christmas!
Eduardo Horta
2010 Dec 07
5
LaTeX, MiKTeX, LyX: A Guide for the Perplexed
Hello Everyone,
Been learning R over the past several months. Read several books and have learned a great deal about data manipulation, statistical analysis, and graphics.
Now I want to learn how to make nice looking documents and about "literate programming." My understanding is that R users normally do this using LaTeX, MiKTeX, LyX, etc. in conjuction with Sweave. An alternative
2010 Dec 27
2
Finding indexes of minum and maximum elements of an array
Hello there
I wish to get the "coordinates" of the minimum element of an array.
For example, if the array were
> H = array(c(8:5,1:4),dim=c(2,2,2))
> H
, , 1
[,1] [,2]
[1,] 8 6
[2,] 7 5
, , 2
[,1] [,2]
[1,] 1 3
[2,] 2 4
then
> min(H)
[1] 1
and
> max(H)
[1] 8
Say "idx" were the function I'm looking for. Then, what
2011 Feb 22
2
Plotting a functional time series
Hello,
I'm willing to plot a sequence of densities on a 3d graph, something like
-----------------------------------------------------------------
x <- sapply(1:10, function(i)rnorm(1000))
f <- sapply(1:10, function(i)density(x[,i], from=-5,to=5)$y)
grid <- density(x[,1], from=-5,to=5)$x
win.graph()
persp(grid1, 1:10, f,theta=-50, phi=30, d=2)
2010 Nov 15
3
Defining functions inside loops
Hello,
I was trying to define a set of functions inside a loop, with the loop index
working as a parameter for each function. Below I post a simpler example, as
to illustrate what I was intending:
f<-list()
for (i in 1:10){
f[[i]]<-function(t){
f[[i]]<-t^2+i
}
}
rm(i)
With that, I was expecting that f[[1]] would be a function defined by t^2+1,
f[[2]] by t^2+2 and so on.
2011 Jan 27
2
pdf greek letter typos
Hi there,
yet on the topic of greek letters and pdf plotting: when I run the
following code
pdf(file="temp.pdf")
mu=seq(from=-pi, to=pi, length=100)
plot(mu, sin(mu^2),
type="l",
xlab=expression(mu%in%(list(-pi,pi))),
ylab=expression(sin(mu^2)),
main=expression((list(mu,sin(mu^2)))))
dev.off()
I get a "proportional to" symbol in place of a
2010 Nov 16
2
Integrating functions / vector arithmetic
Hello,
I was trying to build some functions which I would like to integrate over an
interval using the function 'integrate' from the 'stats' package. As an
example, please consider the function
h(u)=sin(pi*u) + sqrt(2)*sin(pi*2*u) + sqrt(3)*sin(pi*3*u) + 2*sin(pi*4*u)
Two alternative ways to 'build' this function are as in f and g below:
coeff<-sqrt(1:4)
2011 Jan 11
1
Alphabetic labels on multi-plot graphics
Is there a way to achieve
lbl=c("a", "b", "c", "d")
par(mfrow=c(2,2), ann=FALSE)
for (t in 1:4){
plot(seq(from=1,to=2*pi,length=100),
sin(t*seq(from=1,to=2*pi,length=100)), type="l")
title(main=paste("(", lbl[t], ")", sep=""))
}
without having to use an object like 'lbl'?
More generally: is it possible
2011 Nov 15
3
Sweave and accented letters
I often use Lyx/Sweave and I typically write in english.
Today I had to write a document in Italian and, as many of you know,
many italian popular words use ?, ?, ?. ?, etc.
I discovered that if I type in Italian (that is there is at least one
letter with accent) with the Sweave module selected lye is not able
to correctly compile the document.
I tried to change the input encoding, but it
2011 Jan 06
1
Cairo pdf canvas size
Hello,
I want to save a pdf plot using Cairo, but the canvas of the saved file
seems too large when compared to the actual plotted area.
Is there a way to control the relation between the canvas size and the size
of actual plotting area?
Thanks in advance, and best regards,
Eduardo Horta
[[alternative HTML version deleted]]
2011 Feb 19
1
Building an array from matrix blocks
Hello,
I've googled for a while and couldn't find anything on this topic: say
I have a matrix A and want to build matrices B1, B2,... using blocks
from A (or equivalently an array B with B[,,i] being a block from A),
and that I must sum the B[,,i]'s.
I've come up with this rather non-elegant code:
> n = 6
> p = 3
>
> A <- matrix(1:(n^2), n, n, byrow=TRUE)
>
2008 Sep 12
1
sink file type and Latex (Lyx)
Does anyone know what file type sink is outputting to? I've been
reverting output from R using sink and wanted to add it to my Appendix
in LaTex (Lyx) using "Verbatiminput". However, I get an error message as
LaTex is expecting an ASCII file.
Can I set sink somehow to ASCII or is there another option?
Thanks Joanne
2011 Nov 23
1
R-latex syntax highlighting?
Hello,
Can anyone provide or point me to a good setup for the listings latex package that would produce nice R-syntax highlighting?
I am using an example I found in internet for setting up listings like this:
\lstset{
language=R,
basicstyle=\scriptsize\ttfamily,
commentstyle=\ttfamily\color{gray},
numbers=left,
numberstyle=\ttfamily\color{red}\footnotesize,
stepnumber=1,
numbersep=5pt,
2018 Jul 17
4
Compilar libro con paquete bookdown (PDF)
Buenas, foreros y foreras;
No sé si esto es pregunta para hacer acá, lo preguntaría en stackoverfow,
si no fuese que el inglés me intimida.
Quiero usar el packete `bookdown` para escribir un libro, pero resulta que
la salida tiene que ser PDF y no lo consigo.
Siguiendo las instrucciones de acá:
https://bookdown.org/yihui/bookdown/get-started.html
llego a compilar sin ningún problema en formato
2005 Jul 27
4
LyX and Sweave
>>>>> On Mon, 25 Jul 2005 14:12:41 +0200,
>>>>> Gorjanc Gregor (GG) wrote:
> Hello R-users!
> I have tried to use Sweave within LyX* and found two ways to accomplish
> this. I have attached LyX source file for both ways as well as generated
> PDFs.
I have copied Gregor's files at
http://www.ci.tuwien.ac.at/~leisch/Sweave/LyX
for those who