Error: Invalid number of ‘breaks’ in R

You have some problems in your syntax. Note that you have converted gender to a factor variable with values of “1” and “2” instead of “M” and “F”. If you run your code line-by-line, I’ll guess that it should work up to your last set of histograms. Change those lines to: Also, notice that I changed && to &. Run d$negotiated … Read more

Categories R Tags

Warning in GLM analysis

You most likely have a problem with complete or quasi-complete separation: for some combination of your predictors you observed only successes of failures. That is a quite common phenomenon for logistic regression in small samples or if you have large parameter spaces. There are several implementations that add a small penalty to the likelihood in … Read more

Categories r Tags

Conditional mean statement

If you want to exclude the non-smokers, you have a few options. The easiest is probably this: With a data frame, the first variable is the row and the next is the column. So, you can subset using dataframe[1,2] to get the first row, second column. You can also use logic in the row selection. By using bwght$cigs>0 as … Read more

Categories r Tags

‘Incomplete final line’ warning when trying to read a .csv file into R

The message indicates that the last line of the file doesn’t end with an End Of Line (EOL) character (linefeed (\n) or carriage return+linefeed (\r\n)). The original intention of this message was to warn you that the file may be incomplete; most datafiles have an EOL character as the very last character in the file. … Read more

Categories r Tags

Error in xj[i] : invalid subscript type ‘list’

The issue is in subset=train. According to the ?glm. the subset should be a vector as oppose to a subset of original dataset: subset an optional vector specifying a subset of observations to be used in the fitting process. Hence, you may need to change the code to: glm.fit=glm(Status~Length+Right+Bottom+Top+Diagonal,data=train,family=binomial) or glm.fit=glm(Status~Length+Right+Bottom+Top+Diagonal,data=bank,family=binomial,subset=1:100)

Categories R Tags