a) RStudio has its own support forum on its website. If your problem only
happens in RStudio, then your question belongs there. If not, demonstrate the
sequence of steps it takes to obtain your error using plain R and re-post.
b) This kind of thing can happen when you corrupt your workspace.
On Mon, 29 Apr 2013, meng wrote:
Hello Achim:
Sorry for another question about the model g1 in the last mail.
As to model g2 and g3:
g2 - glm(Freq ~ (age + drug + case)^2, data = df, family = poisson)
g3 - glm(Freq ~ age * drug * case, data = df, family = poisson)
anova(g2, g3, test = Chisq)
I have a dataset which for the sake of simplicity has two endpoints. We would
like to test if two different end-points have the same eventual meaning. To
try and take an example that people might understand better:
Lets assume we had a group of subjects who all received a treatment. The
Hi,
I would appreciate if somebody could help me with following calculation.
I have a dataframe, by 10 minutes time, for mostly one year data. This is
small example:
dput(test)
structure(list(jul = structure(c(14655, 14655, 14655, 14655,
14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655,
Hello,
This is very basic and very frustrating.
Suppose this:
A=5
B=5
C=10
ls()
A
B
C
I would like this
xpto()
5
5
10
How can I do xpto()?
Thanks
Rui
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
It is important to check for lack of fit of the categorized variable. One
way to do this is to test for the additional predictive ability of the
original continuous variable after adjusting for its categorized version.
It is very uncommon for a categorized continuous variable to fit well,
Hi Rui,
how about this
sapply(ls(),get)
cheers
Am 29.04.2013 13:07, schrieb Rui Esteves:
Hello,
This is very basic and very frustrating.
Suppose this:
A=5
B=5
C=10
ls()
A
B
C
I would like this
xpto()
5
5
10
How can I do xpto()?
Thanks
Rui
[[alternative
It isn't that complex:
myDataLong - data.frame(Time=c(A, C), Censored=c(B, D), group=rep(0:1,
times=c(length(A), length(C
Fit = survfit(Surv(Time, Censored==0) ~ group, data=myDataLong)
plot(Fit, col=1:2)
survdiff(Surv(Time, Censored==0) ~ group, data=myDataLong)
However, your approach (a
It isn't that complex:
myDataLong - data.frame(Time=c(A, C), Censored=c(B, D), group=rep(0:1,
times=c(length(A), length(C
Fit = survfit(Surv(Time, Censored==0) ~ group, data=myDataLong)
plot(Fit, col=1:2)
survdiff(Surv(Time, Censored==0) ~ group, data=myDataLong)
Yes - for the example
Forgot the last part of the question:
test - structure(list(jul = structure(c(14655, 14655, 14655, 14655,
+ 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655,
+ 14655, 14655, 14655), origin = structure(0, class = Date)),
+ time = structure(c(1266258354, 1266258954, 1266259554,
What is the entry code formula autocovariance and autocorrelation in R
program for these data?
ac(2,3.5,3.5,2.2,2.2,3.3,2.5,2.5,3.2,2.5,2.5,2.7,1.7,2.7,2.9,2.3,2.7,3,1.8,2.5,3.1,2.5,2.5,3.2,2.7,1.9,2.6,2.3,2.7,3.2,2.2,1.5,2.3,2.6,2.5,2.9,2,2.5,2.6,2.4,2.6,2.8,2.5,2.6,3.2,1.8,2.7,3.4,2.2,2.9,3.2)
Hello,
Currently we can load the data with the Bulkload facility with SAS using the
BCP utility instead of the t-sql command BULK INSERT to copy data from a file
to a SQL table.
From now I can see that RODBC package use only the t-sql command BULK INSERT.
It could be interesting to see if the
Thanks for your reply.
As to g2 and g3:
g2: a + d + c + a:d + a:c + d:c
g3: a + d + c + a:d + a:c + d:c + a:d:c
The only difference between g2 and g3 is a:d:c,which refers to case depends
on drug but in the same way for different levels of age. And anova tests
whether this only differenceis
Dear R fellows,
Assume I define
a - expression(fn+tp)
sen - expression(tp/a)
Now I'd like to know, which variables are necessary for calculating sen
all.vars(sen)
This results in a vector c(tp,a). But I'd like all.vars to evaluate the
sen-object down to the ground level, which would result
Hi, res- unlist(mget(ls()))
names(res)-NULL
res
#[1] 5 5 10
A.K.
- Original Message -
From: Rui Esteves ruimax...@gmail.com
To: r-help@r-project.org
Cc:
Sent: Monday, April 29, 2013 7:07 AM
Subject: [R] How to call an object given a string?
Hello,
This is very basic and very
Dear R fellows,
Assume I define
a - expression(fn+tp)
sen - expression(tp/a)
Now I'd like to know, which variables are necessary for calculating sen
all.vars(sen)
This results in a vector c(tp,a). But I'd like all.vars to evaluate the
sen-object down to the ground level, which would result
try this:
test - structure(list(jul = structure(c(14655, 14655, 14655, 14655,
+ 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655, 14655,
+ 14655, 14655, 14655), origin = structure(0, class = Date)),
+ time = structure(c(1266258354, 1266258954, 1266259554, 1266260154,
+ 1266260754,
Dear R forum
I have a data.frame as
cashflow_df = data.frame(instrument =
c(ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,ABC,
ABC, PQR, PQR, PQR,PQR,PQR,PQR,PQR,PQR,PQR,PQR, PQR,
PQR, PQR,PQR, PQR,PQR,PQR,PQR, PQR,PQR,UVWXYZ,UVWXYZ,
UVWXYZ, UVWXYZ, UVWXYZ,UVWXYZ,UVWXYZ,UVWXYZ, UVWXYZ,
Hi
rrr-rle(as.numeric(cut(test$act, c(0,1,199,200), include.lowest=T)))
test$res - rep(rrr$lengths, rrr$lengths)
If you put it in function
fff- function(x, limits=c(0,1,199,200)) {
rrr-rle(as.numeric(cut(x, limits, include.lowest=T)))
res - rep(rrr$lengths, rrr$lengths)
res
}
you can use
Hi all,
Suppose I am fitting an arma(p,q) model to a time series y_t.
So, my model should contain (q+1) white noise variables.
As far as I know, each of them should have the same variance.
How do I get the estimate of this variance by running the arma(y) function
(or is there any other way)?
Fatos Baruti fatosbaruti at gmail.com writes:
What is the entry code formula autocovariance and autocorrelation in R
program for these data?
a-c(2,3.5,3.5,2.2,2.2,3.3,2.5,2.5,3.2,2.5,2.5,2.7,1.7,2.7,2.9,2.
3,2.7,3,1.8,2.5,3.1,2.5,2.5,3.2,2.7,1.9,2.6,2.3,2.7,3.2,
Dear All,
I am trying to compile R-3.0 on Cray xe6 (HLRS) HERMIT, no success so far.
Here is my experience:
I use this to configure and make R:
CC=cc \
CXX=CC \
F77=ftn \
FC=ftn \
CPPFLAGS=-I$PREFIX/include \
LDFLAGS=-L$PREFIX/lib${LIBDIRSUFFIX} \
./configure --prefix=$PREFIX \
If this is a homework problem, there is a no homework policy on this list.
-- Bert
On Mon, Apr 29, 2013 at 5:24 AM, Katherine Gobin
katherine_go...@yahoo.com wrote:
Dear R forum
I have a data.frame as
cashflow_df = data.frame(instrument =
Hello again,
Let say I have 1 matrix:
Mat - matrix(1:12, 4, 3)
rownames(Mat) - letters[1:4]
Now I want to subscript of Mat in following way:
Subscript_Vec - c(a, e, b, c)
However when I want to use this vector, I am geting following error:
Mat[Subscript_Vec, ]
Error: subscript out of bounds
Hi Katherine,
res1-aggregate(cbind(cashflow,cashflows_pv)~instrument+id,data=cashflow_df,sum)
res2-res1[order(res1$instrument),]
res2$cashflow_change-with(res2,ave(cashflows_pv,instrument,FUN=function(x)
x-head(x,1)))
names(res2)[3:4]- paste0(total_,names(res2)[3:4])
res2
# instrument id
Christofer,
The following should get you started:
r - Mat[match(rownames(Mat), Subscript_Vec),]
rownames(r) - Subscript_Vec
r
HTH,
Jorge.-
On Mon, Apr 29, 2013 at 11:38 PM, Christofer Bogaso
bogaso.christo...@gmail.com wrote:
Hello again,
Let say I have 1 matrix:
Mat - matrix(1:12, 4,
You can also use:
library(plyr)
res-mutate(ddply(cashflow_df,.(instrument,id),numcolwise(sum)),cashflow_change=ave(cashflows_pv,instrument,FUN=function(x)
x-head(x,1)))
names(res)[3:4]- paste0(total_,names(res)[3:4])
res
# instrument id total_cashflow total_cashflows_pv cashflow_change
#1
r
# [,1] [,2] [,3]
#a 1 5 9
#e 3 7 11
#b 4 8 12
#c NA NA NA
I guess you meant:
r1- Mat[match(Subscript_Vec,rownames(Mat)),]
rownames(r1)- Subscript_Vec
r1
# [,1] [,2] [,3]
#a 1 5 9
#e NA NA NA
#b 2 6 10
#c 3 7 11
A.K.
-
Hi Felix,
I thought, this could be an easy task for substitute, and the following
works as expected:
all.vars(substitute(expression(tp/a),list(a=expression(fn+tp
# [1] tp fn
But (of course)
all.vars(substitute(sen,list(a=a)))
does not yield the desired result, and I can't figure out, how to
Hi everybody,
I have a list, where every element of this list is a data frame.
An example:
Mylist-list(A=data.frame, B=data.frame, C=data.frame, D=data.frame)
I want to rbind some elements of this list.
As an example:
Output-list(AB=data.frame, CD=data.frame)
Where
I may not understand completely, but it seems you have a 45x45 distance
matrix of stimuli and you want to use to determine which stimuli are
similar. Wouldn't hierarchical clustering be a more straightforward
approach?
?hclust
-
David L Carlson
Associate
Dear R Helpers,
I have about 20 data frames that I need to do a series of data scrubbing
steps to. I have the list of data frames in a list so that I can use
lapply. I am trying to build a function that will do the data scrubbing
that I need. However, I am new to functions and there is
Sorry, the first line should have been
Mat[match( Subscript_Vec, rownames(Mat)),]
and the rest remains the same.
Best,
Jorge.-
On Mon, Apr 29, 2013 at 11:45 PM, Jorge I Velez jorgeivanve...@gmail.comwrote:
Christofer,
The following should get you started:
r - Mat[match(rownames(Mat),
Try poking around in the codetools package. E.g., you can do things like the
following
expr1 - quote(a - fn + tp) # put 'a' in the expression
expr2 - quote( tp / a + fn)
expr12 - call({, expr1, expr2)
expr12
# {
#a - fn + tp
#tp/a + fn
# }
library(codetools)
Hello,
I'm working with a very large dataset (250,000+ lines in its' current form)
that includes presence only data on various species (which is nested within
different sites and sampling dates). I need to convert this into a dataset
with presence/absence for each species. For example, I would
Hi,
If it is for the list:
lst1- list(x,x,x)
lst1-lapply(lst1,myfunc)
- Original Message -
From: arun smartpink...@yahoo.com
To: Sparks, John James jspa...@uic.edu
Cc: R help r-help@r-project.org
Sent: Monday, April 29, 2013 12:13 PM
Subject: Re: [R] Function for Data Frame
Hi,
If I
Hi,
dat1- read.table(text=
id t scores
2 0 1.2
2 2 2.3
2 3 3.6
2 4 5.6
2 6
On Apr 29, 2013, at 6:54 AM, De Castro Pascual, Montserrat wrote:
Hi everybody,
I have a list, where every element of this list is a data frame.
An example:
Mylist-list(A=data.frame, B=data.frame, C=data.frame, D=data.frame)
I'm looking at this apparently malformed command
This problem in sampling::strata() comes from calling cbind on a zero-row
data.frame
with a scalar number.
library(sampling)
strata(mtcars[,c(mpg,hp,gear)], strat=gear, size=c(5,5,0))
Error in data.frame(..., check.names = FALSE) :
arguments imply differing number of rows: 0, 1
In
Hello,
I am running a simple plspm for a class project due later today and I am
receiving the following error despite following along exactly with Gaston
Sanchez's directions in PLS Path Modeling with R:
Error in solve.qr(qr(X.blok), Z[, j]) : singular matrix 'a' in 'solve'
I would greatly
Hi,
If I understand it correctly,
x-myfunc(x)
x
# V2 V3
#1 2 3
#2 2 3
#3 2 2
#4 2 2
#5 1 1
A.K.
- Original Message -
From: Sparks, John James jspa...@uic.edu
To: r-help@r-project.org
Cc:
Sent: Monday, April 29, 2013 10:23 AM
Subject: [R] Function for Data Frame
Dear R
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Matthew Venesky
Sent: Monday, April 29, 2013 8:13 AM
To: r-help@r-project.org
Subject: [R] expanding a presence only dataset into presence/absence
Hello,
I'm working with a
Hi,
On Apr 29, 2013, at 10:23 AM, Sparks, John James wrote:
Dear R Helpers,
I have about 20 data frames that I need to do a series of data scrubbing
steps to. I have the list of data frames in a list so that I can use
lapply. I am trying to build a function that will do the data
Hi,
Try this:
set.seed(24)
lst1-lapply(1:4,function(x)
as.data.frame(matrix(sample(1:20,20,replace=TRUE),ncol=5)))
names(lst1)- LETTERS[1:4]
res-lapply(list(c(A,B),c(C,D)), function(x) do.call(rbind,lst1[x]))
res
#[[1]]
# V1 V2 V3 V4 V5
#A.1 6 14 17 14 4
#A.2 5 19 6 14 1
#A.3 15 6 13
Hi,
Your output dataset is bit confusing as it contains Sites that were not in the
input.
Using your input dataset, I am getting this:
dat1- read.table(text=
Species Site Date
a 1 1
b 1 1
b 1 2
c 1 3
,sep=,header=TRUE,stringsAsFactors=FALSE)
dat1$Present- 1
Hello all,
I am running a simple path analysis with the function sem.mi (of semTools)
after doing multiple imputation in my (missing) data. However, depending on
the option to combine the chi-square, I get the following warning messages:
Warning messages:
1: In estimateVCOV(lavaanModel,
Hi Jeff,
a b) points taken. Thanks for the reference too.
c) taking the zero's out did the trick.
Dan
-Original Message-
From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us]
Sent: Sunday, April 28, 2013 12:15 AM
To: Lopez, Dan
Cc: R help (r-help@r-project.org)
Subject: Re: [R]
Martin Ivanov tramni at abv.bg writes:
Dear All, I am trying to compile R-3.0 on Cray xe6 (HLRS) HERMIT,
no success so far. Here is my experience:
You might be better off posting this to the r-de...@r-project.org
mailing list (the list is for developer queries: technically this
isn't
I am sorry. I forgot to update the code:dat1- read.table(text=
Species Site Date
a 1 1
b 1 1
b 1 2
c 1 3
,sep=,header=TRUE,stringsAsFactors=FALSE)
dat1$Present- 1
dat2-expand.grid(unique(dat1$Species),unique(dat1$Site),unique(dat1$Date))
colnames(dat2)- colnames(dat1)[-4] #changed here
Hi, Uwe.
I still don't get how this can be done correctly. Here is what I tried.
In the file funcs.R, define these functions:
library('modeest')
x = vector(length=500)
x = sapply(x, function(i) i=sample(c(1,0), 1))
pastK = function(n, x, k) {
if (nk) { return(x[(n-k):(n-1)]) }
else
On Apr 29, 2013, at 11:16 AM, Kaiyin Zhong (Victor Chung) wrote:
Hi, Uwe.
I still don't get how this can be done correctly. Here is what I tried.
In the file funcs.R, define these functions:
library('modeest')
x = vector(length=500)
x = sapply(x, function(i) i=sample(c(1,0), 1))
Oh, indeed, that IS the problem. Thank you!!!
Best regards,
Kaiyin ZHONG
--
FMB, Erasmus MC
k.zh...@erasmusmc.nl
kindlych...@gmail.com
On Mon, Apr 29, 2013 at 8:22 PM, David Winsemius dwinsem...@comcast.netwrote:
On Apr 29, 2013, at 11:16 AM, Kaiyin Zhong (Victor
On 29/04/2013 2:16 PM, Kaiyin Zhong (Victor Chung) wrote:
Hi, Uwe.
I still don't get how this can be done correctly. Here is what I tried.
In the file funcs.R, define these functions:
library('modeest')
x = vector(length=500)
x = sapply(x, function(i) i=sample(c(1,0), 1))
pastK = function(n,
Sorry, I got some new error:
Error in cut.default(i, breaks) : 'breaks' are not unique
traceback()
20: stop('breaks' are not unique)
19: cut.default(i, breaks)
18: cut(i, breaks)
17: split.default(i, cut(i, breaks))
16: split(i, cut(i, breaks))
15: structure(split(i, cut(i, breaks)), names =
Thank you all very much for your time and suggestions. The link to
stackoverflow was very helpful. Here are some timings in case someone wants to
know. (I noticed that microbenchmark results vary, depending on how many
functions one tries to benchmark at a time. However, the min stays about
Just to add a little, don't get distracted by the return() function.
Functions return the value of their final expression, provided it isn't an
assignment.
For your example, this will do the job:
myfunc - function(DF) subset(DF, select=-V1)
If you want to modify the data frames in place, one
In addition to the other responses, consider this:
i - 3
i:i+1
[1] 4
i:(i+1)
[1] 3 4
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 4/29/13 6:54 AM, De Castro Pascual, Montserrat mdecas...@creal.cat
wrote:
Hi
HI,
Check if this is what you wanted. I am not sure the Hopeful outcome includes
all the possible combinations.
dat1- read.csv(Matthewdat.csv,sep=,,header=TRUE,stringsAsFactors=FALSE)
dat1
# Species CallingIndex Site Date
#1 Pseudacris crucifer 2 3608
Hello,
Em 29-04-2013 13:49, Preetam Pal escreveu:
Hi all,
Suppose I am fitting an arma(p,q) model to a time series y_t.
So, my model should contain (q+1) white noise variables.
Why? How on hearth can you say this?
As far as I know, each of them should have the same variance.
How do I get
I did a PCA for my data which has a dimension of 19000X4 using princomp
pca2=princomp((data), cor=F)
and obtained a biplot with 19000 labels which were very busy. How can I just
show 19000 spot w/o labels?
biplot(pca2)
Thanks a lot:))
-data
Martin,
This worked, thanks again!
*Ben Caldwell*
Graduate Fellow
University of California, Berkeley
130 Mulford Hall #3114
Berkeley, CA 94720
Office 223 Mulford Hall
(510)859-3358
On Thu, Apr 25, 2013 at 10:04 PM, Benjamin Caldwell btcaldw...@berkeley.edu
wrote:
Thanks for this martin.
Dear helpers,
I'm using plyr to process a large matrix for the first time. My code is set
up to work with matrixes, since I learned the hard way that dataframes
are considerably slower to process.
I started using aaply(), but the data was rearranged from a flat matrix to
a [, , 4] array for
Dear helpers,
Does anyone have information on the status of bigmemory and R3.0? Will it
just take time for the devs to re-code for the new environment? Or is there
an alternative for this new version?
Thanks
Ben Caldwell
[[alternative HTML version deleted]]
Hi,
I'm not sure if this is the proper way to ask questions, sorry if not. But
here's my problem:
I'm trying to do a bootstrap estimate of the mean for some survival data.
Is there a way to specifically call upon the rmean value, in order to store
it in an object? I've used
On 29 April 2013 at 15:46, Benjamin Caldwell wrote:
| Dear helpers,
|
| Does anyone have information on the status of bigmemory and R3.0? Will it
| just take time for the devs to re-code for the new environment? Or is there
| an alternative for this new version?
It just works, with R 3.0.0 and
Hi,
I'd like to print a string vertically. For example, I would like to print
abcd as a\nb\nc\nd
Is there a function in R such that
Input: abcd
Output: a\nb\nc\nd?
Thanks,
Miao
[[alternative HTML version deleted]]
__
Hi,
May be this helps:
cat(paste(strsplit(abcd,)[[1]],collapse=\n))
#a
#b
#c
#d
A.K.
- Original Message -
From: jpm miao miao...@gmail.com
To: r-help r-help@r-project.org
Cc:
Sent: Monday, April 29, 2013 9:41 PM
Subject: [R] Is there a function that print a string vertically (by
On Apr 29, 2013, at 6:03 PM, Sparks, John James wrote:
Dear R Helpers,
I am re-phrasing a question that I put forth earlier today due to some
particulars in the solution that I am searching for. Many thanks to those
who answered the previous post and to any who would be willing to answer
Hello, I'm a first semester statistics
studenthttp://r.789695.n4.nabble.com/Question-regarding-error-quot-x-and-y-lengths-differ-quot-td4665773.html#and
I am using R for roughly the third time ever. I am following a
tutorial
and yet I still get the error x and y lengths differ. I am very new to
On Apr 29, 2013, at 6:41 PM, jpm miao wrote:
Hi,
I'd like to print a string vertically. For example, I would like to print
abcd as a\nb\nc\nd
Is there a function in R such that
Input: abcd
Output: a\nb\nc\nd?
do.call( paste, list( strsplit(abcd, )[[1]] , collapse=\\n))
[1]
On Apr 29, 2013, at 6:50 PM, David Winsemius wrote:
On Apr 29, 2013, at 6:41 PM, jpm miao wrote:
Hi,
I'd like to print a string vertically. For example, I would like to print
abcd as a\nb\nc\nd
Is there a function in R such that
Input: abcd
Output: a\nb\nc\nd?
do.call(
Hello,
I am wondering if I am misinterpreting something from R/3.0.0 NEWS
LONG VECTORS:
This section applies only to 64-bit platforms.
...
o serialize() to a raw vector is unlimited in size (except by
resources).
However when I try the following it fails:
foo - raw(25)
On 04/30/2013 11:38 AM, Sean Doyle wrote:
Hello, I'm a first semester statistics
studenthttp://r.789695.n4.nabble.com/Question-regarding-error-quot-x-and-y-lengths-differ-quot-td4665773.html#and
I am using R for roughly the third time ever. I am following a
tutorial
and yet I still get the error
On 29/04/2013 23:46, Benjamin Caldwell wrote:
Dear helpers,
Does anyone have information on the status of bigmemory and R3.0? Will it
just take time for the devs to re-code for the new environment? Or is there
an alternative for this new version?
What are you asking about? 'bigmemory' has
74 matches
Mail list logo