similar to: Calculate difference between dates in years

Displaying 20 results from an estimated 3000 matches similar to: "Calculate difference between dates in years"

2007 Aug 07
11
Positioning text in top left corner of plot
Simple question how can you position text in the top left hand corner of a plot? I am plotting multiple plots using par(mfrow=c(2,3)) and all I want to do is label these plots a), b), c) etc. I have been fiddling around with both text and mtext but without much luck. text is fine but each plot has a different scale on the axis and so this makes it problematic. What is the best way to do this?
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 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 --
2008 Jan 31
3
Log rank test power calculations
Does anyone have any ideas how I could do a power calculation for a log rank test. I would like to know what the suggested sample sizes would be to pick a difference when the control to active are in a ratio of 80% to 20%. Thanks Dan -- ************************************************************** Daniel Brewer, Ph.D. Institute of Cancer Research Email: daniel.brewer at icr.ac.uk
2007 Sep 18
3
Cox regression and p-values
Hello, I might be barking up the wrong tree here, but I want to make sure I have a full understanding of this. What I would like to know is what tests are performed to give the p-values for each variable in the table that is the result of coxph regression when the variables are categorical only. More specifically, when expected counts are less than 5 is the Fisher's exact test used instead
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:
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
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),
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
2010 Sep 09
5
Highlighting a few bars in a barplot
Hello, I have a bar plot where I am already using colour to distinguish one set of samples from another. I would also like to highlight a few of these bars as ones that should be looked at in detail. I was thinking of using hatching, but I can't work out how or if you can have a background colour and hatching which is different between bars. Any suggestions on how I should do this? Thanks
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
2010 Nov 29
2
Problems in running affylmGUI
Hi, I am trying to run affylmGUI on my mac computer. I have already installed the Tlc package as well as Bwidgets through ActiveTcl conversion installing files. However, when running affylmGUI() on R, I keep getting the message in the attached file. I have copied the tcl folders from the root library to the user library, and have obtained the same issue. I would really appreciate if
2010 Aug 26
7
Find classes for each column of a data.frame
Hello, Is there a simple way to get the class type for each column of a data.frame? I am in the situation where I would like to get all the columns of a data.frame that are factors. I have tried: apply(df,2,class) but all the columns come back as class "character". Thanks Dan -- ************************************************************** Daniel Brewer, Ph.D. Institute of