Hi Anul,
Try this (it worked for me)
mapply (chart_Series, mget(symVec), name=infoVec, MoreArgs=list(pars=cp,
theme=ct ))
Best,
Eric
On Sun, Jul 28, 2019 at 7:03 PM Anuj Goyal wrote:
> It compiles without errors, but the chart_pars() and chart_theme() are
> not being applied. eg. the Right Y-
It compiles without errors, but the chart_pars() and chart_theme() are
not being applied. eg. the Right Y-axis label still exists in p.pdf.
Is it possible that cp and ct don't easily vectorize?
# R --silent --vanilla < sof.r
library(quantmod)
options("getSymbols.warning4.0"=FALSE)
options("getSymb
Hi Anuj,
I am providing comments regarding your first attempt to call mapply.
Since you are working with named arguments, you shouldn't need to include
the NULLs in the call.
Also you have provided the argument MoreArgs twice, which is what is
causing the Error message.
You can replace that call wi
R version 3.6.0 (2019-04-26) on Mac 10.14.5
What is the proper way to pass chart_pars() as well as chart_theme()
into MoreArgs for use in quantmod::chart_Series?
p.txt
===
s,n
ABBV,AbbVie
BMY,Bristol
sof.r
===
# R --silent --vanilla < sof.r
library(quantmod)
options("getSymbols.warning4.
That's exactly what I wanted, thank you very much!
My intent was to perform the SubStr operation first, and then apply the
types to the columns. I wasn't expecting the two types in the same column.
I appreciate your response!
On Tue, Feb 10, 2015 at 5:03 PM, David Winsemius
wrote:
>
> On Feb 1
On Feb 10, 2015, at 3:58 PM, Brian Trautman wrote:
> Hi!
>
> I'm trying to write a custom function that applies SubStr to a string, and
> then depending on the arguments, converts the output to a number.
>
> The substring part of my code works fine, but it's not converting the way I
> want to -
Hi!
I'm trying to write a custom function that applies SubStr to a string, and
then depending on the arguments, converts the output to a number.
The substring part of my code works fine, but it's not converting the way I
want to --
options('stringsAsFactors'=FALSE)
require(data.table)
substr_ty
On 26/04/2014, 11:42 AM, Rguy wrote:
When mapply is applied to a function that has a call to browser() within
it, the result can be a disastrous amount of feedback.
To clarify this situation please consider the following function,
containing a call to browser within it:
plus = function(a, b) {b
When mapply is applied to a function that has a call to browser() within
it, the result can be a disastrous amount of feedback.
To clarify this situation please consider the following function,
containing a call to browser within it:
plus = function(a, b) {browser(); a + b}
A plain vanilla call
A.K.
- Original Message -
From: "Webb,Elizabeth E"
To: "r-help@R-project.org"
Cc:
Sent: Tuesday, June 11, 2013 2:07 AM
Subject: [R] mapply on multiple data frames
Hi all-
I am wondering about using the mapply function to multiple data frames.
Specifically, I woul
Hi all-
I am wondering about using the mapply function to multiple data frames.
Specifically, I would like to do a t-test on a subset of multiple data frames.
All data frames have the same structure.
Here is my code so far:
f<-function(x,y) {
test<-t.test(x$col1[x$col3=="num",],v$col2[x$col3=
Thanks for help.
But, I am surprised, that mapply is slower than for loop?
OV
From: Uwe Ligges
Cc: "r-help@r-project.org"
Sent: Saturday, November 3, 2012 4:32 PM
Subject: Re: [R] mapply instead for loop
On 30.10.2012 20:01, Omphal
On 30.10.2012 20:01, Omphalodes Verna wrote:
Hi all!
My question in about using mapply instead for loop. Below is a example with for
loop: Is it posible to give same results with mapply function?
Thanks for help!
OV
x <- 1:10
y <- 1:10
xyz <- data.frame(expand.grid(x,y)[1], expand.grid(x,y
Hi all!
My question in about using mapply instead for loop. Below is a example with for
loop: Is it posible to give same results with mapply function?
Thanks for help!
OV
x <- 1:10
y <- 1:10
xyz <- data.frame(expand.grid(x,y)[1], expand.grid(x,y)[2], z = rnorm(100))
names(xyz) <- c("x", "y
Thank you very much, though I still don't quite undertdand the
explanation :)
Nevertheless, I just found a seemingly simple (at least quiker to type)
solution after try-and-error:
eval(mapply(function(x) {x; function() x}, c("a", "b")))
Wish it may help future readers.
On Thu, May 03, 2012 at
So, to get back to mapply:
eval(mapply(function(x) substitute(function() z,list(z=x)), c("a", "b"))$a)()
or like this:
mapply(function(x) eval(substitute(function(i) z*i,list(z=x))), c(2,3))[[1]](2)
Am 03.05.2012 um 16:02 schrieb Jessica Streicher:
> Now.. i just tried around and this might b
Now.. i just tried around and this might be a bit strange way to do things..
createFunc<-function(v){
v_out<-NULL
for(i in v){
v_out[[i]]<-substitute(function(){x},list(x=i))
}
return(v_out)
}
> y<-createFunc(c("a","b"))
> y
$a
function() {
"a"
As i see it you will save the actual "text" of the function - and when you call
it later on it takes the last value of x it has encountered as the value. I
guess you want the x not to be saved as x, but as "a" or "b", so, as its value.
I am not sure how to do that however as of yet.
Am 03.05.2
As the title says, I want to apply a function (which itself returns
a function) to a list (or vector), and get a list (or vector) of
generated functions as the return value, but get unexpected result.
Anyone with an idea about the reason of this phenomenon and a correct
way to implement the requir
ter(10)
> [1] 2.5
>
> Bill Dunlap
> Spotfire, TIBCO Software
> wdunlap tibco.com
>
>
>> -Original Message-
>> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
>> Behalf
>> Of J Toll
>> Sent: Monday, March 12, 2012
= 1)
> half(10)
[1] 5
> third(10)
[1] 3.33
> quarter(10)
[1] 2.5
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf
> Of J Toll
> Sent
On 3/12/2012 10:47 AM, J Toll wrote:
Hi,
I have a problem that I'm finding a bit tricky. I'm trying to use
mapply and assign to generate curried functions. For example, if I
have the function divide
divide<- function(x, y) {
x / y
}
And I want the end result to be functionally equivalent
Hi,
I have a problem that I'm finding a bit tricky. I'm trying to use
mapply and assign to generate curried functions. For example, if I
have the function divide
divide <- function(x, y) {
x / y
}
And I want the end result to be functionally equivalent to:
half <- function(x) divide(x, 2)
th
Perhaps something like:
sapply(1:40, function(n) c(gauss.quad(n)$nodes, rep(NA, 40-n)))
sapply(1:40, function(n) c(gauss.quad(n)$weights, rep(NA, 40-n)))
You'll have to decide how you want the records combined but this
should get you going in the right direction
Michael
PS -- it's polite to say
To use the gauss.quad function: gauss.quad(n,type) which returns two lists
$nodes and $weights whose length will each equal n. I'd like to do this for
n=1 to 40 (type will not change) and have a dataset with 40 rows and 81
columns with all the nodes and weights. The first record would have N1 a
owInd,3],e=cells[rowInd,5])))
Error in paste("f", i, j, "(a,b,c,d)", sep = "") :
argument "i" is missing, with no default
What do you think I should try out now?
Vielen Dank
Alex
--- On Mon, 4/18/11, Andreas Borg wrote:
From: Andreas Borg
Subj
Thanks you very much.
You made it work!
Cheers
--- On Mon, 4/18/11, Kenn Konstabel wrote:
> From: Kenn Konstabel
> Subject: Re: [R] mapply to lapply
> To: "Alaios"
> Cc: R-help@r-project.org
> Date: Monday, April 18, 2011, 1:06 PM
> On Mon, Apr 18, 2011 at 2:10 PM,
ep = "") :
> argument "i" is missing, with no default
>
>
> What do you think I should try out now?
>
> Vielen Dank
> Alex
>
> --- On Mon, 4/18/11, Andreas Borg wrote:
>
>> From: Andreas Borg
>> Subject: Re: [R] mapply to lapply
>> To
rgument "i" is missing, with no default
What do you think I should try out now?
Vielen Dank
Alex
--- On Mon, 4/18/11, Andreas Borg wrote:
> From: Andreas Borg
> Subject: Re: [R] mapply to lapply
> To: "Alaios"
> Cc: R-help@r-project.org
> Date: Monday, Apr
My solution would be to use an index variable that goes from 1 to the number of
rows that are to be processed, along with a helper function which calls
Fwithcellvalue with the suitable arguments:
F2[i+1,j+1]<-sum(lapply(1:nrow(cells), function(rowInd)
Fwithcellvalue(i=i,j=j,a=cells[rowInd,2],b
Dear all,
I would like to ask your help concerning
converting a mapply function to lapply. The reason is that I would like to use
mclapply which requires lapply syntax.
The command I would like to convert is:
F2[i+1,j+1]<-sum(mapply(Fwithcellvalue,i=i,j=j,a=cells[,2],b=cells[,4],c=cells[,1],d=c
On Thu, Feb 3, 2011 at 1:26 PM, Albert-Jan Roskam wrote:
> Hi,
>
> I have a function myFun which I want to call multiple times, using
> different
> argument lists.
> myFun("v1", "2009", 1)
> myFun("v2", "2008", 1)
> myFun("q", "2001")
>
Notice that the third call is different, you have 3 args in
Hi,
I have a function myFun which I want to call multiple times, using different
argument lists.
myFun("v1", "2009", 1)
myFun("v2", "2008", 1)
myFun("q", "2001")
How can I easily do this in R? Should I use mapply?
I unsuccessfully tried something like:
x <- list(c("v1", "2009", 1), c("v2", "200
well, you do not have to compute the pairwise difference each time; for
instance, you could use something like this (untested):
out1 <- outer(a, c, "-")
out2 <- outer(b, c, "-")
u <- v <- 1:5
mat <- matrix(0, length(u), length(u))
for (i in seq_len(u)) {
for (j in seq_len(v)) {
res1
Hello, R users.
I would like to count the number of triples (r_i, s_j, t_k) with r_i,
s_j, t_k distinct and abs((r_i-t_k)-u)=0 and abs((s_j-t_k)-v)=0, where
r_i, s_j, t_k are the elements of three vectors a,b,c with different
lengths and u,v=1:n. I have solved this problem writing a subroutine
On Sun, Mar 23, 2008 at 11:06:05AM -0400, Mark Leeds wrote:
> In an earlier post, a person wanted to divide each of the rows of
>
> rawdata by the row vector sens so he did below but didn't like it and
>
> asked if there was a better solution.
>
>
>
> rawdata <- data.frame(rbind(c(1,2,2), c
In an earlier post, a person wanted to divide each of the rows of
rawdata by the row vector sens so he did below but didn't like it and
asked if there was a better solution.
rawdata <- data.frame(rbind(c(1,2,2), c(4,5,6))) sens <- c(2,4,6)
temp <- t(rawdata)/sens
temp <- t(temp)
print
On Thu, 8 Nov 2007, Erik Iverson wrote:
> Hello -
>
> I am wanting to create some Cox PH models with coxph (in package
> survival) using different datasets.
>
> The code below illustrates my current approach and problem with
> completing this.
>
> ### BEGIN R SAMPLE CODE ##
f Of Erik Iverson
> Sent: Thursday, November 08, 2007 4:43 PM
> To: '[EMAIL PROTECTED]'
> Subject: [R] mapply, coxph, and model formula
>
> Hello -
>
> I am wanting to create some Cox PH models with coxph (in package
> survival) using different datasets.
>
> T
Hello -
I am wanting to create some Cox PH models with coxph (in package
survival) using different datasets.
The code below illustrates my current approach and problem with
completing this.
### BEGIN R SAMPLE CODE ##
library(survival)
#Define a function to make tes
40 matches
Mail list logo