Finally, I found the answer from here...
http://www.childrensmercy.org/stats/weblog2005/StratifiedCoxRegression.asp
http://www.childrensmercy.org/stats/weblog2005/StratifiedCoxRegression.asp
Thernau and Grambsch describe it well in their book on survival analysis.
/Analysis of multicenter clinica
Hi,
I'm trying to plot a set of geographical coordinates over the polygons in a
shapefile, so I need to transform the coordinates to the same projection.
I'm currently using the project function in the rgdal library, but I can't
seem to figure out how to format the proj string argument correctly.
Hi Eric,
You can use chain assignment, for example:
r <- s <- t <- u <- v <- x <- numeric(length(p))
Also, just an FYI, you can do something similar using vector(), for example:
vector(mode = "numeric", length = length(p))
of course you would not need to explicitly name the arguments. There
i
Hey Greg,
Thanks for this. Looks like an option I can discuss.
-Original Message-
From: Greg Snow [mailto:greg.s...@imail.org]
Sent: Friday, July 08, 2011 9:11 PM
To: Verma, Ankur; 'jim holtman'
Cc: r-help@r-project.org
Subject: RE: [R] Taking inputs from the user
Are your users willin
Is there a more compact way to say this ?
r <-numeric(length(p)) ; s <-numeric(length(p)); t <- numeric(length(p)); u
<- numeric(length(p)); v <- numeric(length(p)) ; x <-numeric(length(p))
all these variables will be used in a loop
for (i in 1 : length(p)) {
r[i] <-
s[i] <-
t[i] <-
etc
}
--
V
Sorry for continuing to reply to myself. I believe that my problem was
putting a factor ("plot") in my data for the bugs(data,...) call. I still
have stuff to work out in the code but I don't get the error if I exclude
plot from the win.data <- list(...) assignment. I have to think if that will
now
Sorry for the additional post - I received the suggestion to include the
following additional information:
*> traceback()*
5: FUN(X[[12L]], ...)
4: lapply(data, formatC, digits = digits, format = "E")
3: write.datafile(lapply(data, formatC, digits = digits, format = "E"),
file.path(dir, da
I have successfully used R2WinBUGS in the past and an trying to use basically
the same code with some different data but I'm getting the following error:
> out <- bugs(data=win.data, inits=inits, parameters.to.save=params,
> model.file = "PoissonGLMM.txt", n.chains=nc, n.iter=ni, n.burn=nb,
> n.th
I have successfully used R2WinBUGS in the past and an trying to use basically
the same code with some different data but I'm getting the following error:
> out <- bugs(data=win.data, inits=inits, parameters.to.save=params,
> model.file = "PoissonGLMM.txt", n.chains=nc, n.iter=ni, n.burn=nb,
> n.th
Hi:
Works for me:
> library(tseries)
Loading required package: quadprog
Loading required package: zoo
‘tseries’ version: 0.10-25
‘tseries’ is a package for time series analysis and computational
finance.
See ‘library(help="tseries")’ for details.
> x<- as.ts(rnorm(1000))
> str(
This fixed my problem thanks.
--
View this message in context:
http://r.789695.n4.nabble.com/problems-with-ifelse-tp3658498p3658543.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/
On Jul 10, 2011, at 9:09 PM, mousy0815 wrote:
I have the following code to determine the probability of a t-cell
encountering an antigen after "m" steps.
probability <- function(N, f, m, b, x, t) { #using ifelse instead of
if/else
#N is the number of lymph nodes
#f is the fraction
The formula from Finley is reproduced in Johnson, Kotz, and
Balakrishnan's "Continuous Distributions: Vol. 1" in the beginning of
their Log Normal chapter. I am not clear that the recursive formula in
W. Huber's spreadsheet is a correct representation of the iterative
version there, but can
I have the following code to determine the probability of a t-cell
encountering an antigen after "m" steps.
probability <- function(N, f, m, b, x, t) { #using ifelse instead of if/else
#N is the number of lymph nodes
#f is the fraction of Dendritic cells (in the correct node) that
Ah, thanks so much.
I found the excel spreadsheet almost right after I posted to the r group. I had
concerns about using Chebyshev and wanted to reproduce Dr. Whubers simulation
to see for myself how it performs. To be clear I normally use Lands exact or
bootstrap for the UCL (or sometimes take
Hello R users,
I am fitting a spatio-temporal model for the areal data related to school
districts of Texas, US using geobugs. For that I need to load the polygon shape
file in geobugs.In Bradley Carlin's website there was an S-plus program called
poly.S to extract polygons for any state in th
Bill, first off, thanks much for helping me through this. I think the best
approach might be for me to attach the actual code.
I could probably do the if-else-else that you suggested. But I have eight
different variables with the same basic issue (note that six of the eight
are commented out whil
try this:
> x <- data.frame(time = seq(as.POSIXct("2011-1-1 00:00"), by = '1 hour',
> length = 300))
> # default to night
> x$day <- FALSE
> # now set days to TRUE
> # get hour/minutes
> temp <- format(x$time, "%H%M")
> x$day[temp >= "0600" & temp < "1900"] <- TRUE
>
> head(x, 30)
Hi,
I tried running the function terasvirta.test in the package tseries
for a univariate tseries object.
For eg.
x<- as.ts(rnorm(1000))
terasvirta.test(x)
I get the following error
Error in as.matrix(y) : argument "y" is missing, with no default
The function seems to expect a default y argumen
Hi Professor:
When I read the file, the time in military time and date are stored in the same
vector as follows:
2011-01-29 16:15:11.823547
I want to take all the hours saved in that file and categorize them as day and
night.
For
example, the day would be between 06:00:00-19:00:00 and th
Hi,
1) Still not reproducible because we do not have "E.csv"
2) The help list is not for homework questions. Many (most?)
professors and/or their TAs offer office hours where they are willing
to provide help and guidance (unless, of course, the assignment is
meant to encourage you to learn on you
R version 2.13.0 (2011-04-13)
Copyright (C) 2011 The R Foundation for Statistical Computing
ISBN 3-900051-07-0
Platform: i386-pc-mingw32/i386 (32-bit)
Thanks for responding Josh. I got all the codes from my professor. Here is
what was required
##Load fPortfolio, PerformanceAnalytics, fOptions
Look at what sapply() is returning before you
assign it into zest[i]. If the return value has
length 0, set zest[i] to NA. If it has length
more than 1, I don't know what you want to do.
If it has length 1 then do the assignment.
zest <- numeric(1)
tmp <- tryCatch(sapply(...), error=function()NA
region1 <- read.table(file1, header=T)
...
region12 <- read.table(file12, header=T)
region <- data.frame(rbind(region1, region=1)..., rbind(region12, region=12)))
rm(region1, region2, region3..., region11, region12)
On 10 July 2011 12:22, majesty wrote:
> Hello, I am new to R - could somebody sug
On Sun, Jul 10, 2011 at 12:32 PM, finguy wrote:
> Am I missing a Package? I'm not sure why is won't read the functions. Any
That is the implication, yes. To find out which one (though one
wonders how you got this code without knowing the packages it runs
on), you can use the findFn() function fr
Hi,
If all the datasets have the same columns, you could just use rbind().
You might also look into the merge function. You can look up the
documentation by typing (at the console):
?rbind
?merge
We can give more detailed help with a more detailed example.
Cheers,
Josh
On Sun, Jul 10, 2011
Hi,
Please provide a *reproducible* example (as the posting guide
requests). It is also courteous to report your version of R and the
package which contains the chart.Regression() function. We can look
it up, but it saves time if you just say it.
Josh
On Sun, Jul 10, 2011 at 12:52 PM, finguy
Am I missing a Package? I'm not sure why is won't read the functions. Any
help is much appreciated.
> PData = Data[,3:10]
> Spec = portfolioSpec()
Error: could not find function "portfolioSpec"
> setTargetReturn(Spec) = mean(colMeans(PData))
Error in setTargetReturn(Spec) = mean(colMeans(PData))
chart.Regression(MCD,SPX, Rf = .03/12, excess.returns = TRUE, main =
"Security Characteristic Line", fit = c("loess", "linear"), legend.loc =
"topleft")
Error in as.vector(data[, i]) : subscript out of bounds
Why is this happening? Thanks
--
View this message in context:
http://r.789695.n4.nabb
Thanks so much! The single & did it, and now I know how that works
--
View this message in context:
http://r.789695.n4.nabble.com/Basic-vector-logic-not-working-tp3656465p3657958.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r
Hello, I am new to R - could somebody suggest a function to investigate for
the following:
I have data of the form
OA_CODE VALUE
xyz 0.42
abd 0.10
but I have it in 12 separate files, each with output areas and value for one
of 12 regions. I would like to combine the 12 files
I tried the following:
zest[i] <- tryCatch(sapply(getNodeSet(zdoc, "//zestimate/amount"),
xmlValue), error=function() NA)
Here's what happens :
Error in zest[i] <- tryCatch(sapply(getNodeSet(zdoc, "//zestimate/amount"),
:
replacement has length zero
--
View this message in context:
http:
On 2011-07-10 03:16, dmeire wrote:
I'm using the image.plot() function (fields package), but I want to enlarge
the characters of the legend (as they are too small to be read in a combined
figure), but there is no way I can find a command to do this. I can enlarge
the legend bar (with legend.witdh
On Jul 10, 2011, at 2:49 PM, (Ted Harding) wrote:
On 10-Jul-11 16:27:04, Durant, James T. (ATSDR/DTEM/PRMSB) wrote:
Hello,
I was interested in trying to write an R script to calculate a
UCL for a lognormal distribution using the Chebyshev Inequality
-- MVUE Approach (based on EPA’s guidance fo
Thank you very much, this code worked.
I will refer future geospatial queries to R-sig-geo, as suggested.
I have also edited the original shapefile in QGIS to remove the error, as
suggested by Barry Rowlingson.
Dan
-Original Message-
From: Roger Bivand [mailto:roger.biv...@nhh.no]
Sent:
Don't bother putting the 'zest[i]<-' into the error handler: the
retun value of the handler will be the return value of tryCatch:
E.g.,
> tryCatch(stop("Oops"), error=function(cond)NA,
warning=function(cond)-1)
[1] NA
> tryCatch(warning("Hmm"), error=function(cond)NA,
warning=function(cond)-
On 10-Jul-11 16:27:04, Durant, James T. (ATSDR/DTEM/PRMSB) wrote:
> Hello,
> I was interested in trying to write an R script to calculate a
> UCL for a lognormal distribution using the Chebyshev Inequality
> -- MVUE Approach (based on EPAs guidance found in
> http://www.epa.gov/oswer/riskassessmen
Dear Josh,
thank you so much for working this out for me - it works really well now!
My only remaining problem is that I can't seem to plot the gradients to
color.edge in plot.phylo() for my tree, but I've asked the relevant list
(R-sig-phylo) for some troubleshooting with that.
Many thanks
Hello,
I was interested in trying to write an R script to calculate a UCL for a
lognormal distribution using the Chebyshev Inequality MVUE Approach (based on
EPAs guidance found in http://www.epa.gov/oswer/riskassessment/pdf/ucl.pdf).
This looks like it should be straight forward, but I am n
Having a hard time understanding the help files for tryCatch. Looking for a
little help with the following statement which sits inside a for loop
zest[i] <- tryCatch(sapply(getNodeSet(zdoc, "//zestimate/amount"),
xmlValue), error=function() zest[i] <-"NA")
zest is a numeric vector
If the sapply
Same here.
Just made my first package and regret not having learned how to do it from
the very beginning.
Steve
On Sun, Jul 10, 2011 at 3:27 AM, Michael Dewey wrote:
> At 12:30 09/07/2011, Simon Chamaillé-Jammes wrote:
>
>> Dear all,
>>
>> sorry if this is a bit on the sidetrack for R-help.
>>
> To paraphrase your sig:
>
> "Rhelp answers are like a trumpet - if you don't put any code and data into
> them, you don't get anything out of it."
>
>> --
>> "Life is like a trumpet - if you don't put anything into it, you don't get
>> anything out of it."
>> <
>
> David Winsemius, MD
> West Hart
( after getting confirmation of lack of posts try again, LOL )
> From: marchy...@hotmail.com
> To: r-help@r-project.org
> Subject: RE: [R] Using t tests
> Date: Sun, 10 Jul 2011 10:13:51 -0400
>
>
> ( sorry if this is a repost but I meant to post to list
On Jul 10, 2011, at 11:03 AM, Fredrik Karlsson wrote:
Dear list,
I'm working on a panel function where I would like to be able to
visualise
data grouped by the category of the data, and then also changes in
summary
descriptives from one condition to another in the same scatter plot.
Like
On Jul 10, 2011, at 6:16 AM, dmeire wrote:
I'm using the image.plot() function (fields package), but I want to
enlarge
the characters of the legend (as they are too small to be read in a
combined
figure), but there is no way I can find a command to do this. I can
enlarge
the legend bar (wi
I'm using the image.plot() function (fields package), but I want to enlarge
the characters of the legend (as they are too small to be read in a combined
figure), but there is no way I can find a command to do this. I can enlarge
the legend bar (with legend.witdh), axis character size (cex.axis) or
On Sun, Jul 10, 2011 at 3:55 AM, peter dalgaard wrote:
>
> On Jul 10, 2011, at 09:44 , peter dalgaard wrote:
>
>>
>> On Jul 10, 2011, at 09:15 , Prof Brian Ripley wrote:
>>
>> article on date-times (not the un-refereed one in R-News 4/1) to gain more
>> understanding.
>>
>> Just to clarify, R New
Hi:
Here's a simple example:
> df <- data.frame(x = 1:10, y = rnorm(10))
> dput(df)
structure(list(x = 1:10, y = c(-1.55669581922794, -0.6086844726417,
-0.414989571570644, -0.202690819994734, -0.421436945159872,
0.00216009424665418,
-0.193955384660702, -0.764966890023485, -0.740871219664316, -0.0
David, you are right, I seem not to be able to reproduce the problem
with a synthetic file see attached). However, if I run
tst<-read.ods(file="test.ods",stringsAsFactors=FALSE)
I do not get a data.frame() in tst[[1]], just a vector of the row names:
1> tst[[1]]
[1] NA "row1" "row2" "row3"
At 12:30 09/07/2011, Simon Chamaillé-Jammes wrote:
Dear all,
sorry if this is a bit on the sidetrack for R-help.
As a regular R user I have developed quite a lot
of custom R functions, to the point of not
always remembering what I have already programmed, where the file is and so on.
I was wo
[code]>require("survival")
> coxph(Surv(futime,fustat)~age + strata(rx),ovarian)
Call:
coxph(formula = Surv(futime, fustat) ~ age + strata(rx), data = ovarian)
coef exp(coef) se(coef) z p
age 0.137 1.15 0.0474 2.9 0.0038
Likelihood ratio test=12.7 on 1 df, p=0.000368 n= 26,
I re-entered the command and then this appeared
Error in midnightStandard2(charvec, format) :
'charvec' has non-NA entries of different number of characters
--
View this message in context:
http://r.789695.n4.nabble.com/readSeries-tp3657300p3657396.html
Sent from the R help mailing list archi
finguy wrote:
>
> Data = readSeries(file="Data.csv1.csv",header=T,sep=",",format="%Y-%m-%d")
>
> after i enter this command it says it 'Error: could not find function
> "readSeries"'
> Please help thanks.
>
You need to load the library timeSeries first before you can use functions
defined by t
On Jul 10, 2011, at 09:44 , peter dalgaard wrote:
>
> On Jul 10, 2011, at 09:15 , Prof Brian Ripley wrote:
>
> article on date-times (not the un-refereed one in R-News 4/1) to gain more
> understanding.
>
> Just to clarify, R News articles were in general refereed (single reviewer),
> at lea
Data = readSeries(file="Data.csv1.csv",header=T,sep=",",format="%Y-%m-%d")
after i enter this command it says it 'Error: could not find function
"readSeries"'
Please help thanks.
--
View this message in context:
http://r.789695.n4.nabble.com/readSeries-tp3657300p3657300.html
Sent from the R hel
On Jul 10, 2011, at 09:15 , Prof Brian Ripley wrote:
article on date-times (not the un-refereed one in R-News 4/1) to gain more
understanding.
Just to clarify, R News articles were in general refereed (single reviewer), at
least in the later years, but the one you're referring to is a "Help d
On Sun, 10 Jul 2011, Amy Ruiz Goyco wrote:
Hello:
I am new using R. I have a file that contain in the same columns
date and time like for example 2011/10/03 12:34:45.123423 p.m., but
when I read the file and display the vector, I see of this way
"2011-10-03 12:34:45.123423". I need to con
57 matches
Mail list logo