Displaying 20 results from an estimated 2000 matches similar to: "Assignments inside lapply"
2011 Apr 22
1
ggplot
Hello everyone,
I am using ggplot
to plot but I am getting the following error which I do not understand
Error: geom_text requires the following missing aesthetics: label
My code is
dimx<-256
library(ggplot2)
dev.new()
xandy<-expand.grid(seq(1:dimx),seq(1:dimy))
xx<-data.frame(xandy[[1]],xandy[[2]],Powermap=Powermap)
subsetxx<-subset(xx, xx$Powermap>threshold)
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 Oct 15
2
function for handling time
Dear all
I have the following time stamps (in the following format)
MeasurementSet$TimeStamps
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 2011 7 2 13 43 48.718
[2,] 2011 7 2 13 43 54.281
[3,] 2011 7 2 13 43 59.843
[4,] 2011 7 2 13 44 5.390
[5,] 2011 7 2 13 44 10.859
[6,] 2011 7 2 13 44 16.375
[7,] 2011 7 2 13 44
2010 Nov 18
3
Sample covariance matrix in R
Hello everyone.
I would like to find the sample covariance matrix using R.
So far I read on the wikipedia what a sample_covariance is
http://en.wikipedia.org/wiki/Sample_covariance
according to wikipedia one vector is enough to calculate the sample covariance matrix.
In R I tried cov(myvector) and I get the reply that I need to pass either two argument or one matrix with x,y values .
How can I
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
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
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
2010 Oct 27
2
keep adding elements to the matrix
Hello everyone,
I would like to create a "dynamic" array to keep storing number in it
for (i in c(2:length(final))){
myarray <-final[i]-final[i-1]
myarray2<-2*final[i]
}
At the end I would like to use myarray as the x values of an array
and the myarray2 as the yvalues of the same array.
I tried cbind but it didnot work.
Could you please help me with that?
Best
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
2010 Mar 12
1
Length as fun.aggregate in cast function of reshape package: unexpected error
Dear Everyone,
I am having problems with use of the reshape package's cast function using length as an aggregating function.
Unexpectedly, I receive the error: 2 arguments passed to 'length' which requires 1
I don't understand this at all - the data I'm using is very simple, and appears almost identical to that used in the
ChickWeight example in the package. The problem can
2009 Apr 28
1
latticeExtra: useOuterStrips and axis.line$lwd
Hi,
I'm working on some lattice wireframe figures that have two conditioning
factors, and I want the strips labelled on the top and left of the
entire plot, rather than above each individual panel. useOuterStrips()
does this, but it draws internal axis lines, even after I explicitly set
axis.line to 0. Is there a way to use useOuterStrips but without axis
boxes?
I've included a short
2010 Feb 08
1
R ggplot2 legend text left justify
In ggplot2 how do you justify the legend text ?
In the example below the opts(legend.text = theme_text(size =
9,hjust=0)) changes the size of the text OK but it remains right
justified.
> mydata=data.frame(RowID=c("A","B","C"),Name=c("long long long long
long name","short name ","medium medium name"),Speed=c(100,140,120))
>
2007 Jun 23
2
End of File Error on index optmize
I was optimizing a 650MB using ferret (0.11.3) and I received the
following error. I''ve seen some people have similar issues but I
haven''t seen any resolutions. The contents of the index directory
follow the error. Has anyone seen anything like this and found a
resolution? Many thanks.
/mnt/apps/search/releases/20070622175637/script/../config/../vendor/
2012 Aug 17
2
How can we compare corresponding values of x and y (first value of x exacly matches with the first value of y)?
df <- data.frame (
"RowId" = 4:7,
"x"=c("1_1", "2_2", "3_3", "3_3"),
"y"=c("1_1", "3_3", "2_2", "3_3")
)
How can we compare corresponding values of x and y (first value of x exacly matches with the first value of y)?
If they were not matced
2020 Sep 24
1
How to use `[` without evaluating the arguments.
Hello R-devel,
I am currently attempting to implement an API similar to data.table wherein single bracket subsetting can accept an unquoted expression to be evaluated in the context of my object.
A simple example from the data.table package looks like this:
DT <- data.table(col1 = c('a', 'b', 'c'), col2 = c('x', 'y', 'z'))
DT[col1 ==
2007 Apr 14
3
Error on optimize leads to corrupt index?
The following exception occurred while trying optimize a large index:
vendor/gems/rdig-0.3.4/lib/rdig/index.rb:46:in `optimize'': End-of-
File Error occured at <except.c>:93 in xraise (EOFError)
Error occured in store.c:216 - is_refill
current pos = 0, file length = 0
Now, I get the following error any time I try to create a new index
on the directory that I was trying
2012 Mar 07
1
SELECT CASE in RODBC
Hi all,
I have a problem with a variable created by a SELECT CASE statement. See
the code below.
I would like the variable "event" to be a character variabel as I want to
UNION my two SELECTs - and the "event"-variable is a character variable in
the first SELECT result.
I have tried different ways:
* used ' ' in stead of " " around the string I want as the