similar to: For each element in vector do...

Displaying 20 results from an estimated 20000 matches similar to: "For each element in vector do..."

2006 May 26
3
Vector elements and ratios
Dear useRs, I have two different length vectors: one column (1...m) and one row vector (1...n): 20 40 20 60 5 4 2 Now I have to calculate ratios between column vector elements and each row vector elements: 4 5 10 8 10 20 4 5 20 15 12 30 Thank's in advance for any suggestions, Andrej
2006 Jan 25
3
read.table problem
Dear R useRs, I have big (23000 rows), vertical bar delimited file: e.g. A00001|Text a,Text b, Text c|345 A00002|Text bla|456 ... .. . Try using A <- read.table('filename.txt', header=FALSE,sep='\|') process stop at line 11975 with warning message: number of items read is not a multiple of the number of columns I have no problems with processing similar file, which is
2006 Jan 28
1
Regex question
Dear R useRs, is there any simple, build in function to match specific regular expression in data file and write it to a vector. I have the following text file: *NEW RECORD *ID-001 *AB-text *NEW RECORD *ID-002 *AB-text etc. Now I have to match all ID fields and print them to a vector: 001 002 etc. I know that this is very simple with Perl or R-Perl interface, but if possible, I want to do
2007 Jun 25
3
How to shadow 'power' area?
Dear all, Suppose I plot two normal distributions (A and B) side by side and add vertical line which hipotheticaly represent alpha value; e.g.: x <- seq(-3.5,5, length=1000) y <- dnorm(x) # Plot distribution A plot(y~x, type='l',axes=F,xlab="",ylab="",lwd=2) # Plot distribution B y2 <- dnorm(x-1.5) lines(y2~x,lwd=2) # Plot vertical line for alpha value
2010 Feb 08
3
Hypercube in R
Dear all, Does anybody have an idea or suggestion how to construct (plot) 4-dimensional hypercube in R. Thanks in advance for any pointers. Regards, Andrej
2011 Nov 14
2
Checkinstall and R-2.14.0
Dear all, I try to install the latest R version using checkinstall (v. 1.6.2) on Ubuntu 11.10. After solving all the dependencies (installed using apt-get build-dep r-base) checkinstall fails to build and install R package with the following error (the same commands build and install R-2.13.2 on the same machine without any problem): wget
2008 Sep 18
2
Ability estimates for partial credit model
Dear all, I'm working on ability estimates using Rasch model. Using the "ltm" package, the procedure is quite simple: ## Factor Scores for the Rasch model fit <- rasch(LSAT) factor.scores(fit) What about Partial Credit Model (PCM)? For PCM I use PCM function from eRm package. Is there any similar function like factor.scores to estimate ability scores using PCM model? Best,
2006 Jan 15
1
Multiple comparison and two-way ANOVA design
Dear useRs, I'm working on multiple comparison design on two factor (2 3 levels) ANOVA. Each of the tests I have tried (Tukey, multcomp package) seem to do only with one factor at a time. fm1 <- aov(breaks ~ wool * tension, data = warpbreaks) tHSD <- TukeyHSD(fm1, "tension", ordered = FALSE) $tension diff lwr upr p adj M-L -10.000000 -19.35342
2006 Apr 24
1
rmeta: forest plot problem
Der useRs, I'm working on meta analysis using rmeta package. Using code below I plot the forest plot: library(rmeta) data (catheter) a<-meta.MH (n.trt, n.ctrl, col.trt, col.ctrl, data=catheter, names=Name, subset=c(13,6,5,3,7,12,4,11,1,8,10,2)) summary(a) # odds ratio values and confidence intervals metaplot(a$logOR, a$selogOR, nn=a$selogOR^-2,a$names, summn=a$logMH, sumse=a$selogMH,
2006 Jan 16
1
Problem with plot()
Dear R useRs, I have a problem to add title to the following graphics; Tukey=TukeyHSD(aov(CA~C), "C",ordered=TRUE)) plot (Tukey, main="My first graph") actually, it draw a graph, but it also display: parameter "main" could not be set in high-level plot() function. If I execute: plot(rnorm(1000),main="My first plot"), no error occur. What's the
2011 Apr 16
1
"chan_sip.c: No such host:" but I can resolve it from command line ?
Hi, I have Asterisk 1.4.10 under LMCE (upgrade is not an option) and have this strange error appearing in full log : [Apr 16 14:35:48] NOTICE[10802] chan_sip.c: -- Registration for 'NUMBER at voip.siol' timed out, trying again (Attempt #22) [Apr 16 14:35:48] WARNING[10802] chan_sip.c: No such host: voip.siol [Apr 16 14:35:48] WARNING[10802] chan_sip.c: Probably a DNS error for
2008 Mar 19
1
betabinomial model
Hi, can anyone help me fit betabinomial model to the following dataset where each iD is a cluster in itself , if i use package aod 's betabinom model it gives an estimate of zero to phi(the correlation coeficient ) and if i fix it to the anova type estimate obtained from icc( in package aod) then it says system is exactly singular. And when i try to fit my loglikelihood by
2011 Sep 02
5
Hessian Matrix Issue
Dear All, I am running a simulation to obtain coverage probability of Wald type confidence intervals for my parameter d in a function of two parameters (mu,d). I am optimizing it using "optim" method "L-BFGS-B" to obtain MLE. As, I want to invert the Hessian matrix to get Standard errors of the two parameter estimates. However, my Hessian matrix at times becomes
2006 May 23
5
conditional replacement
Hi How can do this in R. >df 48 1 35 32 80 If df < 30 then replace it with 30 and else if df > 60 replace it with 60. I have a large dataset so I cant afford to identify indexes and then replace. Desired o/p: 48 30 35 32 60 Thanx in advance. Sachin
2006 Nov 21
2
using nested ifelse and rowSums to create new variable?
Dear R-help community, If I have a data.frame df as follows: > df x1 x2 x3 x4 x5 x6 1 5 5 1 1 2 1 2 5 5 5 5 1 5 3 1 5 5 5 5 5 4 5 5 1 4 5 5 5 5 1 5 2 4 1 6 5 1 5 4 5 1 7 5 1 5 4 4 5 8 5 1 1 1 1 5 9 1 5 1 1 2 5 10 5 1 5 4 5 5 11 1 5 5 2 1 1 12 5 5 5 4 4 1 13 1 5 1 4 4 1 14 1 1 5 4 5 5 15 1 5 5 4
2007 Jun 06
1
error message: only first element in each line of matrix used
I have a matrix and am trying to write a code to 1. identify all neg values along each line 2. for each neg value I need to identify min(j+3) 3. end with this code: eq[i,j]<- ifelse(mat.r[i,j] < (0.5*mat.s[i,j]), mat.all[i,j], 0) This is the code I have so far. I have tried several different methods but I keep getting the same error message that the condition has length >1 and only
2005 May 31
2
A suggestion to improve ifelse behaviour with vector yes/no arguments
Dear All, I luckily found the following feature (or problem) when tried to apply ifelse-function to an ordered data. > test <- c(TRUE, TRUE, TRUE, FALSE, FALSE, FALSE, FALSE) > ifelse(test, 0, 1:4) [1] 0 0 0 4 1 2 3 > It roots into the ifelse-syntax: ans[!test & !nas] <- rep(no, length.out = length(ans))[!test & !nas] Would it be possible to disable this feature in the
2009 Oct 13
2
Greater than less than in "ifelse"
I'm trying to categorize a continuous variable (yes, I know that's horrible, but I'm trying to reproduce some exercises from a textbook) and don't really know an efficient way to do this. I have a data frame that looks like: surv_time relapse sex log_WBC rx 1 35 0 1 1.45 0 2 34 0 1 1.47 0 3 32 0 1 2.20 0 4 32
2004 Oct 15
6
length with missing values
R-help I have a martix with missing values( in which I want the sample size by column) When I : apply(matrix,2,length) I get the length of the vector regardless of missing values. I can't pass an argument to length in apply. Alternatively I could ifelse ( is.na ( matrix [, "columns in matrix " ] ) , 0 , 1) Is there any easier way? Thank you
2006 Aug 09
3
objects and environments
Dear list, I have two functions created in the same environment, fun1 and fun2. fun2 is called by fun1, but fun2 should use an object which is created in fun1 fun1 <- function(x) { ifelse(somecondition, bb <- "o", bb <- "*") ## mymatrix is created, then myresult <- apply(mymatrix, 1, fun2) } fun2 <- function(idx) { if (bb == "o) { #