similar to: randomness using runif

Displaying 20 results from an estimated 9000 matches similar to: "randomness using runif"

2012 Sep 12
3
how to create a substraction matrix (subtract a row of every column from the same row in other columns)
Hello I have data like this x1 x2 x3 x4 x5 I want to create a matrix similar to a correlation matrix, but with the difference between the two values, like this x1 x2 x3 x4 x5 x1 x2-x1 x3-x1 x4-x1 x5-x1 x2 x3-x2 x4-x2 x5-x2 x3 x4-x3 x5-x3 x4 x5-x4 x5 Then I
2011 Mar 18
4
Performance Difference? Windows vs. Linux
I'm not trying to start a Windows vs. Linux debate, but I've been using R on a Windows machine for a while, and was recently wondering if R's performance would be faster on a Linux machine. And similarly, if any incremental increase in processing speed would be worth the time it would take me to migrate my entire system to Linux (including a database that I access via an R package.)
2012 Oct 10
3
Numeric "Label" of Factor value?
Sorry, I'm sure I'm not using the appropriate vocab here, which is undoubtedly why I can't seem to find a fix to this (hopefully very easy) problem. Suppose you have a factor abc <- factor(c(2,2,3,4,7,7)) And you want to know what the number in the nth spot in that would be abc[1] [1] 2 Levels: 2 3 4 7 shows the correct label of the first element - but if I want to pull out the
2009 May 06
2
Print to File Formatting
Hello, I am writing out to a file and have two quick questions that I can't seem to track down the correct answers for. Luckily, I *think* they are both simple enough that someone might be able to point me in the right direction on them without too much trouble. Both questions relate to the process below where CompleteFrame is a data frame containing what I want printed to a file. filename
2008 Dec 09
2
Applying min to numeric vectors
I was surprised this morning, that it seems as though the min() function does not work as *I* anticipated when given vector arguments. For example: a <- 1:10 b <- c(rep(1, times=5), rep(10, times=5)) Result: > min(a,b) 1 What I actually wanted was a term by term minimum, i.e.: ifelse(a<=b, a, b) 1 1 1 1 1 6 7 8 9 10 Am I losing much in terms of computation power if I use
2009 Jan 16
2
Missing file to run Rcmd batch on Windows
Hi, I'm trying to run an R script using Rcmd Batch from the command line on a Windows Vista machine. I am using R version 2.8.1. I installed the batch files 4-3 found at http://cran.r-project.org/contrib/extra/batchfiles/ and added them to my path. I also had to install the latest version of perl (it's Strawberry perl if that makes a difference) and have added this to my path. Now when
2011 Apr 06
3
Decimal Accuracy Loss?
This is hopefully a quick question on decimal accuracy. Is any decimal accuracy lost when casting a numeric vector as a matrix? And then again casting the result back to a numeric? I'm finding that my calculation values are different when I run for loops that manually calculate matrix multiplication as compared to when I cast the vectors as matrices and multiply them using "%*%".
2012 Jun 01
3
Add rank column to data frame as in SQL...
Hopefully this is an easy problem... I'm trying to add a partitioned rank column to a data frame where the rank is calculated separately across a partition by categories, the way you could easily do in SQL. I found this solution in the archives that looked like it might work: http://tolstoy.newcastle.edu.au/R/e11/help/10/09/8675.html The example has a data frame with several car companies,
2008 Dec 18
2
formatting print statements with multiple lines
When executing the command: print(cat(paste("Input criteria does not meet specifications. Check input against the following requirements: a >= 0 b <= 0 c >= 0 ", sep=""), "")) I get: Input criteria does not meet specifications. Check input against the following requirements: a >= 0 b <=
2009 Feb 17
6
Percentiles/Quantiles with Weighting
Hi All, I am looking at applications of percentiles to time sequenced data. I had just been using the quantile function to get percentiles over various periods, but am more interested in if there is an accepted (and/or R-implemented) method to apply weighting to the data so as to weigh recent data more heavily. I wrote the following function, but it seems quite inefficient, and not really very
2008 Nov 14
2
Embed SQL queries in R?
Hi All, Most of the work I am doing with R uses data which I am pulling from various SQL queries. To streamline the process even more, I was wondering if it was possible to embed SQL queries in R - that way avoiding the need to first get the data, then move to R to process it. I haven't found anything out there on this yet, so if you know of a good resource that includes this topic, I would
2009 Aug 24
2
Multiply List by a Numeric
I apologize for what seems like it should be a straighforward query. I am trying to multiply a list by a numeric and thought there would be a straightforward way to do this, but the best solution I found so far has a for loop. Everything else I try seems to throw an error "non-numeric argument to binary operator" Consider the example: a <- 1 b <- 1:2 c <- 1:3 abc <-
2013 Jan 31
2
Automated Start for new Rgui within existing R code?
Is there a way to start multiple instances of R in an automated manner? Since I'm not sure that question makes tons of sense, here's my scenario: I have a number of data updates that need to be completed on an ongoing basis with the data pulled from and then stored to another location. The updates are manually triggered, so can build up in terms of the volume that needs to be updated.
2009 May 20
2
Example for parsing XML file?
Hi, I am trying to parse XML files and read them into R as a data frame, but have been unable to find examples which I could apply successfully. I'm afraid I don't know much about XML, which makes this all the more difficult. If someone could point me in the right direction to a resource (preferably with an example or two), it would be greatly appreciated. Here is a snippet from one of
2008 Nov 19
2
Exclude holidays in a subset of dates?
Hi All, I am iterating through dated materials, with variable start and end dates, and would like to skip procedures everytime I encounter a weekend or holiday. To do this, I thought the easiest way would be to create a TRUE/FALSE vector corresponding to each day where it is TRUE if a workday, and FALSE if a weekend or holiday. So far I have been able to do this for weekdays: startDate <-
2009 Jan 13
2
Memory Size & Allocation in R
My apologies if this is a bit of a 'newbie' question. I am using R v 2.8.0 in Windows and am a bit confused about the memory size/allocation. A script I wrote faulted out with the error: "Error: cannot allocate vector of size 5.6 Mb" After this error, I still have: > memory.size() [1] 669.3517 > memory.limit() [1] 1535.875 Since the memory size is well under 5.6Mb less
2010 Jun 09
1
Problem Matching Exact Values
Sorry for the basic question - bur I ran into something I haven't noticed before and would appreciate a little more perspective on my problem. I am using R to determine if various thresholds are hit (or surpassed) in a data set.? If a threshold is surpassed, I have had no problems identifying it.? However, when the threshold is matched *exactly*, not all cases are being identified. Please
2010 Mar 26
2
R loop help
Hi, I am tring to write a loop to compute this, ========================== x1=c( rep(-1,4), rep(1,4) ) x2=c( rep(c(-1,-1,1,1),2) ) x3=c( rep(c(-1,1),4) ) x1*x2 x1*x3 x2*x3 ======================== suppose i have x1,x2,x3 i want to compute their ' two factor interactions', x1x2,x1x3 and x2x3, I wrote ======================== for(i in 1:2){ for( j in i+1:3){ xij=c()
2008 Dec 22
2
How can I avoid nested 'for' loops or quicken the process?
Hi All, I'm still pretty new to using R - and I was hoping I might be able to get some advice as to how to use 'apply' or a similar function instead of using nested for loops. Right now I have a script which uses nested for loops similar to this: i <- 1 for(a in Alpha) { for (b in Beta) { for (c in Gamma) { for (d in Delta) { for (e in Epsilon) { Output[i] <-
2009 Jan 21
3
Error as.Date on Invalid Dates
Hi All, I have an script in R which accepts user inputs for certain parameters, particularly dates, which the user inputs as character strings. eg: > date1 <- "2009-01-21" The script later parses the input via the as.Date function: > as.Date(date1) However, as.Date encounters an error when the string does not represent an actual date. eg: > date1 <-