Bansal, Vikas wrote:
>
> Dear all,
>
> I have a problem and it is very difficult for me to get a code.
> I am reading a file(attached with this mail) using the code-
>
> df=read.table("summary.txt",fill=T,sep="",colClasses =
> "character",header=T)
> and dataframe df is like this-
>
> V1
Hi Vikas,
Here is one way:
df <- read.table("summary.txt", header = TRUE)
str(df)
df[, "total"] <- rowSums(df[, 3:6])
df[, 3:6] <- apply(df[, 3:6], 2, function(x) x / df[, "total"] * df[,
"new"] * 2)
> head(df)
V1V2 CaseA CaseC CaseG CaseT new total
1 10 135344109 0 024
Dear all,
I have a problem and it is very difficult for me to get a code.
I am reading a file(attached with this mail) using the code-
df=read.table("summary.txt",fill=T,sep="",colClasses = "character",header=T)
and dataframe df is like this-
V1V2 CaseA CaseC CaseG CaseT new
10 13
3 matches
Mail list logo