similar to: use of apply in a data frame on a row by row basis

Displaying 20 results from an estimated 1000 matches similar to: "use of apply in a data frame on a row by row basis"

2011 Jul 23
1
call a function with explicitly not setting an argument
Is there a way to call a function, and explicitly set an argument to 'not specified'? My situation is the following. I have a function which passes on most of its arguments to another function. The second function, myfun2, serializes all arguments and is out of my control. myfun <- function(...){ return(myfun2(...)); } now, the value for arguments of myfun are stored in variables.
2017 Jun 18
3
R_using non linear regression with constraints
I am not as expert as John, but I thought it worth pointing out that the variable substitution technique gives up one set of constraints for another (b=0 in this case). I also find that plots help me see what is going on, so here is my reproducible example (note inclusion of library calls for completeness). Note that NONE of the optimizers mentioned so far appear to be finding the true best
2017 Jun 18
0
R_using non linear regression with constraints
I've seen a number of problems like this over the years. The fact that the singular values of the Jacobian have a ration larger than the usual convergence tolerances can mean the codes stop well before the best fit. That is the "numerical analyst" view. David and Jeff have given geometric and statistical arguments. All views are useful, but it takes some time to sort them all out and
2017 Jun 18
3
R_using non linear regression with constraints
https://cran.r-project.org/web/views/Optimization.html (Cran's optimization task view -- as always, you should search before posting) In general, nonlinear optimization with nonlinear constraints is hard, and the strategy used here (multiplying by a*b < 1000) may not work -- it introduces a discontinuity into the objective function, so gradient based methods may in particular be
2017 Jun 18
0
R_using non linear regression with constraints
I ran the following script. I satisfied the constraint by making a*b a single parameter, which isn't always possible. I also ran nlxb() from nlsr package, and this gives singular values of the Jacobian. In the unconstrained case, the svs are pretty awful, and I wouldn't trust the results as a model, though the minimum is probably OK. The constrained result has a much larger sum of squares.
2017 Jun 18
0
R_using non linear regression with constraints
> On Jun 18, 2017, at 6:24 AM, Manoranjan Muthusamy <ranjanmano167 at gmail.com> wrote: > > I am using nlsLM {minpack.lm} to find the values of parameters a and b of > function myfun which give the best fit for the data set, mydata. > > mydata=data.frame(x=c(0,5,9,13,17,20),y = c(0,11,20,29,38,45)) > > myfun=function(a,b,r,t){ > prd=a*b*(1-exp(-b*r*t)) >
2012 Jul 02
2
Constructing a list using a function...
Hi All I have a dataframe: myframe<-data.frame(ID=c("first","second"),x=c(1,2),y=c(3,4)) And I have a function myfun: myfun<-function(x,y) x+y I would like to write a function myfun2 that takes myframe and myfun as parameters and returns a list as below: mylist $first [1] 4 $second [2] 6 Could you please help me with this? Doesn't seem like the
2011 Sep 03
2
problem in applying function in data subset (with a level) - using plyr or other alternative are also welcome
Dear R experts. I might be missing something obvious. I have been trying to fix this problem for some weeks. Please help. #data ped <- c(rep(1, 4), rep(2, 3), rep(3, 3)) y <- rnorm(10, 8, 2) # variable set 1 M1a <- sample (c(1, 2,3), 10, replace= T) M1b <- sample (c(1, 2,3), 10, replace= T) M1aP1 <- sample (c(1, 2,3), 10, replace= T) M1bP2 <- sample (c(1, 2,3), 10, replace= T)
2017 Jun 18
2
R_using non linear regression with constraints
I am using nlsLM {minpack.lm} to find the values of parameters a and b of function myfun which give the best fit for the data set, mydata. mydata=data.frame(x=c(0,5,9,13,17,20),y = c(0,11,20,29,38,45)) myfun=function(a,b,r,t){ prd=a*b*(1-exp(-b*r*t)) return(prd)} and using nlsLM myfit=nlsLM(y~myfun(a,b,r=2,t=x),data=mydata,start=list(a=2000,b=0.05), lower = c(1000,0),
2011 Jul 25
1
do.call in "with" construction
Dear all, I'd appreciate any help to rectify what must be a misconception of mine how environments work: ########################## myEnv <- new.env() myEnv$a.env <- 1 myEnv$symbols.env <- "a.env" a.global <- 2 symbols.global <- "a.global" myFun <- function(symbols){do.call("print", lapply(symbols, FUN=as.name))} do.call("myFun",
2004 Mar 11
1
how to pass extra parameters using call() or similar mechanism ?
I am trying to write a function, which would allow to call various methods and would pass to them extra arbitrary parameters. My first attempt was to use call() as illustrated below, but apparently '...' cannot be used in such context. How can this be achieved ? Best regards, Ryszard > myfun <- function(method, x, ...) { + v <- eval(call(method, x, ...)) + } > method =
2015 May 12
2
AEL keyword IfTime with variable on time range
Hi It's possible using a variable in the iftime keyword argument? E.g: context text { s => { timerange = '06:00-12:00|*|*|*'; ifTime(${timerange} { Playback(ivr/goodbye); } } } thanks [image: Sua Foto] <rafaelsnsa at gmail.com>Rafael S. SaraivaPorto Alegre - RS | Mobile: (51) 8174-7956 <http://br.linkedin.com/pub/rafael-saraiva/52/aab/230>
2011 Jul 05
1
Create factor variable by groups
Hi, suppose that I have the following data.frame: cnae4 cnpj 1995 1996 1997 1998 1999 2000 2001 2002 2003 2004 Y 24996 10020470 1 1 2 12 16 21 17 51 43 19 183 24996 10020470 69 91 79 92 91 77 90 96 98 108 891 36145 10020470 0 0 0 0 2 83 112 97 91 144 529 44444 10023333 5 20 60 0 0 0 0 5 20 1000 1110 I would like to create a new variable X that indicates which
2015 Oct 28
2
sieve vacation - 2 questions
Hello, still trying to move from procmail to sieve, but there are new problems. Currently we use procmail for autoresponder and let user choose timerange, in which responder should work. May be you set up today your responder for 2 weeks in future where responder start and stop automatically without further manuell intervention. In procmail this is done by simple scripting and comparison of
2015 May 12
1
AEL keyword IfTime with variable on time range
Sorry, I forget to tell I tried, but not works. *Context:* context ivr_temp2 { s => { Proceeding(); str_time_01 = '06:00-12:00|*|*|*'; // Manh? ifTime (${str_time_01}) { Playback(ura/bom_dia); } } } The error is showed on "ael reload". *Console errors:* rs0000sr304*CLI> ael reload Command 'ael reload' failed.
2005 Dec 07
1
Dots argument in apply method
Hello everyone, I'm working on a package using S4 classes and methods and I ran into the following "problem" when I tried to create an "apply" method for objects of one of my new classes. I've found a way around the problem but I wonder if I did not paint myself into the corner. I'd like your opinion about that. So I have an object "myObj" of class
2006 Jul 06
1
which data structure for a set of time series ?
Hello, I'm a R newcomer and I'm wondering the kind of data structure that would best fit to my problem: my data are equities (stocks) : so I have a time serie (say 1 year of weekly data), and a bunch of qualitative + quantitative variables : the sector of the stock (biotech/finance...), the geographical region, the name, ISIN code, P/E ratios, whatever... The data.frame is perfect for the
2008 Jan 22
2
R object as a function
I want to use a function as an argument to ingtegrate it twice. See the following (senseless) example of a double integration: test<-function(sf,lo,up,rest) { innerFkn<-function(sf,lo) { inte=integrate(f=sf,lower=lo,upper=4) return( inte$value ) } integral=integrate(f=innerFkn,lower=1,upper=2,sf=sf,lo=lo,up=up) return( integral$vlaue+rest ) }
2011 Jan 06
5
Problem with timeSequence {timeDate} - wrong end date
Dear help-list, I have a problem with timeSequence {timeDate}. When I use it like > timeSequence(from = "2008-01-01", to = "2010-12-13", by = "1 month") GMT [1] [2008-01-01] [2008-02-01] [2008-03-01] [2008-04-01] [2008-05-01] [2008-06-01] [2008-07-01] [2008-08-01] [2008-09-01] [2008-10-01] [2008-11-01] [12] [2008-12-01] [2009-01-01] [2009-02-01] [2009-03-01]
2006 Oct 19
3
Schedules for certain weekdays...
Hi From the documentation I can''t see if I can define the following schedule: I want a certain command to be run once a day, monday-friday on a certain time of the day. Can I define that somehow...? -- Med venlig hilsen Juri Rischel Jensen Fab:IT ApS Vesterbrogade 50 DK-1620 København Tlf: 70 202 407 / Fax: 33 313 640 www.fab-it.dk / juri@fab-it.dk