Displaying 2 results from an estimated 2 matches for "rs_df".
Did you mean:
res_df
2018 Mar 05
0
Help with apply and new column?
...# using apply( ..., 2, ... ) when only one column has ":" characters
#temp <- apply( dta, 2, split_rs ) #send data frame to function
temp <- strsplit( dta$rs, ":" ) # gets the whole column splits at once
# wildly guessing here
rs_chrmatrix <- do.call( rbind, temp )
rs_DF <- as.data.frame( rs_chrmatrix, stringsAsFactors = FALSE )
names( rs_DF ) <- c( "CHR", "P", "X1", "X2" )
rs_DF$P <- as.integer( rs_DF$P )
str( rs_DF )
##################################################
>
> -----Original Message-----
> F...
2018 Mar 05
2
Help with apply and new column?
Thanks. I think nabble is good for programming questions. Bear with me if I'm incorrect.
Data: Genomics SNP information
Goal: I need to add Chromosome and SNP position to the data frame I'm using through apply.
I'd like to add new column from text processed through apply function.
For example: 10:60523:T:G (Column 2)
CHR: 10
Position: 60523
Dataset:
chr rs ps n_miss allele1