LinZhongjun wrote:
I ran Winbugs under R. I could get the results, but I kept getting the error
messages:
Error in
file(con, wb) : cannot open the connection
In addition: Warning messages:
1: In file.create(to[okay]) :
I run the script and it exports a PDF called version 1.
I want it to check if version 1 already exists. If so,
then I want the new graphs to be exported as
version 2, and so on.
Is it possible to do it in R?
Someone may know a way. However its certainly possible to execute a command in
I might be missing something really obvious, but is there an easy way to locate
all non-unique values in a data frame?
Example
mydata - numeric()
mydata$id - 0:8
mydata$unique - c(1:5, 1:4)
mydata$result - c(1:3, 1:3, 1:3)
mydata
$id
[1] 0 1 2 3 4 5 6 7 8
$unique
[1] 1 2 3 4 5 1 2 3 4
Sorry this may well be defined as Off Topic. I apologize in advance.
I am interested in performing what I think would be a probabilistic sensitivity
simulation. I've done some crude ones before in excel but I'm wondering if R
can help me do it more effectively?
I have a set of theoretical
Hi guys I'm hoping someone can help me with this. It should be easy but it
seems to get stuck for no obvious reason! I am trying to set a report up in
odfWeave so that we can re-run the same analysis at 3 time points as the data
matures and provide an 'instant' report.
To simplify the
Solved my own problem by using:
odfTable.matrix(
as.matrix (
with (mydata, table (site_id, reaction))
)
)
This message may contain confidential information. If
I'm hoping I'm missing some (probably fundamental basic process) which might
make my life easier!
Lets assume I have a 3 column table summarizing results from a trial from three
arms (Arm A, B and C).
For each arm there will be a number of pieces of information to report. The
simplest example
I'm anything but an expert in R however if I'm labeling a graph axis with a
superscript I have tended to use:
plot (x , y , xlab = expression (label^2))
But when you try to have more than one superscript it fails. Assuming you are
in a UTF8 location (Western Europe) you could try:
plot (x
I tried to post this a few times last week and it seems to have got stuck
somehow so I'm trying from a different email in the hope that works. If
somehow this has appeared on the list 20 tiems and I never saw any of them I
apologize ;-)
I'm basically an R-newbie. But I am VERY computer
So the issue is something to do with the [['xxx']] construction of your data.
Can you explain what thats' all about - as it errors all over the shop when I
try using that...
You've set me on a mission to find the answer! So I'd really like to recreate
a little bit of your data here, and
Are n.FD and n.RD the number of people who received the full/reduced dose
Yes - but I don't have the data structured like that YET - thats what I want to
get to because thats what forest plot seems to be wanting.
and surv.FD and surv.RD the number of people that survived?
Mmm... was more
What I want to do is do a forrest (forest) plot for subgroups within my
single dataset as a test of heterogeniety. I have a dataset who received
either full dose(FD) or reduced dose(RD) treatment, and a number of
characteristics about those subjects: age, sex, renal function, weight,
library(RODBC)
library(HYDAT)
You will need to install HYDAT (the zip file) from
http://www.geog.ubc.ca/~rdmoore/Rcode.htm
Below is my current code - which works. The [[]] is the way i am accessing
the columns from the data frame.
thanks again for all your help
# load HYDAT data
Duh! did it again! the variables need str in front of them don't they!!
sub = sprintf('Seasonal station with natural streamflow - Lat: %s Lon: %s
Gross Area %s km\UB2 - Effective Area %s km\UB2 ',
round( str[['metadata']][['latitude']], digits=4 ),
round( str[['metadata']][['longitude']], digits
Ah, I think I see what you want. Try this on each pair of exclusive sets:
n_total-dim(mydataset)[1]
under65-mydataset$age = 65
n_under65-sum(under65)
under65row-c(sum(mydataset$dose[under65] == FD),
sum(mydataset$dose[under65] == RD),
sum(mydataset$vitalstatus[under65] == dead
Ah, I think I see what you want. Try this on each pair of exclusive sets:
snip
Then under65row and over65row should be the first two rows of your result.
Can't test this at the moment, but I don't think it's too far wrong.
I knew this shouldn't need so much work ;-)
Not cracked it yet -
I may be doing this wrong! but I have a function which I have simplified a lot
below. I want to pass some 'field names' of a data-frame to the function for
it to then do some manipulation of.
Here's my code:
#build a simple dataset
mydataset = data.frame (
I'm far from an expert on stats but what I think you are saying is if you try
and compare Baseline with Version 3 you don't think your p-value is as good as
version 1 and 2. I'm not 100% sure you are meant to do that with p-values but
I'll let someone else comment on that!.
I've been tweaking code for several days on and off in R, cut and pasting in
from a text editor (I just leave them open all the time). I think I got
something that was usable but then a powersurge tripped the fuses and
unfortunately the machine I was working on doesn't have a UPS.
Does R hold
Rolf Write:
If you've been cut-and-pasting from a text editor, then your commands
*might* be in the file .Rhistory. Unfortunately this history gets saved
only when you exit R (and by default only when you also say ``yes'' to
saving the workspace) or if you explicitly savehistory().
Was
OK - I've been doing some work on getting a forest plot or two together for a
sub-group analaysis. Thats the crucial thing - because its a sub-group
analysis rather than a meta-analsysis and all the forest (meta) and forestplot
(rmeta) instructions assume you are doing a meta-analysis.
I
Example,
data(GlaucomaM, package = ipred) is accepted. Now instead of GlaucomaM,
I need to give my own data. But the data format for GlaucomaM is not given.
So how can I know that?
Not familliar with the packages at all but if you simply enter:
data (GlaucomaM, package=ipred)
GlaucomaM
All
Hi,
I'm sure this should be simple but I can't figure it out! I want to get the
median survival calculated by the survfit function and use the value rather
than just be able to print it. Something like this:
library(survival)
data(lung)
lung.byPS = survfit(Surv (time, status) ~ ph.ecog,
# I tried defining a function like this
myplot - function(...)plot(..., pch=19, col=c(blue,red)[treatment])
# So i can call it like this:
with(mydfr, myplot(Xmeas, Ymeas))
# but:
Error in plot.xy(xy, type, ...) : object 'treatment' not found
basically that is something like calling:
I have got 27 graphs to export (not a lot...I know!). How can I fit all of
them into a single file like PNG without adjusting the size of the graphs?
What's in my mind is like pasting graphs into Word, in which I can just
scroll down to view the graphs.
Pretty sure PNG can only cope with
col=c(blue,red)mydfr$[treatment]
Yes, but I would like to use the function for lots of other dataframes
as well, so embedding 'mydfr' in the function is not the ideal
solution...
In that case I'd try something like:
myplot - function(..., tmnt) {
plot(...,
pch=19,
Sorry I'm having one of those moments where I can't find the answer but I bet
its obvious...
I'm outputting my results to a file using sink()
Is there a command simillar to php's echo command that would allow me to add
some text to that file ie:
dataFr$a = 1:10
dataFr$b = 2*1:10
sink
I have some data which is censored and I want to determine the median. Its
actually cost data for a cohort of patients, many of whom are still on
treatment and so are censored.
I can do the same sort of analysis for a survival curve and get the median
survival... ...but can I just use the
November 2011 19:55
To: Polwart Calum (COUNTY DURHAM AND DARLINGTON NHS FOUNDATION TRUST);
r-help@r-project.org
Subject: RE: Kaplan Meier - not for dates
I think it really depends on what your event of interest is. If your event is
that the patient got better and left treatment then I think
2. The answer will be wrong. The reason is that the censoring occurs on a
time scale, not a $ scale: you don't stop observing someone because
total cost hits a threshold, but because calendar time does. The KM routines
assume that the censoring process and the event process are on the
2. The answer will be wrong. The reason is that the censoring occurs on a
time scale, not a $ scale: you don't stop observing someone because
total cost hits a threshold, but because calendar time does. The KM routines
assume that the censoring process and the event process are on the
This may be a really obvious question but I just can't figure out how to do it.
I have a small dataset that I am trying to compare to some controls. It is
essential that the controls are matched on Cancer Stage (a numerical factor
between 1 and 4), and then ideally on Age (integer), Gender
Some colleagues nationally have developed a system which means they can pick
the optimal sets of doses for a drug. The system could apply to a number of
drugs. But the actual doses might vary. To try and explain this in terms that
the average Joe on the street might understand if you have
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
that the
distributions are different is not proof that the distributions are equal.
Yes absolutely - however I'm half expecting to detect a difference and so then
dismiss using A as a surrogate of B...
Thanks
-Original Message-
From: Polwart Calum (COUNTY DURHAM AND DARLINGTON NHS
from TypeMail<http://www.typeapp.com/r>
On 27 Dec 2015, at 08:00, "Polwart Calum (COUNTY DURHAM AND DARLINGTON NHS
FOUNDATION TRUST)" <calum.polw...@nhs.net<mailto:calum.p
planation of the problem, to basically say... has anyone come across a
function in R that might simplify this?
Sent from TypeMail<http://www.typeapp.com/r>
On 27 Dec 2015, at 08:00, "Polwart Calum (COUNTY DURHAM AND DARLINGTON NHS
FOUNDATION TRUST)"
<calum.polw...@nhs.net<m
Before I go and do this another way - can I check if anyone has a way of
looping through data in odfWeave (or possibly sweave) to do a repeating
analysis on subsets of data?
For simplicity lets use mtcars dataset in R to explain. Dataset looks like
this:
> mtcars
mpg cyl disp
I am using seq with the expression seq(1.4, 2.1, by=0.001) to create a sequence
of references from 1.4 to 2.1 in 0.001 increments. They appear to be created
correctly. They have a related pair of data which for the purposes of this we
will call val. I'm interested in the content on the row
it from FAQ 7.31.
Cheers
Petr
> -Original Message-
> From: POLWART, Calum (COUNTY DURHAM AND DARLINGTON NHS FOUNDATION
> TRUST)
> Sent: Thursday, January 17, 2019 2:56 PM
> To: PIKAL Petr ; Ben Tupper
>
> Cc: r-help@r-project.org
> Subject: RE: [R] I can't get s
Tupper
> Sent: Thursday, January 17, 2019 2:43 PM
> To: POLWART, Calum (COUNTY DURHAM AND DARLINGTON NHS FOUNDATION TRUST)
>
> Cc: r-help@r-project.org
> Subject: Re: [R] I can't get seq to behave how I think it should
>
> Hi,
>
> This looks like a floating point real
I'm writing a quite large document in Rmarkdown which has financial data in it.
I format that data using scales::dollar() currently something like this:
>
> require (scales)
> x = 10
> cat (dollar (x, prefix ="£", big.mark=","))
£100,000
But actually, I'd quite like to get £100k out in
42 matches
Mail list logo