Displaying 20 results from an estimated 300 matches similar to: "Convert SAS code to R code about survival analysis"
2007 Apr 29
2
how to code the censor variable for "survfit"
Dear r-helpers,
This is my first time to run survival analysis. Currently, I have a
data set which contains two variables, the variable of time to event
(or time to censoring) and the variable of censor indicator. For the
indicator variable, it was coded as 0 and 1. 0 represents right
censor, 1 means event of interest. Now I try to use "survfit" in the
package of "survival". I
2008 Jan 24
1
Grouping
I need to group some subjects according to two
variables (var1, var2)
I have a data frame that looks something like this:
Subject var1 var2
1 400 150
2 320 100
3 580 600
4 145 789
Each suject would fall into one of 2 categories ('A'
or 'B'). I want to find (and see) all the possible
combinations of
2005 Feb 03
1
help on "stack" function
So in fact :
I have a data wich colnames are :
"id","VEMS5A","VEMS6A","VEMS7A","VEMS8A","VEMS9A","VEMS10A","VEMS11A","VEMS12A","VEMS13A","VEMS14A","VEMS15A","VEMS16A","VEMS17A","VEMS18A","cohort")
With "VEMS5A" is the value when
2006 Feb 14
3
A concrete type I/III Sum of square problem
Hi R-help members,
I have read a lot in the Archive about the "Type I" vs "Type III" sum
of square. I think I have read confusing post so
I want to have a clear idea of the problem.
Here is an example.
I have 3 groups of subjects of unequal sample size (G1 (n=7), G2
(n=7), G3 (n=4)).
for Each subject I have 4 measures corresponding to the crossing of
2 factor (A & B)
2011 Jun 15
4
R string functions
Hi,
I have a string "GGGGGGCCCAATCGCAATTCCAATT"
What I want to do is to count the percentage of each letter in the string,
what string functions can I use to count the number of each letter appearing
in the string?
For example, the letter "A" appeared 6 times, letter "T" appeared 5 times,
how can I use a string function to get the these number?
thanks,
karena
2010 Aug 05
2
questions about string handling
Hi, I have a question about the data handling. I have a dataset as following:
ID snp1 snp2 snp3
1001 0/0 1/1 1/1
1002 2/2 3/3 1/1
1003 4/4 3/3 2/2
I want to convert the dataset to the following format:
ID snp1 snp2 snp3
1001 00 AA AA
1002 GG
2011 Jul 21
4
Random number generation
Hi,
I want to generate multiple sets of random numbers.
The requirement is that:
1) each set have 3 random numbers;
2) the sum of the three number is always 1.
how to do this?
thank you,
karena
--
View this message in context: http://r.789695.n4.nabble.com/Random-number-generation-tp3685463p3685463.html
Sent from the R help mailing list archive at Nabble.com.
2010 May 05
4
any function in R similar to the "scan" function in SAS?
I am wondering if there is any function in R that is similar to the "scan"
function in SAS.
I have a data.frame which has two columns as the following:
one two
1 2
3 4
5 6
I used the "paste" function to create the third column: three <-
paste(one,'-',two,sep="")
so the data.frame is like this now:
one two three
1 2 1-2
3
2010 Apr 22
6
macro variable in R?
I need to create 10 matrices. say matrix 1-10.
matrix_1 is 1 by 1
matrix_2 is 2 by 2
matrix_3 is 3 by 3
.
.
.
matrix_10 is 10 by 10
I am just wondering if there are some functions in R that are similar to the
macro variables in SAS. so I can create these 10 matrices by doing:
for (i in 1: 10) {
matrix_$i <- matrix(nrow=i, ncol=i)
}
rather thank creating these matrices one by one
2011 Oct 19
2
A questions regarding R plots
Hi Dear all,
I am making Venn Diagram plots in R. I attached an example:
http://r.789695.n4.nabble.com/file/n3919206/venn.jpeg
I want to get rid of the black boarder line, is there any way to do it?
Thank you very much,
Karena
--
View this message in context: http://r.789695.n4.nabble.com/A-questions-regarding-R-plots-tp3919206p3919206.html
Sent from the R help mailing list archive at
2010 May 04
2
question about 'write.table'
I have a question about the "write.table"
I have 100 data.frames, loci1, loci2, loci3.............,loci100.
now, I want to print these data.frames to 100 separate files, and the names
of the files are also loci1, loci2, loci3,......., loci100.
how to perform this under a "for" loop?
say,
for (i in 1:100) {
write.table(...., file='...', ........)
}
thank you,
2010 Jan 13
4
a question about deleting rows
I have a file like this:
id n1 n2 n3 n4 n5 n6
1 3 4 7 8 10 2
2 4 1 2 4 3 10
3 7 0 0 0 0 8
4 10 1 0 0 2 3
5 11 1 0 0 0 5
what I want to do is: only if n2=0 and n3=0 and n4=0 and n5=0 then delete
the row. how can I do that?
thank you,
karena
--
View this message
2010 Jan 12
2
how to handle missing values "." when importing data in R
hi, I have a question about importing data in R.
I want to import a file which has missing value in it, and the missing
values are denoted as ".", I want to first read in the file, and then change
the "." into the number zero "0".
how can I do that?
thank you,
karena
--
View this message in context:
2010 Nov 02
2
how to make multiple curves in one plot
hello,
plot(running(-log10(results_chr_p$empi_p), fun=mean, width=41, font.axis=4,
by=1),type="l",cex=0.1, ylab="-Log(p)", ylim=c(0,5.0), xlab=" ", lwd=2)
this is my code to make a plot. The problem is, now I want to add one more
curve to the plot, which is for another variable in the data.frame
-log10(results_chr_p$p). My question is: how to make multiple lines
2010 Jul 16
2
a issue about the qutation mark?
Following is a function that I wrote (It is working well). It's a simple one,
nothing complicated. The only question that I have is a qutation mark issue,
I guess.
#############################################
funcname <- function(trait.file){ #line1
setwd('/root/subroot') # line 2
load('imge.RData')
2010 Jun 03
5
string handling
I have a data.frame as the following:
var1 var2
9G/G09 abd89C/T90
10A/T9 32C/C
90G/G A/A
. .
. .
. .
10T/C 00G/G90
What I want is to get the letters which are on the left and right of '/'.
for example, for "9G/G09", I only want "G", "G", and for "abd89C/T90", I
only want "C" and
2010 Sep 08
2
a question about replacing the value in the data.frame
I have a data.frame as follows:
v1 v2 v3 v4 v5.....v100
1 1 0 0 1 2
2 1 2 1 0 1
1 1 1 2 1 0
. . . . . .
. . . . . .
1 2 2 1 1 0
so for this data set, what I wanna do is to replace all the
2010 Jul 14
4
question about string handling....
Hi,
I have a data.frame as following:
var1 var2
1 ab_c_(ok)
2 okf789(db)_c
3 jojfiod(90).gt
4 "ij"_(78)__op
5 (iojfodjfo)_ab
what I want is to create a new variable called "var3". the value of var3 is
the content in the Parentheses. so var3 would be:
var3
ok
db
90
78
iojfodjfo
how to do this?
thanks,
karena
--
2012 Mar 07
2
fill=T?
If a text file has rows of variable lengths. How to read the file into R?
I think some people may suggest using 'fill=T', however, it sort of messes
the data up, for example, in the text file:
a b c d
1 2 3 4
1 8 6
1 2 0
1 1 0
If I read in the file using 'read.table("data", head=T, fill=T), then the
data.frame in R will
2010 Aug 05
2
a question about 'read.table' with or without 'read.table'.(urgent)
Hi, I've got a quite tricky question.
I have a txt file, named 'temp.txt', as the following:
snp1 snp2 snp3
AA 00 00
GG GG 00
00 AA 00
I want to read the file into R.
1) when I use 'read.table' without 'header=T' option,
> temp <- read.table('temp.txt')
# I got
> temp
V1