Re: [R] Predictably puzzled.

2021-11-19 Thread David Carlson
All you need is predict(fit, data.frame(x)) or if you had started with a data frame: xy <- data.frame(x, y) fit <- lm(y~x, xy) predict(fit, xy) David Professor Emeritus of Anthropology Texas A University College Station, TX On Fri, Nov 19, 2021 at 8:45 PM Rolf Turner wrote: > > On Fri, 19

Re: [R] Predictably puzzled.

2021-11-19 Thread Rolf Turner
On Fri, 19 Nov 2021 18:35:23 -0800 Bert Gunter wrote: > ?predict.lm says: > > "predict.lm produces predicted values, obtained by evaluating the > regression function in the frame newdata (which defaults to > model.frame(object)). " > > model.frame(fit) is: > 1 1.37095845 -0.30663859 > 2

Re: [R] Predictably puzzled.

2021-11-19 Thread Bert Gunter
?predict.lm says: "predict.lm produces predicted values, obtained by evaluating the regression function in the frame newdata (which defaults to model.frame(object)). " model.frame(fit) is: 1 1.37095845 -0.30663859 2 -0.56469817 -1.78130843 4 0.63286260 1.21467470 6 -0.10612452 -0.43046913

[R] Predictably puzzled.

2021-11-19 Thread Rolf Turner
Consider the following toy example: set.seed(42) y <- rnorm(20) x <- rnorm(20) y[c(3,5,14,15)] <- NA fit <- lm(y~x) predict(fit) This for some reason, which escapes me, does not provide predicted values when the response/dependent variable is missing, despite there

Re: [R] Confirmatory Factor Analysis

2021-11-19 Thread Bert Gunter
Please read the posting guide linked below, which says: "Questions about statistics: The R mailing lists are primarily intended for questions and discussion about the R software. However, questions about statistical methodology are sometimes posted. If the question is well-asked and of interest

[R] Confirmatory Factor Analysis

2021-11-19 Thread AbouEl-Makarim Aboueissa
Dear All: I am conducting a Confirmatory Factor Analysis (CFA) for the attached data. Here is what I did. please see below I do need your help with the structure of the model. I believe that what I used is the correlated CFA model. If I am wrong, please fix me. I need your help with the

Re: [R-es] reemplazar valores de una variable por otras

2021-11-19 Thread Juan Carlos Lopez Mesa
Hola, La función case_when() del paquete dplyr te sirve Saludos El jue, 18 nov 2021 a las 13:36, juan manuel dias () escribió: > Hola, como andan! > Necesito crear una variable nueva "*Dirección_Final*" que sea igual a la > variable "*Dirección*", pero que si "*Dirección" *es NA traiga

Re: [R-es] reemplazar valores de una variable por otras

2021-11-19 Thread Javier Marcuzzi
Estimados Personalmente yo uso esa forma antes que if, pero, hay varias alternativas. Javier Marcuzzi El vie, 19 nov 2021 a las 5:01, Proyecto R-UCA () escribió: > Buenas, > > ¿qué tal esto? > > Supongamos que las variables están en un data.frame d que tiene todas > esas columnas, entonces > >

Re: [R-es] reemplazar valores de una variable por otras

2021-11-19 Thread juan manuel dias
Hola, muchas gracias! Lo resolví con coalesce() ##mutate(Dirección_Final=coalesce(Dirección,`Dirección General`,Subsecretaria, Secretaria)) El vie, 19 nov 2021 a las 5:01, Proyecto R-UCA () escribió: > Buenas, > > ¿qué tal esto? > > Supongamos que las variables están en un data.frame d que

[R] Mostly Off-topic: Scientific Data Analysis Reproducibility

2021-11-19 Thread Bert Gunter
A long-ish article on code/data-analysis reproducibility in scientific research for those of you who may be interested. Questions related to this occasionally appear on this list. R is mentioned. Apologies if I have strayed too far.

Re: [R] severe bug in LICORS/kmeanspp

2021-11-19 Thread Ivan Krylov
On Wed, 3 Nov 2021 23:04:06 +0100 frit...@web.de wrote: > Since LICORS has not been updated since 2013, I am not sure if there > is an active maintainer. The named maintainer works for Google since > 2014 and may have abandoned the package. Computing the wrong distances is a serious problem.

Re: [R] Merge column with characters

2021-11-19 Thread ROSLINAZAIRIMAH BINTI ZAKARIA .
Hi Jim and all, All functions worked beautifully. I really appreciate your help. *Thank you and best regards.* On Fri, Nov 19, 2021 at 4:26 AM Jim Lemon wrote: > Hi RosalinaZakaria, > Talk about using a sledgehammer to crack a nut. In your example the > two objects are character vectors.

Re: [R-es] reemplazar valores de una variable por otras

2021-11-19 Thread Proyecto R-UCA
Buenas, ¿qué tal esto? Supongamos que las variables están en un data.frame d que tiene todas esas columnas, entonces d$Direccion_Final <- d$Direccion d$Direccion_Final[is.na(d$Direccion_Final)] <- d$Direccion_General d$Direccion_Final[is.na(d$Direccion_Final)] <- d$Subsecretaria