[R] Scaling rows of a large Matrix::sparseMatrix()

2016-01-12 Thread tomdharray
Hello R-Users, I'm looking for a way to scale the rows of a sparse matrix M with about 57,000 rows, 14,000 columns, and 238,000 non-zero matrix elements; see example code below. Usually I'd use the base::scale() function (see sample code), but it freezes my computer. The same happens when I try

Re: [R] cross correlation of filtered Time series

2016-01-12 Thread Sudheer Joseph
Thank you, May I know the reason for keeping frequency as 60, the package says it expects frequency in hertz, how does it work if I input daily data?. The correlation max shown by the plot is at around 55 -ve lag (0.36). which is not the actual case, so there is some thing

Re: [R] Forecasting with Timeseries with Different Frequency

2016-01-12 Thread Bert Gunter
A statistics, not an R question, and hence OT here. However, look at the CRAN Time Series Task View and/or post on a statistics site like stats.stackexchange.com Cheers, Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus

Re: [R] Forecasting with Timeseries with Different Frequency

2016-01-12 Thread Berend Hasselman
Have a look at the midasr package available on CRAN. It might provide what you need. Berend > On 12 Jan 2016, at 17:16, Lorenzo Isella wrote: > > Dear All, > Suppose you have some time series, e.g. monthly data about > profits in a company. > I am trying to develop a

Re: [R] for loop

2016-01-12 Thread Jim Lemon
Hi maryam (firoozi), Apart from the fact that you are overworking your sires (or the more realistic scenario of differential mating success) you can achieve the 700:30 ratio in this simple way: sires<-paste("Sire",1:30,sep="") dams<-paste("Dam",1:700,sep="")

Re: [R] cross correlation of filtered Time series

2016-01-12 Thread Giorgio Garziano
Hello, I think that the package "seewave" may help you. See corenv() function. https://cran.r-project.org/web/packages/seewave/seewave.pdf library(seewave) sst.ts <- ts(dc$sst, frequency=60) t2m.ts <- ts(dc$t2m, frequency=60) corenv(sst.ts, t2m.ts) corenv.res <- corenv(sst.ts, t2m.ts,

Re: [R] Running R 3.2.2 on Mac OS X 10.11.3 - not getting proper response to ls and dir commands ... launching error scripts. See below:

2016-01-12 Thread William Dunlap via R-help
> getwd() [1] "/Users/johnbeyer" > dir function (path = ".", pattern = NULL, all.files = FALSE, full.names = FALSE, recursive = FALSE, ignore.case = FALSE, include.dirs = FALSE, Note what a difference the parentheses after the function name make. With parentheses, often with

Re: [R] Running R 3.2.2 on Mac OS X 10.11.3 - not getting proper response to ls and dir commands ... launching error scripts. See below:

2016-01-12 Thread David Winsemius
> On Jan 12, 2016, at 1:22 PM, John Beyer wrote: > > This is what I get when i try to run dir or ls on my R Console: > > > getwd() > [1] "/Users/johnbeyer" >> dir > function (path = ".", pattern = NULL, all.files = FALSE, full.names = FALSE, >recursive = FALSE,

[R] Trying to use name of difference variable created in a function in call to wilcox.test function.

2016-01-12 Thread John Sorkin
I am trying to write a function which will allow me to analyze many variables all of which have the same form, Base.stem and Disch.stem, where stem varies from variable to variable, e.g. Base.rolling and Disch.rolling, Base.standing, Disch.standing. I want to pass a dataframe and the stem of

[R] Running R 3.2.2 on Mac OS X 10.11.3 - not getting proper response to ls and dir commands ... launching error scripts. See below:

2016-01-12 Thread John Beyer
This is what I get when i try to run dir or ls on my R Console: getwd() [1] "/Users/johnbeyer" > dir function (path = ".", pattern = NULL, all.files = FALSE, full.names = FALSE, recursive = FALSE, ignore.case = FALSE, include.dirs = FALSE, no.. = FALSE) .Internal(list.files(path,

Re: [R] printing a data.frame that contains a list-column of S4 objects

2016-01-12 Thread boB Rudis
I wonder if something like: format.list <- function(x, ...) { rep(class(x[[1]]), length(x)) } would be sufficient? (prbly needs more 'if's though) On Tue, Jan 12, 2016 at 12:15 PM, Jenny Bryan wrote: > Is there a general problem with printing a data.frame when it has a >

Re: [R] Trying to use name of difference variable created in a function in call to wilcox.test function.

2016-01-12 Thread William Dunlap via R-help
Is the following function, myFormula(), what you are looking for? myFormula <- function(stem, env = parent.frame()) { eval(bquote(.(as.name(paste0("Disch.",stem))) ~ .(as.name(paste0("Base.",stem))), list(stem=as.name("rolling"))), envir=env) } str(myFormula("myStem")) #Class "formula"

Re: [R] Trying to use name of difference variable created in a function in call to wilcox.test function.

2016-01-12 Thread Bert Gunter
I think you're looking for ?bquote . Something like this should give you the idea: nm <- "yvar" bquote( .(y)~x, list(y = as.symbol(nm ))) The key is distinguishing between the character string "yvar" and the (language) object, as.symbol("yvar"). Cheers, Bert Bert Gunter "The trouble with

Re: [R] for loop

2016-01-12 Thread Michael Dewey
Dear Maryam Please keep the list cc'ed in as others will have better answers than me. If dam has 700 members then sample (dam) gives you a random permutation of dams, each once. I did not understand the second part as i do not think you can have 30 sires each occurring 20 times. Did you

[R] for loop

2016-01-12 Thread maryam firoozi via R-help
Dear mr/madam I want to mak a matrix with 10 row and 3 column . this matrix is pedigree. my input sire<- c(1,2,3,4,5) count<- 0 sire<- cbind(sire,count) dam<- c(1,2,3,4,5,6,7,8,9,10) ped<-mstrix(NA,nrow=10,ncol=3) for(i in 1:10){ Sire<- sample(sire[,1],1) a<- which(sire[,1]==Sire)

[R] Forecasting with Timeseries with Different Frequency

2016-01-12 Thread Lorenzo Isella
Dear All, Suppose you have some time series, e.g. monthly data about profits in a company. I am trying to develop a model to predict what the profit will be the next month or two. Other useful data is for sure the number of employes in the company, the volume of product purchases etc...but they

Re: [R] for loop

2016-01-12 Thread Michael Dewey
Dear Maryam sample(dam) would give you a random permutation of dams sample(c(sire, sire)) would give you a random permutation of sires, each twice. Does that help? On 12/01/2016 05:53, maryam firoozi via R-help wrote: Dear mr/madam I want to mak a matrix with 10 row and 3 column . this

[R] printing a data.frame that contains a list-column of S4 objects

2016-01-12 Thread Jenny Bryan
Is there a general problem with printing a data.frame when it has a list-column of S4 objects? Or am I just unlucky in my life choices? I ran across this with objects from the git2r package but maintainer Stefan Widgren points out this example below from Matrix as well. I note that the offending