See inline: On Mon, Jan 16, 2012 at 6:29 PM, ruggeddon24 <smithdon2...@gmail.com> wrote: > This is my first time running GAMs in R. > My csv file has these column headings: > > "X" "Y" "Sound" "Atlantic" "Blacktip" "Bonnet" > "Bull" "Finetooth" "Lemon" "Scalloped" "Sandbar" "Spinner" > "Abundance" "Diversity" "Depth" "Distance" "Width" "System" > "Channel" "Profile" "Bathy" "Slope" "Salinity" > X is longitude and Y is Latitude.
Your csv file? You read it into R with read.table() or read.csv(), right? > I typed in the code below and received the reply "Error in eval(expr, envir, > enclos) : object 'Atlantic' not found". > >> library(mgcv) > This is mgcv 1.7-6. For overview type 'help("mgcv-package")'. >> help("mgcv-package") > starting httpd help server ... done >> gam(Atlantic ~ s(depth, bs="sos", k=4) + s(distance, bs="sos", k=4)) > Error in eval(expr, envir, enclos) : object 'Atlantic' not found You need the data=mydataframe argument to gam(), with whatever the name of your data frame is. Otherwise R has no idea where to look for Atlantic, so it just looks for an object with that name, which there isn't. > I do not have a clue how to fix this problem. Do I have too many variables > or do I need to remove my x and y from the file? This data is being used to > assess the spatial distribution of shark abundance in relation to > environmental variables. I really cannot remove the x and y anyway. Help > would be greatly appreciated. Sarah -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ R-help@r-project.org mailing list 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.