Displaying 20 results from an estimated 40 matches for "dataname".
2006 Mar 28
0
Help with the code
...s) ~ trt + strata(site), data=data1, iter.max=500) model1.surv=survfit(model1.cox) #### Cox proportional hazard model with dummy covariates for site model2.cox=coxph(Surv(time,status) ~ trt + factor(site), data=data1, iter.max=500) model2.surv=survfit(model2.cox) beta.fun1 = function(dataname) { cox = coef(coxph(Surv(dataname$time,dataname$status) ~
dataname$trt+strata(dataname$site))) } beta.fun2 = function(dataname) { cox =coef(coxph(Surv(dataname$time,dataname$status) ~ dataname$trt+factor(dataname$site))) #cox=cox[1] } dataname=data1 ## Calculate Cox's regressi...
2010 Jul 27
6
Eval() or parse() do not work inside function
I am writing a function where the arguments are names of objects or variable
names in a data frame. To convert the strings to the objects I am using
eval(parse(text=name)):
f.graph.two.vbs<-function(dataname,v1){
val<-paste(dataname,v1,sep="$")
val<-eval(parse(text=val))
val
}
However running this returns an error:
>f.graph.two.vbs("data","RECORD")
Error in data$RECORD : $ operator is invalid for atomic vectors
Repeating the individual c...
2011 Nov 11
1
Formula variable help
I have an R script with the following applicable lines:
xshort <- window(s, start=st, end=ed)
. . .
xshort <- ts(xshort, frequency=1, start=1)
. . .
m1 <- m2 <- m3 <- m4 <- m5 <- m6 <- NULL
m1 <- tslm(xshort ~ trend)
I get an error:
Error in get(dataname) : object 'xshort' not found
When I do traceback() I get:
3: get(dataname)
2: tslm(xshort ~ trend) at #19
1: model.cross.validation(l[["MEN"]]$series)
Which points to the call to tslm above. Since I am not supply 'data' to
the tslm call (in the forecast package),, I a...
2011 Sep 20
1
Data
Hey everybody,
i am using the rugarch-package and its great!
I have a pretty easy problem, but i just dont get it, so thanks if you can
help me.
Normally i use:
/
data(DATANAME)
spec = ugarchspec()
fit = ugarchfit(data = x[,1], spec = spec)
fit
slotNames(fit)
names(fit at fit)
coef(fit)
infocriteria(fit)
likelihood(fit)
nyblom(fit)
signbias(fit)
head(as.data.frame(fit))
head(sigma(fit))
head(residuals(fit))
head(fitted(fit))
gof(fit,c(20,30,40,50))
uncmean(fit)
uncvaria...
2000 May 02
2
Variable names in model formula
...n the fitted probability of
>survival at a fixed time point t0 and covariate value Xi0. I tried to do
>this in a for loop where the index is the variable name as follows
>
>covnames <- names(...)
>for (covi in covnames) {
> survout <- coxph(Surv(time,status) ~ covi, data = dataname)
> print(summary(survfit(survout,newdata),t0))
>}
You could try
covnames <- names(...)
form <- Surv(time, status) ~ dummy
for(nam in covnames) {
form[[3]] <- as.name(nam)
survout <- coxph(form, data = dataname)
print(summary(survfit(survout, newdata), t0))
}
>
>Unfort...
2011 Jan 21
3
confidence interval
Hi,
I have a circular shaped set of point on the plane (X,Y) centered in
zero. The distribution is more dense close to zero and less dense far
from zero.
I need to find the radius of a circle centered in zero that contains
65% of the points in the sample. Is there any R directive that can do
this?
I wanna start with 2D set of points, but the real case scenario is
with a 5D set of points.
2017 Dec 04
3
Dynamic reference, right-hand side of function
...acro" (is that only a Stata-word?) in the right hand side of the functions. When I try to replace the static reference with a dynamic one (like in the left-hand side), the syntax just doesn't work.
I would very much appreciate some help with this issue!
All the best,
Love
year <- 2002
dataname <- paste0("aa_",year)
assign(paste0(dataname), as.numeric(aa_2002[,1]))
year <- 2003
assign(paste0("aa_",year), as.numeric(aa_2003))
year <- 2005
assign(paste0("aa_",year), aa_2005[,1])
list1 <- c(2000:2007)
list1[c(7)]
assign(paste0("aa_",list...
2017 Dec 04
0
Dynamic reference, right-hand side of function
The generic rule is that R is not a macro language, so looping of names of things gets awkward. It is usually easier to use compound objects like lists and iterate over them. E.g.
datanames <- paste0("aa_", 2000:2007)
datalist <- lapply(datanames, get)
names(datalist) <- datanames
col1 <- lapply(datalist, "[[", 1)
colnum <- lapply(col1, as.numeric)
(The 2nd line assumes that the damage has already been done so that you have aa_2000 ... aa_2007 in...
2017 Dec 04
3
Dynamic reference, right-hand side of function
...an at sociology.su.se>
Kopia: r-help at r-project.org
?mne: Re: [R] Dynamic reference, right-hand side of function
The generic rule is that R is not a macro language, so looping of names of things gets awkward. It is usually easier to use compound objects like lists and iterate over them. E.g.
datanames <- paste0("aa_", 2000:2007)
datalist <- lapply(datanames, get)
names(datalist) <- datanames
col1 <- lapply(datalist, "[[", 1)
colnum <- lapply(col1, as.numeric)
(The 2nd line assumes that the damage has already been done so that you have aa_2000 ... aa_2007 in y...
2009 Oct 08
3
error message - unexpected input
...program file folder. I have
also tried changing the font the code is written in and turning off
"smart quotes" in MS word. Additionally, I have right clicked on R and
set myself as the only user on this computer to run this program. The
syntax line that appears to be causing problems is:
dataname="Igt2model.txt" and the error message is: Error: unexpected
input in "dataname=""
Does anyone have any suggestions?
Thanks for all of your help,
Danielle
Danielle Dandreaux, Ph.D.
Faculty Research Associate
Arizona State University
Department of Psychology...
2017 Dec 04
0
Dynamic reference, right-hand side of function
...Kopia: r-help at r-project.org
> ?mne: Re: [R] Dynamic reference, right-hand side of function
>
> The generic rule is that R is not a macro language, so looping of names of things gets awkward. It is usually easier to use compound objects like lists and iterate over them. E.g.
>
> datanames <- paste0("aa_", 2000:2007)
> datalist <- lapply(datanames, get)
> names(datalist) <- datanames
> col1 <- lapply(datalist, "[[", 1)
> colnum <- lapply(col1, as.numeric)
>
> (The 2nd line assumes that the damage has already been done so that you...
2012 Feb 16
2
Problem building up ggplot graph in a loop.
Folks,
I want to automate some graphing using ggplot.
Here is my code
graphChargeOffs2<-function(coffs) {
ggplot(coffs, aes(levels))
dataNames<-names(coffs)[!names(coffs) == "levels"]
for(i in dataNames) {
thisData<-coffs[[i]]
last_plot() + geom_line(aes(y = thisData, colour = i))
}
last_plot() + ylab("Total Chargeoffs")
}
coffs is a data.frame.
I get the following error:
Error in eval(expr, envi...
2008 Jul 29
4
Graphics function question
Hello
I have created a graph using the following commands:
<<<
startBReP3O1T <- diffs$BReP3O1T - diffs$diff_BReP3O1T
endBReP3O1T <- diffs$BReP3O1T
x <- seq(47,89, length = 10)
ymin <- min(min(startBReP3O1T), min(endBReP3O1T))
ymax <- max(max(startBReP3O1T), max(endBReP3O1T))
y <- seq(ymin, ymax, length = 10)
plot(x,y, type = 'n', xlab = 'Age', ylab =
2017 Dec 04
2
Dynamic reference, right-hand side of function
...Kopia: r-help at r-project.org
> ?mne: Re: [R] Dynamic reference, right-hand side of function
>
> The generic rule is that R is not a macro language, so looping of names of things gets awkward. It is usually easier to use compound objects like lists and iterate over them. E.g.
>
> datanames <- paste0("aa_", 2000:2007)
> datalist <- lapply(datanames, get)
> names(datalist) <- datanames
> col1 <- lapply(datalist, "[[", 1)
> colnum <- lapply(col1, as.numeric)
>
> (The 2nd line assumes that the damage has already been done so that
&g...
2010 Dec 29
1
Counting number of datasets and appending them
Hi there,
I have a question on how to read a bunch of dataset, assign each of the dataset to a matrix in the memory, and append them.
Suppose I have 20 dataset saved to different .rda files named gradeFileData1, gradeFileData2,...., gradeFileData20. And I would like to read them each into a dataset in the memory, then combine them. I wrote something like:
e1<-new.env(parent=.GlobalEnv)
2017 Dec 05
3
Dynamic reference, right-hand side of function
....csv(text="1,0,1,1,0,0,0,0,0,0,1,0,0", header=FALSE))
bb_2001 <- as.matrix(read.csv( text="0,0,0,1,0,1,1,0,0,0,0,1,0,0", header=FALSE))
bb_2002 <- as.matrix(read.csv( text="1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0", header=FALSE))
is.vector(bb_2000)
datanames <- paste0("bb_", 2000:2002)
datalist <- lapply(datanames, get)
is.vector(datalist[1])
I learned a lot of code today, and I really appreciate it! A million thanks!
My R-superpowers are, well, not as minuscule as when I woke up this morning.
All the best,
Love (or maybe LoveR, my...
2017 Dec 04
0
Dynamic reference, right-hand side of function
...r-project.org
>> ?mne: Re: [R] Dynamic reference, right-hand side of function
>>
>> The generic rule is that R is not a macro language, so looping of names of things gets awkward. It is usually easier to use compound objects like lists and iterate over them. E.g.
>>
>> datanames <- paste0("aa_", 2000:2007)
>> datalist <- lapply(datanames, get)
>> names(datalist) <- datanames
>> col1 <- lapply(datalist, "[[", 1)
>> colnum <- lapply(col1, as.numeric)
>>
>> (The 2nd line assumes that the damage has alread...
2017 Dec 05
0
Dynamic reference, right-hand side of function
...1,0,0,0,0,0,0,1,0,0",
> header=FALSE))
> bb_2001 <- as.matrix(read.csv( text="0,0,0,1,0,1,1,0,0,0,0,1,0,0",
> header=FALSE))
> bb_2002 <- as.matrix(read.csv( text="1,0,0,0,0,0,0,0,1,0,0,0,0,1,0,0",
> header=FALSE))
>
> is.vector(bb_2000)
>
> datanames <- paste0("bb_", 2000:2002)
> datalist <- lapply(datanames, get)
> is.vector(datalist[1])
>
>
> I learned a lot of code today, and I really appreciate it! A million
> thanks!
> My R-superpowers are, well, not as minuscule as when I woke up this
> morning.
&g...
2016 Dec 12
2
accessing data by packagename::dataname from within package code fails.
I have narrowed down the problem.
The error
Error : 'AminoAcids' is not an exported object from 'namespace:bibliospec'
Error : unable to load R code in package 'bibliospec'
occurs only if I try to access the data using bibliospec::AminoAcids
within the initialize method of an R reference class.
It does work, as far as I tested everywhere else. In other methods of
a
2005 Feb 26
3
averaging within columns
...times
between decisions in the second column. Since individuals make
multiple decisions, I want the average for each individual. For
example, the data might look like this
name wtime
jo 1
jo 2
jo 1
jo 3
tim 3
tim 2
tim 2
ro 1
ro 2
etc.
I'm hoping there is something like
mean(dataname$wtime[name])
which will just create a column with length equal to the number of
different names (levels) and an average wtime for each. So far though,
I haven't had much luck figuring that one out.
Thanks.
Thomas