The R Project SVN R

Rev

Rev 61160 | Rev 61650 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 61160 Rev 61433
Line 14... Line 14...
14
\description{
14
\description{
15
  These functions extract information from source references.
15
  These functions extract information from source references.
16
}
16
}
17
\usage{
17
\usage{
18
getSrcFilename(x, full.names = FALSE, unique = TRUE)
18
getSrcFilename(x, full.names = FALSE, unique = TRUE)
19
getSrcDirectory(x, unique = TRUE) 
19
getSrcDirectory(x, unique = TRUE)
20
getSrcref(x)
20
getSrcref(x)
21
getSrcLocation(x, which = c("line", "column", "byte", "parse"),
21
getSrcLocation(x, which = c("line", "column", "byte", "parse"),
22
               first = TRUE)
22
               first = TRUE)
23
}
23
}
24
\arguments{
24
\arguments{
Line 50... Line 50...
50
      differ in case of multibyte characters.}
50
      differ in case of multibyte characters.}
51
    \item{parse}{As for \code{"line"}, but this ignores \code{#line} directives.}
51
    \item{parse}{As for \code{"line"}, but this ignores \code{#line} directives.}
52
  }
52
  }
53
}
53
}
54
\value{
54
\value{
55
  \code{getSrcFilename} and \code{getSrcDirectory} return character vectors 
55
  \code{getSrcFilename} and \code{getSrcDirectory} return character vectors
56
  holding the filename/directory.
56
  holding the filename/directory.
57
 
57
 
58
  \code{getSrcref} returns a list of \code{"srcref"} objects or
58
  \code{getSrcref} returns a list of \code{"srcref"} objects or
59
  \code{NULL} if there are none.
59
  \code{NULL} if there are none.
60
 
60
 
Line 65... Line 65...
65
\code{\link{srcref}}, \code{\link{getParseData}}
65
\code{\link{srcref}}, \code{\link{getParseData}}
66
}
66
}
67
\examples{
67
\examples{
68
fn <- function(x) {
68
fn <- function(x) {
69
  x + 1 # A comment, kept as part of the source
69
  x + 1 # A comment, kept as part of the source
70
}			    
70
}			
71
 
71
 
72
# Show the temporary file directory
72
# Show the temporary file directory
73
# where the example was saved
73
# where the example was saved
74
 
74
 
75
getSrcDirectory(fn)  
75
getSrcDirectory(fn)
76
getSrcLocation(fn, "line")
76
getSrcLocation(fn, "line")
77
}
77
}
78
\keyword{ utilities }
78
\keyword{ utilities }