Displaying 4 results from an estimated 4 matches for "split_r".
Did you mean:
split_rs
2018 Mar 05
2
Help with apply and new column?
....980 -8.513143e-03 3.837054e-02 1.566875e-01 8.244260e-01
Code:
--------------------------------------------------------
data<-read.table("small.txt",header = T) # read data
data<-data[,c(2,11)] #delete other columns not needed
#--split data on : and get chromosome and position
split_rs<-function(rs){
chr<-vector(,length(rs)) # create new vector to store chr
pos<-vector(,length(rs)) #create new vector to store position
for(i in 1:length(rs)){ #iterate over RS column
if(grepl(":",rs[i])){ #if : in column string
temp...
2018 Mar 05
0
Help with apply and new column?
...8.244260e-01
>
> Code:
>
> --------------------------------------------------------
> data<-read.table("small.txt",header = T) # read data
> data<-data[,c(2,11)] #delete other columns not needed
>
> #--split data on : and get chromosome and position
>
> split_rs<-function(rs){
>
> chr<-vector(,length(rs)) # create new vector to store chr
> pos<-vector(,length(rs)) #create new vector to store position
>
> for(i in 1:length(rs)){ #iterate over RS column
>
> if(grepl(":",rs[i])){ #if : in column string...
2018 Mar 05
0
Help with apply and new column?
Read the Posting Guide... (see message footer) ... some relevant things you can find there:
a) Yes, this appears to be about how to use an R base function so it is on topic
b) Post a reproducible example (include some sample data, preferably using the dput function)
c) Post using plain text so the mailing list doesn't convert it for you and mangle things in a way you did not intend.
--
Sent
2018 Mar 05
2
Help with apply and new column?
Hello members,
Can I ask question for apply, adding new column to data frame on this e-mail list?
Thanks!
[[alternative HTML version deleted]]