similar to: which() with multiple conditions

Displaying 20 results from an estimated 50000 matches similar to: "which() with multiple conditions"

2010 Jul 10
4
eliminating constant variables
Hi all, I have a large data set and want to immediately build a 'blind' model without first examining the data. Now it appears in the data there are a lot of fields that are constant or all missing values - which prevents the model from being built. Can someone point me the right direction as to how I can automatically purge my data file of these useless fields. Thanks in advance, pdb
2011 Jun 13
2
computer name
Is there an r function that will be able to identify the computer the code is running on? I have some common code that I run on several computers and each has a database with a different server name - although the content is identical. I need to set thisServer depending on which machine the code is running on... something like... if(pcname = pc1) thisServer = 'SERVER1' if(pcname = pc2)
2010 Aug 01
3
finding max value in a row and reporting colum name
Hi, Hopefully someone can point me in the right direction on how I would go about solving the following. I have some data and need to find the column name of the maximum value in each row. This could be the data... > a <- data.frame(x = rnorm(4), y = rnorm(4), z = rnorm(4)) > a x y z 1 1.6534561 0.11523404 0.2261730 2 -1.2274320 -0.24096054 1.5096028
2010 May 04
4
timing a function
Hi, I want to time how long a function takes to execute. Any clues on what to search for to achieve this? Thanks in advance. -- View this message in context: http://r.789695.n4.nabble.com/timing-a-function-tp2126319p2126319.html Sent from the R help mailing list archive at Nabble.com.
2010 Jul 29
2
how to 'stack' data frames?
I have 2 data frames (A & B) with some common column names. A has 10 rows. B has 20 rows. How do I combine them so I end up with a data frame with 30 rows that only contains the common columns. I was trying 'merge' (Merge two data frames by common columns .....etc. ) but that is not giving me what I expect... > a <- iris > b <- iris > > c <-merge(a,b) >
2010 Jun 30
5
plot focus
I am doing calculations in a loop and then plotting the results by adding a point to each of 2 charts at the end of the loop. Its very informative as you can see the progression through time. My problem is, if I have 2 plots, I don't know how to get the focus back to the first plot. layout(matrix(c(1,2))) plot(iris[,1],col="red",) #plot1 plot(iris[,3],col="blue") #plot2
2010 Jul 05
2
r code exchange site?
Does there exist a site where snippets of r code examples can be deposited, such as the one that exists for matlab? http://www.mathworks.com/matlabcentral/fileexchange/ ps I also noted from the main r site http://www.r-project.org/ when you click on the nabble link under the search link, I end up here http://e-nvf.vvvay.net/-td13672.html#a13819 which I don't think is anything to do with
2012 Apr 12
3
directory of current script
I am running a series of scripts sequentially and they all need some global parameters. These will be included in a file in a known sub directory as the scripts themselves. The scripts need to be run by anyone without ANY editing. Question is: Is there a command to return the directory of the current script, so it then knows where to find the global parameter file? Or is there a simpler way?
2012 Sep 05
2
POSIXlt and daylight savings time
I have a data frame that contains dates, but when I use as.POSIXlt() I lose the hours on all records. I traced this down to a particuar hour which causes the issue... > as.POSIXlt('2004-10-31 02:00:00') [1] "2004-10-31" > as.POSIXlt('2004-10-31 03:00:00') [1] "2004-10-31 03:00:00" How do I tell as.POSIXlt() to ignore daylight savings and just convert to
2011 May 01
1
caret - prevent resampling when no parameters to find
I want to use caret to build a model with an algorithm that actually has no parameters to find. How do I stop it from repeatedly building the same model 25 times? library(caret) data(mdrr) LOGISTIC_model <- train(mdrrDescr,mdrrClass ,method='glm' ,family=binomial(link="logit") ) LOGISTIC_model 528
2010 Sep 01
1
transaction object - how to coerce this data
Hi, I am wanting to look at frequent item sets using the arules package. I need to transform my data into a "transactions" object. The data I read in from a file has 2 columns, an ID and an item. How do I convert data like this into a transactions object? I've tried class? transactions but it only confuses me. My data is like this.... basketID item 1 bread 1 cheese 1 milk 2
2010 Jul 31
1
Lags and Differences of zoo Objects
Hi, I'm struggling to understand the documentation. ?lag.zoo x - a "zoo" object. k, lag - the number of lags (in units of observations). Note the sign of k behaves as in lag. differences - an integer indicating the order of the difference. What does the above line actually mean? I've tried a few settings on sample data but can't figure out what it is doing. x <-
2011 Jun 18
1
can this sequence be generated easier?
I have 'x' variables that I need to find the optimum combination of, with the constraint that the sum of all x variables needs to be exactly 100. I need to test all combinations to get the optimal mix. This is easy if I know how many variables I have - I can hard code as below. But what if I don't know the number of variables and want this to be a flexible parameter. Is there a sexy
2010 May 04
1
randomforests - how to classify
Hi, I'm experimenting with random forests and want to perform a binary classification task. I've tried some of the sample codes in the help files and things run, but I get a message to the effect 'you don't have very many unique values in the target - are you sure you want to do regression?' (sorry, don't know exact message but r is busy now so can't check). In
2011 Jan 26
2
2 functions with same name - what to do to get the one I want
There seems to be 2 functions call ecdf... http://lib.stat.cmu.edu/S/Harrell/help/Hmisc/html/ecdf.html http://127.0.0.1:11885/library/stats/html/ecdf.html How do I get the one ecdf {Hmisc} to run instead of the ecdf {stats} A pointer in the right direction would be greatly appreciated. Tried to instal Hmisc but got this message, so I assume I have it > utils:::menuInstallPkgs() Warning:
2010 Jul 29
1
where did the column names go to?
I've just tried to merge 2 data sets thinking they would only keep the common columns, but noticed the column count was not adding up. I've then replicated a simple example and got the same thing happening. q1. why doesn't 'b' have a column name? q2. when I merge, why does the new column 'y' have all values as 5.1? Thanks in advance, Mr. confused > a <-
2012 Apr 24
1
Multiple Conditional Statement
Dear R helpers, I have two separate data frames. In one data frame the transaction data is stored and the other data frame has exchange rates stored say rate_A and rate_B where rate_A and rate_B are series of rates. rate_A and rate_B are properly defined and I am reading them through the appropriate dataframe. (Actually I have a different datasets and to try to keep things simple, I am defining
2012 May 08
1
revolution foreach oddity
I know this is not a revolution support forum, but as anyone noticed the following? I have a foreach loop to generate random samples. If I run the exact code below in normal r (2.14.1) it works as expected, but if I run it from revolution 4.2.0 each loop returns the same numbers. The only way I can get revolution to give different numbers is using 1 instead of 8 in registerDoSNOW(makeCluster(8,
2012 Mar 29
1
How to access value of the conditioning variable in my panel
Hi, I have 10 panels in the "mypanel" function of my xyplot based on the conditioning variable and I want to print those ten values, panel headings, groups, .. whatever you want to call them. Easiest way please! Fayez [[alternative HTML version deleted]]
2012 Jan 08
2
multivariate problem
Dear all,  I am not sure if this is the right place to ask this question, but I will have a go. Please redirect me to a different place if this is not the right one! I have a (relatively) simple problem which causes me some frustration because I cannot find the solution. I measure ten variables (var1 to var10) every day, they are all continuous (linear) and most of them are correlated. Some days,