Displaying 20 results from an estimated 1000 matches similar to: "How to fill out some columns? (Solved)"
2008 Apr 11
2
How to fill out some columns?
Dear R users,
I'm working with 2 data sets which look like (for example) dx and dy in the
next code:
# Seed
set.seed(4)
# First data frame
dx=matrix(rnorm(6*5),ncol=6)
colnames(dx)=LETTERS[1:6]
# Second data frame
dy=matrix(rnorm(3*5),ncol=3)
colnames(dy)=c('A','C','E')
As you will notice, some columns in both data sets have the same names. At
the end, what I need
2008 Mar 05
0
[PATCH] ioemu: fix SDL mouse events processing
ioemu: fix SDL mouse events processing
- GetRelativeMouseState always returns the last position, so when the
polling loop gets several mouse events in one go, we would send
useless ''no move'' events.
- So as to make sure we don''t miss any mouse click / double click, we
should not use GetRelativeMouseState() to get the button state, but
keep records of the button
2009 Aug 11
3
Lattice: How to do error bars
I am trying to add 2 stdev error bars to lattice type plots:
panel.ebar<-function(x,y,dy=NULL,...) {
panel.xyplot(x,y,...)
panel.segments(x,y-dy,x,y+dy,...)
}
Then:
xyplot(y~x|fc,data=dat,dy=dat$dy,panel=panel.ebar)
This adds error bars but they are not conditioned on the factor fc.
xyplot(y+I(y-dy)+I(y+dy)~x|fc,data=dat)
This produces 3 series of points in different colors, conditioned
2011 Aug 11
1
Splitting data
I want to implement the following algorithm in R:
I want to split my data, use a t test to compare both means of the groups to see if they significantly differ from each other. If this is a yes (p < alpha) I want to split again (into 4 groups) and do the same procedure twice, and stop otherwise (here the problem arises). As a final result I would have different groups of data.
I made some
2002 Mar 21
1
legend - bug with argument angle (PR#1404)
When legend() is used with the angle argument as follows, not only the
boxes beside the legend text, but also the whole legend box is filled
with shading lines.
I think this is not intended:
plot(1:10)
legend(8, 4, c("A", "B"), angle=c(10, 80), fill=NULL, density=20)
I'd suggest as a fix (legend.R of R-1.5.0):
25c25
< rect2 <- function(left, top, dx, dy,
2005 Dec 08
1
kronecker(... , make.dimnames=TRUE)
Hi
I'm using kronecker() with a matrix and a vector. I'm interested in
the column names that kronecker() returns:
> a <- matrix(1:9,3,3)
> rownames(a) <- letters[1:3]
> colnames(a) <- LETTERS[1:3]
> b <- c(x=1,y=2)
> kronecker(a,b,make.dimnames=TRUE)
A: B: C:
a:x 1 4 7
a:y 2 8 14
b:x 2 5 8
b:y 4 10 16
c:x 3 6 9
c:y 6 12 18
>
The
2001 Oct 12
2
FLOOR_fromdB_LOOKUP
Hello,
You know, I always worry about the precision
and the float constants... and there is a large
lookup table in the floor1.c ... and I figure out
a way to keep the code size and speed, but
to improve the precision at this lookup table.
(the difference is small, but audible)
Here is the modifications in the floor1.c:
tatic unsigned long FLOOR_fromdB_LOOKUP[256]={
2011 Oct 02
0
deSolve - Function daspk on DAE system - Error
I'm getting this error on the attached code and breaking my head but can't
figure it out. Any help is much appreciated. Thanks, Vince
CODE:
library(deSolve)
Res_DAE=function(t, y, dy, pars) {
with(as.list(c(y, dy, pars)), {
res1 = -dS -dES-k2*ES
res2 = -dP + k2*ES
eq1 = Eo-E -ES
eq2 = So-S -ES -P
return(list(c(res1, res2, eq1, eq2)))
})
}
pars <- c(Eo=0.02,
2011 Oct 03
0
deSolve - Function daspk on DAE system - Error (Vince)
Vince,
When that happens, one possible reason is that your DAE is of index > 1,
which cannot be solved by daspk.
The solver radau, also from deSolve can handle DAEs up to index 3, but
you need to rewrite the problem in the form M*y' = f(x,y), where M is a
mass matrix.
If you do that for your problem, and solve it with radau, then radau
complains that the "matrix is repeatedly
2003 May 14
1
lme speedup question
I am hoping someone will be kind enough to have a look at the following piece of code and tell me if there is a way to run lme() so it is a lot faster. The inner loop, j in 1:15000, takes about 2 hrs on my 2.8GHz dual Xeon 4GB RAM machine. The timings I have done show the dominant execution time is in lme.
options(contrasts=c("contr.sum", "contr.sum"))
2012 Oct 10
3
Generating random geographical coordinates
Dear all,
I have two coordinates vectors, say X and Y of length n.
I want to generate for each couple of coordinates X1,Y1 X2,Y2
X3,Y3....Xn,Yn a random coordinate which is located in a square define
as X +/- dx and Y +/- dy.
I saw the runif function which can generate for just one value at a time
what I want : runif(1, X - dx, X + dx) for X and runif(1, Y - dy, Y +
dy) for Y.
I would like
2005 Dec 29
1
use of tapply?
I'm still learning how to program with R and I was hoping someone could
take the time to show me how I can rewrite this code?
Many thanks
Tom
data.intersects<-data.frame(
x=c(0.230,0.411,0.477,0.241,0.552,0.230),
y=c(0.119,0.515,0.261,0.431,0.304,0.389),
angle=vector(length=6),
length=vector(length=6),
2001 Mar 21
0
Suggest new outer for R-1.3
Hi everyone,
Can I suggest the following modification of outer for R-1.3, in the
interests of speed and size of calculation:
*******************************************************************
"outer" <-
function (X, Y, FUN = "*", ...)
{
no.nx <- is.null(nx <- dimnames(X <- as.array(X)))
dX <- dim(X)
no.ny <- is.null(ny <- dimnames(Y <-
2009 Jun 04
0
type = 'b' with Grid
Dear all,
I feel like I've been reinventing the wheel with this code (implementing
type = 'b' for Grid graphics),
http://econum.umh.ac.be/rwiki/doku.php?id=tips:graphics-grid:linesandpointsgrob
Has anyone here attempted this with success before? I found suggestions
of overlapping large white points to mask the lines but it's not ideal.
I welcome any comments on the code.
2007 May 19
2
Crash in blur.c (SIGSEGV)
Hello.
System info:
OS: FC6 x86_64
video: Nvidia GF 7900 GT, driver version 97.55
compiz version: git
config backend used: ccp
I can reproduce this crash every time on my system. When blur plugin is active and I try to access any right-click menu, regular application menu or drop-down list, compiz crashes. Backtrace produced by crashhandler plugin shows crash in blur.c in function
2012 Nov 27
2
in par(mfrow=c(1, 2)), how to keep one half plot static and the other half changing
Hi,
I'm trying to plot something in the following way and would like if
you could help:
I'd like in a same plot window, two plots are shown, the left one is a
bird-view plot of the whole data, the right half keep changing, i.e.,
different plots will be shown up on request, so that when I
select/click on some where in the left plot, the right plot will be
the corresponding plot.
What I
2011 Nov 30
1
How can I pick a matrix from a function? (Out Product of Gradient)
Hi all,
I would like to use optim() to estimate the equation by the log-likelihood
function and gradient function which I had written. I try to use OPG(Out
Product of Gradient) to calculate the Hessian matrix since sometime Hessian
matrix is difficult to calculate. Thus I want to pick the Gradient matrix
from the gradient function.
Moreover, could R show the process of calculation on gradient
2006 Jan 06
2
panel data unit root tests
When finally got some time to do some coding, I started and stopped right
after. The stationary test is a good starting point because it demonstrates
how we should be able to move the very basic R matrices. I have a real-
world small N data set with
rows:
id(n=1)---t1---variable1
...
id=(N=20)---T=21---variable1
Thus, a good test case. For first id I was considering something like this:
lag
2009 Jun 06
1
large numbers of observations using ME() of spdep
Dear All,
We aim to remove the spatial structure of our data using Moran Eigen
Vectors and spdep package . Our data has 3694 samples and 13
variables.
The computer stop working after almost 4 days of processing (we found
it emitting a sharp sound and with all colors on the screen. No
wories, it was restared without problem!). And we are left with
nothing: no result file was produced since the
2006 Sep 01
1
difference between ns and bs in predict.glm
I am fittling a spline to a variable in a regression model, I am then using
the predict.glm funtion to make some predictions. When I use bs to fit the
spline I don't have any problems using the predict.glm function however when
I use ns I get the following error:
Error in model.frame(formula, rownames, variables, varnames, extras,
extranames, :
variable lengths differ (found for