Merge will give you an output like below and you should be able to
find the value you need:
> merge(df1, df2, by='ID', all=TRUE)
ID Date.x y.x x.x Date.y
y.y x.y
1 1NANA 2007-05-31 23:00:00
-20.82907 217.7022
2 1
tsippel wrote:
The suggestion below was made.
df1$Date <- as.Date(df1$Date)
df2$Date <- as.Date(df2$Date)
ifelse(df1$ID==df2$ID & df1$Date-df2$Date<0.5,df1$y-df2$y, NA)
However, because my dataframe rows do not align, I need the conditionals to
be tested on every combination of cells. I'm s
The suggestion below was made.
df1$Date <- as.Date(df1$Date)
df2$Date <- as.Date(df2$Date)
ifelse(df1$ID==df2$ID & df1$Date-df2$Date<0.5,df1$y-df2$y, NA)
However, because my dataframe rows do not align, I need the conditionals to
be tested on every combination of cells. I'm starting to think
Dear Gabor,
Thank you for the quick answer.
I will use plot.zoo and strech the x-axis with xlim to fit the legend on the
right side of the plot.
Best regards,
Rosa
On Sun, Dec 28, 2008 at 10:52 PM, Gabor Grothendieck <
ggrothendi...@gmail.com> wrote:
> On Sun, Dec 28, 2008 at 3:06 PM, Rosa
On Sun, Dec 28, 2008 at 3:06 PM, Rosa Trancoso wrote:
> Hello,
>
> I have a zoo object that I would like to plot with lattice, because I need
> the legend outside the plots. However, I don't want to use the strips,
> because these figures are for publication.
>
> I noticed that if I choose strip=F
Hello,
I have a zoo object that I would like to plot with lattice, because I need
the legend outside the plots. However, I don't want to use the strips,
because these figures are for publication.
I noticed that if I choose strip=FALSE but add the ylab argument, the
xyplot.zoo functions plots all
Dear R users:
I'm new to R and am trying to fit a mixed model
Cox regression model with coxme function.
I have one two-level factor (treat) and one
covariate (covar) and 32 different groups
(centers). I'd like to fit a random coefficients model, with treat and covar
as fixed factors and a random
Dear guRus,
I am doing a logistic regression using restricted cubic splines via
rcs(). However, the fitted probabilities should be nondecreasing with
increasing predictor. Example:
predictor <- seq(1,20)
y <- c(rep(0,9),rep(1,10),0)
model <- glm(y~rcs(predictor,n.knots=3),family="binomial")
p
Is that an appropriate request?
On Sun, Dec 28, 2008 at 2:14 PM, Marcus Vinicius wrote:
>>
>>
>
> Dear R user´s,
> Is there anyone that may send me *Spatial Statistics* e-book from *Brian
> Ripley* ?
> Thanks a lot.
> Best regards.
>
>
>
> --
> Marcus Vinicius P. de Souza
> Juiz de Fora - Minas
Please read the last line to every message to r-help. There is no
code in your post so we have no idea what you did wrong.
> x <- matrix(1:12, 3, 4, dimnames = list(letters[1:3], LETTERS[1:4]))
> x
A B C D
a 1 4 7 10
b 2 5 8 11
c 3 6 9 12
> rownames(x)
[1] "a" "b" "c"
> colnames(x)
[1] "A" "B"
On 12/23/08, richard.cot...@hsl.gov.uk wrote:
> Hopefully an easy question. When drawing a rectangles in a lattice plot
> key, how do you omit the black borders?
They are currently hard-coded. I will add support for a 'border' component.
-Deepayan
> Here is an example adapted from one on the
?rownames
?colnames
> x <- matrix(nrow=7, ncol=3)
> rownames(x) <- paste('name', 1:7)
> rownames(x)
[1] "name 1" "name 2" "name 3" "name 4" "name 5" "name 6" "name 7"
>
On Sun, Dec 28, 2008 at 12:43 PM, Math Girl wrote:
> Hello,
>
> I have a 3 x 7 matrix. I want to assign a name to each row
>
Hello,
I have a 3 x 7 matrix. I want to assign a name to each row
and each column. I tried using
dimnames, but for some reason I cannot retrieve the names of the rows or the
names
of the columns. Is there another way to name the rows and columns and refer to
them?
[[alternati
>
>
Dear R user´s,
Is there anyone that may send me *Spatial Statistics* e-book from *Brian
Ripley* ?
Thanks a lot.
Best regards.
--
Marcus Vinicius P. de Souza
Juiz de Fora - Minas Gerais
Brasil
[[alternative HTML version deleted]]
__
R-h
I would use paste but as.Date(ISOdate(...)) is another possibility although
it uses paste internally itself.
On Sun, Dec 28, 2008 at 2:11 PM, Terry Therneau wrote:
> I have a data from with 3 numeric variables, and wish to create a Date
> object.
> The old "date" library had a function mdy.date
I have a data from with 3 numeric variables, and wish to create a Date object.
The old "date" library had a function mdy.date to do this. I've chased all of
the See Also sections I can find for the Date class, and didn't find anything
comparable.
Yes, I can use as.Date(paste(data$year+1900, da
Try this. na.approx fills in missing values. See
?na.approx, ?approx and ?plot.zoo and the
three zoo vignettes.
Lines <- 'Subject: 1 2 3 4
"1"NA3 2 NA
"2"4NANA 4
"3"66.5 6 5.5
"4"7NA N
Hi,
I have sets of three points provided by subjects that I want to graph
as lines over a specific range, but the subjects were split into two
groups and provided different points. The subjects provided a y-value
for the given x-value, for example:
Subject: 1 2 3 4
Lisa mac.com> writes:
>
> I am working off an example from Deepayan Sarkar's
> Lattice:Multivariate Data Visualiization with R. I am trying to create
> Figure 5.6, essentially, but I would like to be able depict different
> metro areas. These of course have different lat/longs, so I need
Hi all,
I have two networks for the same group of the users.
I want to compare individual's degree in different networks.
But how could I get the degrere of the nodes according to its name?
When I use degree(g1), I could only get a vector of the degree of each node.
But when I turn to g2, I don't
Dear Jarrod,
If you use na.action=na.exclude in fitting the model, then you can produce
rows of NAs in the model matrix with na.resid(); e.g., for a model m,
mm <- naresid(m$na.action, model.matrix(m))
Then if you really want to convert the rows of NAs in mm to 0s, you could
use
Hi,
Does anyone know an easy way of retaining rows in a model.matrix where
missing values are present in the predictors. Ideally I'd be able to
retain these rows as zeros.
Thanks,
Jarrod
--
The University of Edinburgh is a charitable body, registered in
Scotland, with registration numb
Dear all,
I am looking to compute a 2-player Nash Equibrium. Has anybody looked
into similar things before? I would like to implement it in R instead of
doing it in Matlab. Thanks.
Tao
[[alternative HTML version deleted]]
__
R-help@r-proj
Given a time series of length N, I am trying to figure out its maximum DWT
decomposition level.
With reference to "dwt" function of R package "wavelets", running the provided
example I get the following
and wonder how the maximum decomposition level (which is not an integer number)
is calculated
Given a time series of length N, I am trying to figure out its maximum DWT
decomposition level.
With reference to "dwt" function of R package "wavelets", running the provided
example I get the following
and wonder how the maximum decomposition level (which is not an integer number)
is calculated
Using the built in CO2 data frame this regresses uptake on all the
other columns:
lm(uptake ~., CO2)
On Sun, Dec 28, 2008 at 2:28 AM, Math Girl wrote:
> Hello,
>
> How could I generalize the following statement for an arbitrary number of
> columns instead of 7?
>
> result[[i]]<-lm( returns[,i]
Hello,
I am hoping for some advice regarding warning/error messages I
received when running a Cox regression
# message 1 - obtained while creating a plot of residuals
> plot (NV.zph, main = "groupNUSM - UNFIT", var= 'groupNUSM')
Warning messages:
1: In approx(xx, xtime, seq(min(xx), max(xx),
27 matches
Mail list logo