Skip to content

Can't find files after install package (Windows)

9 messages · bcbob43, Tom Backer Johnsen, Gabor Grothendieck +2 more

#
--I was not registered when I first sent this. I registered and it looks
like I have to resend so sorry if this gets sent twice ...

I am a total newbie at R but experienced with computers. If this is not the
right forum for this question, please let me know one that is. I searched in
the R manuals in the Help section, the Nabble help and Rseek but no luck.

I am trying to install the package gcl on my recently installed R 2.8.1

I searched on cran for the windows version and found a zip file for the
package

In RGui, I ran Packages|Install Package(s) from local zip files
This ran without any error messages

When I look in the 'library' directory of my R installation I see a
subdirectory named 'gcl' with subdirectories
'demo','man','R'

I try to run gcldemo.r in the Demo directory and get the following messages:
Data table:
      V1    V2    V3    V4 V5
1  0.628 0.525 0.634 0.714  1
2  0.317 0.746 0.994 0.661  0
3  0.275 0.669 0.709 0.208  1
4  0.458 0.179 0.198 0.996  1
5  0.926 0.162 0.857 0.309  0
6  0.456 0.082 0.109 0.306  0
7  0.894 0.951 0.896 0.076  1
8  0.415 0.731 0.626 0.463  0
9  0.694 0.656 0.335 0.187  1
10 0.193 0.478 0.615 0.590  0
computing fuzzy rule classifier function cf...
Error in eval.with.vis(expr, envir, enclos) : 
  could not find function "gcl"

I have exited RGui and restarted it but still get same error

Any help appreciated.

Bob

p.s. I was not registered when I first sent this. I registered and it looks
like I have to resend so sorry of this gets sent twice
#
Did you include the statement

library (gcl)

before the call on source () ?

Tom
bcbob43 wrote:

  
    
#
Tom Backer Johnsen wrote:
Yes. Here is the code I am trying to run. It was provided by the authors of
the gcl package


# library(gcl)
#gcldemo <- function() {
  df <-
    structure(list(V1 = c(0.628, 0.317, 0.275, 0.458, 0.926, 0.456, 
       0.894, 0.415, 0.694, 0.193), V2 = c(0.525, 0.746, 0.669, 0.179, 
       0.162, 0.082, 0.951, 0.731, 0.656, 0.478), V3 = c(0.634, 0.994, 
       0.709, 0.198, 0.857, 0.109, 0.896, 0.626, 0.335, 0.615), V4 =
c(0.714, 
       0.661, 0.208, 0.996, 0.309, 0.306, 0.076, 0.463, 0.187, 0.59), 
       V5 = as.integer(c(1, 0, 1, 1, 0, 0, 1, 0, 1, 0))),
              .Names = c("V1", "V2", "V3", "V4", "V5"),
              class = "data.frame",
              row.names = c("1", "2", "3", "4", "5", "6", "7", "8", "9",
"10"))

  cat("Data table:\n")
  print(df)

  cat("computing fuzzy rule classifier function cf...\n")
  cf <- gcl(df,filter=df)
  cat("done.\n")
  cat(cf())
  cat("Classifying data:\n")
  print(cf(df))
#  cat("Dumping source of classifying function cf to
/tmp/example-output.r\n")
#  dump("cf", "/tmp/example-output.r")
#  cat("Removing old definition of classifying function cf...")
#  rm("cf")
#  cat("done.\n")
#  cat("Sourcing /tmp/example-output.r containing definition of function
cf...")
#  source('/tmp/example-output.r')
#  cat("done.\n")
#  cat("Classifying data again:\n")
#  print(cf(df))
  cat("Making class calls according to max membership:\n")
  calls <- apply(cf(df), 1, which.max) - 1
  m <- cbind(calls, df[,5])
  colnames(m) <- c("GCL Call made", "Actual Class")
  errors <- sum(m[,1] != m[,2])
  cat("Calls:\n")
  print(m)
  cat("Made", errors, "errors.\n")
  cat("That is all folks.\n")
#}

#gcldemo()
#
You should only have to do this from within R:

install.packages("glc", dep = TRUE)
library(gcl)
demo("glcdemo", package = "glc")

or in place of the first line you could use the Packages
menu choosing Install packages...
On Wed, Jan 14, 2009 at 3:51 PM, bcbob43 <bcbob43 at aol.com> wrote:
#
Gabor Grothendieck wrote:
Thanks for your help but I have already run "Packages|Install Packages from
local zip" and it seems to run OK. 
There is a directory called glc in C:\R-2.8.1\library\ so the library files
are on my system.

But, I got the following result when I tried to run the last line on Rgui
Error in .find.package(package, lib.loc, verbose = verbose) : 
  there is no package called 'glc'


So, even though the files are there, it looks like the package was not
installed.

I ran search() and the glc package is not listed:
[1] ".GlobalEnv"        "package:stats"     "package:graphics" 
[4] "package:grDevices" "package:utils"     "package:datasets" 
[7] "package:methods"   "Autoloads"         "package:base"     


Bob

here is the code I am trying to run:

  
    
#
Unless you issue the statement

library(gcl)

the gcl package will not be available in the current session.
Using demo does not load the package; only library() does.

                                        - Phil Spector
 					 Statistical Computing Facility
 					 Department of Statistics
 					 UC Berkeley
 					 spector at stat.berkeley.edu
On Wed, 14 Jan 2009, bcbob43 wrote:

            
#
Phil Spector wrote:
I should have mentioned that  I did try that and got the following result:
Error in library(gcl) : 
  'gcl' is not a valid package -- installed < 2.0.0?


I have also tried running the code from RGui|File|Source R code...
This has library(gcl) as the first statement and fails with the same result
Error in library(gcl) : 
  'gcl' is not a valid package -- installed < 2.0.0?
#
bcbob43 wrote:
That's a risk of the strange way you installed it.  If you use 
install.packages (or the menu item that calls it) you'll get a version 
that's built for the current R.  You appear to have downloaded an older one.

R offers ways to do things correctly, but doesn't always stop you from 
not doing so.

Duncan Murdoch