Displaying 4 results from an estimated 4 matches for "massicotte".
Did you mean:
pmassicotte
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
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]]
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
2013 Mar 12
1
Fine control of plot
Hi everyone.
I'm trying to create a graph where I could plot some lines on the right side. Here an example:
layout(matrix(c(1,2), 1, 2, byrow = TRUE), widths=c(6,2), heights=c(1,1))
x = 1:100y = rnorm(x)+xplot(x,y)
reg = lm(y~x)abline(reg, col = "red")
plot(1, type="n", axes=F, xlab="", ylab="", xlim = c(-1,1), ylim = c(min(y),