MSSanton / glmms_workflow

This space will be used to maintain the script and functions file associated with the paper "A versatile workflow for linear modelling in R" published in Frontiers of Ecology and Evolution.
7 stars 3 forks source link

Issue with assigning variables #1

Closed Natalie-J-M closed 1 year ago

Natalie-J-M commented 1 year ago

Hi there, I'm new to GithHub so I hope this is the correct place the post an issue/question.

I've trying to use the workflow template but am having trouble assigning the variables. I have tried both "variablename" and df$variablename, but it returns this error when I try to use them in a command: Error in [.data.frame(data, variables) : undefined columns selected

What am I doing wrong here?

See example below.

Thanks!

================================

* 3.1 ONE RESPONSE variable ----

================================

var_resp <- NA # assign default NA if missing var_resp <- df$calling.index # Replace with the name of the response variable.

=============================================================================

* 3.2 Fixed predictors: quantitative and categorical predictor variables ----

=============================================================================

FACTOR PREDICTOR variable(s)

var_fac <- NA # assign default NA if missing. var_fac <- c(df$site.id, df$frog.season) # var_fac <- c("fac_1", "fac_2", ... )

Template: replace entries with the name(s) of your factor predictor(s).

Assure all these are factors with at least two levels.

================================

* 3.1 ONE RESPONSE variable ----

================================

var_resp <- NA # assign default NA if missing var_resp <- "calling.index" # Replace with the name of the response variable.

=============================================================================

* 3.2 Fixed predictors: quantitative and categorical predictor variables ----

=============================================================================

FACTOR PREDICTOR variable(s)

var_fac <- NA # assign default NA if missing. var_fac <- c("site.id", "frog.season") # var_fac <- c("fac_1", "fac_2", ... )

Template: replace entries with the name(s) of your factor predictor(s).

Assure all these are factors with at least two levels.

MSSanton commented 1 year ago

Hi Natalie,

You should assign variable names as follows:

var_resp <- “calling.index” …etc

Please make sure that all your variables are part of the dataframe, and that fixed categorical predictors are of type “factor”.

Hope this helps. Matteo

From: Natalie-J-M @.> Date: Tuesday, 12 September 2023 at 06:08 To: MSSanton/glmms_workflow @.> Cc: Subscribed @.***> Subject: [MSSanton/glmms_workflow] Issue with assigning variables (Issue #1)

Hi there, I'm new to GithHub so I hope this is the correct place the post an issue/question.

I've trying to use the workflow template but am having trouble assigning the variables. I have tried both "variablename", which didn't work and df$variable but then returned this error when I try to use it in a command: Error in [.data.frame(data, variables) : undefined columns selected

What am I doing wrong here?

See example below.

Thanks!

================================

================================

var_resp <- NA # assign default NA if missing var_resp <- df$calling.index # Replace with the name of the response variable.

=============================================================================

=============================================================================

FACTOR PREDICTOR variable(s)

var_fac <- NA # assign default NA if missing. var_fac <- c(df$site.id, df$frog.season) # var_fac <- c("fac_1", "fac_2", ... )

Template: replace entries with the name(s) of your factor predictor(s). Assure all these are factors with at least two levels.

================================

================================

var_resp <- NA # assign default NA if missing var_resp <- "calling.index" # Replace with the name of the response variable.

=============================================================================

=============================================================================

FACTOR PREDICTOR variable(s)

var_fac <- NA # assign default NA if missing. var_fac <- c("site.id", "frog.season") # var_fac <- c("fac_1", "fac_2", ... )

Template: replace entries with the name(s) of your factor predictor(s). Assure all these are factors with at least two levels.

— Reply to this email directly, view it on GitHubhttps://github.com/MSSanton/glmms_workflow/issues/1, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A53Z7CDRFVK6DC2G4ZYHA3DXZ7U3XANCNFSM6AAAAAA4UJBSA4. You are receiving this because you are subscribed to this thread.Message ID: @.***>

Natalie-J-M commented 1 year ago

Hi Matteo,

Thank you for getting back to me so quickly.

As previously mentioned, I did try that but it didn't work:

I can confirm my variables are part of the dataframe and are correctly specified, I can use for any other function/command outside of the workflow without a problem.

Kind regards,

Natalie McLeod BSc(Hons) | s5149399 School of Environment and Science Griffith University


From: MSSanton @.> Sent: Tuesday, 12 September 2023 6:55 PM To: MSSanton/glmms_workflow @.> Cc: Natalie McLeod @.>; Author @.> Subject: Re: [MSSanton/glmms_workflow] Issue with assigning variables (Issue #1)

Hi Natalie,

You should assign variable names as follows:

var_resp <- “calling.index” …etc

Please make sure that all your variables are part of the dataframe, and that fixed categorical predictors are of type “factor”.

Hope this helps. Matteo

Dr Matteo Santon

UKRI/Marie Curie Research Fellow University of Bristol Ecology of Vision Group

Address: Life Sciences Building 24 Tyndall Avenue, BS8 1TQ

Web: https://matteosanton.comhttps://protect-au.mimecast.com/s/_y8OC71ZNnhm40DxzC8vMK8?domain=matteosanton.comhttps://matteosanton.com/<https://protect-au.mimecast.com/s/_y8OC71ZNnhm40DxzC8vMK8?domain=matteosanton.com/> | http://www.ecologyofvision.comhttps://protect-au.mimecast.com/s/JV59C81ZPohjDAoZXH1ScYQ?domain=ecologyofvision.comhttp://www.ecologyofvision.com/<https://protect-au.mimecast.com/s/JV59C81ZPohjDAoZXH1ScYQ?domain=ecologyofvision.com/> Twitter: @MatteoSanton https://twitter.com/MatteoSanton<https://protect-au.mimecast.com/s/WR07C91ZRphmL6GgzC365GZ?domain=twitter.com> Instagram: Matteo Santon | Scientisthttps://www.instagram.com/save_tonic/<https://protect-au.mimecast.com/s/cJXbC0YZv2S2q91DkiW1d1-?domain=instagram.com/>

From: Natalie-J-M @.> Date: Tuesday, 12 September 2023 at 06:08 To: MSSanton/glmms_workflow @.> Cc: Subscribed @.***> Subject: [MSSanton/glmms_workflow] Issue with assigning variables (Issue #1)

Hi there, I'm new to GithHub so I hope this is the correct place the post an issue/question.

I've trying to use the workflow template but am having trouble assigning the variables. I have tried both "variablename", which didn't work and df$variable but then returned this error when I try to use it in a command: Error in [.data.frame(data, variables) : undefined columns selected

What am I doing wrong here?

See example below.

Thanks!

================================

================================

var_resp <- NA # assign default NA if missing var_resp <- df$calling.index # Replace with the name of the response variable.

=============================================================================

=============================================================================

FACTOR PREDICTOR variable(s)

var_fac <- NA # assign default NA if missing. var_fac <- c(df$site.id, df$frog.season) # var_fac <- c("fac_1", "fac_2", ... )

Template: replace entries with the name(s) of your factor predictor(s). Assure all these are factors with at least two levels.

================================

================================

var_resp <- NA # assign default NA if missing var_resp <- "calling.index" # Replace with the name of the response variable.

=============================================================================

=============================================================================

FACTOR PREDICTOR variable(s)

var_fac <- NA # assign default NA if missing. var_fac <- c("site.id", "frog.season") # var_fac <- c("fac_1", "fac_2", ... )

Template: replace entries with the name(s) of your factor predictor(s). Assure all these are factors with at least two levels.

— Reply to this email directly, view it on GitHubhttps://github.com/MSSanton/glmms_workflow/issues/1<https://protect-au.mimecast.com/s/HtLqCgZo1xHlOjMxqtEl0Wc?domain=github.com>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A53Z7CDRFVK6DC2G4ZYHA3DXZ7U3XANCNFSM6AAAAAA4UJBSA4<https://protect-au.mimecast.com/s/wSWUCjZr7vHjKwWMYHn2Ex1?domain=github.com>. You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHubhttps://protect-au.mimecast.com/s/5Sl3Ck8v9wHn8Rx6ktkpjOK?domain=github.com, or unsubscribehttps://protect-au.mimecast.com/s/mv_PClxwjvHo03Q51Ugjlnh?domain=github.com. You are receiving this because you authored the thread.Message ID: @.***>

MSSanton commented 1 year ago

Hi Natalie,

Please send me an email where you show me the bit of the script that gives you the error, so I can try to reproduce it. The routine works fine on my laptop.

Thanks, Matteo

From: Natalie-J-M @.> Date: Tuesday, 12 September 2023 at 11:46 To: MSSanton/glmms_workflow @.> Cc: Matteo Santon @.>, Comment @.> Subject: Re: [MSSanton/glmms_workflow] Issue with assigning variables (Issue #1) Hi Matteo,

Thank you for getting back to me so quickly.

As previously mentioned, I did try that but it didn't work:

I can confirm my variables are part of the dataframe and are correctly specified, I can use for any other function/command outside of the workflow without a problem.

Kind regards,

Natalie McLeod BSc(Hons) | s5149399 School of Environment and Science Griffith University


From: MSSanton @.> Sent: Tuesday, 12 September 2023 6:55 PM To: MSSanton/glmms_workflow @.> Cc: Natalie McLeod @.>; Author @.> Subject: Re: [MSSanton/glmms_workflow] Issue with assigning variables (Issue #1)

Hi Natalie,

You should assign variable names as follows:

var_resp <- “calling.index” …etc

Please make sure that all your variables are part of the dataframe, and that fixed categorical predictors are of type “factor”.

Hope this helps. Matteo

Dr Matteo Santon

UKRI/Marie Curie Research Fellow University of Bristol Ecology of Vision Group

Address: Life Sciences Building 24 Tyndall Avenue, BS8 1TQ

Web: https://matteosanton.comhttps://protect-au.mimecast.com/s/_y8OC71ZNnhm40DxzC8vMK8?domain=matteosanton.comhttps://matteosanton.com/<https://protect-au.mimecast.com/s/_y8OC71ZNnhm40DxzC8vMK8?domain=matteosanton.com/> | http://www.ecologyofvision.comhttps://protect-au.mimecast.com/s/JV59C81ZPohjDAoZXH1ScYQ?domain=ecologyofvision.comhttp://www.ecologyofvision.com/<https://protect-au.mimecast.com/s/JV59C81ZPohjDAoZXH1ScYQ?domain=ecologyofvision.com/> Twitter: @MatteoSanton https://twitter.com/MatteoSanton<https://protect-au.mimecast.com/s/WR07C91ZRphmL6GgzC365GZ?domain=twitter.com> Instagram: Matteo Santon | Scientisthttps://www.instagram.com/save_tonic/<https://protect-au.mimecast.com/s/cJXbC0YZv2S2q91DkiW1d1-?domain=instagram.com/>

From: Natalie-J-M @.> Date: Tuesday, 12 September 2023 at 06:08 To: MSSanton/glmms_workflow @.> Cc: Subscribed @.***> Subject: [MSSanton/glmms_workflow] Issue with assigning variables (Issue #1)

Hi there, I'm new to GithHub so I hope this is the correct place the post an issue/question.

I've trying to use the workflow template but am having trouble assigning the variables. I have tried both "variablename", which didn't work and df$variable but then returned this error when I try to use it in a command: Error in [.data.frame(data, variables) : undefined columns selected

What am I doing wrong here?

See example below.

Thanks!

================================

================================

var_resp <- NA # assign default NA if missing var_resp <- df$calling.index # Replace with the name of the response variable.

=============================================================================

=============================================================================

FACTOR PREDICTOR variable(s)

var_fac <- NA # assign default NA if missing. var_fac <- c(df$site.id, df$frog.season) # var_fac <- c("fac_1", "fac_2", ... )

Template: replace entries with the name(s) of your factor predictor(s). Assure all these are factors with at least two levels.

================================

================================

var_resp <- NA # assign default NA if missing var_resp <- "calling.index" # Replace with the name of the response variable.

=============================================================================

=============================================================================

FACTOR PREDICTOR variable(s)

var_fac <- NA # assign default NA if missing. var_fac <- c("site.id", "frog.season") # var_fac <- c("fac_1", "fac_2", ... )

Template: replace entries with the name(s) of your factor predictor(s). Assure all these are factors with at least two levels.

— Reply to this email directly, view it on GitHubhttps://github.com/MSSanton/glmms_workflow/issues/1<https://protect-au.mimecast.com/s/HtLqCgZo1xHlOjMxqtEl0Wc?domain=github.com>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A53Z7CDRFVK6DC2G4ZYHA3DXZ7U3XANCNFSM6AAAAAA4UJBSA4<https://protect-au.mimecast.com/s/wSWUCjZr7vHjKwWMYHn2Ex1?domain=github.com>. You are receiving this because you are subscribed to this thread.Message ID: @.***>

— Reply to this email directly, view it on GitHubhttps://protect-au.mimecast.com/s/5Sl3Ck8v9wHn8Rx6ktkpjOK?domain=github.com, or unsubscribehttps://protect-au.mimecast.com/s/mv_PClxwjvHo03Q51Ugjlnh?domain=github.com. You are receiving this because you authored the thread.Message ID: @.***>

— Reply to this email directly, view it on GitHubhttps://github.com/MSSanton/glmms_workflow/issues/1#issuecomment-1715487459, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A53Z7CB7UFLARVUORXBVD3DX2A4Q7ANCNFSM6AAAAAA4UJBSA4. You are receiving this because you commented.Message ID: @.***>