Displaying 20 results from an estimated 10000 matches similar to: "R windows crash (PR#9426)"
2009 Jun 20
2
Special characters in Rd example section will cause errors
Hi (Duncan?),
The other day I noticed some characters will cause errors in R CMD
CHECK because of parse_Rd(), and AFAIK, these chars include '%', '{'
and '}'. For example, note the comments in the example section:
%~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~%
\name{testfun}
\Rdversion{1.1}
\alias{testfun}
\title{
A Test
}
\description{
A test
}
\usage{
testfun()
}
\value{
NULL
}
2011 Jul 12
2
foreach not recognizing functions in memory
All,
I am not understanding the scoping used in foreach when it is used
inside a function. I keep getting "could not find function" errors for
functions that are in memory when I try to use foreach within a function
call. I have a simple example below. "testFun" is in memory and works
when called by foreach directly, but when I place foreach in a function
called
2012 Oct 07
3
get: problem with environments
Dear R users,
I am running R-2.15.1 in Linux Slackware64-14.0. Here is my minimal working example:
testfun <- function (x) {
a <- 0;
sapply(X="a", FUN=get, envir=sys.frame(which=x));
}
Inside R, that is R called from within a Linux terminal, the following code works:
testfun(x=5)
print(testfun(x=6))
But within rkward the above code fails and the following works:
testfun(x=1)
2012 Aug 08
1
random number generator with SNOW/ Parallel/ foreach
Dear All,
I have three classes of questions about generating random numbers with
different packages (windows xp 32bit R).
.
1. Suppose I would like to use package *foreach*, can I use current
Sys.time as a seed?
Although I can get the time up to1e-6 second precesion, the code below dose
not work well on a local machine with two cores. #################
library(foreach)
library(snow)
2015 Feb 18
4
Different serialization of functions in interactive vs. batch mode
Hi Luke,
Ah - I see - thank you! This at least points me to a way on how to
"fix" this. I tried setting the srcref attribute to NULL, but the hash
value is still different and so is the serialization. So this looks
like it is one difference, but not all of them
Even if all differences were identified - it still leaves me with
different behavior between interactive and batch-mode,
1998 Nov 19
2
Re: ESS & R data import problems
I have a similar question, I know about --vsize, but I use R under Emacs
using ESS. I know there is an easy way to call R from ESS with command
line options but I don't remember how. I can't find help on this in ESS
documentation or in R documentation.
Could someone please remind me how this is done.
------------------------------------
| Robert Denham |
|
2015 Feb 18
2
Different serialization of functions in interactive vs. batch mode
Hi,
I posted this question to the regular help list, but it seems to be
this is probably a question that is better addressed on r-devel. Sorry
for the double posting.
I am using hash-values to cache certain results in R. This caching
also depends on the hash-value of the function that is being cached
(calculated using the digest package). I noticed that computations
that should already be cached
2013 Jan 14
2
The three-dot question
Dear all,
Why does not the three-dot accept arguments from the parent environment?
I am just confused with this error, can someone give me a hint?
> rm(list=ls())
> testFun <- function(a, ...)
+ {
+ if(a){
+ print(a)
+ }else
+ {
+ print(b)
+ }
+ }
>
> myTask <- function(a)
+ {
+ b <- 3
+ testFun(a, b = b)
+ }
>
2015 Feb 18
1
Different serialization of functions in interactive vs. batch mode
Hi Gabriel,
thanks for your reply - it does solve the problem of my toy function,
but does come with some other problems though.
a) as.list(f)[[1]] yields an expression, not a function. In order to
go the route you are suggesting, I would more likely use "deparse" in
order to get the original back
b) and more seriously - as.list strips the environment of the function
(and thus
2012 Jun 09
1
Applying a function to a column of a data frame
Apologees the novice question. Currently climbing up the learning curve of R.
Suppose I have the following function and the data.frame:
testfun<-function(x=1,y=2) x+y
testframe=data.frame(col1=c(1,2),col2=c(3,4))
When evaluating testfun, I want to use the default value for y (which
is 2) and for x, I want to feed (one by one) the values in col2 of
testframe. How can I achieve this please?
2009 Sep 16
3
apply function across two variables by mult factors
Greetings,
I am attempting to run a function, which produces a vector and
requires two input variables, across two nested factor levels. I can
do this using by(X, list(factor1, factor2), function), however I
haven't found a simple way to extract the list output into an
organized vector form. I can do this using nested loops but it isn't
exactly an optimal approach.
Thank you
2005 Aug 17
4
accesing slots of S4 class in C code
I am trying to use a custom S4 object in my C code and I cannot get the
access to its slots working.
The following is a toy example, but even this crashes.
In R I have:
setClass("pd", representation(data="numeric"))
x <- new("pd", data=1:5)
test <- function(pd.obj) {
res <- .C("TestFun", pd.obj)
res}
test(x)
(Of couse
2009 Sep 24
1
how to make a function recognize the name of an object/vector given as argument
Dear guRus,
I'd like to learn how to make a function recognize the name of an
object/vector given as argument
If I have :
testFun <- function(x,y) plot(x,y, main=paste("plot
of",names(x),"and",names(y)) ) # this just a simple example ...
a1 <- 5:8
b1 <- 9:6
testFun(a1,b1)
# Returns the plot, but not the names of the objects/vectors given as
arguments,
# but
2012 Jun 10
3
Data.frames can not hold objects...What can be done in the following scenario?
R-Help community,
I understand that data.frames can hold elements of type double, string
etc but NOT objects (such as a matrix etc). This is not convenient for
me in the following situation. I have a function that takes 2 inputs
and returns a vector:
testfun <- function (x,y) seq(x,y,1)
I have a data.frame defined as follows:
testframe<-data.frame(xvalues=c(2,3),yvalues=c(4,5))
I would
2004 Apr 08
1
Why are Split and Tapply so slow with named vectors, why is a for loop faster than mapply
First, here's the problem I'm working on so you understand the context. I
have a data frame of travel activity characteristics with 70,000+ records.
These activities are identified by unique chain numbers. (Activities are
part of trip chains.) There are 17,500 chains.
I use the chain numbers as factors to split various data fields into lists
of chain characteristics with each element of
1997 Jun 06
1
R-beta: nlm
I am trying to use the function "nlm" to find the mle. I want to use a
generic function for the likelihood which would require me to use both the
parameters and the data as arguments. But nlm requires the function to
have only the parameters as arguments for this function (see example below).
> testfun <- function(x,y) sum((x-y)^2) # x - parameters, y - data
>
2019 Apr 05
2
Deep Replicable Bug With AMD Threadripper MultiCore
The following program is whittled down from a much larger program that
always works on Intel, and always works on AMD's threadripper with
lapply but not mclappy. With mclapply on AMD, all processes go into
"suspend" mode and the program then hangs. This bug is replicable on an
AMD Ryzen Threadripper 2950X 16-Core Processor (128GB RAM), running
latest ubuntu 18.04. The R version
2011 Apr 13
3
predict()
Hi,
I am experimenting with the function predict() in two versions of R and the R extension package "survival".
library(survival)
set.seed(123)
testdat=data.frame(otime=rexp(10),event=rep(0:1,each=5),x=rnorm(10))
testfm=as.formula('Surv(otime,event)~x')
testfun=function(dat,fm)
{
predict(coxph(fm,data=dat),type='lp',newdata=dat)
}
# Under R 2.11.1 and
2011 Apr 13
3
predict()
Hi,
I am experimenting with the function predict() in two versions of R and the R extension package "survival".
library(survival)
set.seed(123)
testdat=data.frame(otime=rexp(10),event=rep(0:1,each=5),x=rnorm(10))
testfm=as.formula('Surv(otime,event)~x')
testfun=function(dat,fm)
{
predict(coxph(fm,data=dat),type='lp',newdata=dat)
}
# Under R 2.11.1 and
2018 Sep 20
3
Comparing Clang and GCC: only clang stores updated value in each iteration.
Hi,
I have a benchmark (mcf) that is currently slower when compiled with
clang compared to gcc 8 (~10%). It seems that a hot loop has a few
differences, where one interesting one is that while clang stores an
incremented value in each iteration, gcc waits and just stores the final
value just once after the loop. The value is a global variable.
I wonder if this is something clang does not do