similar to: apply (or similar preferred) for multiple columns

Displaying 20 results from an estimated 2000 matches similar to: "apply (or similar preferred) for multiple columns"

2006 Aug 16
3
separate row averages for different parts of an array
I have an array with 44800 columns and 24 rows I would like to compute the row average for the array 100 columns at a time, so I would like to end up with an array of 24 rows x 448 columns. I have tried using apply(dataset, 1, function(x) mean(x[])), but I am not sure how to get it to take the average 100 columns at a time. Any ideas would be welcomed. thanks, Spencer [[alternative HTML
2011 Mar 04
2
apply.rolling() to a multi column timeSeries
Hello there, I am trying to compute the 3 months return momentum with the timeSeries x.ts, which is just a subset of simple returns from a much bigger series, > class(x.ts) [1] "timeSeries" attr(,"package") [1] "timeSeries" > dim(x.ts) [1] 20 3 > x.ts[1:8,] GMT MS.US AAPL.US CA.FP 1996-01-31 0.15159065 -0.133391894
2004 Nov 30
1
Using mimR
Hi, I am trying to use the mimR Package. According to its help pages it needs the RDCOMClient package to run. When I try to evaluate a model I get > m.sat<-mim("..",data=gm.dat) Error in mim.cmd("clear; clear output") : couldn't find function "COMCreate" > m2.sat<-emfit(m.sat) Error in toMIM(mim$data) : Object "m.sat" not found >
2006 Jan 16
3
distorted native music on hold
Hello, Using asterisk-1.2.1 I am trying to convert my music-on-hold files from .wav to alaw: % sox moh.wav -r 8000 -c 1 moh.al resample -ql The file sounds fine when listened with: % sox mox.al -t ossdsp /dev/dsp But when listened through asterisk with an alaw SIP phone the sound is clicky and too fast. Did I forget something in my conversion command? -- ldm@apartia.fr
2007 Dec 05
1
Working with "ts" objects
I am relatively new to R and object oriented programming. I have relied on SAS for most of my data analysis. I teach an introductory undergraduate forecasting course using the Diebold text and I am considering using R in addition to SAS and Eviews in the course. I work primarily with univariate or multivariate time series data. I am having a great deal of difficulty understanding and working with
2011 Nov 24
2
proper work-flow with 'formula' objects and lm()
Dear all I have a work-flow issue with lm(). When I use > lm(y1~x1, anscombe) Call: lm(formula = y1 ~ x1, data = anscombe) Coefficients: (Intercept) x1 3.0001 0.5001 I get as expected the formula, "y1 ~ x1", in the print()ed results or summary(). However, if I pass through a formula object > (form <- formula(y1~x1)) y1 ~ x1 > lm(form, anscombe) Call:
2020 Oct 15
0
package(moments) issue
moments::anscombe.test(x) does give errors when x has too few values or if all the values in x are the same > moments::anscombe.test(c(1,2,6)) Error in if (pval > 1) pval <- 2 - pval : missing value where TRUE/FALSE needed > moments::anscombe.test(c(2,2,2,2,2,2,2,2)) Error in if (pval > 1) pval <- 2 - pval : missing value where TRUE/FALSE needed You can use tryCatch() to
2020 Oct 15
2
package(moments) issue
Hi all, While running the anscombe.test in R, I'm getting an error of *Error in if (pval > 1) pval <- 2 - pval : missing value where TRUE/FALSE needed* for a few time series columns whereas for most of the series the function is working fine. I have checked for those specific columns for missing values. However, there is no NA/NAN value in the dataset. I have also run kurtosis for
2013 Jun 27
3
using "rollapply" to calculate a moving sum or running sum?
#using "rollapply" to calculate a moving sum or running sum? #I am tryign to use rollapply to calcualte a moving sum? #I tried rollapply and get the error message #"Error in seq.default(start.at, NROW(data), by = by) : # wrong sign in 'by' argument" #example: mymatrix <- ( matrix(data=1:100, nrow=5, ncol=20) ) mymatrix_cumsum <- ( matrix(data=NA, nrow=5,
2002 Dec 15
1
Tierra games...
Hi, I found these remakes of old Sierra games at http://www.tierraentertainment.com/ They run on an windows adventure game engine AGS found at http://www.adventuregamestudio.co.uk Due to the engine author's reclutance for helping linux people, the only solutions seems to be using wine to get these ancient-but-excellent games running. So far they have made King's Quest 1 VGA and
2020 Oct 15
2
package(moments) issue
Hi Bill, Thanks for prompt reply and letting me know a way around it. I have more than 1200 observations and not all the values are the same. However, my data points are quite similar, for example, 0.079275, 0.078867, 0.070716 in millions and etc. I have run the data without converting it to millions and I still get the same error message. As I have kurtosis value, it should be fine for the
2010 Jun 10
2
points marking
Hi, How to mark points on x axis of a graph keeping x axis as constant and changing y from y1 to y2 respectively. I want to highlight the area from y1 to y2. Any suggestions Thank you Jeet [[alternative HTML version deleted]]
2007 Mar 13
2
turn regression coefficients into matrix or...
I don't have much experience with r. What I am trying to do is to turn regression coefficients (after I run a lm or glm model) into some matrix such that I can do some post-estimation calculation, for example predicted probabilities in glm model, etc.. Or, is there any function in r that I can use to do something along that line? thanks. Jun Xu, Ph.D. Department of Sociology Ball State
2006 Sep 25
1
Rows of a data frame to matrix
useRs, I have a data frame where four of the columns of the data frame represent the values of a two-by-two matrix. I'd like to, row-by-row, go through the data frame and use the four columns, in matrix form, to perform calculations necessary to create new values for variables in the data frame. My first idea was to use apply: apply(as.array(data.frame[,1:4]), 1, matrix, nrow=2) Though
2009 Mar 23
1
performance: zoo's rollapply() vs inline
zoo's rollapply() function appears to be extremely useful for plugging in a function on-the-fly to run over a window. With inline, there is a lot more coding and room for error, and the code is less portable because the user has to have R compiling set up or it won't work. However, rollapply() seems to be really slow. Several orders of magnitude slower than inline, in fact. I don't
2010 Apr 09
3
"fill in" values between rollapply
Hi, Sorry ahead of time for not including data with this question. Using rollapply to calculate mean values for 5 day blocks, I'd use this: Roll5mean <- rollapply(data, 5, mean, by=5, align = c("left")) My question is, can someone tell me how to fill in the days between each of these means with the previously calculated mean? If this doesn't make sense, I will clarify and
2011 Oct 25
1
alternative option in skewness and kurtosis tests?
I have a question about the D'Agostino skewness test and the Anscombe-Glynn kurtosis test. agostino.test(x, alternative = c("two.sided", "less", "greater")) anscombe.test(x, alternative = c("two.sided", "less", "greater")) The option "alternative" in those two functions seems to be the null hypothesis. In the output, the
2017 Apr 17
6
doubt
I added a linux server to the Active Directory domain, I realized that the samba-winbind package uses the smb.conf file, but I also need to use the same linux server with shares, if I install the samba package, this package use the smb.conf file. Is there a solution? Then i have problem with 2 services. Example systemctl services: smb.service winbind.service My system is Centos 7. --
2012 Feb 15
2
integrate (error: evaluation of function gave a result of wrong length)
Dear all, I am trying to use the integrate function in R but it seems that it does not work in my example and I cannot figure out why. I create a function Mu1 (which works fine) and try to integrate by the code: n <- 100 Ctrl <- as.matrix(cbind(runif(n, -30, 30))) W <- Ctrl + as.matrix(rnorm(n)) Rsp <- (W>as.matrix(sample(10, n, T)))*1 Mu1 <- function(x, Y=Rsp, Xc=Ctrl){ x
2007 Aug 26
3
subset using noncontiguous variables by name (not index)
Hi All, I'm using the subset function to select a list of variables, some of which are contiguous in the data frame, and others of which are not. It works fine when I use the form: subset(mydata,select=c(x1,x3:x5,x7) ) In reality, my list is far more complex. So I would like to store it in a variable to substitute in for c(x1,x3:x5,x7) but cannot get it to work. That use of the c function