For the example df below this also works:
library(lattice); library(zoo)
xyplot(zoo(df[1:4], df$x), type = "p")
On Sun, Sep 6, 2009 at 12:51 AM, David Winsemius wrote:
> I'm not exactly sure what structure df has. Here's my effort to duplicate
> it:
>
> df <- data.frame(y=matrix(rnorm(24), nrow=6
Thanks David, your way of constructing df is much more compact than what I
was using, so I've incorporated it. I also had my rows and columns
transposed relative to how xyplot wanted them (though I had tested for that,
other problems interfered).
In my case, I may have varying numbers of y column
Hello,
I am working on getting optimal lags by using BIC, But I don't know
how to calculate BIC. Is there any code or useful function for it?
Thanks and regards,
Dan Zhao
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-
I'm not exactly sure what structure df has. Here's my effort to
duplicate it:
df <- data.frame(y=matrix(rnorm(24), nrow=6), x=1:6)
> df
y.1y.2y.3y.4 x
1 0.1734636 0.2348417 -1.2375648 -1.3246439 1
2 1.9551669 -1.1027262 -0.7307332 0.3953752 2
3 -0.7645778 1
Hello R Folks...
I have a list with the following structure:
> str(df)
List of 3
$ y: num [1:4, 1:1242] -0.005379 0.029874 -0.023274 0.000655 -0.004537
..
$ x: num [1:1242] 501 503 505 507 509 ...
$ names: Factor w/ 4 levels "PC Loading 1",..: 1 2 3 4
I want to plot each row of df$y a
On Sep 5, 2009, at 5:07 PM, spencerg wrote:
What software exists for digitizing video to quantify the motion
of specific features in the image? I might be willing to use
something that's NOT in R, though I'd prefer something in R (or at
least with an R intereface).
A few options tha
Hi Abbas,
Before I try to give you answers, I just want to mention that you
should send R related reqests to the R-help list, and not me
personally because (i) there's a greater likelihood that it will get
answered in a timely manner, and (ii) people who might have a similar
problem down the road
why not transform the y-data?
On Sat, Sep 5, 2009 at 8:03 PM, Michael Kubovy wrote:
> Hi,
>
> Does anyone know how to do a coord_trans() in which the y-axis is tranformed
> into (for example) -1000/y?
>
> Thanks,
> _
> Professor Michael Kubovy
> University of Virginia
>
What software exists for digitizing video to quantify the motion
of specific features in the image? I might be willing to use something
that's NOT in R, though I'd prefer something in R (or at least with an R
intereface).
Thanks,
Spencer Graves
__
Hi,
Does anyone know how to do a coord_trans() in which the y-axis is
tranformed into (for example) -1000/y?
Thanks,
_
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400Charlottesville, VA 22904-4400
Parcels:Ro
I would use the base plot routine
plot(x,c, type='l', ylim=range(a,c))
points(x,a)
park(new=TRUE)
plot(x,d,type='l', ylim=range(b,d), axes=FALSE,ylab='', xlab='')
pints(x,b)
axis(4)
On Fri, Sep 4, 2009 at 11:28 AM, Paul Sweeting wrote:
> Hi
>
> Well, I think the title says it all! I've looked th
Tyr this:
> system.time(sort(x, partial=c(99,100)))
user system elapsed
0.120.000.14
On Fri, Sep 4, 2009 at 3:53 AM, ONKELINX,
Thierry wrote:
> Using tail() for the selection is more elegant and slightly faster.
>
>> N<- 100
>> x <- runif(N)
>> system.time(x[order(x)[c
Try this:
# Use cummin for 'and'
> x <- c(TRUE, TRUE, FALSE, TRUE)
> cummin(x) == TRUE# the last element below is the result you want
[1] TRUE TRUE FALSE FALSE
# Use cummax for 'or'
> y <- c(FALSE, FALSE, TRUE, FALSE)
> cummax(y) == TRUE# the last element below is the result you want
2009/9/5 Henrique Dallazuanna
>
> Try this:
> anova(myModels[[1]],myModels[[2]])
>
> do.call(anova, myModels)
Does this work for you? Both functions are failing here:
> anova(myModels[[1]],myModels[[2]])
Error in names(mods) <- sapply(as.list(mCall)[c(FALSE, TRUE, modp)],
as.character) :
'name
Try this:
1)
anova(myModels[[1]],myModels[[2]])
2)
do.call(anova, myModels)
On Sat, Sep 5, 2009 at 5:18 PM, Jeroen Ooms wrote:
>
> I have a list object, in which I have stored n lme4-models. For example:
>
> library(lme4);
> myModels <- list();
> myModels[1] <- lmer(Reaction ~ Days + (Days|Sub
On 05-Sep-09 10:00:26, Markku Karhunen wrote:
>> On 04-Sep-09 10:45:27, Markku Karhunen wrote:
>>> True. Should have read ?diag.
>>>
>>> However, this provokes a more general question: Is there some way I
>>> can declare some scalar and _all its functions_ as matrices?
>>>
>>> For instance, I would
I have a list object, in which I have stored n lme4-models. For example:
library(lme4);
myModels <- list();
myModels[1] <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy)
myModels[2] <- lmer(Reaction ~ Days + (1|Subject) + (0+Days|Subject),
sleepstudy)
Now I would like to perform an anova ove
Hello,
I would appreciate help regarding converting an image (jpeg, bmp) in R and
saving it to a postgresql database server.
Does the writeBin function provide any support for image to binary
conversion?
Once converted, how can I use the packages "DBI" and "RPostgreSQL" to send
such data into the s
Try this variation; might have something to do with scope:
testA<-function(input)
{
dat<- data.frame(A=seq(input,5), B=seq(6,10))
vec.names<- c("a", "b")
for(i in 1:ncol(dat))
{
tab<- dat[,i]-1
assign(vec.names[i], tab)
}
do.call("rbind", lapply(
On 05/09/2009 2:21 PM, David Winsemius wrote:
I get the same error in a bash session on a Mac. My assumption at this
point is is that the authors of Rscript decided that you should
already know what is in the input file and so left out that feature of
the console program. Mavbe if you explai
I get the same error in a bash session on a Mac. My assumption at this
point is is that the authors of Rscript decided that you should
already know what is in the input file and so left out that feature of
the console program. Mavbe if you explained why you wanted what would
generally be a
Try this:
my.array <- replicate(10, data.frame(matrix(sample(9), 3)), simplify =
FALSE)
#2
lapply(my.array, replace, list = 3, values = newThirdColumn)
The solution was for matrices, the above works with data.frames.
On Thu, Sep 3, 2009 at 5:03 PM, Carlos Hernandez wrote:
>
> On Thu, Sep 3, 2
> -Original Message-
> From: r-help-boun...@r-project.org
> [mailto:r-help-boun...@r-project.org] On Behalf Of Jeroen Ooms
> Sent: Saturday, September 05, 2009 9:20 AM
> To: r-help@r-project.org
> Subject: [R] Convert dataframe to array of records
>
>
> I would like to convert a datafram
you might also look at the output of 'ps' to see how much time each
process is using. also instrument your R script to collect the cpu
time.
Sent from my iPhone
On Sep 4, 2009, at 11:34, j.delashe...@ed.ac.uk wrote:
Ah! sorted!
it was NOT running the same code.
We're making a GUI using
HI,
Try this:
mapply(`+`, as.data.frame(x), as.data.frame(y))
You are using matrices, which are vectors with dim attributes, then you need
convert to data.frame
On Sat, Sep 5, 2009 at 1:16 PM, Peng Yu wrote:
> Hi,
>
> I tried the following code. For example, I want to add the
> corresponding r
Hi Peng,
Here is a suugestion using lapply():
res <- lapply(1:2, function(i) lm( x[i, ] ~ y[i, ]) )
names(res) <- c('row1','row2')
res
# The summaries for each regression
lapply(res, summary)
# for the coefficients only
lapply(res, coef)
# ANOVAs
lapply(res, anova)
HTH,
Jorge
On Sat, Sep 5,
On Sep 5, 2009, at 12:13 PM, David Winsemius wrote:
On Sep 5, 2009, at 11:58 AM, John Casey wrote:
Hello all,
I am new to R but have some experience with MATLAB and am trying
to make the switch.
snipped specifics
And of course:
Sorry: got distracted and forgot to append the inten
I would like to convert a dataframe to an array of lists, one for every
record. A natural choide is apply as.list to the rows. However, as it seems,
as.list() automatically converts all list elements to the same datatype. Eg:
myData <- data.frame(a="foo",b=as.logical(rbinom(10,1,.5)));
apply(myDa
Hi,
I tried the following code. For example, I want to add the
corresponding rows of x and y. I expect that the result be a matrix of
the same size. But the actual result is different from what I expect.
Would you please let me know what the correct command should be?
Regards,
Peng
> x=matrix(1:
On Sep 5, 2009, at 11:58 AM, John Casey wrote:
Hello all,
I am new to R but have some experience with MATLAB and am trying
to make the switch. I generally find the two languages easy to adapt
but there are a few routine tasks which I would like to run smoother
in R and I am having tr
subset(data1,cast==33&(depth %in% c(1,20,100))
Sent from my iPhone
On Sep 5, 2009, at 11:58, John Casey wrote:
Hello all,
I am new to R but have some experience with MATLAB and am trying
to make the switch. I generally find the two languages easy to adapt
but there are a few routine
Yes, see mapply.
On Sat, Sep 5, 2009 at 12:18 PM, Peng Yu wrote:
> Hi,
>
> I am wonder if there is a function similar 'apply' but it could accept
> multiple arguments?
>
> For example, I have the following matrix.
> x=matrix(1:6,nr=2)
> y=matrix(1:6,nr=2)
>
> I want to find a function that can b
Hello all,
I am new to R but have some experience with MATLAB and am trying to make
the switch. I generally find the two languages easy to adapt but there are a
few routine tasks which I would like to run smoother in R and I am having
trouble finding a help resource. Could someone suggest
Why instead you don't explore packages 'multicore' or 'snow+showfall
(using sockets)'?
Ciao!
mario
Peter Juhasz wrote:
Dear R experts,
please excuse me for writing to the mailing list without subscribing.
I have a somewhat urgent problem that relates to R.
I have to process lar
Hi,
I am not familiar enough with statistics yet. Please excuse me if my
question is wrong.
In the simplest form of linear regression, the data points are two
list of scalars x_1, ..., x_n and y_1, ..., y_n. I am wondering if
there is a linear regression for two lists of vectors X_1, ..., X_n
and
if I look at your output, the single thread is using almost 100% of
the two cpus (3:49 real, 5:49 user or something close to that). for
the two thread case it is close to the same with the user now
something like 6:15. I would like to see what the contribution of
each of the processes are
Hi,
I run Rscript from the command line (bash). My OS is the following
$ cat /etc/redhat-release
CentOS release 5 (Final)
$ uname -a
Linux selenium.cluster 2.6.18-53.1.13.el5 #1 SMP Tue Feb 12 13:02:30
EST 2008 x86_64 GNU/Linux
$ dmesg | grep gcc
Linux version 2.6.18-53.1.13.el5 (mockbu...@build
Hi,
I am wonder if there is a function similar 'apply' but it could accept
multiple arguments?
For example, I have the following matrix.
x=matrix(1:6,nr=2)
y=matrix(1:6,nr=2)
I want to find a function that can be used to compute the linear
regression for each pair of rows in the two matrices?
m
You did not make it clear (to me anyway) what computing environment
the Rscript command was issued from. I assumed probably incorrectly
that you were doing this from inside an R session and did not
understand that Rscript was an external program. If I was wrong about
that, then you are goin
Hi,
I got the following error. Does it mean that the files in the save
session will not be saved in history in Rscript?
$ Rscript savehistory.R
> f=tempfile()
> f
[1] "/tmp/RtmpMEGKVq/file327b23c6"
> savehistory(f)
Error in savehistory(file) : no history available to save
Execution halted
Regard
Dear R experts,
please excuse me for writing to the mailing list without subscribing.
I have a somewhat urgent problem that relates to R.
I have to process large amounts of data with R - I'm in an
international collaboration and the data processing protocol is fixed,
that is a specific set of R c
On 04-Sep-09 10:45:27, Markku Karhunen wrote:
True. Should have read ?diag.
However, this provokes a more general question: Is there some way I
can declare some scalar and _all its functions_ as matrices?
For instance, I would like to
A = as.matrix(0.98)
B = function(A)
C = diag(sqrt(B))
s
Thanks Baptiste
On Fri, Sep 4, 2009 at 5:13 PM, baptiste auguie <
baptiste.aug...@googlemail.com> wrote:
> Hi,
>
> I think you've got a problem with environments,
>
> testA<-function(input=1)
>
> {
>
> dat <- data.frame(A=seq(input,5), B=seq(6,10))
> vec.names<- c("a", "b")
> env
Yichih,
Answer 2 is "correct," because your indexing specification for 1 is wrong.
You also seem to have left out a comma.
##
mu1990$wage[mu1990$edu==2|mu1990$edu==3|mu1990$edu==4, ] ## like this
mu1990$wage[mu1990$edu%in%2:4, ]
You really could have worked this out for yourself by looking at t
Hi,
you have two problems in your first scenario,
1- Wrong operator precedence. For example,
> 1 == 2 | 3
[1] TRUE
where 1==2 is tested as FALSE, but 1 is not tested against 3 for equality as
it would be using,
> 1 == 2 | 1 == 3
[1] FALSE
or using %in% 2:3
Instead, R evaluates "FALSE | 3", a
Dear all,
I got another problem:
if education have five levels
edu=1
edu=2
edu=3
edu=4
edu=5
If I want to appoint y=edu2~4 in 1990
which programs is correct?
I tried this two programs, they both work, but two results is different.
1.
fig2b<-reldist(y=mu1990$wage[mu1990$edu==2|3|4],..)
2.
SOmething like this should work where you 'split' you data frame by
the contents of the first column and then plot the data:
Dens <- split(D, D[,1])
for (i in Dens){ # process each species
jpeg(paste(i[1,1], '.jpg', sep='') # create file with species name
plot(., main=i[1,1])
dev
I have a several questions about R graphic properties.
I use a "barplot2" function for creating plots with error bars. My data include
species' names in first column, and I need make plots for each species. I know
how to select species for each plot:
D<-read.table("FD_R.txt", h=T)
Dens<-D[D[,1
Dear All,
I was looking for the color index in image function, such as from
topo.colors(n) and etc. but still never found it. For instance, from the help
menu.
###
# Volcano data visualized as matrix. Need to transpose and flip
# matrix horizontally.
ima
Dear All,
I was looking for the color index in image function, such as from
topo.colors(n) and etc. but still never found it. For instance, from the help
menu.
###
# Volcano data visualized as matrix. Need to transpose and flip
# matrix horizontally.
ima
Robert A LaBudde wrote:
Thanks, Uwe. Unfortunately, that doesn't work either:
> library('roxygen')
Warning message:
package 'roxygen' was built under R version 2.9.1
> roxygen::trim(' 1234 ')
You need three colons as indicated in my previous answer!
Uwe
Error: 'trim' is not an exported
Dear Petr,
your suggestion is useful
many thanks for your help !
best,
Yichih
2009/9/3 Petr PIKAL
> Hi
>
> use any of suitable selection ways that are in R.
>
> E.g.
>
> data[data$gender==1, ]
>
> selects only female values
>
> data$wage[(data$gender==1) & (data$race=1)] selects black femal
In some countries a decimal comma is the norm.
On Fri, Sep 4, 2009 at 6:16 PM, David Winsemius wrote:
> It's pretty subtle, I will admit, but look more carefully at the dec=
> parameter in the help page. Kind of like the historical battles between
> between the Liebnizians and the Newtonians.
>
>
>> I must say that this is slightly odd behavior to require both
>> na.action= AND exclude=. Does anyone know of a justification?
Not strange at all.
?options
na.action, sub head "Options set in package stats." You need to override the
default setting.
ws-7 wrote:
>
>>> xtabs(~wkhp, x, excl
54 matches
Mail list logo