Displaying 20 results from an estimated 30000 matches similar to: "Errors and line numbers in scripts?"
2010 Nov 17
1
Multiple Line Plots with xyplot
I'm trying to make multiple line plots, each with a different color, using the xyplot command. Specifically, I have an NxK matrix Y and an Nx1 matrix x. I would like the plot to contain a line for each (x, Y[,i]), i=1:K. I know something like
xyplot(Y[,1] + Y[,2] + Y[,3] ~ x, type='l')
will work, but if Y is large, this notation can get very awkward. Is there a way to do something
2012 Jul 31
2
Error Installing Package with Dependency on "Matrix"
I'm attempting to update to R 2.15.1, and I'm having trouble with a package
that depends on the "Matrix" package. I've created a dummy package
consisting only of a DESCRIPTION file that specifies the dependence on
"Matrix", a NAMESPACE file, and an R directory, containing a single
function, "square <- function(x) { return (x*x) }". When I try to
2012 Aug 07
2
Repeated Aggregation with data.table
I have been using ddply to do aggregation, and I frequently define a
single aggregation function that I use to aggregate over different
groups. For example,
require(plyr)
dat <- data.frame(x = sample(3, 100, replace=TRUE), y = sample(3, 100,
replace = TRUE), z = rnorm(100))
f <- function(x) { data.frame(mean.z = mean(x$z), sd.z = sd(x$z)) }
ddply(dat, "x", f)
ddply(dat,
2012 Jul 30
2
Thinning Lattice Plot
Is there an easy way to "thin" a lattice plot? I often create plots from
large data sets, and use the "pdf" command to save them to a file, but the
resulting files can be huge, because every point in the underlying dataset
is rendered in the plot, even though it isn't possible to see that much
detail.
For example:
require(Hmisc)
x <- rnorm(1e6)
2011 Feb 18
2
Scaling Lattice Graphics for tikzDevice
I'm trying to use lattice graphics to produce some small plots for inclusion in a LaTeX file. I want the LaTeX fonts to be used in the plots, but to be scaled down to match the size of the plot. I have written the following code to apply a scaling factor to all the "cex" and "padding" entries in the trellis parameters, but there is still a large white space between the key
2012 Jun 25
1
combineLimits and Dates
I'm having some trouble using the latticeExtra 'combineLimits' function
with a Date x-variable:
require(lattice)
set.seed(12345)
dates <- seq(as.Date("2011-01-01"), as.Date("2011-12-31"), "days")
dat <- data.frame(d = rep(dates, 4),
g = factor(rep(rep(c(1,2), each = length(dates)), 2)),
h =
2011 May 06
1
Cumsum in Lattice Panel Function
I'm trying to create an xyplot with a "groups" argument where the y-variable
is the cumsum of the values stored in the input data frame. I almost have
it, but I can't get it to automatically adjust the y-axis scale. How do I
get the y-axis to automatically scale as it would have if the cumsum values
had been stored in the data frame?
Here is the code I have so far:
2011 May 31
1
splom Tick Location
When using the 'splom' function of the 'lattice' packge, is it possible to
get all the tick marks in the outer margins of the plot?
X <- as.data.frame(matrix(rnorm(1000), 100, 10))
plot(X) ## Tick marks are in the outer margin
splom(X) ## Tick marks are inside the on-diagonal panels
Thanks.
- Elliot
[[alternative HTML version deleted]]
2012 Sep 26
1
how to know where you've been sourced from
Hello All,
I need a script to perform different actions depending on the file from
which it was source()'d. Thus, my script needs a way to figure out from
whence it was sourced.
There seems to be some relevant information in sys.calls() (see below).
However, I need to get at the name of the file that directly source the
file in question. That is, just one level above. For example, in the
2008 Mar 07
1
Help with 'memory not mapped'
Hi,
I'm no expert programmer at all;
I'm running an R script ("mariam1_2.R"). This scripts calls another
script, which contains an R function, which .Call some C code.
It runs several times without any problem, but sometimes I get the error:
-------
*** caught segfault ***
address 0x1c404ec8, cause 'memory not mapped'
Traceback:
1: .Call("rrfunc",
2009 Nov 04
2
error in install.packages() (PR#14042)
Full_Name: Michael Spiegel
Version: 2.10
OS: Windows Vista
Submission from: (NULL) (76.104.24.156)
The following error is produced when attempting to call install.packages. Here
is the results of the traceback:
> source('http://openmx.psyc.virginia.edu/getOpenMx.R')
Error in f(res) : invalid subscript type 'list'
> traceback()
7: f(res)
6: available.packages(contriburl =
2011 Jan 31
1
Generic Functions and Dates
I'm trying to write a generic function that calls different methods depending on the structure of the argument, but not the exact type of its contents. For example, the function 'nan2last' below works for a numeric vector but not for a vector of Date objects. Is there any way to make it work on any vector?
setGeneric("nan2last", function(x) {
2005 Jul 06
4
Tempfile error
Dear List:
I am encountering an error that I can't resolve. I'm looping through
rows of a dataframe to generate individual tex files using Sweave. At
random points along the way, I encounter the following error
Error in file() : cannot find unused tempfile name
At which point Sweave halts. There isn't a logical pattern that I can
identify in terms of why the program stops at
2007 Dec 27
2
Problem of lmer under FreeBSD
I encounter such problem with lmer under FreeBSD, but not under
Windows. Anyone knows why? Thanks.
> example(lmer)
lmer> (fm1 <- lmer(Reaction ~ Days + (Days|Subject), sleepstudy))
Error in UseMethod("as.logical") : no applicable method for "as.logical"
> traceback()
9: as.logical(EMverbose)
8: as.logical(EMverbose)
7: lmerControl()
6:
2009 Apr 13
2
I source an R script. An error is reported. But on what line
> source("C:\\Documents and Settings\\smiller53\\Desktop\\perf.r")
Error in eval.with.vis(expr, envir, enclos) : element 1 is empty;
the part of the args list of 'c' being evaluated was:
perf.r is a long script. how can I determine which line the error occurred on?
TIA, SHane
2010 Mar 08
1
confused by classes and methods.
Hello, I have a simple class that looks like:
setClass("statisticInfo",
representation( max = "numeric",
min = "numeric",
beg = "numeric",
current = "numeric",
avg = "numeric",
obs = "vector"
2012 Oct 16
2
gam (mgcv) problem: Error in while (mean(ldxx/(ldxx + ldss)) > 0.4) { :, missing value where TRUE/FALSE needed
Hi All,
I'm running into a problem with GAM (in the MGCV package). When I try
to estimate the model, I get the following error message:
1> fit <-
gam(ndvi~s(rain)+s(temp)+s(rainl1)+s(rainl2)+s(rainxY)+s(rainl1xY)+s(rainl2xY)+s(tempxY),
data=dsub, weights=wvec)
Error in while (mean(ldxx/(ldxx + ldss)) > 0.4) { :
missing value where TRUE/FALSE needed
Using
2013 Mar 19
1
source, sys.source and error line numbers
Hi,
is there a way to retrieve the line number of where en error occurred when
sourcing a file in a tryCatch statement? Is it stored somewhere accessible?
It is not found in the error object.
Consider the following code/output and note the difference in the traceback
between source (has line number) and sys.source (has no line number).
Thank you,
Renaud
########
# code
########
codefile <-
2010 Jun 23
2
possibility to determine whether a script is "sourced"?
Dear R community,
I am running some rather large scripts either by executing single blocks of them separately or by executing them at once via
source('script.R')
Now there is a lot of code in those scripts that I only want to run when I run them manually, so I wonder whether there is any way to automatically find out whether the script is run manually stepwise or whether it is run via
2012 Jun 20
1
Websocket example out of the box failing if running at startup from Rprofile.site
Hello,
I run websockets 1.1.1 from R 2.15 without any problems. I would like
to deploy R script running automatically for all users when R is
starting from Rprofile.site like follow:
.First <- function()
{
source("C:\\R\\orig-websockets.R")
}
This script is from websockets package distribution.
The error is follow:
Error in .parse_header(x) :