similar to: related to my previous sapply question]

Displaying 20 results from an estimated 2000 matches similar to: "related to my previous sapply question]"

2006 Jun 28
2
hopefully my last question on lapply
Marc and many other people ( whose names escape me ) have been very helpful in explaining the use of lapply to me. In his last response, Marc explained that if tradevectors is a list of vectors of different lengths ( excuse my terminology ) then lapply(tradevectors,function(x) G[x]*B[x] ) will go through each component of the list as if it was a vector and apply the element by element
2006 Jun 26
2
probably need to se sapply but i can't get it
Hi : I think I need to use sapply but I can't figure this out. Suppose I have two vectors : tempa ( 4, 6,10 ) and tempb ( 11,23 ,39 ) I want a function that returns 4:11,6:23 and 10:39 as vectors. I tried : sapply(1:length(tempa) function (z) seq(tempa[z],tempb[z]) but i got 3 really strange vectors back in the sense that the numbers in them did not make no sense to me. obviously, i
2006 Nov 16
1
getting a title in a plot during an lapply
In my code below tempa and tempb are numeric vectors that I combined into a dataframe along with the deciles of tempa. I have an lapply statement that goes through the dataframe and does ten plots according to the appropriate decile. The code is below and it works fine. There are no bugs so I figure there was no need to include structure statements on the data. Also, I don't want to use coplot
2008 Jun 04
2
converting a table to a dataframe or a matrix
can someone show me how to convert a table to a data.frame or a matrix ? I tried below and as.data.frame rearranges the columns similarly to a melt from reshape and as.matrix didn't change it. I actually would prefer to change it to a dataframe but if someone can show me how to convert it to a matrix, then as.data.frame will work on that. I was thinking about just changing the class to
2011 Aug 01
4
Use dump or write? or what?
Greetings all, I am calculating two t-test values for each of many files then save it to file calculate another set and append, repeat. But I can't figure out how to write it to file and then append subsequent t-tests. (maybe too tired ;} ) I have tried to use "dump" and "file.append" to no avial. ttest_results = tempfile() two_sample_ttest <- t.test (tempA, tempB,
2012 May 30
1
caret() train based on cross validation - split dataset to keep sites together?
Hello all, I have searched and have not yet identified a solution so now I am sending this message. In short, I need to split my data into training, validation, and testing subsets that keep all observations from the same sites together ? preferably as part of a cross validation procedure. Now for the longer version. And I must confess that although my R skills are improving, they are not so
2006 Jan 23
1
will vectorization help in this case?
Hi all, I am doing a array marginalization over one dimension in the following manner: =========================================================== for(l in 1:L) { flst=list(Pzu, Pzi, array(Puzu[,as.character(r[[l,"u"]])], dim=dim(Puzu)[1], dimnames=dimnames(Puzu)[1]), array(Pizi[,as.character(r[[l, "i"]])], dim=dim(Pizi)[1], dimnames=dimnames(Pizi)[1]) ); tempa = 1;
2012 Jul 03
2
EM algorithm to find MLE of coeff in mixed effects model
I have a general question about coefficients estimation of the mixed model. I simulated a very basic model: Y|b=X*\beta+Z*b +\sigma^2* diag(ni); b follows N(0,\psi) #i.e. bivariate normal where b is the latent variable, Z and X are ni*2 design matrices, sigma is the error variance, Y are longitudinal data, i.e. there are ni
2008 Oct 22
4
A matrix automation problem
[I am really sorry if it is double posted, I doubt me previous post could not reach forum due to some problem with net] Suppose I have a matrix : a = matrix(1:9, 3) >From this matrix, I construct 9 additional matrices : i = 1:9 bi = a * i Now combining all those 9 new matrices, I construct a final metrix as : c = b1 b4 b7 b2 b5 b8 b3 b6 b8 I want to automate this procedure for any
2010 Aug 05
2
[Bug 29403] New: [nvac] attempting to use displayport freezes machine
https://bugs.freedesktop.org/show_bug.cgi?id=29403 Summary: [nvac] attempting to use displayport freezes machine Product: xorg Version: git Platform: Other OS/Version: All Status: NEW Severity: normal Priority: medium Component: Driver/nouveau AssignedTo: nouveau at lists.freedesktop.org
2012 Jul 03
0
need help EM algorithm to find MLE of coeff in mixed effects model
Dear All, have a general question about coefficients estimation of the mixed model. I simulated a very basic model: Y|b=X*\beta+Z*b +\sigma^2* diag(ni); b follows N(0,\psi) #i.e. bivariate normal where b is the latent variable, Z and X are ni*2 design matrices, sigma is the error variance, Y are longitudinal data, i.e. there are ni
2005 Feb 28
1
Using mutiply imputed data in NLME
Dear All, I am doing a growth modeling using NLME. I have three levels in my data: observation, individual, household. About half of my total sample have missing values in my household-level covariates. Under this situation, the best way to go is probably to multiply impute the data (for, say, 5 times), estimate the same model separately on each model using LME function, and merge the results. My
2009 May 15
4
replace "%" with "\%"
Dear all, I'm trying to gsub() "%" with "\%" with no obvious success. > temp1 <- c("mean", "sd", "0%", "25%", "50%", "75%", "100%") > temp1 [1] "mean" "sd" "0%" "25%" "50%" "75%" "100%" > gsub("%",
2012 May 06
2
Translation of matlab vectors code into r
Hi there I am new user of r, i would need some help to translate som code for vectors in matlab to r. I have managed to translate the first 7 rows, but not the rest. Could anyone give me any suggestions for this problem?? Matlab code: tempo=[]; temps=[]; tempn=[]; tempao=[]; tempas=[]; tempan=[]; for k=1:5 tempo = [tempo n_o(k,:)]; temps = [temps n_s(k,:)]; tempn = [tempn
2004 Feb 18
1
forwarding
Greetings All. I wonder if it's possible to implement unix-domain-socket forwarding in opnessh. It might very useful since "namespace" for unix sockets is much bigger than for tcp ports and it would be easier to avoid any "name" clashes. In fact such implementation already exists as agent forwarding so what is my wish is to be able to specify local and remote socket name
2009 Jul 08
3
matching each row
I have two dataframes, the first column of each dataframe is a unique id number (the rest of the columns are data variables). I would like to figure out how many times each id number appears in each dataframe. So far I can use: length( match (dataframeA$unique.id[1], dataframeB$unique.id) ) but this only works on each row of dataframe A one-at-a-time. I would like to do this for all of
2009 Jun 17
1
sapply() related query
Hi folks, I'm trying to consolidate the outputs (of anova() and lrm()) from multiple runs of single-variable logistic regression. Here's how the output looks: ------------------------------------------------------------ y ~ x1 y ~ x2 y ~ x3 y ~ x4 Chi-Square 0.1342152 1.573538 1.267291 1.518200 d.f. 2 2
2011 Oct 09
1
sapply(pred,cor,y=resp)
Hello. I am wondering why I am getting NA for all in cors=sapply(pred,cor,y=resp). I suppose that each column in pred has NAs in them. Is there some way to fix this? Thanks > str(pred) 'data.frame':   200 obs. of  13 variables:  $ mnO2: num  9.8 8 11.4 4.8 9 13.1 10.3 10.6 3.4 9.9 ...  $ Cl  : num  60.8 57.8 40 77.4 55.4 ...  $ NO3 : num  6.24 1.29 5.33 2.3 10.42 ...  $ NH4 : num  578
2002 Oct 17
4
Newbie Time Series Questions
I have a data set of monthly river flows from 1960-2000, which are similar in structure to the nottem data: > klam.flow Oct Nov Dec Jan Feb Mar Apr May Jun Jul Aug Sep 1961 1461 1716 2524 1773 1906 2005 1756 1575 1387 983 1094 1382 1962 1907 2253 1985 1907 1769 1676 2634 1386 929 766 968 1309 ... I tried plotting with > ts.plot(klam.flow) Which quickly led me to
2003 Jun 12
3
unionfs related patch
G'day ... David Schultz, in his spare time, has been working through some of the issues I've been able to 'tweak' in the unionfs code ... as he is currently working on forward-patching it to -CURRENT right now, he can't commit the code to the -STABLE tree ... in order to allow others using unionfs to test the patch (I've been running it a few weeks now on a very heavily