Displaying 20 results from an estimated 600 matches similar to: "ggplot"
2011 Apr 27
6
Assignments inside lapply
Dear all I would like to ask you if an assignment can be done inside a lapply statement.
For example
I would like to covert a double nested for loop
for (i in c(1:dimx)){
for (j in c(1:dimy)){
Powermap[i,j] <- Pr(c(i,j),c(PRX,PRY),f)
}
}
to something like that:
ij<-expand.grid(i=seq(1:dimx),j=(1:dimy))
unlist(lapply(1:nrow(ij),function(rowId) { return
2011 Mar 30
4
a for loop to lapply
Dear all,
I am trying to learn lapply.
I would like, as a test case, to try the lapply alternative for the
Shadowlist<-array(data=NA,dim=c(dimx,dimy,dimmaps))
for (i in c(1:dimx)){
Shadowlist[,,i]<-i
}
---so I wrote the following---
returni <-function(i,ShadowMatrix) {ShadowMatrix<-i}
lapply(seq(1:dimx),Shadowlist[,,seq(1:dimx)],returni)
So far I do not get same results
2011 Apr 09
1
For->lapply->parallel apply
Dear all,
I would like to ask your help understand the subsequent steps for making my program faster.
The following code:
Gauslist<-array(data=NA,dim=c(dimx,dimy,dimz))
for (i in c(1:dimz)){
print(sprintf('Creating the %d map',i));
Gauslist[,,i]<-f <- GaussRF(x=x, y=y, model=model, grid=TRUE,param=c(mean,variance,nugget,scale,Whit.alpha))
}
creates 100 GaussMaps (each
2011 May 30
0
2D random walk with traps convert C++ code to R code
Hello, I have a C++ code for 2D random walks with traps and I want to convert it in a R code with its syntaxs, can anyone help???????
It's easy for me to adapt the body but I want help with the beginig (variable declaration) and th end exporting the output to a file ( like write.table() or sink() )
Thank you...
#include <iostream>
#include <math.h>#include
2009 Aug 04
0
Writing a NetCDF file in R
Dear all,
I am attempting to convert 10 NetCDF files into a single NetCDF file, due to the data input requirements of a model I hope to use. I am using the ncdf package, version 1.6. The data are global-scale water values, on a monthly basis for 10 years (ie. 120 months of data in total; at present the data are separated by year, with 12 months of data in each file - mrunoff_1986 through to
2009 Aug 05
0
ncdf package problem - put.var.ncdf
Dear all,
I am attempting to convert 10 NetCDF files into a single NetCDF file, due to the data input requirements of a model I hope to use. I am using the ncdf package, version 1.6. The data are global-scale water values, on a monthly basis for 10 years (ie. 120 months of data in total; at present the data are separated by year, with 12 months of data in each file - mrunoff_1986 through to
2010 Nov 05
0
NaN, ncdf
Dear All,
Can anyone please let me know how exactly ncdf deals with NaN.
I am trying to pass in a vector of data that has some NaN in it, into a variable in NetCDF.
dimX <- dim.def.ncdf("X","count",(1:6))
dimY <- dim.def.ncdf("Y","count",(1:3))
var1 <-
2010 Sep 06
0
How R converts data between objects
Hello everyone.
I would kindly request your help concerning how R converts data between
different structrures.
In the following example please keep attention on the following two
1)
I create
f <- GaussRF(x=x, y=y, model=model, grid=TRUE,param=c(mean, variance, nugget,
scale, alpha))
with
image(x,y,f)
and
image(f)
I get exactly the same image.
then
2)I try to store f inside a raster
1998 May 29
0
aov design questions
R developers,
I have a first attempt to make an aov function. Eventually I want to
build in Error() structure, but first I am trying to get this
presentable for balanced data with only a single stratum, just using
residual error. I am following R. M. Heiberger's Computation for the
Analysis of Designed Experiments, Wiley (1989)
I a using a wrapper (aov.bal) to call the
2012 Jun 19
1
R and C pointers
Dear R devel,
Apologies for these (most probably trivial) questions, doing my first
attempt to call C from R (and actually learning C in the process).
I need to pass a matrix to C, and after reading R-exts.pdf (many
times), I was unable to find how to handle matrices at C-level...
except for, what probably is the answer, that matrices are in fact
vectors with dimensions.
This is a sample code I
2013 Jan 24
1
Insert segment only on particular facets in ggplot
Dear R users,
I am working on a data-set with 3 species. They are apple, orange and
banana.
I want to annotate the facets only on the bottom panel. However, by default
I am getting annotations on all the plots. I was able to get text
annotation only on the desired plot. However, I am confused what I need to
do for the arrows / segments.
Here is my code:
library(ggplot2)
library(grid)
tempobs
2010 Apr 19
2
plotting RR, 95% CI as table and figure in same plot
Hi all--
I am in the process of helping colleagues write up a ms in which we fit
zero-inflated Poisson models. I would prefer plotting the rate ratios
and 95% CI (as I've found Gelman and others convincing about plotting
tables...), but our journals usually like the numbers themselves.
Thus, I'm looking at a recent JAMA article in which both numbers and
dotplot of RR and 95% CI are
2009 Mar 30
2
ggplot2-geom_text()
Hi: I need help with geom_text().
I would like to count the number of Locations
and put the sum of it right above each bar.
x <- "Location Lake_dens Fish Pred
Lake1 1.132 1 0.115
Lake1 0.627 1 0.148
Lake1 1.324 1 0.104
Lake1 1.265 1 0.107
Lake2 1.074 0 0.096
Lake2 0.851 0 0.108
Lake2 1.098 0 0.095
Lake2 0.418 0 0.135
Lake2 1.256 1 0.088
Lake2 0.554 1 0.126
Lake2 1.247 1 0.088
2012 Feb 02
1
"shifted" bar chart / battleship curve
What I want to do is create a horizontal bar chart matrix for a set of data that have a common set of variables (e.g., % of As, % of Bs, etc.) listed on the Y-axis and groups (e.g., Classes) on the X-axis. The key here is that the bars for each individual class plot are "centered" rather than left or right-justified. In archaeology plots similar to this are called battleship curves or
2009 May 16
1
ggplot2: annotating plot with mathematical formulae
Hi,
Is there a way of annotating a ggplot plot with mathematical formulae?
I can do
geom_text(aes(label="some text", ...
but I can't do
geom_text(aes(label=expression(x^{n-1}), ...
It gives the error
Error: geom_text requires the following missing aesthetics: label
Is there a convenient equivalent?
Cheers,
Paul
2008 May 27
1
label outliers in geom_boxplot (ggplot2)
Dear List and Hadley,
I would like to have a boxplot with ggplot2 and have the outlier values
labelled with their "name" attribute. So I did
> library(ggplot2)
> dat=data.frame(num=rep(1,20), val=c(runif(18),3,3.5),
name=letters[1:20])
> p=ggplot(dat, aes(y=val, x=num))+geom_boxplot(outlier.size=4,
outlier.colour="green")
>
2012 Apr 27
3
kiteChart to show real values with scalebar
Dear R-users
I hope someone could help me on this problem.
I want to create a multiple kiteChart showing the real values with a
scalebar on each indicating the scale .
Here are some sample data to show what I want to achieve.
Y <- read.table(textConnection("Sample1 Sample2
60 20
150 50
300
2011 Apr 14
4
Categorical bubble plot
Hi,
I do not have much R experience just the basics, so please excuse
any obvious questions.
I would like to create bubble plot that have Categorical data on the x and y
axis and then the diameter if the bubble the value related to x and y.
Attached to the email is a pic of what I would like to do.
I do hope someone can help me.
--
Regards/Groete/Mit freundlichen Gr??en/recuerdos/meilleures
2010 May 28
4
Matrix interesting question!
hi,
I have been trying to do this in R (have implemented it in Excel) but I have
been using a very inefficent way (loops etc.). I have matrix A (columns are
years and ages are rows) and matrix B (columns are birth yrs and rows are
ages)
I would like to first turn matrix A into matrix B
And then I would like to convert matrix B back again to the original matrix
A. (I have left out details of
2013 Sep 01
1
Blur and not readable text, using geom_text in ggplot
Dear R Users,
I am new to ggplot. I am using geom_text to inscribe values on my ggplot
but it is giving me values which are unreadable and blur.
Please let me know if there is any way out.
----------------- Code -----------------
*es <- es3 + geom_text(data=tmp.cor, aes(x=2, y=min(infer.df$value),*
* label=text.bottom), colour="black",*
*