similar to: On the speed of apply and alternatives?

Displaying 20 results from an estimated 300 matches similar to: "On the speed of apply and alternatives?"

2005 Aug 14
1
complex expression with plotmath
Hello everyone, I want to define a function that receives the name of two variables (may include Greek letters and subscripts) and uses them into the title of a plot. My best attempt is the following: myplot <- function(var1, var2) { v=paste(var1,"==1 & ",var2,"==2"); plot(1:10, main=parse(,,v)) } But when I call it with something like myplot("Q[i]",
2006 May 19
2
How to run direct DML (insert or update)
I want when the user clicks on a button on the browser "Perform monthly billing run" the controller to lanch a sql DML statment to be called (in the model?) than runs something like "insert into billing (item, qnt, total_cost, billing_run_timestamp select item, qnt, item*cost as total_cost, timestamp from services where service_end_date is null" How can I run a DML
2016 Apr 26
2
How to print the frequency table (produced by the command "table" to Excel
Hi, How could we print the frequency table (produced by "table") to an Excel file? Is there an easy way to do so? Thanks, Miao > df <- data.frame(x = 1:3, y = 3:1, z = letters[1:3]) > table(df[,c("y","z")]) z y a b c 1 0 0 1 2 0 1 0 3 1 0 0 > test<-table(df[,c("y","z")]) > as.data.frame(test) y z Freq 1 1 a
2011 Jun 06
2
Wireframe, custom x-axis values
Hi, Im plotting some data with wireframe() like so: wireframe(result ~ u * r, myData, scales=list(arrows=FALSE)) However, I would really like to display something different for the displayed values of "u" rather than the actual values. This is because my u-values are a sequence of quantiles of myData, and I would like to display the quantiles used (e.g. "0.8 0.85 0.9
2008 Aug 21
1
pnmath compilation failure; dylib issue?
(1) ...need to speed up a monte-carlo sampling...any suggestions about how I can get R to use all 8 cores of a mac pro would be most useful and very appreciated... (2) spent the last few hours trying to get pnmath to compile under os- x 10.5.4... using gcc version 4.2.1 (Apple Inc. build 5553) as downloaded from CRAN, xcode 3.0... ...xcode 3.1 installed over top of above after
2016 Apr 26
0
How to print the frequency table (produced by the command "table" to Excel
Hi jpm miao, You can get CSV files that can be imported into Excel like this: library(prettyR) sink("excel_table1.csv") delim.table(table(df[,c("y","z")])) sink() sink("excel_table2.csv") delim.table(as.data.frame(table(df[,c("y","z")])),label="") sink() sink("excel_table3.csv")
2012 Feb 17
2
(subscript) logical subscript too long in using apply
Dear ALL I have this function in R: func_LN <- function(data){ med_ge <- matrix(c(rep(NA,nrow(data)*ncol(data))), nrow = nrow(data), ncol=ncol(data), byrow=TRUE) T <- matrix(c(rep(NA,length(n)*ncol(data))), nrow = length(n), ncol=ncol(data), byrow=TRUE) Tdiff<- matrix(c(rep(NA,length(n)*ncol(data))), nrow = length(n), ncol=ncol(data), byrow=TRUE) T1<- c(rep(NA,ncol(data)))
2004 Apr 18
2
lm with data=(means,sds,ns)
Hi Folks, I am dealing with data which have been presented as at each x_i, mean m_i of the y-values at x_i, sd s_i of the y-values at x_i number n_i of the y-values at x_i and I want to linearly regress y on x. There does not seem to be an option to 'lm' which can deal with such data directly, though the regression problem could be algebraically
2001 Feb 15
2
deviance vs entropy
Hello, The question looks like simple. It's probably even stupid. But I spent several hours searching Internet, downloaded tons of papers, where deviance is mentioned and... And haven't found an answer. Well, it is clear for me the using of entropy when I split some node of a classification tree. The sense is clear, because entropy is an old good measure of how uniform is distribution.
2011 Jun 15
1
Reshaping data with xtabs reorders my rows
Dear, I have a data frame melted from a list of matrices (melt from reshape package), then I impute some missing values and then want to tabulate the data again to the array (or list, doesn't matter) of matrices form. However when using xtabs function it orders my rows alphabetically and apparently doesn't take "reorder = FALSE" option or anything like it. Is there anything I
2009 Nov 15
2
resampling problem counting number of means above a specific value
I am trying to modify some code from Good 2005. I am trying to resample the mean of 8 values and then count how many times the resampled mean is greater than 10. But my count of means above 10 is coming out as zero, which I know isn't correct. I would appreciate it if someone could look at the code below and tell me what I am doing wrong. Many thanks, Graham > LL<-
2003 Jul 17
3
univariate normal mixtures
Hello, I have a concrete statistical question: I have a sample of an univariate mixture of an unknown number (k) of normal distributions, each time with an unknown mean `m_i' and a standard deviation `k * m_i', where k is known factor constant for all the normal distributions. (The `i' is a subscript.) Is there a function in R that can estimate the number of normal distributions k
2008 Jul 31
1
rollapply() to portions of a matrix
Hi everyone, I have a rollapply statement that applies a function, in steps, over a data matrix as follows: #Code start testm<-rollapply(mat, 100, by=100, min, na.rm=F) #Code end This moves down matrix 'mat' and calculates the minimum value over a 100 row range, every 100 rows (i.e. no overlaps). NAs are not removed. I want to modify this statement somehow so that the rollapply()
2009 Mar 17
3
R does not compile any more on FreeBSD 8.0-CURRENT
On a recent FreeBSD 8.0-CURRENT (i386) building R (any version) breaks with the following messages: ---------------------------------------------------------------------- [...snip...] gcc -std=gnu99 -I. -I../../src/include -I../../src/include -I/usr/local/include -DHAVE_CONFIG_H -g -O2 -c wilcox.c -o wilcox.o gcc -std=gnu99 -I. -I../../src/include -I../../src/include -I/usr/local/include
2004 Feb 03
1
Stereo mode settings
Hi everyone, I'd like a bit of information about the stereo mode settings in psych_44.h of libvorbis. Specifically, about the adj_stereo structure: typedef struct { int pre[PACKETBLOBS]; int post[PACKETBLOBS]; float kHz[PACKETBLOBS]; float lowpasskHz[PACKETBLOBS]; } adj_stereo; What I am attempting to do is bring lossless stereo coupling down to the lower quality levels in
2018 Feb 02
1
R-gui sessions end when executing C-code
Hi I'm trying to develop some C code to find the fixpoint of a contraction mapping, the code compiles and gives the right results when executed in R. However R-gui session is frequently terminated. I'm suspecting some access violation error due to the exception code 0xc0000005 In the error report windows 10 gives me. It is the first time I'm writing any C-code so I'm guessing I
2012 May 23
1
numerical integration
Greetings, Sorry, the last message was sent by mistake! Here it is again: I encounter a strange problem computing some numerical integrals on [0,oo). Define $$ M_j(x)=exp(-jax) $$ where $a=0.08$. We want to compute the $L^2([0,\infty))$-inner products $$ A_{ij}:=(M_i,M_j)=\int_0^\infty M_i(x)M_j(x)dx $$ Analytically we have $$ A_{ij}=1/(a(i+j)). $$ In the code below we compute the matrix
2001 Oct 03
1
package GeneSOM ?
Hello Rprofessionals, The SOM-Obj works very well, when i normalize my data and the plot-function, too ! But i miss or didn't find the possibility , extract the information from the SOMplot "clusterSize" and "mean" for every cluster as quantitative information ( i.e. the DataFrame with an additional column which define the calculate clusters from SOM)? My intention -
2009 Jul 30
1
stepwise variable selection method wanted
Hi List, I am looking for a variable selection procedure with a forward-backward selection method. Firstly, it is meant to work with the cophenetic correlation coefficient (CPCC) and intended to find the variable combination with the highest cophenetic correlation. Secondly, it is aimed at Gower metric with wards method (though this could be easily extended) aimed at categorical data. What I
2012 Mar 16
2
how to speed up the inefficient code
hi, i'm really in trouble to simulate some experiment. that is, it takes too much time to process the following code. following is short example, ------------------------------------------------------------------------------------------------------- p<-data.frame(a=rnorm(10),b=rnorm(10),c=rnorm(10),d=rnorm(10)) test<-data.frame(a=rnorm(1),b=rnorm(1),c=rnorm(1),d=rnorm(1))