similar to: Multiple conditional without if

Displaying 20 results from an estimated 7000 matches similar to: "Multiple conditional without if"

2012 Jul 12
3
Add row into a Matrix witout headers from Function
Hi, Here i have a matrix like this, OLDMatrix <- X1 X2 X3 ----- ------ ------ 22 24 23 25 27 27 10 13 15 the thing is, im running two function(SUM,COUNT) to get output in another matrix called NEWMatrix NEWMatrix <- c("SUM",colSums(OLDMatrix )) NEWMatrix <- c("COUNT",colSums(!is.na(OLDMatrix
2005 Apr 21
1
large matrix
Dear R-users I need to convert a matrix with three columns in a new array with multiple columns. For example, oldmatrix 1 4 5 1 54 52 1 9 43 2 32 5 2 54 6 2 76 6 3 54 54 3 543 7 3 54 6 newmatrix 5 5 54 52 6 7 43 6 6 if the first column have a new value then add a column to the new matrix and the new[i,j] <- old[,3][i] I write this code, but my initial matrix is very
2010 Jan 28
2
NA Replacement by lowest value?
Hi all, I need to replace missing values in a matrix by 10 % of the lowest available value in the matrix. I've got a function I've used earlier to replace negative values by the lowest value, in a data frame, but I'm not sure how to modify it... nonNeg = as.data.frame(apply(orig.df, 2, function(col) # Change negative values to a small value, close to zero { min.val =
2007 Mar 07
5
hwo can i get a vector that...
dear all, how can i get a vector that shows the number of the column of matrix that contains the maximum of the row ?? can?t believe in need a loop for this... i have a 100 x 3 matrix and want to get a 100 x 1 vector with values 1,2,3 . there must be a simple solution. i just cannot find it. i think am searching on the wrong end. thx for help in advance. m.
2008 Jul 12
5
shapiro wilk normality test
Hi everybody, somehow i dont get the shapiro wilk test for normality. i just can?t find what the H0 is . i tried : shapiro.test(rnorm(5000)) Shapiro-Wilk normality test data: rnorm(5000) W = 0.9997, p-value = 0.6205 If normality is the H0, the test says it?s probably not normal, doesn ?t it ? 5000 is the biggest n allowed by the test... are there any other test ? ( i know qqnorm
2007 Mar 01
7
count the # of appearances...
Hi there, is there a possibility to count the number of appearances of an element in a vector ? i mean of any given element.. deliver all elements which are exactly xtimes in this vector ? thx in advance !!
2008 Jan 06
3
run setwd at the launch of R
Dear all, my R files (and the .csv files as well) are saved somewhere pretty deep down my hard disk. i have to chage to working directory therefore everytime i run R (i run it on powerPC mac), which is disgusting. using the setwd command at the beginning of an R script doesnt really help because i have to find this file first by hand. I am looking for possibility to run setwd during the
2010 Apr 28
7
operator problem within function
Dear all, i have a problem with processing dataframes within a function using the "$". Here´s my code: recode_items = function(dataframe,number,medium=2){ # this works q<-paste("columna",number,sep="") # this does not work, particularly because "dataframe" is not processed # dataframe should be: givenframe$columnagivennumber
2008 Sep 23
3
odds ratio: how to create reference
HI there, i know this is a basic question, though i need some help because this is somewhat away from my current issue, but nevertheless interesting to me... Lets assume i have some estimated probabilities, say estimated by a logit model. i know i can also state them as an odds ratio. Now i?d like to state these odds ratios as a reference to a specific outcome of my investigated
2006 Nov 24
2
vector problem
Hello out there, i am not yet that experienced and trying to my best on a real survey. but i am stuck with a little matrix / vector problem. my vector of answers could have a length of 3 or only one. i want to rbind all the answers into one matrix. (one vector for each participant) answers vectors for one participant could look like: p1: 100 p2: 20 80 p3: 40 10 50 i have the following
2010 Jun 01
3
lapply with functions with changing parameters
Dear all, I am trying to avoid a for loop here and wonder if the following is possible: I have a data.frame with 6 columns and i want to get a cross-correlogram (by using ccf) . Obivously ccf only accepts two columns at once and then returms a list. In fact, with a for loop i?d do the following for (i in 1:6) { x[[i]]=ccf(mydf[,i],mydf[,6]) } Is there any chance to the same with
2008 Sep 17
3
t-test between percentages
Hi all, though i know this is a simple question, i really hope someone could. I am just trying to compare percents respectively the difference in percents by a simple test. t.test usually compares means and is working like it is supposed to be. Now i wonder how i can use a test in R to test for significant difference between two percentages.
2010 Feb 03
1
plm package index
Dear all, i just wonder if there´s a way to use a two column time index field in plm package. the manual says the following concerning data indexing: a character vector of length two containing the names of the individual and the time index, What would y´all do with a quarterly dataset that contains one column for the period and one for the year. Do I have to convert it to one single date
2009 Jan 13
5
indexing question
Hi all, i have a pretty easy indexing question, at least i believe so. The main reason i post it here, is that brackets and $ are hard to google. How do I index correctly, if i just want to display the whole dataset conditioned on the fact that some particular column equals one. I know i can do something like: data$somecolumn[data$particularcol ==1] . That will show all "some
2006 Jul 20
2
function names in a vector used by for (){} character problem ?
Hi there, i´m have vector of kernels. just like: kernels = c('gauss','epan','rectangular') i know there are density.default$kernels, but thats not my question here. my own kernel functions are running and working. my problem is the following is not working: dev.off() par(mfrow=c(3,3)) for(i in 1:length(bw)) { for(j in 1:length(kernels)) {
2008 Nov 28
2
editor for MacOS X
Hi all, just wondered again, if there is some R editor for Mac OS X comparable to TINN-R on windows. thx in advance..
2008 Sep 18
5
propensity score adjustment using R
Hi all, i am looking to built a simple example of a very basic propensity score adjustment, just using the estimated propensity scores as inverse probability weights (respectively 1-estimated weights for the non-treated). As far as i understood, MLE predictions of a logit model can directly be used as to estimates of the propensity score. I already considered the twang package and the
2009 Aug 31
1
how to add data to some ts
Dear all, Finally, I made it, my RPostgreSQL works. After working through some tutorials, i was able to plot, get and replace several timeseries. Still I miss the opportunity (syntax) to add data. Most tutorials are about: "Download some S&P data from Yahoo and play around a little". What I want to do is, add data to an existing timeseries. Is there a possibility to add data
2008 Oct 09
1
adjusted t-test with unequal variance
Hi all, right now i am simply comparing means. obviously this can be done by the simple t.test respectively the welch test, if var.equal is set to FALSE. just like this t.test( Y ~ group) t.test( Y ~ group, var.equal = FALSE) now that i need to compare weighted means i am using the lm function as an adjusted t-test: like lmtest <- ( Y ~ group ) anova(lmtest)
2010 Jul 22
2
Sweave special characters problem
Dear all, I use Sweave to create my reports. Unfortunately my script crashes whenever I my R code contains special characters like umlauts. Is there a way to to escape special characters in Sweave... This is the line that crashes Sweave: gl_bybranch = ddply(new_wans,.(period,Branchen), function(X) data.frame(Gesch?ftslage=mean(X$sentiment))) Unfortunately I can't just rename it, because I