Displaying 1 result from an estimated 1 matches for "data2trip".
Did you mean:
data1trip
2007 Oct 30
0
data types changing
...e statement for each entry. I've included some code below. In my example all but row 5 are factors and should be kept as characters, and column 7 has 2 levels, 1 or 2. Column 5, the response is a double. Thanks for the help.
l = nrow(data)
n = 1
k = 1
data1trip = as.data.frame(rbind(1:7))
data2trip = as.data.frame(rbind(1:7))
colnames(data1trip) =...#my column names for data1trip
colnames(data2trip) =...# "" "" data2trip
for(i in 1:l){
if (data[i,7]=="1"){
data1trip[k,] = data[i,]; k=k+1 }
else {
data2trip[n,] = data[i,]; n = n+1}
}
is the only...