Dear Sir/Madam, I am encountering one of those alien computer momements one finds every so often in life. See the sequence below:> fish3.fis <-read.csv("emperor2.csv", check.names = TRUE, strip.white TRUE) > colnames(fish3.fis)[1] "Month" "Year" "FishingArea" "SumOfTotalCatch" "CPUE" [6] "rCPUE" "PA" "Latitude" "Longitude" "Depth" [11] "SST"> hist(CPUE)Error in hist(CPUE) : Object "CPUE" not found So, the system knows CPUE exists, but will not do a hist or a gam model using the term - but for some strange reason it will do a plot. I have created a completely different data file and that same problem is happening. The imported files are exactly the same as I was using quite happily last month. As you will see from the above I've tried adding check.names and strip.white in the reading in process to avoid the unseen effect of blank spaces. Any ideas what I might do next? Have you come across this issue at all? Thanks Lubna Al-Kharusi PhD student (GIS) Department of Geography University of Leicester University Road Leicester LE1 7RH mobile # 07886990332
On Thu, 21 Sep 2006, Al-Kharusi, L. wrote:> Dear Sir/Madam, > > > I am encountering one of those alien computer momements one finds every > so often in life. See the sequence below: > > > fish3.fis <-read.csv("emperor2.csv", check.names = TRUE, strip.white > TRUE) > > colnames(fish3.fis) > [1] "Month" "Year" "FishingArea" > "SumOfTotalCatch" "CPUE" > [6] "rCPUE" "PA" "Latitude" "Longitude" > "Depth" > [11] "SST" > > hist(CPUE) > Error in hist(CPUE) : Object "CPUE" not foundhist(fish3.fis$CPUE) CPUE is inside the data.frame object and so cannot be "seen" in the workspace. Reviewing: http://cran.r-project.org/doc/manuals/R-intro.html#Data-frames may help.> > So, the system knows CPUE exists, but will not do a hist or a gam model > using the term - but for some strange reason it will do a plot. I have > created a completely different data file and that same problem is > happening. The imported files are exactly the same as I was using quite > happily last month. > > As you will see from the above I've tried adding check.names and > strip.white in the reading in process to avoid the unseen effect of > blank spaces. > > Any ideas what I might do next? Have you come across this issue at all? > > Thanks > > > Lubna Al-Kharusi > PhD student (GIS) > Department of Geography > University of Leicester > University Road > Leicester > LE1 7RH > mobile # 07886990332 > > ______________________________________________ > R-help at stat.math.ethz.ch 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. >-- Roger Bivand Economic Geography Section, Department of Economics, Norwegian School of Economics and Business Administration, Helleveien 30, N-5045 Bergen, Norway. voice: +47 55 95 93 55; fax +47 55 95 95 43 e-mail: Roger.Bivand at nhh.no
On Thu, 2006-09-21 at 13:07 +0100, Al-Kharusi, L. wrote:> Dear Sir/Madam, > > > I am encountering one of those alien computer momements one finds every > so often in life. See the sequence below: > > > fish3.fis <-read.csv("emperor2.csv", check.names = TRUE, strip.white > TRUE) > > colnames(fish3.fis) > [1] "Month" "Year" "FishingArea" > "SumOfTotalCatch" "CPUE" > [6] "rCPUE" "PA" "Latitude" "Longitude" > "Depth" > [11] "SST" > > hist(CPUE) > Error in hist(CPUE) : Object "CPUE" not found > > So, the system knows CPUE exists, but will not do a hist or a gam model > using the term - but for some strange reason it will do a plot. I have > created a completely different data file and that same problem is > happening. The imported files are exactly the same as I was using quite > happily last month. > > As you will see from the above I've tried adding check.names and > strip.white in the reading in process to avoid the unseen effect of > blank spaces. > > Any ideas what I might do next? Have you come across this issue at all? > > ThanksCPUE is not found, as it is a column within the R data frame object fish3.fis. There are (at least) 5 ways to do a histogram on CPUE: 1. attach() the data frame, which puts it in the search path and you can then use the column name alone: attach(fish3.fis) hist(CPUE) detach(fish3.fis) 2. Identify the column using the '$' function: hist(fish3.fis$CPUE) 3. Use with() to evaluate the hist() call within the environment of the data frame: with(fish3.fis, hist(CPUE)) 4. Use the "[" function: hist(fish3.fis[, "CPUE"]) 5. Use the "[[" function: hist(fish3.fis[["CPUE"]]) This is covered in "An Introduction to R". HTH, Marc Schwartz