similar to: create a zero matrix & fill

Displaying 20 results from an estimated 400 matches similar to: "create a zero matrix & fill"

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
0
RES: initialize a matrix
You have to put the tml in the function and deltat too. like VAR<-function(power,length,deltat,tml){ -----Mensagem original----- De: r-help-bounces em r-project.org [mailto:r-help-bounces em r-project.org]Em nome de mysimbaa Enviada em: sexta-feira, 4 de julho de 2008 11:22 Para: r-help em r-project.org Assunto: [R] initialize a matrix Dear R users, I'm trying to write a function
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
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
2020 May 20
2
Precision of function mean,bug?
Hello R-dev, Yesterday, while I was testing the newly implemented function pmean in package kit, I noticed a mismatch in the output of the below R expressions. set.seed(123) n=1e3L idx=5 x=rnorm(n) y=rnorm(n) z=rnorm(n) a=(x[idx]+y[idx]+z[idx])/3 b=mean(c(x[idx],y[idx],z[idx])) a==b # [1] FALSE For idx= 1, 2, 3, 4 the last line is equal to TRUE. For 5, 6 and many others the difference is small
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
2020 May 20
2
Precision of function mean,bug?
> On Wednesday, May 20, 2020, 7:00:09 AM EDT, peter dalgaard <pdalgd at gmail.com> wrote: > > Expected, see FAQ 7.31. > > You just can't trust == on FP operations. Notice also Additionally, since you're implementing a "mean" function you are testing against R's mean, you might want to consider that R uses a two-pass calculation[1] to reduce floating
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
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
2011 Mar 15
4
Element by element mean of a list of matrices
Hi All, is there any effiective and dense/compact method to calculate the mean of a list of - of course coincident - matrices on an element by element basis? The resulting matrix' [i, j]-th element is the mean of the list's matrices' [i, j]-th elements respectively... Iterating by for statement is quite straightforward, but I am seeking for a more elegant solution, and my attempt with
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. --
2017 Jul 12
0
Extracting sentences with combinations of target words/terms from cancer patient text medical records
Hi Paul, Sounds like you have your answer, but for fun I thought I'd try solving your problem using only a regular expression query and base R. I believe this works: > txt <- "Patient had stage IV breast cancer. Nothing matches this sentence. Metastatic and breast match this sentence. French bike champion takes stage IV victory in Tour de France." > pattern <-
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
2017 Jul 12
2
Extracting sentences with combinations of target words/terms from cancer patient text medical records
Hi Bert, Thanks for your reply. It appears that I didn't replace the variable name "sampletxt" with the argument "x" in my function. I've corrected that and now my code seems to be working fine. Paul ________________________________ From: Bert Gunter <bgunter.4567 at gmail.com> Cc: R-help <r-help at r-project.org> Sent: Tuesday, July 11, 2017 2:00 PM
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 Sep 02
2
cluster a distance(analogue)-object using agnes(cluster)
I try to perform a clustering using an existing dissimilarity matrix that I calculated using distance (analogue) I tried two different things. One of them worked and one not and I don`t understand why. Here the code: not working example library(cluster) library(analogue) iris2<-as.data.frame(iris) str(iris2) 'data.frame': 150 obs. of 5 variables: $ Sepal.Length: num 5.1 4.9 4.7
1998 Oct 16
3
mean and sd of each serial position
I want to do something like this in R. If I have three vectors > a1 [1] 1 2 3 > a2 [1] 4 5 6 > a3 [1] 9 10 7 I want to compute 1. A vector that is the mean at each serial position of a1, a2, and a3. so in this example it would have the contents 4.667, 5.667, 5.333333 2. A vector that is the SD at each serial position of a1, a2, and a3. so in this example it would have the contents
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