similar to: Compact sums in functions definitions

Displaying 20 results from an estimated 3000 matches similar to: "Compact sums in functions definitions"

2006 Jul 13
1
Problems plotting a function defined as a product
In order to define a function f as: > f <- function(x) (x+1)*(x+2) I want to use the notation: > v = c(1,2) > g <- function(x) prod((v+x)) That apparently works and, for instance, the loop: >for (i in 1:100) { print(f(i)-g(i)) } Produces a sequence of zeros. Nevertheless, if I try to plot the function g by: >t = seq(0,100,1) >plot(t,g(t),type="l") I
2006 Aug 03
1
levels of an array (strings and numbers)
Reading a csv file (db.csv) as: yes,full no,full no,empty I can use the command 'levels' to extract the different values appearing for each column as follows: > d<-read.csv("db.csv") > levels(d[,2]) which returns > [1] "empty" "full" while, doing the same with a numerical csv file as: 1,6 0,6 0,7 the same instruction returns an empty
2012 Mar 09
6
unir 2 dataframe con con igual caso pero distinto valor en igual variable
Estimados usarios de R: Tengo una base de datos madre en formato .sav de SPSS y la quiero modificar usando datos de otras base de datos .sav y otra en .csv a las que llamare hijos. No tengo problema en convertirlas en data.frame. Todos los archivos tienen en comĂșn una variable que es Ășnica. En aquellos casos que les falta un valor a una variable en el archivo madre lo relleno con el valor del
2008 Oct 28
1
Marginal effects in negative binomial
Dear All, I carry out negative binomial estimations using the glm.nb command from the MASS package. Is there a command or a simple procedure for computing marginal effects from a glm.nb fitted object? If these are the same as for a Poisson fitted object (glm), my question remains how to compute them. Thanks in advance for your help. Roberto Patuelli ******************** Roberto Patuelli, Ph.D.
2010 Jun 07
1
Patch for legend.position={left,top,bottom} in ggplot2
Hi Hadley and everyone, here's a patch for ggplot2 that fixes the behavior of opts(legend.position={left,top,bottom}). If you try the following code in an unmodified ggplot2 options(warn = -1) suppressPackageStartupMessages(library("ggplot2")) data <- data.frame( x = c(1, 2, 3, 4, 5, 6), y = c(2, 3, 4, 3, 4, 5), colour = c(TRUE, TRUE, TRUE, FALSE, FALSE, FALSE))
2007 Jun 26
3
surprising difference in log()
Hello everybody My collegue and I noticed a strange behaviour of R on different platforms. It's a simple computation, but results are rather different. On Windows XP: > floor(log(8,2)) [1] 3 which is what one should expect. Here's instead the result with Mac OS X (same version, 2.5.0 (2007-04-23)) > floor(log(8,2)) [1] 2 Is it a "bug" in R or in the operating
2009 Jan 30
1
Fitted values and residuals from glmmPQL (MASS package)
Dear All, I would like to analyse the residuals from a generalized linear mixed model (GLMM) that I estimated, with random effects, by means of the command glmmPQL, from the MASS package. It is not very clear to me what the actual residuals to analyse are (Y - Yhat): I obtain two columns of residuals, of which the first are population residuals, and the second refer to the grouping used in the
2016 Feb 04
2
Profiling with LLVM.
Dear Duncan, Thank you a lot for your feedback. I have a problem though. The branch weights counters overflow in some files and thus I get incorrect numbers. Is there any way to find a workaround for that? Is is supposed to be a known bug or is it something that needs configuration on my part? Again, thank you a lot for your reply. Best Regards, Georgios Zacharopoulos 2016-02-03 18:23
2008 Oct 03
1
Problem with glm.nb estimation
Dear All, I've been using already for a year glm.nb() from the MASS package. But today, R gave me an error message when estimating one of my usual models: > depEsf.nb <- glm.nb(depE ~ manuf00E + corps00E + lngdp00E + lngdp00sqE + > lnpop00E + indshE + scishE + mechshE + elecshE + chemshE + drugshE + > urban_dummyE + aggl_dummyE + + eE1 + eE2 + eE3 + eE4 + eE5 + eE6 + eE7 +
2001 Oct 30
2
creating chron object aggregates (e.g. sums by day)
What is the recommended/optimal way to perform aggregates on data frames with chron objects? Here is an example: >raw.data 1 07/09/01 4000 2 07/09/01 2000 3 07/11/01 1000 4 07/13/01 800 5 07/13/01 700 6 07/16/01 600 7 07/17/01 500 I'm trying to construct a function that would first aggregate the data (second column) by day (grouping by the first column) according to a
2005 Oct 03
1
Error in xy.coords(x, y, xlabel, ylabel, log) : x and y lengths differ
I am currently trying to use R to construct a regression model to explain output based on temperature. I have combined my output and temp data into a notepad file. there is no problem with loading the data into R. > data.df output temp 1 850 17 2 849 17 3 905 17 4 925 17 5 1043 19 6 1104 20 7 1097 18 8 979 19 9 926 18 10 1133 18 ~~ ~~ 240 1124
2016 Feb 05
2
Profiling with LLVM.
Dear Duncan, I am generating branch-weights annotated IR files as described in the documentation of LLVM, using profiling with instrumentation. http://clang.llvm.org/docs/UsersManual.html#profiling-with-instrumentation e.g. llvm-profdata merge -output=$(BENCH).profdata default.profraw > clang -S -emit-llvm -O3 -fprofile-instr-use=$(BENCH).profdata -o > bench.prof.ll bench.c The issue is
2009 Nov 09
1
Percentage effects in logistic regression
Dear ALL, I'm trying to figure out what the percentage effects are in a logistic regression. To be more clear, I'm not interested in the effect on y of a 1-unit increase in x, but on the percentage effect on y of a 1% increase in x (in economics this is also often called an "elasticity"). For example, if my independent variables are in logs, the betas can be directly
2008 Apr 22
1
plot(x) in 2.7.0 (with y=NULL) proposed code correction
Hi all: following the previous discussion, it looks like plot(x) with y=NULL still does not work correctly. If one tries for example plot(1:5) it works, but already for plot(runif(100)) it does not. I posted the proposed correction for plot.POSIXct and plot.POSIXlt before. Please voice your opinions whether the following fix for plot.default could be reasonable? I include the full function and
2010 Aug 26
0
anova for plm objects
Dear All, I'm looking to perform an ANOVA between two nested panel fixed effects models. I tried with anova, as well as with waldtest. anova tells me there is no method available for plm objects, while waldtest tells me my models are not nested. I think they are instead. The difference between the two models is that in the second I let the regression coefficients of a given variable variate
2018 Mar 12
0
Call for Papers: ManLang 2018 (Sept. 10-14, Linz, Austria)
Dear Person That Posted This Email, Please be aware that calls for papers are only on-topic for this email list if they are specifically about LLVM. For example, a call for a workshop on LLVM in Scientific Computing would be on topic whereas a general compiler call for papers (like the one below) is not. That said, I hope you receive many strong submissions. Your conference looks
2018 Mar 07
2
Call for Papers: ManLang 2018 (Sept. 10-14, Linz, Austria)
------------------------------------------------------------------------------------------------ CALL FOR PAPERS 15th International Conference on Managed Languages & Runtimes (ManLang'18) September 10-14, 2018, Linz, Austria http://ssw.jku.at/manlang18/ ------------------------------------------------------------------------------------------------ ManLang (formerly PPPJ) is a
2004 May 06
1
plot(hist.default(1:10,plot=F)) error.
Hi! How to find out which plot function is used when i call plot(hist.default(1:10,plot=F)) and all works fine ? The reason why I would like to know it is that after loading some self written R functions > plot(hist.default(1:10,plot=F)) Error in xy.coords(x, y, xlabel, ylabel, log) : x and y lengths differ > traceback() 5: stop("x and y lengths differ") 4: xy.coords(x, y,
2012 May 19
0
Call for Participation: ACM HPDC 2012 -- Early registration deadline May 25th
Call for Participation http://www.hpdc.org/2012/ The organizing committee is delighted to invite you to *HPDC'12*, the /21st International ACM Symposium on High-Performance Parallel and Distributed Computing/, to be held in *Delft, the Netherlands*, which is a historic, picturesque city that is less than one hour away from Amsterdam-Schiphol airport. HPDC <http://www.hpdc.org> is
2012 May 19
0
Call for Participation: ACM HPDC 2012 -- Early registration deadline May 25th
Call for Participation http://www.hpdc.org/2012/ The organizing committee is delighted to invite you to *HPDC'12*, the /21st International ACM Symposium on High-Performance Parallel and Distributed Computing/, to be held in *Delft, the Netherlands*, which is a historic, picturesque city that is less than one hour away from Amsterdam-Schiphol airport. HPDC <http://www.hpdc.org> is