Displaying 20 results from an estimated 34 matches for "pmassicotte".
2012 Jul 03
2
Data manipulation with aggregate
Hi everyone.
I have these data :
myData = data.frame(Name = c('a', 'a', 'b', 'b'), length = c(1,2,3,4), type
= c('x','x','y','z'))
which gives me:
Name length type
1 a 1 x
2 a 2 x
3 b 3 y
4 b 4 z
I would group (mean) this DF using 'Name' as grouping factor. However, I
have a
2013 Oct 04
3
Trying to avoid nested loop
Dear R users.
I'm trying to avoid using nested loops in the following code but I'm not sure how to proceed. Any help would be greatly appreciated.
With regards,Phil
X = matrix(rnorm(100), 10, 10)
## Version with nested loopsresult = 0
for(m in 1:nrow(X)){ for(n in 1:ncol(X)){ if(X[m,n] != 0){ result = result + (X[m,n] / (1 + abs(m - n))) } }}
## No loop-sum(ifelse(M
2011 Apr 18
2
Avoiding loop
Hi everyone.
I'm using matrix product such as :
#Generate some data
NCols = 5
NRows = 5
A = matrix(runif(NCols*NRows), ncol=NCols)
B = matrix(runif(NCols*NRows), ncol=NCols)
#First calculation
R = A%*%B
for(i in 1:100)
{
R = R%*%B
}
I would like to know if it was possible to avoid the loop by using something
like mapply or anything else.
Tx in advance,
Phil
--
View this message
2012 Apr 12
1
Help with vectorization
Hi every one. I have a exponential function (3 fitting parameters) that I
would like to use to produce data (6 series) without having to use a loop.
Here
wl = seq(300,500,1)
k1 = c(1.2e-6, 4.9e-6, 9.6e-6, 2.7e-10, 6.7e-8, 7.44e-6)
k2 = c(726, 352, 128, 5232, 1538, 128)
k3 = c(-176, -224, -257, 88.7, -111, -256)
stations = c('R5d', 'R5a', 'R9', '108',
2012 Apr 20
1
Quick question about princomp/biplot
Hi everyone.
I performing a simple PCA using the princomp function. Then, I use the
biplot function to show it. However, the function use line number to
represent samples. I would like to know if there's a way to use a dot
(point) instead of the line number when using the biplot function.
With regards,
Phil
--
View this message in context:
2012 Oct 18
2
Re-projecting geotiff
Dear R users,
I'm currently trying to re-project a geotiff in another coordinate system.
For instance, I have a tif image in UTM 19 zone which I would like to
reproject into UTM 18. I was wondering if it was possible in R.
Furthermore, I looked into 'rgdal' package, but I can't really find out if
I'm doing the right thing. So far, here is what I'm doing:
library(rgdal)
2012 Nov 29
2
googleVis plot and knitr/sweave
Dear R users.
I'm currently making a report with knitr (RStudio) where I would like to
plot a googleVis map. However, the map generated is an HTML file which I
don't know how to integrate it in my report.
So my question is how to include a map generated with googleVis in a PDF
created with knitr/sweave.
Regards,
Phil
--
View this message in context:
2013 Feb 23
1
Help with layout
Dear R users.
I'm new with layout and I can't figure how to teak my graphs.
I have the following code:
layout(matrix(c(1,2,3), 3, 1, byrow = TRUE), heights=c(0.3,0.3,0.6))
boxplot(rnorm(100), horizontal=TRUE, axes=FALSE)
boxplot(rnorm(100), horizontal=TRUE, axes=FALSE)
hist(rnorm(100))
Is it possible to have the two horizontal boxplot closer to each other?
With regards,
Phil
2011 Nov 01
3
Greek letter
Hi everyone.
I'm trying to use small letter phi in a graph produced in R. However, the
small letter phi does not look as it should.
In fact, it looks like this:
http://r.789695.n4.nabble.com/file/n3963311/Untitled.png
instead of what is here http://en.wikipedia.org/wiki/Phi
Here's the code I use:
expression(phi [1])
Anyone has an idea?
With regards,
Phil
--
View this message
2012 Feb 06
1
Creating time series (ts) object
Hi everyone.
I have have a dataset with daily measurement from January 1st of 1966 up to
December 31th of 2011.
Here's the first part of the data:
Date SLEV
1/1/1966 1.086
1/2/1966 1.079
1/3/1966 1.133
1/4/1966 1.261
1/5/1966 1.391
1/6/1966 1.571
1/7/1966 1.728
1/8/1966 1.823
1/9/1966 1.97
1/10/1966 1.804
1/11/1966 2.02
1/12/1966 2.017
1/13/1966 1.86
1/14/1966 1.96
1/15/1966 1.813
1/16/1966
2010 Oct 12
6
List or matrix of object
Hi everyone.
Is it possible in R to create a matrix or a list (vector) or R object. For
instance, I have
f1 <- function(x) sqrt(x%*%x);
f2 <- function(x) (2x+1);
I would like to do something like
L <- List();
L[1] = f1;
L[2] = f2;
So, is there a way to create matrix or vector that can contains R object.
With regards,
Phil
--
View this message in context:
2013 Dec 02
3
legend position
Hi all.
I'm ploting a raster and I can't find the proper way to move the legend. For example,
r = raster(system.file("external/test.grd", package="raster"))plot(r)
How can I put the legend at the desired position?
Thank in advance,Phil
[[alternative HTML version deleted]]
2010 Sep 16
1
Help with graphic margin
Hi everyone.
I would like to make a graphic with 2 subplots (lets say A and B). For
instance, I use :
par(mfcol = c(2,1));
The 2 subplots use the same X axis. So I provide no tics labels and no xlab
for the top plot. I would like the second plot to be right bellow the first
one (small margin).
So my question is how I can keep a small gap between the 2 plots while
having enough space under
2010 Sep 30
3
Inserting a plot into another
Hi everyone.
I would like to know if it was possible to insert a plot into another one.
For example I have a plot and I would like to add a smaller plot in the top
right corner.
Best regards,
Phil
--
View this message in context: http://r.789695.n4.nabble.com/Inserting-a-plot-into-another-tp2720936p2720936.html
Sent from the R help mailing list archive at Nabble.com.
2011 Mar 03
2
Greek character and R
Dear R users.
In a loop, I set the title of my graph with :
mytitle = expression(paste(delta^13,'C Station ', i)
title(mytitle)
However, instead of using value of i, it will literally use "i" character.
Any one know the way to concatenate the value of i to the mathematical
expression?
With regards,
Phil
--
View this message in context:
2011 Aug 15
1
Font size R
Hi everyone.
I'm using this following code:
pdf(file="Fig5.pdf", width = 4.86, height = 6.29, pointsize = 10, family
='Times')
par(mfcol = c(3,2), mai = c(0.4,0.8,0,0), omi = c(0.7, 0, 0.7, 0.1));
hist( rnorm(100) )
dev.off()
When I open this in any vectorial software (like Illustrator), it says that
my font size is 7 instead of 10 that I specified.
I have tried
2011 Aug 16
3
Text wrap
Hi everyone.
I have a long label that I would like to split. I found that I could use
"strwrap" for simple text. However, this is not working with this label:
str = expression(paste("< 20 ?m phytoplankton ","(cells ? ",mL^-1,")"))
plot(...., ylab = strwrap(str,20),...)
I suspect this is because I'm using "expression" for form my label.
2010 Jul 22
2
Mathematical expression
Hi everyone.
I'm trying to display the r^2 of a linear regression on a plot using
text(...). I first build the string to display. However, I can't find why
this is not working (it display literally r^2 instead of r superscript 2).
r2string = expression(paste(r^2)," = ", r2);
Any help would be greatly appreciated,
Phil
--
View this message in context:
2010 Jul 30
1
Problem with "par" and "bubble plot"
Hi all.
I have been trying to plot 9 bubble plots on each page of a PDF file. For
this, I'm using :
par(mfcol = c(3,3), mar = c(3,3,3,3), oma = c(0,0,0,0));
However, when plotting the bubble plot (gstats package), it plots the graph
on a full page. I tried to plot something else with plot(x,y) and it works
as intended. So I'm guessing the problem comes from the bubble plot itself.
2010 Oct 05
2
loess and NA
Hi everyone.
I'm trying to do a loess with missing value on independant variable.
doc = c(2.27904, 2.59536, 7.44696, NA, 6.24264, 4.58400, 5.79192, 5.39502,
7.41216, 4.09440, 4.22868, 4.24620, 5.43804, 1.95528);
distance = c(26.5,56.5, 90.3, 123.0, 147.5, 176.0, 215.7, 229.3, 252.0,
325.3, 362.0, 419.3, 454.6, 470.0);
myloess = loess(doc ~ distance, na.action = na.omit);
plot(distance,