Re: [R] Error: 'format_glimpse' is not an exported object from 'namespace:pillar'

2023-03-21 Thread Ivan Krylov
Something in the code you're trying to run attempted to call
pillar::format_glimpse [1]. The problem is, there's no format_glimpse
in the version of pillar installed on your computer. The format_glimpse
function appeared in pillar 1.5.1 [2]. Can you install a newer version
of pillar?

-- 
Best regards,
Ivan

[1]
https://search.r-project.org/CRAN/refmans/pillar/html/format_glimpse.html

[2]
https://cran.r-project.org/web/packages/pillar/news/news.html

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] Error: 'format_glimpse' is not an exported object from 'namespace:pillar'

2023-03-21 Thread Sorkin, John
I am receiving the following error message. I don't understand what it means, 
and I don't know how to fix it. I am running my code in R studio. I do not know 
if the error comes from R or RStudio. Please see session data below,
Thank you,
John


version data:
platform   x86_64-w64-mingw32  
arch   x86_64  
os mingw32 
system x86_64, mingw32 
status 
major  3   
minor  6.1 
year   2019
month  07  
day05  
svn rev76782   
language   R   
version.string R version 3.6.1 (2019-07-05)
nickname   Action of the Toes  

Rstudio.version()
$mode
[1] "desktop"

$version
[1] ‘2023.3.0.386’

$long_version
[1] "2023.03.0+386"

$release_name
[1] "Cherry Blossom"
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] DOUBT

2023-03-21 Thread avi.e.gross
Your spelling of:

HH size

Is two word.

-Original Message-
From: R-help  On Behalf Of Nandini raj
Sent: Monday, March 20, 2023 1:17 PM
To: r-help@r-project.org
Subject: [R] DOUBT

Respected sir/madam
can you please suggest what is an unexpected symbol in the below code for
running a multinomial logistic regression

model <- multinom(adoption ~ age + education + HH size + landholding +
Farmincome + nonfarmincome + creditaccesibility + LHI, data=newdata)

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] DOUBT

2023-03-21 Thread Bill Dunlap
The HH Size is the problem - it doesn't follow R's rules for a name.  Put
backticks around it: `HH Size`.

-Bill

On Tue, Mar 21, 2023 at 9:47 AM Nandini raj 
wrote:

> Respected sir/madam
> can you please suggest what is an unexpected symbol in the below code for
> running a multinomial logistic regression
>
> model <- multinom(adoption ~ age + education + HH size + landholding +
> Farmincome + nonfarmincome + creditaccesibility + LHI, data=newdata)
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R-es] preguntas múltiples y creación de variables

2023-03-21 Thread juan manuel dias
hola muchas gracias! me hice mucho lío en cómo lo pene´finalmente usé
este código que me srvió
para resolver lo que estaba buscando! gracias!

misdatos<-misdatos %>%
  mutate(excel = case_when(grepl("Excel", r5) ~ 1,
   TRUE ~ 0)) %>%
  mutate(oracle = case_when(grepl("Oracle", r5) ~ 1,
TRUE ~ 0)) %>%
  mutate(sheets = case_when(grepl("Sheets", r5) ~ 1,
TRUE ~ 0)) %>%
  mutate(sql_server_microsoft = case_when(grepl("SQL Server (Microsoft)",
r5) ~ 1,
  TRUE ~ 0)) %>%
  mutate(mongo_db = case_when(grepl("Mongo db", r5) ~ 1,
  TRUE ~ 0)) %>%
  mutate(access = case_when(grepl("Access", r5) ~ 1,
TRUE ~ 0)) %>%
  mutate(mysql = case_when(grepl("MySQL", r5) ~ 1,
   TRUE ~ 0)) %>%
  mutate(postgre_sql = case_when(grepl("Postgre-SQL", r5) ~ 1,
 TRUE ~ 0))


El mar, 21 mar 2023 a las 5:06, Proyecto R-UCA () escribió:

> Buenas,
>
> las imágenes no se ven por lo que no puedo reproducir tu ejemplo, pero tal
> vez lo siguiente te valga:
> > library('stringr')
> > d <- data.frame(respuestas = c('manzana, naranja', 'manzana, melocotón',
> 'naranja, melocotón'))
> > d
>   respuestas
> 1   manzana, naranja
> 2 manzana, melocotón
> 3 naranja, melocotón
> > d$manzana <- sapply(d$respuestas, FUN = str_detect, 'manzana', simplify
> = TRUE)
> > d$naranja <- sapply(d$respuestas, FUN = str_detect, 'naranja', simplify
> = TRUE)
> > d
>   respuestas manzana naranja
> 1   manzana, naranjaTRUETRUE
> 2 manzana, melocotónTRUE   FALSE
> 3 naranja, melocotón   FALSETRUE
>
> Un saludo, Manuel.
>
> El lun, 20-03-2023 a las 17:09 -0300, juan manuel dias escribió:
> > Hola, cómo andan!
> >
> > Tengo el siguiente problema.
> >
> > Tengo una pregunta cuya respuesta es múltiple, pero en en la base están
> > todas las respuestas en una misma variable y cada respuesta está
> > separada por ",".
> >
> > Así está
> >
> > [image: image.png]
> >
> > Hago esto para poder separar en columnas las distintas respuestas:
> >
> >
> >
> >
> >
> > *mult_bas_dat<-mult_bas_dat %>%  separate_rows(bases, sep = ",") %>%
> > mutate(basedatos = str_squish(bases)) %>%  select(basedatos)*
> > ## múltiple a columnas ##
> >
> >
> >
> >
> >
> > *mult_bas_dat_final<-mult_bas_dat %>%  separate_rows(basedatos, sep =
> ",")
> > %>%  mutate(basedatos = str_squish(basedatos), # Para quitar los espacios
> > en blanco indeseados id = 1) %>%  spread(key = basedatos, value =
> > id)*
> >
> > ## na's a 0 ##
> >
> > *mult_bas_dat_final[is.na
> > <
> https://urldefense.com/v3/__http://is.na/__;!!D9dNQwwGXtA!TsC3j72nXLD-S9sKeaG-5pjChVYrV50lLQSZr1EC7xry6qlcSxhH2t-I-jcHTbshUTYCwdUvub1KiPE
> > $ >(mult_bas_dat_final)] <- 0*
> > # limpio los nombres #
> >
> > *mult_bas_dat_final <- mult_bas_dat_final %>%  clean_names()*
> >
> > ## cambio nombres a cada opción de bases ##
> > *mult_bas_dat_final=rename(mult_bas_dat_final,
> >
> c(excel="p5.1",sheets="p5.2",sql_server_microsoft="p5.3",mongo_db="p5.4",access="p5.5",oracle="p5.6",mysql="p5.7",postgre_sql="p5.8"))*
> >
> > Me queda así
> >
> > [image: image.png]
> >
> > El tema es que cuándo quiero correr el siguiente código:
> >
> >
> >
> >
> >
> >
> >
> > *mutate(puntaje_p4_p5=case_when(p4_bases_prop==1 & p5.1==1 ~ 0.4,
> >p4_bases_prop==1 & p5.2==1 ~ 0.5,
> >  (p4_bases_prop==1) & ((p5.1==1) & (p5.3==1) | (p5.4==1) |
> > (p5.6=1) | (p5.7==1) | (p5.8==1)) ~  1,
> >  (p4_bases_prop==1) & ((p5.2==1) & (p5.3==1) | (p5.4==1) | (p5.6=1) |
> > (p5.7==1) | (p5.8==1)) ~  1,
> >  (p4_bases_prop==1) & ((p5.5==1) & (p5.3==1) | (p5.4==1) | (p5.6=1) |
> > (p5.7==1) | (p5.8==1)) ~  1,
> >  (p4_bases_prop==1) & (p5.3==1 | p5.4==1 | p5.6==1 | p5.7==1 | p5.8==1) ~
> > 1, p4_bases*_prop==1  &  p5.5==1 ~ 0.6,
> >
> > Sale el siguiente error porque no encuentra una de las variables que
> están
> > en los condicionales, en este caso p5.3, pero podría ser cualquier otra.
> >
> > [image: image.png]
> >
> > Necesito para todos los casos generar tantas columnas como posibilidades
> de
> > respuesta tengo en esa pregunta, más allá de las respuestas generadas.
> >
> > Las posibles respuestas son: excel, sheets, sql_server_microsoft,
> > mongo_db, access, oracle, mysql, postgre_sql
> >
> > Por ejemplo, este caso que respondió así:
> >
> > *"excel, sheets, oracle, postgre_sql"   *
> >
> > Necesitaría que quede así
> >
> > [image: image.png]
> >
> > Y así con todos los casos, por ejemplo, si solo respondió "*excel",
> > *necesitaría
> > que quede así:
> >
> > [image: image.png]
> >
> > Estoy intentando hacerlo pero sin resultados!
> >
> > Muchas gracias! Juan.
> >
> > [[alternative HTML version deleted]]
> >
> > ___
> > R-help-es mailing list
> > R-help-es@r-project.org
> >
> 

Re: [R] Good Will Legal Question

2023-03-21 Thread John Fox

Dear Timothy,

On 2023-03-21 1:38 p.m., Ebert,Timothy Aaron wrote:

My guess: It I clear from the link that they can use the R logo for commercial purposes. The issue 
is what to do about the "appropriate credit" and "link to the license." How 
would I do that on a hoodie? Would they need a web address or something?


That's a good question, and one that I missed -- the implicit focus is 
on using the logo, e.g., in software.


With the caveat that I'm not speaking for the R Foundation, I think that 
it would be sufficient to provide credit and a link to the license on 
the webpage that sells the hoodie. FWIW, I (and I expect you) have seen 
many t-shirts, etc., with R logos, some from companies, and I even have 
a few. I doubt that anyone will care.


Best,
 John



-Original Message-
From: R-help  On Behalf Of John Fox
Sent: Tuesday, March 21, 2023 1:19 PM
To: Coding Hoodies 
Cc: r-help@r-project.org
Subject: Re: [R] Good Will Legal Question

[External Email]

Dear Arid Sweeting,

R-help is probably not the place to ask this question, although perhaps since 
you're seeking moral advice, people might want to say something. I would 
normally expect to see a query like this addressed to the R website webmasters, 
of which I'm one -- with the caveat that the R Foundation doesn't give legal 
advice.

Just to be sure, you say that you read the rules for use of the R logo, so I assume that you've 
seen 
,
 which seems entirely clear to me. I think that it's safe to say that if the R Foundation wanted 
to limit commercial use of the R logo, it wouldn't have released it under the CC-BY-SA 4.0 
license. I'm not sure what moral issues concern you.

I hope this helps,
   John

John Fox, Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
web: 
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsocialsciences.mcmaster.ca%2Fjfox%2F=05%7C01%7Ctebert%40ufl.edu%7C99f01774c9f5452bd99a08db2a31ec23%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C638150166126816193%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=iLeUGFcyjk3kYNi2v8fV1jgc9M9OVdWYv9nJeI1G7Q4%3D=0

On 2023-03-21 6:18 a.m., Coding Hoodies wrote:

Hi R Team!,

We are opening a new start up soon, codinghoodies.com, we want to make coders 
feel stylish.

Out of goodwill I wanted to ask you formally if I can have permission to use 
the standard R logo on the front of hoodies to sell? I have read your rules but 
wanted to ask as I feel a moral right to email you asking to show support and 
respect for the R project.

If it makes it easier I could build send a picture of the hoodie with the logo 
on to you to see if this is acceptable.

Arid Sweeting




__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat
.ethz.ch%2Fmailman%2Flistinfo%2Fr-help=05%7C01%7Ctebert%40ufl.edu
%7C99f01774c9f5452bd99a08db2a31ec23%7C0d4da0f84a314d76ace60a62331e1b84
%7C0%7C0%7C638150166126972400%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C
ta=p2ffNKEh6intBdGjjtr6jaaaRcdtiBw4iMI1CL6K9Xg%3D=0
PLEASE do read the posting guide
https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.r
-project.org%2Fposting-guide.html=05%7C01%7Ctebert%40ufl.edu%7C99
f01774c9f5452bd99a08db2a31ec23%7C0d4da0f84a314d76ace60a62331e1b84%7C0%
7C0%7C638150166126972400%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiL
CJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=bg
OZVdlLFSw3mbQGmF0OLrMOVUcYonH9wHMN3Y2TqDM%3D=0
and provide commented, minimal, self-contained, reproducible code.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help=05%7C01%7Ctebert%40ufl.edu%7C99f01774c9f5452bd99a08db2a31ec23%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C638150166126972400%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=p2ffNKEh6intBdGjjtr6jaaaRcdtiBw4iMI1CL6K9Xg%3D=0
PLEASE do read the posting guide 

Re: [R] Categorical variable in MA

2023-03-21 Thread Bert Gunter
This list  is about general help for coding in R. I see no indication
of that in your query, which appears to concern statistical
methodology.  In any case, R has a meta-analysis SIG that would seem
to fit your query better:
https://stat.ethz.ch/mailman/listinfo/r-sig-meta-analysis

Cheers,
Bert

On Tue, Mar 21, 2023 at 9:47 AM Pier-Alexandre Tardif
 wrote:
>
> Good morning,
>
> We're undertaking a meta-analysis in which we have an association between a 
> dichotomous outcome (mortality) and a categorical variable with multiple 
> choices (usually between 3 and 4). However, the reference isnt always the 
> same, so we could have study A who present results with A/B/C/D categories 
> with «A» as reference, but study B who presents results with the same A/B/C/D 
> categories but with B as the reference. In the case of a dichotomous variable 
> and an odds ratio, we could ensure a common denominator among the study using 
> 1/OR. Is there any reliable way to do so with a categorical variable (with OR 
> mostly, and possibly relative risks [RR])?
>
> Thanks in advance,
>
> Pier-Alex
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Good Will Legal Question

2023-03-21 Thread Ebert,Timothy Aaron
My guess: It I clear from the link that they can use the R logo for commercial 
purposes. The issue is what to do about the "appropriate credit" and "link to 
the license." How would I do that on a hoodie? Would they need a web address or 
something?

-Original Message-
From: R-help  On Behalf Of John Fox
Sent: Tuesday, March 21, 2023 1:19 PM
To: Coding Hoodies 
Cc: r-help@r-project.org
Subject: Re: [R] Good Will Legal Question

[External Email]

Dear Arid Sweeting,

R-help is probably not the place to ask this question, although perhaps since 
you're seeking moral advice, people might want to say something. I would 
normally expect to see a query like this addressed to the R website webmasters, 
of which I'm one -- with the caveat that the R Foundation doesn't give legal 
advice.

Just to be sure, you say that you read the rules for use of the R logo, so I 
assume that you've seen 
,
 which seems entirely clear to me. I think that it's safe to say that if the R 
Foundation wanted to limit commercial use of the R logo, it wouldn't have 
released it under the CC-BY-SA 4.0 license. I'm not sure what moral issues 
concern you.

I hope this helps,
  John

John Fox, Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
web: 
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fsocialsciences.mcmaster.ca%2Fjfox%2F=05%7C01%7Ctebert%40ufl.edu%7C99f01774c9f5452bd99a08db2a31ec23%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C638150166126816193%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=iLeUGFcyjk3kYNi2v8fV1jgc9M9OVdWYv9nJeI1G7Q4%3D=0

On 2023-03-21 6:18 a.m., Coding Hoodies wrote:
> Hi R Team!,
>
> We are opening a new start up soon, codinghoodies.com, we want to make coders 
> feel stylish.
>
> Out of goodwill I wanted to ask you formally if I can have permission to use 
> the standard R logo on the front of hoodies to sell? I have read your rules 
> but wanted to ask as I feel a moral right to email you asking to show support 
> and respect for the R project.
>
> If it makes it easier I could build send a picture of the hoodie with the 
> logo on to you to see if this is acceptable.
>
> Arid Sweeting
>
>
>
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat
> .ethz.ch%2Fmailman%2Flistinfo%2Fr-help=05%7C01%7Ctebert%40ufl.edu
> %7C99f01774c9f5452bd99a08db2a31ec23%7C0d4da0f84a314d76ace60a62331e1b84
> %7C0%7C0%7C638150166126972400%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAw
> MDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C
> ta=p2ffNKEh6intBdGjjtr6jaaaRcdtiBw4iMI1CL6K9Xg%3D=0
> PLEASE do read the posting guide 
> https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.r
> -project.org%2Fposting-guide.html=05%7C01%7Ctebert%40ufl.edu%7C99
> f01774c9f5452bd99a08db2a31ec23%7C0d4da0f84a314d76ace60a62331e1b84%7C0%
> 7C0%7C638150166126972400%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiL
> CJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=bg
> OZVdlLFSw3mbQGmF0OLrMOVUcYonH9wHMN3Y2TqDM%3D=0
> and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://nam10.safelinks.protection.outlook.com/?url=https%3A%2F%2Fstat.ethz.ch%2Fmailman%2Flistinfo%2Fr-help=05%7C01%7Ctebert%40ufl.edu%7C99f01774c9f5452bd99a08db2a31ec23%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C638150166126972400%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=p2ffNKEh6intBdGjjtr6jaaaRcdtiBw4iMI1CL6K9Xg%3D=0
PLEASE do read the posting guide 
https://nam10.safelinks.protection.outlook.com/?url=http%3A%2F%2Fwww.r-project.org%2Fposting-guide.html=05%7C01%7Ctebert%40ufl.edu%7C99f01774c9f5452bd99a08db2a31ec23%7C0d4da0f84a314d76ace60a62331e1b84%7C0%7C0%7C638150166126972400%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C%7C=bgOZVdlLFSw3mbQGmF0OLrMOVUcYonH9wHMN3Y2TqDM%3D=0
and provide commented, minimal, self-contained, reproducible code.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] DOUBT

2023-03-21 Thread John Fox

Dear Nandiniraj,

Please cc r-help in your emails so that others can see what happened 
with your problem.


You don't provide enough information to know what exactly is the source 
of your problem  -- you're more likely to get effective help if you 
provide a minimal reproducible example of the problem -- but it's a good 
guess that the variable (HHsize or perhaps some other variable) isn't in 
the newdata data frame.


Best,
 John

--
John Fox, Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
web: https://www.john-fox.ca/

On 2023-03-21 1:24 p.m., Nandini raj wrote:

I removed space even though it is showing error. I.e Variable not found

Nandiniraj

On Tue, Mar 21, 2023, 10:36 PM John Fox > wrote:


Dear Nandini raj,

You have a space in the variable name "HH size".

I hope this helps,
   John

John Fox, Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
web: https://socialsciences.mcmaster.ca/jfox/


On 2023-03-20 1:16 p.m., Nandini raj wrote:
 > Respected sir/madam
 > can you please suggest what is an unexpected symbol in the below
code for
 > running a multinomial logistic regression
 >
 > model <- multinom(adoption ~ age + education + HH size +
landholding +
 > Farmincome + nonfarmincome + creditaccesibility + LHI, data=newdata)
 >
 >       [[alternative HTML version deleted]]
 >
 > __
 > R-help@r-project.org  mailing list
-- To UNSUBSCRIBE and more, see
 > 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.



__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Good Will Legal Question

2023-03-21 Thread John Fox

Dear Arid Sweeting,

R-help is probably not the place to ask this question, although perhaps 
since you're seeking moral advice, people might want to say something. I 
would normally expect to see a query like this addressed to the R 
website webmasters, of which I'm one -- with the caveat that the R 
Foundation doesn't give legal advice.


Just to be sure, you say that you read the rules for use of the R logo, 
so I assume that you've seen , which 
seems entirely clear to me. I think that it's safe to say that if the R 
Foundation wanted to limit commercial use of the R logo, it wouldn't 
have released it under the CC-BY-SA 4.0 license. I'm not sure what moral 
issues concern you.


I hope this helps,
 John

John Fox, Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
web: https://socialsciences.mcmaster.ca/jfox/

On 2023-03-21 6:18 a.m., Coding Hoodies wrote:

Hi R Team!,
  
We are opening a new start up soon, codinghoodies.com, we want to make coders feel stylish.
  
Out of goodwill I wanted to ask you formally if I can have permission to use the standard R logo on the front of hoodies to sell? I have read your rules but wanted to ask as I feel a moral right to email you asking to show support and respect for the R project.
  
If it makes it easier I could build send a picture of the hoodie with the logo on to you to see if this is acceptable.
  
Arid Sweeting
  
  
  


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] DOUBT

2023-03-21 Thread John Fox

Dear Nandini raj,

You have a space in the variable name "HH size".

I hope this helps,
 John

John Fox, Professor Emeritus
McMaster University
Hamilton, Ontario, Canada
web: https://socialsciences.mcmaster.ca/jfox/

On 2023-03-20 1:16 p.m., Nandini raj wrote:

Respected sir/madam
can you please suggest what is an unexpected symbol in the below code for
running a multinomial logistic regression

model <- multinom(adoption ~ age + education + HH size + landholding +
Farmincome + nonfarmincome + creditaccesibility + LHI, data=newdata)

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] [External Email] DOUBT

2023-03-21 Thread Christopher Ryan via R-help
Usually R provides a somewhat informative error message about where,
exactly, it was surprised by something. Here, I suspect (not certain,
without seeing the error message) that R was objecting to the space between
HH and size. R cannot tell whether that represents two different variables
where you forgot the + sign, or whether it is one variable, HHsize, where
you added a space.

--Chris Ryan

On Tue, Mar 21, 2023 at 12:47 PM Nandini raj 
wrote:

> Respected sir/madam
> can you please suggest what is an unexpected symbol in the below code for
> running a multinomial logistic regression
>
> model <- multinom(adoption ~ age + education + HH size + landholding +
> Farmincome + nonfarmincome + creditaccesibility + LHI, data=newdata)
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.
>

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] Categorical variable in MA

2023-03-21 Thread Pier-Alexandre Tardif
Good morning,

We're undertaking a meta-analysis in which we have an association between a 
dichotomous outcome (mortality) and a categorical variable with multiple 
choices (usually between 3 and 4). However, the reference isnt always the same, 
so we could have study A who present results with A/B/C/D categories with �A� 
as reference, but study B who presents results with the same A/B/C/D categories 
but with B as the reference. In the case of a dichotomous variable and an odds 
ratio, we could ensure a common denominator among the study using 1/OR. Is 
there any reliable way to do so with a categorical variable (with OR mostly, 
and possibly relative risks [RR])?

Thanks in advance,

Pier-Alex

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] DOUBT

2023-03-21 Thread Nandini raj
Respected sir/madam
can you please suggest what is an unexpected symbol in the below code for
running a multinomial logistic regression

model <- multinom(adoption ~ age + education + HH size + landholding +
Farmincome + nonfarmincome + creditaccesibility + LHI, data=newdata)

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] Good Will Legal Question

2023-03-21 Thread Coding Hoodies
Hi R Team!,
 
We are opening a new start up soon, codinghoodies.com, we want to make coders 
feel stylish.
 
Out of goodwill I wanted to ask you formally if I can have permission to use 
the standard R logo on the front of hoodies to sell? I have read your rules but 
wanted to ask as I feel a moral right to email you asking to show support and 
respect for the R project.
 
If it makes it easier I could build send a picture of the hoodie with the logo 
on to you to see if this is acceptable.
 
Arid Sweeting
 
 
 

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Rprofile.site and automatic installation of missing packages

2023-03-21 Thread Duncan Murdoch

On 21/03/2023 9:58 a.m., PIKAL Petr wrote:

Hallo Duncan

Tested but does not work so something other must be wrong.

R version 4.2.2.

installed.packages()[,"Package"]

   base   boot  classcluster  codetools 
  compiler   datasetsforeign   graphics  grDevices  
 grid KernSmooth
 "base" "boot""class"  "cluster""codetools" "compiler" "datasets"  
"foreign" "graphics""grDevices" "grid"   "KernSmooth"
lattice   MASS Matrixmethods   mgcv 
  nlme   nnet   parallel  rpartspatial
splines  stats
  "lattice" "MASS"   "Matrix"  "methods" "mgcv" "nlme" "nnet" 
"parallel""rpart"  "spatial"  "splines""stats"
 stats4   survival  tcltk  tools   translations 
 utils
   "stats4" "survival""tcltk""tools" "translations"
"utils"

My Rprofile.site
# Things you might want to change
options(papersize="a4")
options(help_type="html")

library(utils)
library(MASS)

#**
test <-(scan("pack.txt", character(), quote = ""))
x<- utils::installed.packages()
utils::install.packages(test[!test %in% x], repos="https://cloud.r-project.org;)

##**

Options are set and working.
MASS should be loaded but is not


search()

[1] ".GlobalEnv""package:stats" "package:graphics"  "package:grDevices" "package:utils" 
"package:datasets"  "package:methods"   "Autoloads" "package:base"




Any suggestion where to look?


I'd add code to print the values of x and test to confirm that things 
are proceeding as you expect.  I don't know if print() or cat() will 
work there; you might need to use message().


For attaching packages, you should see ?Startup again:  this is done via 
options() or an environment variable, not library() calls in the profile 
file.


Duncan Murdoch



Best regards
Petr

-Original Message-
From: Duncan Murdoch 
Sent: Tuesday, March 21, 2023 1:55 PM
To: PIKAL Petr ; r-help 
Subject: Re: [R] Rprofile.site and automatic installation of missing packages

?Startup says:  "Note that when the site and user profile files are sourced only the 
base package is loaded, so objects in other packages need to be referred to by e.g. 
utils::dump.frames or after explicitly loading the package concerned."

So you need utils::installed.packages and utils::install.packages .

Duncan Murdoch

On 21/03/2023 8:04 a.m., PIKAL Petr wrote:

Dear all.



I am trying to install missing (not installed) packages during startup
of R through code in Rprofile.site but I miserably failed and I am not
sure what I am doing wrong.



R is installed to C:Program files but it is not writable for the
users, therefore I cannot change Rprofile.site located in root etc
directory. I however can put Rprofile.site in users home directory
(Documents) and use it for R startup setting (partly).

However I want for less experienced users to put a code here to check
installed packages, check if some specified set of packages is
installed and install them, but it is not working.



The code in Rprofile.site is:



#**

test <- scan("pack.txt", character(), quote = "")

inst <- installed.packages()

install.packages(test[!test %in% inst],
repos="https://cloud.r-project.org;)

#**



An example of pack.txt is e.g.

ggplot2

zoo



but the code is not executed and packages are not installed. If I use
this code after R starts, everything is OK and packages are installed
to




Sys.getenv("R_LIBS_USER")


[1] "C:\\Users\\PikalP\\AppData\\Local/R/win-library/4.2"





The same applies if I put e.g. library(MASS) in the Rprofile.site, the
package is not loaded but after R is live, library(MASS) loads a package.



So my question is What is the best way to check after fresh R
installation if some predefined set of packages is installed and if
not, perform an installation without user intervention in Windows environment?



S pozdravem | Best Regards

Petr


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních 
partnerů PRECHEZA a.s. jsou zveřejněny na: 
https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about 
processing and protection of business partner’s personal data are available on 
website: https://www.precheza.cz/en/personal-data-protection-principles/
Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a 
podléhají tomuto právně závaznému prohláąení o vyloučení odpovědnosti: 

Re: [R] Rprofile.site and automatic installation of missing packages

2023-03-21 Thread PIKAL Petr
Hallo Duncan

Tested but does not work so something other must be wrong.

R version 4.2.2.
> installed.packages()[,"Package"]
  base   boot  classcluster  codetools  
 compiler   datasetsforeign   graphics  grDevices   
grid KernSmooth
"base" "boot""class"  "cluster""codetools" 
"compiler" "datasets"  "foreign" "graphics""grDevices" 
"grid"   "KernSmooth"
   lattice   MASS Matrixmethods   mgcv  
 nlme   nnet   parallel  rpartspatial
splines  stats
 "lattice" "MASS"   "Matrix"  "methods" "mgcv"  
   "nlme" "nnet" "parallel""rpart"  "spatial"  
"splines""stats"
stats4   survival  tcltk  tools   translations  
utils
  "stats4" "survival""tcltk""tools" "translations"  
  "utils"

My Rprofile.site
# Things you might want to change
options(papersize="a4")
options(help_type="html")

library(utils)
library(MASS)

#**
test <-(scan("pack.txt", character(), quote = ""))
x<- utils::installed.packages()
utils::install.packages(test[!test %in% x], repos="https://cloud.r-project.org;)

##**

Options are set and working.
MASS should be loaded but is not

> search()
[1] ".GlobalEnv""package:stats" "package:graphics"  
"package:grDevices" "package:utils" "package:datasets"  "package:methods"   
"Autoloads" "package:base"
>

Any suggestion where to look?

Best regards
Petr

-Original Message-
From: Duncan Murdoch 
Sent: Tuesday, March 21, 2023 1:55 PM
To: PIKAL Petr ; r-help 
Subject: Re: [R] Rprofile.site and automatic installation of missing packages

?Startup says:  "Note that when the site and user profile files are sourced 
only the base package is loaded, so objects in other packages need to be 
referred to by e.g. utils::dump.frames or after explicitly loading the package 
concerned."

So you need utils::installed.packages and utils::install.packages .

Duncan Murdoch

On 21/03/2023 8:04 a.m., PIKAL Petr wrote:
> Dear all.
>
>
>
> I am trying to install missing (not installed) packages during startup
> of R through code in Rprofile.site but I miserably failed and I am not
> sure what I am doing wrong.
>
>
>
> R is installed to C:Program files but it is not writable for the
> users, therefore I cannot change Rprofile.site located in root etc
> directory. I however can put Rprofile.site in users home directory
> (Documents) and use it for R startup setting (partly).
>
> However I want for less experienced users to put a code here to check
> installed packages, check if some specified set of packages is
> installed and install them, but it is not working.
>
>
>
> The code in Rprofile.site is:
>
>
>
> #**
>
> test <- scan("pack.txt", character(), quote = "")
>
> inst <- installed.packages()
>
> install.packages(test[!test %in% inst],
> repos="https://cloud.r-project.org;)
>
> #**
>
>
>
> An example of pack.txt is e.g.
>
> ggplot2
>
> zoo
>
>
>
> but the code is not executed and packages are not installed. If I use
> this code after R starts, everything is OK and packages are installed
> to
>
>
>
>> Sys.getenv("R_LIBS_USER")
>
> [1] "C:\\Users\\PikalP\\AppData\\Local/R/win-library/4.2"
>
>>
>
> The same applies if I put e.g. library(MASS) in the Rprofile.site, the
> package is not loaded but after R is live, library(MASS) loads a package.
>
>
>
> So my question is What is the best way to check after fresh R
> installation if some predefined set of packages is installed and if
> not, perform an installation without user intervention in Windows environment?
>
>
>
> S pozdravem | Best Regards
>
> Petr
>
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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.

Osobní údaje: Informace o zpracování a ochraně osobních údajů obchodních 
partnerů PRECHEZA a.s. jsou zveřejněny na: 
https://www.precheza.cz/zasady-ochrany-osobnich-udaju/ | Information about 
processing and protection of business partner’s personal data are available on 
website: https://www.precheza.cz/en/personal-data-protection-principles/
Důvěrnost: Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a 
podléhají tomuto právně závaznému prohláąení o vyloučení odpovědnosti: 
https://www.precheza.cz/01-dovetek/ | This email and any documents attached to 
it may be confidential and are subject to the legally binding disclaimer: 
https://www.precheza.cz/en/01-disclaimer/

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see

Re: [R] Rprofile.site and automatic installation of missing packages

2023-03-21 Thread PIKAL Petr
Thanks Duncan

I expected some silly mistake on my side.

Just for completeness, I finally tested .Rprofile file with the code and it 
worked. So now the question is whether to use your suggestion or .Rprofile 
file way. I tend to use Rprofile.site way as it enables experienced users to 
modify their .Rprofile to get customised way how to start R.

Best regards
Petr

> -Original Message-
> From: Duncan Murdoch 
> Sent: Tuesday, March 21, 2023 1:55 PM
> To: PIKAL Petr ; r-help 
> Subject: Re: [R] Rprofile.site and automatic installation of missing 
> packages
>
> ?Startup says:  "Note that when the site and user profile files are sourced 
> only
> the base package is loaded, so objects in other packages need to be referred 
> to
> by e.g. utils::dump.frames or after explicitly loading the package 
> concerned."
>
> So you need utils::installed.packages and utils::install.packages .
>
> Duncan Murdoch
>
> On 21/03/2023 8:04 a.m., PIKAL Petr wrote:
> > Dear all.
> >
> >
> >
> > I am trying to install missing (not installed) packages during startup
> > of R through code in Rprofile.site but I miserably failed and I am not
> > sure what I am doing wrong.
> >
> >
> >
> > R is installed to C:Program files but it is not writable for the
> > users, therefore I cannot change Rprofile.site located in root etc
> > directory. I however can put Rprofile.site in users home directory
> > (Documents) and use it for R startup setting (partly).
> >
> > However I want for less experienced users to put a code here to check
> > installed packages, check if some specified set of packages is
> > installed and install them, but it is not working.
> >
> >
> >
> > The code in Rprofile.site is:
> >
> >
> >
> > #**
> >
> > test <- scan("pack.txt", character(), quote = "")
> >
> > inst <- installed.packages()
> >
> > install.packages(test[!test %in% inst],
> > repos="https://cloud.r-project.org;)
> >
> > #**
> >
> >
> >
> > An example of pack.txt is e.g.
> >
> > ggplot2
> >
> > zoo
> >
> >
> >
> > but the code is not executed and packages are not installed. If I use
> > this code after R starts, everything is OK and packages are installed
> > to
> >
> >
> >
> >> Sys.getenv("R_LIBS_USER")
> >
> > [1] "C:\\Users\\PikalP\\AppData\\Local/R/win-library/4.2"
> >
> >>
> >
> > The same applies if I put e.g. library(MASS) in the Rprofile.site, the
> > package is not loaded but after R is live, library(MASS) loads a package.
> >
> >
> >
> > So my question is What is the best way to check after fresh R
> > installation if some predefined set of packages is installed and if
> > not, perform an installation without user intervention in Windows
> environment?
> >
> >
> >
> > S pozdravem | Best Regards
> >
> > Petr
> >
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > 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.

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R] Rprofile.site and automatic installation of missing packages

2023-03-21 Thread Duncan Murdoch
?Startup says:  "Note that when the site and user profile files are 
sourced only the base package is loaded, so objects in other packages 
need to be referred to by e.g. utils::dump.frames or after explicitly 
loading the package concerned."


So you need utils::installed.packages and utils::install.packages .

Duncan Murdoch

On 21/03/2023 8:04 a.m., PIKAL Petr wrote:

Dear all.

  


I am trying to install missing (not installed) packages during startup of R
through code in Rprofile.site but I miserably failed and I am not sure what
I am doing wrong.

  


R is installed to C:Program files but it is not writable for the users,
therefore I cannot change Rprofile.site located in root etc directory. I
however can put Rprofile.site in users home directory (Documents) and use it
for R startup setting (partly).

However I want for less experienced users to put a code here to check
installed packages, check if some specified set of packages is installed and
install them, but it is not working.

  


The code in Rprofile.site is:

  


#**

test <- scan("pack.txt", character(), quote = "")

inst <- installed.packages()

install.packages(test[!test %in% inst], repos="https://cloud.r-project.org;)

#**

  


An example of pack.txt is e.g.

ggplot2

zoo

  


but the code is not executed and packages are not installed. If I use this
code after R starts, everything is OK and packages are installed to

  


Sys.getenv("R_LIBS_USER")


[1] "C:\\Users\\PikalP\\AppData\\Local/R/win-library/4.2"





The same applies if I put e.g. library(MASS) in the Rprofile.site, the
package is not loaded but after R is live, library(MASS) loads a package.

  


So my question is What is the best way to check after fresh R installation
if some predefined set of packages is installed and if not, perform an
installation without user intervention in Windows environment?

  


S pozdravem | Best Regards

Petr


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] Rprofile.site and automatic installation of missing packages

2023-03-21 Thread PIKAL Petr
Dear all.

 

I am trying to install missing (not installed) packages during startup of R
through code in Rprofile.site but I miserably failed and I am not sure what
I am doing wrong.

 

R is installed to C:Program files but it is not writable for the users,
therefore I cannot change Rprofile.site located in root etc directory. I
however can put Rprofile.site in users home directory (Documents) and use it
for R startup setting (partly). 

However I want for less experienced users to put a code here to check
installed packages, check if some specified set of packages is installed and
install them, but it is not working.

 

The code in Rprofile.site is:

 

#**

test <- scan("pack.txt", character(), quote = "")

inst <- installed.packages()

install.packages(test[!test %in% inst], repos="https://cloud.r-project.org;)

#**

 

An example of pack.txt is e.g.

ggplot2

zoo

 

but the code is not executed and packages are not installed. If I use this
code after R starts, everything is OK and packages are installed to

 

> Sys.getenv("R_LIBS_USER")

[1] "C:\\Users\\PikalP\\AppData\\Local/R/win-library/4.2"

> 

The same applies if I put e.g. library(MASS) in the Rprofile.site, the
package is not loaded but after R is live, library(MASS) loads a package.

 

So my question is What is the best way to check after fresh R installation
if some predefined set of packages is installed and if not, perform an
installation without user intervention in Windows environment?

 

S pozdravem | Best Regards

Petr

ggplot2
zoo
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


[R] [Rd] R 4.3.0 scheduled for April 21

2023-03-21 Thread peter dalgaard
Full schedule is available on developer.r-project.org (pending update from SVN).

-- 
Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Office: A 4.23
Email: pd@cbs.dk  Priv: pda...@gmail.com

___
r-annou...@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-announce

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.


Re: [R-es] preguntas múltiples y creación de variables

2023-03-21 Thread Proyecto R-UCA
Buenas,

las imágenes no se ven por lo que no puedo reproducir tu ejemplo, pero tal vez 
lo siguiente te valga:
> library('stringr')
> d <- data.frame(respuestas = c('manzana, naranja', 'manzana, melocotón', 
> 'naranja, melocotón'))
> d
  respuestas
1   manzana, naranja
2 manzana, melocotón
3 naranja, melocotón
> d$manzana <- sapply(d$respuestas, FUN = str_detect, 'manzana', simplify = 
> TRUE)
> d$naranja <- sapply(d$respuestas, FUN = str_detect, 'naranja', simplify = 
> TRUE)
> d
  respuestas manzana naranja
1   manzana, naranjaTRUETRUE
2 manzana, melocotónTRUE   FALSE
3 naranja, melocotón   FALSETRUE

Un saludo, Manuel.

El lun, 20-03-2023 a las 17:09 -0300, juan manuel dias escribió:
> Hola, cómo andan!
> 
> Tengo el siguiente problema.
> 
> Tengo una pregunta cuya respuesta es múltiple, pero en en la base están
> todas las respuestas en una misma variable y cada respuesta está
> separada por ",".
> 
> Así está
> 
> [image: image.png]
> 
> Hago esto para poder separar en columnas las distintas respuestas:
> 
> 
> 
> 
> 
> *mult_bas_dat<-mult_bas_dat %>%  separate_rows(bases, sep = ",") %>%
> mutate(basedatos = str_squish(bases)) %>%  select(basedatos)*
> ## múltiple a columnas ##
> 
> 
> 
> 
> 
> *mult_bas_dat_final<-mult_bas_dat %>%  separate_rows(basedatos, sep = ",")
> %>%  mutate(basedatos = str_squish(basedatos), # Para quitar los espacios
> en blanco indeseados id = 1) %>%  spread(key = basedatos, value =
> id)*
> 
> ## na's a 0 ##
> 
> *mult_bas_dat_final[is.na
>  $ >(mult_bas_dat_final)] <- 0*
> # limpio los nombres #
> 
> *mult_bas_dat_final <- mult_bas_dat_final %>%  clean_names()*
> 
> ## cambio nombres a cada opción de bases ##
> *mult_bas_dat_final=rename(mult_bas_dat_final,
> c(excel="p5.1",sheets="p5.2",sql_server_microsoft="p5.3",mongo_db="p5.4",access="p5.5",oracle="p5.6",mysql="p5.7",postgre_sql="p5.8"))*
> 
> Me queda así
> 
> [image: image.png]
> 
> El tema es que cuándo quiero correr el siguiente código:
> 
> 
> 
> 
> 
> 
> 
> *mutate(puntaje_p4_p5=case_when(p4_bases_prop==1 & p5.1==1 ~ 0.4,
>    p4_bases_prop==1 & p5.2==1 ~ 0.5,
>  (p4_bases_prop==1) & ((p5.1==1) & (p5.3==1) | (p5.4==1) |
> (p5.6=1) | (p5.7==1) | (p5.8==1)) ~  1,
>  (p4_bases_prop==1) & ((p5.2==1) & (p5.3==1) | (p5.4==1) | (p5.6=1) |
> (p5.7==1) | (p5.8==1)) ~  1,
>  (p4_bases_prop==1) & ((p5.5==1) & (p5.3==1) | (p5.4==1) | (p5.6=1) |
> (p5.7==1) | (p5.8==1)) ~  1,
>  (p4_bases_prop==1) & (p5.3==1 | p5.4==1 | p5.6==1 | p5.7==1 | p5.8==1) ~
> 1, p4_bases*_prop==1  &  p5.5==1 ~ 0.6,
> 
> Sale el siguiente error porque no encuentra una de las variables que están
> en los condicionales, en este caso p5.3, pero podría ser cualquier otra.
> 
> [image: image.png]
> 
> Necesito para todos los casos generar tantas columnas como posibilidades de
> respuesta tengo en esa pregunta, más allá de las respuestas generadas.
> 
> Las posibles respuestas son: excel, sheets, sql_server_microsoft,
> mongo_db, access, oracle, mysql, postgre_sql
> 
> Por ejemplo, este caso que respondió así:
> 
> *"excel, sheets, oracle, postgre_sql"   *
> 
> Necesitaría que quede así
> 
> [image: image.png]
> 
> Y así con todos los casos, por ejemplo, si solo respondió "*excel",
> *necesitaría
> que quede así:
> 
> [image: image.png]
> 
> Estoy intentando hacerlo pero sin resultados!
> 
> Muchas gracias! Juan.
> 
> [[alternative HTML version deleted]]
> 
> ___
> R-help-es mailing list
> R-help-es@r-project.org
> https://urldefense.com/v3/__https://stat.ethz.ch/mailman/listinfo/r-help-es__;!!D9dNQwwGXtA!TsC3j72nXLD-S9sKeaG-5pjChVYrV50lLQSZr1EC7xry6qlcSxhH2t-I-jcHTbshUTYCwdUvoDzCjq4$
>  

___
R-help-es mailing list
R-help-es@r-project.org
https://stat.ethz.ch/mailman/listinfo/r-help-es


[R] Optimizing with constraints using alabama

2023-03-21 Thread Depratti, Roland A. (Student) via R-help
Hi,

I am testing code that is working successfully using constrOptim. I am 
replacing constrOptim with other solvers to compare benefits and performance.

My belief was that, like constrOptim,  auglag in the alabama package would 
eliminate beta vectors that failed the constraints prior to calling the 
objective
function. These betas are not only not in the solution space but also cause 
chaos for my objective function.

I can see via debugging that hin is working correctly, but I am finding 
that these beta vectors are being passed to the objective function. I am not 
sure if this is
due to my ineptness or if it is doing so as planned. The auglag 
documentation talks about applying penalties, so I assume it has examined the 
vector coming out
of hin.  I would be pleased to have input from those more knowledgeable 
than me. If this is by design is there a flag variable available to be examined 
by my
objective function. Currently, I am calling hin again within my objective 
function - certainly not an optimum solution.

Thanks,

Roland DePratti
Graduate Student
Central Connecticut State University Data Science Program

Here is my inequality constraint logic:


X (constraint matrix) =

1  2  3  4 partyDem
1   -1  0  0  00
2   -1  0  0  0   -1
30  0  0 -10
40  0  0 -1   -1
50 -1  0  00
60 -1  0  0   -1
70  0 -1  00
80  0 -1  0   -1
90  0  0 -10
10   0  0  0 -1   -1
11  -1  0  0  00
12  -1  0  0  0   -1
13   0 -1  0  00
14   0 -1  0  0   -1
15   0  0 -1  00
16   0  0 -1  0   -1
17  -1  1  0  00
18  -1  1  0  00
19   0 -1  1  00
20   0 -1  1  00
21   0  0 -1  10
22   0  0 -1  10


hin <- function(par,X,Xa1,XaJ,Xaj1,Xaj2) {
  out <- X %*% par
  return(out)
}



[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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.