Displaying 20 results from an estimated 30000 matches similar to: "getting informative error messages"
2007 Feb 13
1
question on docs for delayedAssign and substitute
The help files for delayedAssign and substitute both say that
substitute() can be used to see the expression associated with a
promise. However, I can't see how to do that. When I try the example
in help file for delayedAssign I don't see substitute() extracting the
promise, e.g.:
> msg <- "old"
> delayedAssign("x", msg)
> msg <-
2009 Jun 26
1
should Sys.glob() cope with a UNC windows path beginning with backslashes?
I find that Sys.glob() doesn't like UNC paths where the initial slashes are backslashes. The help page for Sys.glob() doesn't specificly mention UNC paths, but does say: "File paths in Windows are interpreted with separator \ or /." Is the failure to treat a path beginning with a double-backslash as a UNC network drive path the intended behavior?
E.g., on a Windows system
2007 Feb 12
1
bug in partial matching of attribute names
There looks to be a bug in do_attr() (src/main/attrib.c): incorrect
partial matches of attribute names can be returned when there are an odd
number of partial matches.
E.g.:
> x <- c(a=1,b=2)
> attr(x, "abcdef") <- 99
> attr(x, "ab")
[1] 99
> attr(x, "abc") <- 100
> attr(x, "ab") # correctly returns NULL because of ambig
2007 Apr 13
1
how to control which version of a package library() installs?
library() seems to remember the location of a package when I give it a
lib.loc, and then use that version thereafter, even if I don't supply
lib.loc again. Is there any way I can load different versions of a
package in one R session? -- I don't seem to able to simply detach the
package and then load a different version from a different library location.
$ R
[...startup info...]
>
2008 Mar 23
2
problem with 'install.packages'
Hi, All:
Is there a way to identify whether any users are using a
particular package in a shared network R installation?
I ask, because we have such a multiple-user installation and when
I tried to install a package using Rgui that was in use by Rterm on a
single-user installation, 'install.packages' deleted the existing
package but failed to install the new version;
2009 Sep 07
2
using an array of strings with strsplit, issue when including a space in split criteria
Dear all,
I'm having a problem understanding why a split does not occur with in
the 2nd use of the function strsplit below:
# text strings
> txt <- c("sales to 23 August 2008 published 29 August",
+ "sales to 6 September 2008 published?11 September")
# first use
> strsplit(txt, 'published', fixed=TRUE)
[[1]]
[1] "sales to 23 August 2008 "
2007 Nov 01
1
daylight saving / time zone issues with as.POSIXlt/as.POSIXct (PR#10392)
Running under Windows XP 64 bit, as.POSIXlt()/as.POSIXct() seem
to think that US time zones (EST5EDT, MST7MDT) switched from daylight
savings back to standard time on Oct 28, 2007, whereas the switch
is actually on Sun Nov 04, 2007.
Examples:
> Sys.timezone()
[1] "Mountain Daylight Time"
> as.POSIXct("2007-10-30 12:38:47")
[1] "2007-10-30 12:38:47 Mountain
2008 Nov 04
2
How to suppress errors from htmlTreeParse() function in XML package?
Dear R-help,
The following code downloads an html document into variable 'doc' and
then stores an internal representation into variable 'html.tree'. Even
if the html code is malformed, this still works which is fantastic.
However, as in the example below, i do get some ouput from R in the
console which i would like to suppress somehow, so i can keep my
window a bit cleaner.
I
2008 Oct 06
3
Extracting text from html code using the RCurl package.
Dear R-help,
I want to download the text from a web page, however what i end up
with is the html code. Is there some option that i am missing in the
RCurl package? Or is there another way to achieve this? This is the
code i am using:
> library(RCurl)
> my.url <- 'https://stat.ethz.ch/mailman/listinfo/r-help'
> html.file <- getURI(my.url, ssl.verifyhost = FALSE,
2008 Oct 13
1
Running R at a specific time - alternative to Sys.sleep() ?
Dear R-Help,
Is it possible to set R up to run a particular script at specific
times of the day? trivial example: If the time is now 8:59:55am and I
wish to run a function at 9am, I do the following:
my.function <- function(x) {
p1 <- proc.time()
Sys.sleep(x)
print('Hello R-Help!')
proc.time() - p1
}
my.function (5)
[1] "Hello R-Help!"
user system
2009 Feb 22
1
Filtering a data frame using a string for colum header
Hi all,
I was just radomly playing with R and got the following error when
trying to filter a data frame using a string:
> Angel <- c(7,8,6,9,10)
> Buffy <- c(8,9,4,9,10)
> Firefly <- c(9,9,10,10,10)
> DrHorrible <- c(10,9,9,10,10)
> my.df <- data.frame(Angel, Buffy, Firefly, DrHorrible)
> my.df["DrHorrible"]
DrHorrible
1 10
2 9
3
2008 Nov 13
1
readPDF() -- unsure how to install xpdf to make this work?
Dear R-Help,
I need to convert a set of '.pdf' files into an equivalent set of
'.txt' files. This is so that i can do some text mining on the
content.
In the latest R-News letter (http://cran.r-project.org/doc/Rnews/
Rnews_2008-2.pdf), the package 'tm' for text mining is mentioned. In
that lovely package, there is a function called 'readPDF()'. In order
to use
2009 Oct 21
2
How to average subgroups in a dataframe? (not sure how to apply aggregate(..))
Dear all,
Lets say I have the following data frame:
> set.seed(1)
> col1 <- c(rep('happy',9), rep('sad', 9))
> col2 <- rep(c(rep('alpha', 3), rep('beta', 3), rep('gamma', 3)),2)
> dates <- as.Date(rep(c('2009-10-13', '2009-10-14', '2009-10-15'),6))
> score=rnorm(18, 10, 3)
> df1<-data.frame(col1=col1,
2010 May 06
2
reading formatted txt file into a data frame
Dear all
Lets say I have a plain text file as follows:
> cat(c("[ID: 001 ] [Writer: Steven Moffat ] [Rating: 8.9 ] Doctor Who",
+ "[ID: 002 ] [Writer: Joss Whedon ] [Rating: 8.8 ] Buffy",
+ "[ID: 003 ] [Writer: J. Michael Straczynski ] [Rating: 7.4 ]
Babylon [5]"),
+ sep = "\n", file = "tmp.txt")
I would somehow like to read
2010 Jan 20
1
Reshaping data with xtabs giving me 'extra' data
Dear all,
Lets say I have several data frames as follows:
> set.seed(42)
> dates <- as.Date(c("2010-01-19", "2010-01-20"))
> times <- c("09:30:00", "11:30:00", "13:30:00", "15:30:00")
> shows <- c("Red Dwarf", "Being Human", "Doctor Who")
>
> df1 <- data.frame(Date = dates[1],
2009 Oct 05
1
How to get NA's into the output of xtabs?
Dear all,
Lets say I have the following data frame:
> df1 <- data.frame(Show=c('Star Trek', 'Babylon 5', 'Dr Who'), Size=c(0.7, 0.0, 0.701), Date=as.Date(c('2007-08-03', '2007-08-03', '2007-08-03'), format='%Y-%m-%d'))
> df2 <- data.frame(Show=c('Star Trek', 'Dr Who', 'Torchwood'), Size=c(0.8, 0.85,
2007 Oct 30
1
timezone conversion difficulties with the new US daylight saving time switch over
I'm having difficulties with daylight saving times in US time zones.
(Apologies for the long post, but the problem seems subtle and complex,
unless I'm doing something completely wrong, in which case it should
be evident from the first 10 lines below.)
This is what I see, using a (slightly modified) example from ?as.POSIXlt :
> as.POSIXlt((d <- Sys.time()), "EST5EDT") #
2007 Mar 28
1
checking existence of active bindings
Is there any way to check whether an active binding exists without
actually calling the active binding? I'd like to be able to do
something like exists("x", ...) and know whether "x" exists without
actually fetching its value if it is an active binding (because it could
consume significant resources to fetch the value).
The documentation for exists() doesn't
2009 Feb 18
1
Training nnet in two ways, trying to understand the performance difference - with (i hope!) commented, minimal, self-contained, reproducible code
Dear all,
Objective: I am trying to learn about neural networks. I want to see
if i can train an artificial neural network model to discriminate
between spam and nonspam emails.
Problem: I created my own model (example 1 below) and got an error of
about 7.7%. I created the same model using the Rattle package (example
2 below, based on rattles log script) and got a much better error of
about
2009 Jan 26
2
RCurl unable to download a particular web page -- what is so special about this web page?
Dear R-help,
There seems to be a web page I am unable to download using RCurl. I
don't understand why it won't download:
> library(RCurl)
> my.url <- "http://www.nytimes.com/2009/01/07/technology/business-computing/07program.html?_r=2"
> getURL(my.url)
[1] ""
Other web pages are ok to download but this is the first time I have
been unable to download a