Topic: Utilities
Topic Description:
Basic R utilities used in many packages and functions, such as date and string manipulations, statistical distributions, geometry of lines and distances. The R package date is required for the two data functions.
File: utilities/utilities.r
| View File Source | Download File | No help file available |
Function: detachfiles
Function Description: detachfiles
detachs from the searchpath files matching a submitted vector of names.Function Arguments:
| Argument | Default Value |
|---|---|
| filename |
Function Source:
detachfiles=function(filename)
{
error=character()
error=paste(filename,': nothing to detach')
for(i in 1:length(filename))
{
searchlist=search()
cut=grep(filename[i],searchlist)
if(length(cut)==1) { detach(pos=cut); error[i]=paste('detached',filename[i]) }
if(length(cut)>1) error[i]=paste(filename[i],': Too many matches')
}
for(i in 1:length(error)) cat(error[i],'\n')
for(i in 1:10) gc()
}
{
error=character()
error=paste(filename,': nothing to detach')
for(i in 1:length(filename))
{
searchlist=search()
cut=grep(filename[i],searchlist)
if(length(cut)==1) { detach(pos=cut); error[i]=paste('detached',filename[i]) }
if(length(cut)>1) error[i]=paste(filename[i],': Too many matches')
}
for(i in 1:length(error)) cat(error[i],'\n')
for(i in 1:10) gc()
}