similar to: RES: initialize a matrix

Displaying 20 results from an estimated 700 matches similar to: "RES: initialize a matrix"

2008 Jul 04
1
initialize a matrix
Dear R users, I'm trying to write a function which returns minimum,maximum,mean of a vector(power) I've done the following : VAR<-function(power,length){ for(i in tml:length)){ tvar[i]<-i pmean[i]<-mean(power[i:i+deltat]) pmin[i]<-min(power[i:i+deltat]) pmax[i]<-max(power[i:i+deltat]) varmax[i]<-100*(pmax[i]-pmean[i])/pmean[i]
2008 Jul 04
2
create a zero matrix & fill
Dear R user, I have written a function which returns max,min and variation of a power (see below) Power is a given matrix(1,n) I call the function >Variation<-VAR(p,(n-deltat)) Now the problem is when I want plot(Results[1],Results[2]). Not possible! I become the following error (in english it means: Error in as.double.default(x) :Object cannot be transformed in double) >
2007 Nov 13
2
Plot segments with different colors
Hello Everybody, I'm trying to plot(x,y) using different colors. I have to cut (x,y) into sub intervals. And I want to plot this sub intervals using colors. But infortunally I don't know how to do this with R. Can any body help me please? My code is looking like : x<-c(tvar[1:t0],tvar[t0:(ts)],tvar[ts:n]) F<-c(var[1:t0],var[t0:(ts)],var[ts:n]) plot(x,F,xlab="Zeit
2008 Mar 03
3
Plot using colors
Dear R users, I have a problem since I try to plot my datas with different colors. plot(tvar, var, xlab="zeit [s]",ylab="Variation [%]", col = ifelse(var <= varstability, 'green','red')) this works well! But since I add a type="l" to my plot, it will color all the plot with green!!! Is there any solution? I avoid to use teachingDemos. Thanks. --
2004 Dec 13
3
Advice on parsing formulae
Dear list I would like to be able to group terms in a formula using a function that I will call tvar(), eg. the formula Y ~ 1 + tvar(x:A) + tvar(z) + u + tvar(B) + tvar(poly(v,3)) where x,u and v are numeric and A and B are factors - binary, say. As output, I want the model.matrix as if tvar had not been there at all. In addition, I would like to have information on the grouping, as a vector
2007 Dec 28
1
logistic mixed effects models with lmer
I have a question about some strange results I get when using lmer to build a logistic mixed effects model. I have a data set of about 30k points, and I'm trying to do backwards selection to reduce the number of fixed effects in my model. I've got 3 crossed random effects and about 20 or so fixed effects. At a certain point, I get a model (m17) where the fixed effects are like this
2009 Jul 26
0
Version 0.7 of package tsDyn, nonlinear time series
Hi Version 0.7 of package tsDyn presented at useR! 2009 is now on CRAN, extended with several new features. The package tsDyn is aimed at estimating nonlinear time series models which exhibit regime specific properties. The regime switching dynamics can either be described by smooth transition (STAR and LSTAR) or threshold effects (SETAR). The package furthermore offers nonlinear models
2009 Jul 26
0
Version 0.7 of package tsDyn, nonlinear time series
Hi Version 0.7 of package tsDyn presented at useR! 2009 is now on CRAN, extended with several new features. The package tsDyn is aimed at estimating nonlinear time series models which exhibit regime specific properties. The regime switching dynamics can either be described by smooth transition (STAR and LSTAR) or threshold effects (SETAR). The package furthermore offers nonlinear models
2000 Jul 19
1
How to use tcltk?
Hallo Tk experts, the Tcl/Tk package allows to define very nice widgets for starting R functions, for printing results and for interactive parameter input. tkdensity.R and tkttest.R demonstrate this and both demos explain how some of the tk functions can be used. For constructing new widgets I would like to see further examples showing Tcl/Tk package in action. Therefore my question: Is there a
2011 Sep 23
1
Cross Spectrum : Conversion of 2-D spectrum into a single complex array
Hi, I'm wondering why the spectrum() phase of quadrature couple isn't purely +/-pi. But mostly, I'm looking for a recommended way to take a 2-D spectrum and convert it into a single complex array. Kindly consider: # 10 Hz sine wave 10 seconds long sampled at 50 Hz deltaT = 1/50 t = seq(0, 10, deltaT) w = 2 * pi * 10 x = ts( sin( w * t ), deltat = deltaT ) y = ts( sin(
2008 Mar 26
1
cbind and mean by week
Hi: I have been able to finally crunch my data by importing it by week(thank you all for your help),but here we go again.. Now I'am trying to do it for the the whole year. Since the dataset is huge I'm only making a 3 weeks dataframe. - I want to get the mean of pd by week - I want to count the number of days by week and bind it to the existing dataframe(x) - I want to remove the
2017 Jul 13
0
Extracting sentences with combinations of target words/terms from cancer patient text medical records
Hi Paul, No need to collapse the information into a single text string, gregexpr() can take a vector of strings (sentences in your case). You can split your sentences up, number them how you want, then search for your pattern either via regex or via these extra packages you use which probably use the PCRE regex library anyway. However, as this is basically what you did, I'm not sure why
2017 Jul 13
1
Extracting sentences with combinations of target words/terms from cancer patient text medical records
Hi Robert, Thank you for your reply. An attempt to solve this via a regular expression query is particularly helpful. Unfortunately, I don't have much time to play around with this just now. Ultimately though, I think I would like to implement a solution something along the lines of what you have done. I have a book on regular expressions that I am now starting to read. In the meantime, the
2004 Apr 27
4
Problems raised to 1/3 power and NaN
I am debugging some code and found a function that returns and error most of the time. I have issolated the problem to when it raises an argument to the 1/3 power but for the life of me I can not figure out why it is not working. i have gone through the FAQs and have found nothing (not to say I might have missed something). I am highly embarrased with my inability find the problem (my face is
2017 Jul 11
0
Extracting sentences with combinations of target words/terms from cancer patient text medical records
Have you looked at the CRAN Natural Language Processing Task View? If not, why not? If so, why were the resources described there inadequate? Bert On Jul 11, 2017 10:49 AM, "Paul Miller via R-help" <r-help at r-project.org> wrote: > Hello All, > > I need some help figuring out how to extract combinations of target > words/terms from cancer patient text medical
2017 Jul 11
2
Extracting sentences with combinations of target words/terms from cancer patient text medical records
Hello All, I need some help figuring out how to extract combinations of target words/terms from cancer patient text medical records. I've provided some sample data and code below to illustrate what I'm trying to do. At the moment, I'm trying to extract sentences that contain the word "breast" plus either "metastatic" or "stage IV". It's been some
2010 Apr 20
1
bug in aggregate.ts
Hi, I am getting unexpected behaviour from aggregate.ts(). The 'ndeltat' argument is effectively being reduced by 1 in some cases, even when it is an integer, with the result that the blocks to be aggregated are not of the expected size, and also that the end() of the aggregated series is much later than the end() of the original series. rawts <- ts(rep(1:10, each = 5), start = 1) ##
2010 Apr 13
0
ccf problem (cross-correlation)
Hi all, I have a problem concerning my understanding of the cross-correlation (ccf) function in R. assume a time serie as: > t<-seq(0,6.28,by=0.01); > my_serie<-ts(sin(t),start=0,end=6.28,deltat=0.01) then I generate an other one shifted by 12 time points: > my_shifted_serie<-ts(sin(t),start=0+0.12,end=6.28+0.12,deltat=0.01) if I do the cross-correlation I get that the two
2006 Jul 13
1
ts and stl functions - still a problem
Hi I am still having problems with using the stl function, when I read the csv file into R into a file called tkr and use dim(tkr) the result is 132 1 which is fine. When coerce it into a trime series using ts either: tstkr <- ts(t(tkr), deltat=1/12) or tstkr <- ts(c(tkr), deltat=1/12) and use the stl function I get the following error: Error in
2012 Jan 07
1
using deltat parameter in time series in HoltWinters prediction
Hi. I have to forecast a time series of a Internet network traffic bitrate. The data are in file http://www.forumaltavilla.it/joomla/datitesi/dati.datand the sampling time is every 0.05 seconds. Now, i want to use HoltWinters forecasting. This is my script. dt=1.58443823e-9 #0.05 seconds in years dati.ts=ts(scan("dati.dat"),start=0,deltat=dt) model=HoltWinters(dati.ts)