Can't find files after install package (Windows)
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:
Gabor Grothendieck wrote:
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...
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
demo("glcdemo", package = "glc")
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:
search()
[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:
# 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()
-- View this message in context: http://www.nabble.com/Can%27t-find-files-after-install-package-%28Windows%29-tp21463602p21465775.html Sent from the R help mailing list archive at Nabble.com.
______________________________________________ R-help at 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.