Displaying 20 results from an estimated 1000 matches similar to: "Does R support [:punct:] in regexps?"
2009 Jan 20
2
Stacked barplot with two stacked bars besides each other
Hi,
I have a particular barplot I would like to generate, but I am having
trouble getting it to work. What I would like is in effect two barplots
with stacked bars merged into one. For example, I have two samples
(yoda1,yoda2) on which I measure whether two variables (var1,var2) are
present or absent for a number of measurements on that sample.
> var1 <- data.frame(yoda1=c(3,7),
2009 Apr 06
2
Collapse data matrix with extra info separated by commas
Hello,
I would like to reshape my data for presentation purposes from something
like this:
> test <-
data.frame(a=c("A","A","A","A","B","B","B"),b=c(1,1,2,2,1,1,1),c=1:7)
> test
a b c
1 A 1 1
2 A 1 2
3 A 2 3
4 A 2 4
5 B 1 5
6 B 1 6
7 B 1 7
to something like this:
a b c
1 A 1 1,2
3 A 2 3,4
5 B 1 5,6,7
This seems
2009 Apr 28
1
Mathematical label in a plot with a percent sign
Hi,
I am trying to produce a plot with an xlabel that reads (x >= 5%) with
the >= turned into the correct epression. I can do this up to the
percentage sign by specifiing xlab=expression(x>=5). Whatever I do to
include the % sign as well doesn't seem to work.
xlab=bquote(x>=5.("%")) almost works but includes brackets.
Anyonw know how to solve this one
Dan
PS I am
2009 Dec 02
1
Extract html tables to data.frames
Hello,
I would like to scrape some html tables from a web page and convert them
to a data.frame so I can perform further analysis. Could anyone tell me
the best way to do this? Would it be more appropriate to use an
external tool first?
Thanks
Dan
--
**************************************************************
Daniel Brewer, Ph.D.
Institute of Cancer Research
Molecular Carcinogenesis
2010 Nov 19
1
expand comma separated field vertically in data.frame
Hello,
I have a data.frame like this:
a 1,2,3,4 b1
b 6,7 b3
And I would like to transform it to this:
a 1 b1
a 2 b1
a 3 b1
a 4 b1
b 6 b3
b 7 b3
I have been looking at ddply but can't seem to work it out. ANy help
would be gratefully received.
Dan
--
**************************************************************
Daniel Brewer, Ph.D.
Institute of Cancer Research
Molecular Carcinogenesis
2009 Jun 24
1
order by decerasing 1st variable and increasing 2nd variable
Hello,
I have a data.frame which I would like to sort with the primary key
decreasing while the secondry key is increasing e.g.
x <- data.frame(One=c(1,1,1,2,2,3,4,5),Two=c(2,3,1,2,3,3,3,3))
I would like to order it so it looks like this:
One Two
8 5 3
7 4 3
6 3 3
4 2 2
5 2 3
3 1 1
1 1 2
2 1 3
i.e. primarily decreasing in the 1st column but if there is a
2008 Mar 26
1
Adding name labels to x-axis of matplot
Hello,
I have a gene expression matrix with columns being samples and rows
being genes. I would like to display the expression values for each
gene. I have two groups which I colour differently. The aim is to see
if there is any difference between the two groups consistently across genes.
So the following works well:
2009 Dec 23
2
COnfidence intervals for estimates of linear model
Hello,
I would like to calculate the 95% confidence intervals for the estimates
of a linear model and I just wanted to check that I am doing it correct.
Is it just:
Estimate + 1.95996*Std.Error to Estimate - 1.95996*Std.Error
or is there another approach that doesn't assume a normal distrbution?
Thanks. Apologies for my naiivity
Dan
--
2010 Dec 10
1
melt causes errors when characters and values are used
Hello,
I am finding that the melt function from the reshape library causes
errors when applied to a data.frame that contains numeric and character
columns. For example,
melt(id.vars="ID",data.frame(ID=1:3,date=c("a","b","c"),value=c(1,4,5)))
ID variable value
1 1 date a
2 2 date b
3 3 date c
4 1 value <NA>
5 2
2008 Jun 17
3
Capturing coxph warnings and errors
Hi,
I have a script that takes a subset of genes on a microarray and tries
to fit a coxph model to the expression values for each gene. This seems
to work fine but in some cases it produces warnings and/or errors.
For example:
Error in fitter(X, Y, strats, offset, init, control, weights = weights, :
NA/NaN/Inf in foreign function call (arg 6)
In addition: Warning message:
In fitter(X, Y,
2010 Dec 02
1
Suitable test for ordinal variable vs continuous variable trend
Dear all,
For a population of about 200 I have a continuous variable and an ordinal variable. The question I would like to ask is whether the continuously increases (or decreases) as the rank of the ordinal variable increases. I was thinking that a Spearmen's rank correlation or or a chi squared trend might be appropriate. I don't have any experience dealing with ordinal variables so I
2009 May 05
2
Bristol mirror GPG problem ubuntu repository
Hello,
I am getting a GPG error with the ubuntu repository at the bristol UK
mirror.
When my source.list has this line:
deb http://www.stats.bris.ac.uk/R/bin/linux/ubuntu/ intrepid/
On an "apt-get update" you get this:
W: GPG error: http://www.stats.bris.ac.uk intrepid/ Release: The
following signatures were invalid: BADSIG D67FC6EAE2A11821 Vincent
Goulet <vincent.goulet at
2009 Sep 08
2
Fitting a linear model with a break point
Hello,
I would like to test some data to see whether it has the shape of a step
function (i.e. y1 up until x_th and then y2 where x_th is the
threshold). The threshold x_th is unknown and the x values can only
take discrete values (0,1,2,3,4).
An example would be:
data<- data.frame(x=1:20,y=c(rnorm(10),rnorm(10,10)))
I was thinking along the lines of fitting some sort of piiecewise linear
2008 May 08
1
cpower and censoring
I would like to do some power estimations for a log-rank two sample test
and cpower seems to fit the bill. I am getting confused though by the
man page and what the arguments actually mean. I am also not sure
whether cpower takes into account censoring or not.
Could anyone provide a simple example of how I would get the power for a
set control/non-control clinical trial where censoring occurs at
2008 Oct 24
1
pwr.2p2n.test when the ratio of n1/n2 is known
Hi,
I am trying to do a power calculation for a difference in proportions
test where I want to estimate the sample size required. I know (well
estimate) that group one (n1) is 10% of the population and group 2 (n2)
is 90% of the population. I know the effect size (h). pwr.2p2n.test
only allows one variable to be left null whereas I would like both n1
and n2 to be determined where I know there
2009 Jan 27
2
Memory issue?
I have a script that sometimes produces the following error:
Error in assign(".target", method at target, envir = envir) :
formal argument "envir" matched by multiple actual arguments
Do you think this is a memory issue? I don't know what else it could be
as it doesn't always occur even if the script is run with exactly the
same data.
Does rm() actually free up
2009 Jan 29
0
Use SOCKS proxy
Hi,
Is there anyway to set up R so that it uses a SOCKS proxy in Linux? I am
getting some strange issues with the Institute's new web filtering
system and want to be able to test whether a problem I have with the
biomaRt package is caused by it.
Many thanks
Dan
--
**************************************************************
Daniel Brewer, Ph.D.
Institute of Cancer Research
Molecular
2010 Mar 24
1
Bulk editing of mySQL tables
Hello,
I have started to use RMySQL and I would like to use R to make batch
changes to data. What it the best way to do this? Is it to download
the table using dbGetQuery, manipulate the data in R and then
dbWriteTable to delete the existing table and replace it with the local
data.
What I am concerned about this is that it might lose some mySQL table
configuration options and it isn't a
2008 Jun 02
1
Ancova: formula with a common intercept
I have some data with two categorises plus/minus (p53) and a particular
time (Time) and the outcome is a continuous vairable (Result). I set up
a maximum model.
ancova <- lm(Result~Time*p53)
> summary(ancova)
..
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 0.05919 0.55646 0.106 0.916
Time -0.02134 0.01785 -1.195 0.241
p53plus
2010 Dec 10
2
Remove 100 years from a date object
Hello,
I have some data that has dates in the form 27.02.37. I convert them to
a date object as follows:
as.Date(data$date,format="%d.%m.%y")
But this gives me years such as 2037 when I would like them to be 1937.
I thought of trying to take off some time i.e.
as.Date(camCD$DoB,format="%d.%m.%y") - 100*365
But that doesn't seem to work out correctly. Any ideas how to