Re: [R] class in apply

2005-07-20 Thread Omar Lakkis
Thank you for teh helpful answer. I do have one aother related question; If I am not interested in teh result of the lapply, as I am using it instaid of a for loop, example lapply(df, function(r) sqlQuery(conn, paste("insert into t values(",r['a'],',',r['b'],')'))) and I am not interested in teh

Re: [R] class in apply

2005-07-19 Thread Stéphane Dray
apply transorm your data.frame into a matrix which can contains only one type of values (character or numeric or logical). data.frame are list, so they can contain various kind of data, and a solution to your problem is given by lapply: > b=lapply(df, function(r) print(class(r['a']))) [1] "nume

[R] class in apply

2005-07-19 Thread Omar Lakkis
Numeric data that is part of a mixed type data frame is converted into character. How can I tell apply to maintain the original class of a column and not convert it into character. I would like to do this of the vector and not inside the apply function individually over each element. Consider the f