Arantzazu, Your problem is that the data were probably imported from Excel where you had at least one cell containing "#N/A". You need to replace those cases in your dataframe with NA. Then you should be able to do as.numeric(as.character(arcilla)).
-Peter Ehlers On 2010-05-18 10:07, Arantzazu Blanco Bernardeau wrote:
Hello Well, the problem is, that arcilla is the percentage of clay in the soil sample. So, for linear model, I need to work with that number or value. Now, R thinks that arcilla (arcilla means clay in spanish), is a factor, and gives me the value as a factor, so the output of the linear model is Call: lm(formula = formula, data = caperf) Residuals: Min 1Q Median 3Q Max -1.466e+01 -1.376e-15 1.780e-16 2.038e-15 1.279e+01 Coefficients: Estimate Std. Error t value Pr(>|t|) (Intercept) 1.68964 6.33889 0.267 0.790221 arcilla0.9 1.90228 8.90888 0.214 0.831239 arcilla10 1.26371 7.96734 0.159 0.874212 arcilla10.3 15.70081 9.05141 1.735 0.085090 . arcilla10.4 7.27517 7.72806 0.941 0.348183 arcilla10.45 7.03879 9.02600 0.780 0.436853 arcilla10.5 2.41241 8.90827 0.271 0.786954 arcilla10.65 15.44298 9.03879 1.709 0.089838 . arcilla10.7 19.35651 9.04675 2.140 0.034185 * arcilla10.9 3.55947 9.18501 0.388 0.698974 [...] arcilla9.9 6.31949 7.35724 0.859 0.391892
===> arcilla#N/A 24.17959 8.87201 2.725 0.007274 **
limo 0.24920 0.04605 5.412 2.76e-07 *** CO_gkg1 0.21015 0.03931 5.346 3.73e-07 *** C03Ca 0.01711 0.02727 0.628 0.531337 --- Signif. codes: 0 ‘***’ 0.001 ‘**’ 0.01 ‘*’ 0.05 ‘.’ 0.1 ‘ ’ 1 Residual standard error: 6.249 on 135 degrees of freedom (50 observations deleted due to missingness) Multiple R-squared: 0.9736, Adjusted R-squared: 0.9014 F-statistic: 13.47 on 370 and 135 DF, p-value:< 2.2e-16 So, in the desired linear model, arcilla should be just a line, with the valors of the linear model. I hope you understand better more. If not, I could make an english version of the file to send, so you can try the commands. Thanks a lot for your help! Arantzazu Blanco Bernardeau Dpto de Química Agrícola, Geología y Edafología Universidad de Murcia-Campus de Espinardo
[snip] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.