Why glm make an input error on this function
I'm trying to run a glm in R but it results me with an error I can't figure it out how to solve:
> GLM.3 <- glm(log(Total_Pass + 1) ~ Total_Pass + Total_Buzz + dm_plant + dm_cdeagua + dm_cultivo + dm_humed + dm_bnativ + dm_snaspe + Cultivos + BosqNat + Plantac + Pastizal + Matorral + Humedal + C_agua + Sup_imper + Tie_desnud + hielo + alt_media + pend_media + Temp_media + PP_media + CA _100 + PLAND _100 + PD _100 + ED _100 + AREA_MN _100 + ENN_MN_100 + CA _210 + PLAND _210 + PD _210 + ED _210 + AREA_MN _210 + ENN_MN_210 + CA _600 + PLAND _600 + PD _600 + ED _600 + AREA_MN _600 + ENN_MN_600 + SHDI + SIDI + MSIDI + SHEI + SIEI + MSIEI, family=gaussian(identity), data=bats_araucania_500)
Error: unexpected input in "Total_Pass + Total_Buzz + dm_plant + dm_cdeagua + dm_cultivo + dm_humed + dm_bnativ + dm_snaspe + Cultivos + BosqNat + Plantac + Pastizal + Matorral + Humedal + C_agua + Sup_imper + Tie_desnud"
Any help is useful
r glm
add a comment |
I'm trying to run a glm in R but it results me with an error I can't figure it out how to solve:
> GLM.3 <- glm(log(Total_Pass + 1) ~ Total_Pass + Total_Buzz + dm_plant + dm_cdeagua + dm_cultivo + dm_humed + dm_bnativ + dm_snaspe + Cultivos + BosqNat + Plantac + Pastizal + Matorral + Humedal + C_agua + Sup_imper + Tie_desnud + hielo + alt_media + pend_media + Temp_media + PP_media + CA _100 + PLAND _100 + PD _100 + ED _100 + AREA_MN _100 + ENN_MN_100 + CA _210 + PLAND _210 + PD _210 + ED _210 + AREA_MN _210 + ENN_MN_210 + CA _600 + PLAND _600 + PD _600 + ED _600 + AREA_MN _600 + ENN_MN_600 + SHDI + SIDI + MSIDI + SHEI + SIEI + MSIEI, family=gaussian(identity), data=bats_araucania_500)
Error: unexpected input in "Total_Pass + Total_Buzz + dm_plant + dm_cdeagua + dm_cultivo + dm_humed + dm_bnativ + dm_snaspe + Cultivos + BosqNat + Plantac + Pastizal + Matorral + Humedal + C_agua + Sup_imper + Tie_desnud"
Any help is useful
r glm
1
Welcome to StackOverflow. See how to make a great reproducible example.
– Anonymous coward
Nov 21 '18 at 16:20
3
Do you have spaces in your column names" When you have+ CA _100 +
that's not valid because of the space between the CA and _. R can't parse such a value. You'd have to surround those values in backticks. What exactly doesnames(bats_araucania_500)
return?
– MrFlick
Nov 21 '18 at 16:23
as general points: that looks like a lot of covariates to be regressing against. you'll probably want to remove quite a few of them. also regressinglog(Y+1)
againstY
looks very unusual, are you sure you want to be doing that?!
– Sam Mason
Nov 21 '18 at 22:19
add a comment |
I'm trying to run a glm in R but it results me with an error I can't figure it out how to solve:
> GLM.3 <- glm(log(Total_Pass + 1) ~ Total_Pass + Total_Buzz + dm_plant + dm_cdeagua + dm_cultivo + dm_humed + dm_bnativ + dm_snaspe + Cultivos + BosqNat + Plantac + Pastizal + Matorral + Humedal + C_agua + Sup_imper + Tie_desnud + hielo + alt_media + pend_media + Temp_media + PP_media + CA _100 + PLAND _100 + PD _100 + ED _100 + AREA_MN _100 + ENN_MN_100 + CA _210 + PLAND _210 + PD _210 + ED _210 + AREA_MN _210 + ENN_MN_210 + CA _600 + PLAND _600 + PD _600 + ED _600 + AREA_MN _600 + ENN_MN_600 + SHDI + SIDI + MSIDI + SHEI + SIEI + MSIEI, family=gaussian(identity), data=bats_araucania_500)
Error: unexpected input in "Total_Pass + Total_Buzz + dm_plant + dm_cdeagua + dm_cultivo + dm_humed + dm_bnativ + dm_snaspe + Cultivos + BosqNat + Plantac + Pastizal + Matorral + Humedal + C_agua + Sup_imper + Tie_desnud"
Any help is useful
r glm
I'm trying to run a glm in R but it results me with an error I can't figure it out how to solve:
> GLM.3 <- glm(log(Total_Pass + 1) ~ Total_Pass + Total_Buzz + dm_plant + dm_cdeagua + dm_cultivo + dm_humed + dm_bnativ + dm_snaspe + Cultivos + BosqNat + Plantac + Pastizal + Matorral + Humedal + C_agua + Sup_imper + Tie_desnud + hielo + alt_media + pend_media + Temp_media + PP_media + CA _100 + PLAND _100 + PD _100 + ED _100 + AREA_MN _100 + ENN_MN_100 + CA _210 + PLAND _210 + PD _210 + ED _210 + AREA_MN _210 + ENN_MN_210 + CA _600 + PLAND _600 + PD _600 + ED _600 + AREA_MN _600 + ENN_MN_600 + SHDI + SIDI + MSIDI + SHEI + SIEI + MSIEI, family=gaussian(identity), data=bats_araucania_500)
Error: unexpected input in "Total_Pass + Total_Buzz + dm_plant + dm_cdeagua + dm_cultivo + dm_humed + dm_bnativ + dm_snaspe + Cultivos + BosqNat + Plantac + Pastizal + Matorral + Humedal + C_agua + Sup_imper + Tie_desnud"
Any help is useful
r glm
r glm
edited Nov 21 '18 at 23:48
K.Dᴀᴠɪs
7,320112440
7,320112440
asked Nov 21 '18 at 16:12
Gastón Sepúlveda TruanGastón Sepúlveda Truan
52
52
1
Welcome to StackOverflow. See how to make a great reproducible example.
– Anonymous coward
Nov 21 '18 at 16:20
3
Do you have spaces in your column names" When you have+ CA _100 +
that's not valid because of the space between the CA and _. R can't parse such a value. You'd have to surround those values in backticks. What exactly doesnames(bats_araucania_500)
return?
– MrFlick
Nov 21 '18 at 16:23
as general points: that looks like a lot of covariates to be regressing against. you'll probably want to remove quite a few of them. also regressinglog(Y+1)
againstY
looks very unusual, are you sure you want to be doing that?!
– Sam Mason
Nov 21 '18 at 22:19
add a comment |
1
Welcome to StackOverflow. See how to make a great reproducible example.
– Anonymous coward
Nov 21 '18 at 16:20
3
Do you have spaces in your column names" When you have+ CA _100 +
that's not valid because of the space between the CA and _. R can't parse such a value. You'd have to surround those values in backticks. What exactly doesnames(bats_araucania_500)
return?
– MrFlick
Nov 21 '18 at 16:23
as general points: that looks like a lot of covariates to be regressing against. you'll probably want to remove quite a few of them. also regressinglog(Y+1)
againstY
looks very unusual, are you sure you want to be doing that?!
– Sam Mason
Nov 21 '18 at 22:19
1
1
Welcome to StackOverflow. See how to make a great reproducible example.
– Anonymous coward
Nov 21 '18 at 16:20
Welcome to StackOverflow. See how to make a great reproducible example.
– Anonymous coward
Nov 21 '18 at 16:20
3
3
Do you have spaces in your column names" When you have
+ CA _100 +
that's not valid because of the space between the CA and _. R can't parse such a value. You'd have to surround those values in backticks. What exactly does names(bats_araucania_500)
return?– MrFlick
Nov 21 '18 at 16:23
Do you have spaces in your column names" When you have
+ CA _100 +
that's not valid because of the space between the CA and _. R can't parse such a value. You'd have to surround those values in backticks. What exactly does names(bats_araucania_500)
return?– MrFlick
Nov 21 '18 at 16:23
as general points: that looks like a lot of covariates to be regressing against. you'll probably want to remove quite a few of them. also regressing
log(Y+1)
against Y
looks very unusual, are you sure you want to be doing that?!– Sam Mason
Nov 21 '18 at 22:19
as general points: that looks like a lot of covariates to be regressing against. you'll probably want to remove quite a few of them. also regressing
log(Y+1)
against Y
looks very unusual, are you sure you want to be doing that?!– Sam Mason
Nov 21 '18 at 22:19
add a comment |
1 Answer
1
active
oldest
votes
R can not handle column names with space: CA _210. Try to wrap these columns between two ` (backticks) or rename your columns without spaces.
FYI : If you are using all columns as predictors, you can write your code this way: glm(log(y+1) ~ . , nextargs...)
Yes, it was the space between characters, i redid all and run it
– Gastón Sepúlveda Truan
Nov 21 '18 at 17:07
Good, you can now close the question with accepting answer
– emsinko
Nov 21 '18 at 17:45
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416208%2fwhy-glm-make-an-input-error-on-this-function%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
R can not handle column names with space: CA _210. Try to wrap these columns between two ` (backticks) or rename your columns without spaces.
FYI : If you are using all columns as predictors, you can write your code this way: glm(log(y+1) ~ . , nextargs...)
Yes, it was the space between characters, i redid all and run it
– Gastón Sepúlveda Truan
Nov 21 '18 at 17:07
Good, you can now close the question with accepting answer
– emsinko
Nov 21 '18 at 17:45
add a comment |
R can not handle column names with space: CA _210. Try to wrap these columns between two ` (backticks) or rename your columns without spaces.
FYI : If you are using all columns as predictors, you can write your code this way: glm(log(y+1) ~ . , nextargs...)
Yes, it was the space between characters, i redid all and run it
– Gastón Sepúlveda Truan
Nov 21 '18 at 17:07
Good, you can now close the question with accepting answer
– emsinko
Nov 21 '18 at 17:45
add a comment |
R can not handle column names with space: CA _210. Try to wrap these columns between two ` (backticks) or rename your columns without spaces.
FYI : If you are using all columns as predictors, you can write your code this way: glm(log(y+1) ~ . , nextargs...)
R can not handle column names with space: CA _210. Try to wrap these columns between two ` (backticks) or rename your columns without spaces.
FYI : If you are using all columns as predictors, you can write your code this way: glm(log(y+1) ~ . , nextargs...)
answered Nov 21 '18 at 16:36
emsinkoemsinko
18616
18616
Yes, it was the space between characters, i redid all and run it
– Gastón Sepúlveda Truan
Nov 21 '18 at 17:07
Good, you can now close the question with accepting answer
– emsinko
Nov 21 '18 at 17:45
add a comment |
Yes, it was the space between characters, i redid all and run it
– Gastón Sepúlveda Truan
Nov 21 '18 at 17:07
Good, you can now close the question with accepting answer
– emsinko
Nov 21 '18 at 17:45
Yes, it was the space between characters, i redid all and run it
– Gastón Sepúlveda Truan
Nov 21 '18 at 17:07
Yes, it was the space between characters, i redid all and run it
– Gastón Sepúlveda Truan
Nov 21 '18 at 17:07
Good, you can now close the question with accepting answer
– emsinko
Nov 21 '18 at 17:45
Good, you can now close the question with accepting answer
– emsinko
Nov 21 '18 at 17:45
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53416208%2fwhy-glm-make-an-input-error-on-this-function%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
Welcome to StackOverflow. See how to make a great reproducible example.
– Anonymous coward
Nov 21 '18 at 16:20
3
Do you have spaces in your column names" When you have
+ CA _100 +
that's not valid because of the space between the CA and _. R can't parse such a value. You'd have to surround those values in backticks. What exactly doesnames(bats_araucania_500)
return?– MrFlick
Nov 21 '18 at 16:23
as general points: that looks like a lot of covariates to be regressing against. you'll probably want to remove quite a few of them. also regressing
log(Y+1)
againstY
looks very unusual, are you sure you want to be doing that?!– Sam Mason
Nov 21 '18 at 22:19