similar to: directory of current script

Displaying 20 results from an estimated 6000 matches similar to: "directory of current script"

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 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 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
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
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
2009 Oct 12
1
field index given name.
Hi, How do I access the index number of a field given I only know the field name? eg - I want to set the probability of the field 'species' higher than the other fields to use in sampling. > colprob <- array(dim=NCOL(iris)) > for(i in 1:NCOL(iris)){colprob[i]=0.5} > colprob[iris$species] = 1 #this doesn't work > colprob [1] 0.5 0.5 0.5 0.5 0.5 -- View this
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
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
2009 Oct 10
1
field names as function parameters
Hi, I am passing a data frame and field name to a function. I've figured out how I can create the formula based on the passed in field name, but I'm struggling to create a vector based in that field. for example if I hard code with the actual field name Y = df$Target, everything works fine. but if I use the passed in parameter name, it doesn't give me what I want, Y = df$mytarget
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
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 <-
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)
2009 Oct 15
3
populating an array
Hi, Can someone please give me a pointer as to how I can set values of an array? Why does the code below not work? my_array <- array(dim=c(2,2)) my_array[][] = 0 my_array [,1] [,2] [1,] 0 0 [2,] 0 0 for(i in seq(1,2,by=1)){ for(j in seq(1,2,by=1)){ my_array[i][j] = 5 } } Warning messages: 1: In my_array[i][j] = 5 : number of items to replace is not a multiple of
2009 Oct 31
2
Logistic and Linear Regression Libraries
Hi all, I'm trying to discover the options available to me for logistic and linear regression. I'm doing some tests on a dataset and want to see how different flavours of the algorithms cope. So far for logistic regression I've tried glm(MASS) and lrm (Design) and found there is a big difference. Is there a list anywhere detailing the options available which details the specific
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,
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: