similar to: why is 0 not an integer?

Displaying 20 results from an estimated 5000 matches similar to: "why is 0 not an integer?"

2009 Aug 04
4
array slice notation?
Suppose I have an n-diml array A and I want to extract the first "row" -- ie all elements A[1, ...] Interactively if I know 'n' I can write A[1,,,,,] with (n-1) commas. How do I do the same more generally, eg in a script? (I can think of doing this by converting A to a vector then extracting the approp elements then reshaping it to an array, but I wonder if there isn't a
2009 Jul 08
2
print() to file?
I'd like to write some objects (eg arrays) to a log file. cat() flattens them out. I'd like them formatted as in 'print' but print only writes to stdout. Is there a simple way to achieve this result? Thanks -- View this message in context: http://www.nabble.com/print%28%29-to-file--tp24397445p24397445.html Sent from the R help mailing list archive at Nabble.com.
2009 Jun 23
1
X-window graphics -- preventing window coming to front?
When I do dev.new(), the resulting window comes to the front and grabs the focus. Is there a way to prevent this so I can continue working in other windows while the graphics are being produced? Thanks -- View this message in context: http://www.nabble.com/X-window-graphics----preventing-window-coming-to-front--tp24167763p24167763.html Sent from the R help mailing list archive at Nabble.com.
2009 Jul 01
2
sorting question
I've asked about custom sorting before and it appears that -- in terms of a user-defined order -- it can only be done either by defining a custom class or using various tricks with "order" Just wondering if anyone has a clever way to order "vintages" of the form 2002, 2003H1, 2003H2, 2004, 2005Q1, 2005Q2, etc some have H1 or H2, some have Q1,Q2,Q3,Q4, some are just plain
2010 Feb 01
5
regular expression submatch?
What is the simplest way to extract a matched subexpression? Eg. in perl you can do "hello world" =~ m/hello (.*)/ which would return 1(true) and set $1 to the matched subexpression "world". -- View this message in context: http://n4.nabble.com/regular-expression-submatch-tp1459146p1459146.html Sent from the R help mailing list archive at Nabble.com.
2009 Apr 24
4
omit empty cells in crosstab?
Perhaps this is a common question but I haven't been able to find the answer. I have data with many factors, each taking many values. However, only relatively few combinations appear in the data, ie have nonzero counts, in other words the resulting table is sparse. Say we have 10 factors each with 10 levels. The result of table() would exceed the memory space (on a 32bit machine). Is there
2007 Sep 14
2
Building an R GUI using gWidgets and RGtk2
Hello, I'm developing a GUI in R that will be used to monitor financial portfolio performance. The GUI will be distributed as an R package. So far, I've decided to use the "cairoDevice", "RGtk2", "gWidgets", and "gWidgetsRGtk2" packages to develop the GUI. I am trying to decide what would be the best way to structure the GUI would be. I've
2006 Aug 04
2
Sampling from a Matrix
Hello all, Consider the following problem: There is a matrix of probabilities: > set.seed(1) > probs <- array(abs(rnorm(25, sd = 0.33)), dim = c(5,5), dimnames = list(1:5, letters[1:5])) > probs a b c d e 1 0.21 0.27 0.50 0.0148 0.303 2 0.06 0.16 0.13 0.0053 0.258 3 0.28 0.24 0.21 0.3115 0.025 4 0.53 0.19 0.73 0.2710 0.656 5 0.11 0.10 0.37 0.1960
2006 Jul 14
1
Splitting the left and right hand terms of a formula
Let's say I have the following formula: a.formula <- x ~ y + z I want to extract the left and right-hand sides of the function so that I have two character vectors like the ones you would create using the following assignments: left.hand.side <- "x" right.hand.side <- c("y", "z") One way to do this follows: left.hand.side <-
2009 Feb 13
3
R Help
Hi, I have a list of numbers (classified as a list) that contains integer(0) empty vectors. How do I convert those integer(0) into NAs? Thanks [[alternative HTML version deleted]]
2004 Jul 30
2
mirroring in both directions with rsync
When operating in daemon mode, will rsync check to see which file is newer and decide which direction to transfer based on that? Example, We have 2 terminal servers, A and B. I want users to be able to work on either server and have their home directories on both stay in sync. If a user logs into server A and changes files, the server would know to transfer the file from A to B. If they log
2009 Jun 17
4
searching help for partial matches
The situation is that I know there is a function and know approximately what the name is, and want to find the exact name. Is there a way of searching for near-matches (similar to unix apropos). For example, I know there is a function called something like allequal (or allequals or AllEquals or...). But ?allequal, etc, return nothing, only if I remember the name can I get help via ?all.equal.
2009 Jul 07
3
vectorizing a function
I'm sure I'm missing something obvious but I'm not seeing how to simply "vectorize" a function of two or more variables. Say I have f <- function(x,y) if (x>0) y else -y Now I have vectors x and y of equal length and I'd like to apply f element-wise. I.e. conceptually z <- f(x,y) where x, y, z are vectors of the same length Some magic involving apply?
2005 Jan 12
2
?"=" (Windows) (PR#7504)
?"=", ?"==", ?"!=", ?">=", and ?"<=" sends me to the documentation for ?help on Windows, while returning the correct documentation on Linux. Robert > version _ platform i386-pc-mingw32 arch i386 os mingw32 system i386, mingw32 status major 2 minor
2010 Feb 02
3
tapply for function taking of >1 argument?
I'm sure I can put this together from the various 'apply's and split, but I wonder if anyone has a quick incantation: E.g. I can do tapply( data, groups, mean) but how can I do something like: tapply( list(data,weights), groups, weighted.mean ) ? (or: mapply is to sapply as ? is to tapply ) Thanks for your help. -- View this message in context:
2006 Jul 25
1
Follow Up To: Splitting the left and right hand terms of a formula
Hi All, I sent the following message to R-help on July 14th, 2006: Let's say I have the following formula: a.formula <- x ~ y + z I want to extract the left and right-hand sides of the function so that I have two character vectors like the ones you would create using the following assignments: left.hand.side <- "x" right.hand.side <- c("y", "z") One
2005 May 11
7
bug in modulus operator %% (PR#7852)
The following can't be right, first rw2010: > 1 %% 0.001 [1] 0.001 Then rw2001: > 1 %% 0.001 [1] -2.081668e-17 > and the last seems about right. -- Kjetil Halvorsen. Peace is the most effective weapon of mass construction. -- Mahdi Elmandjra -- No virus found in this outgoing message. Checked by AVG Anti-Virus.
2005 Apr 22
3
as.data.frame: Error in "names<-.default" (PR#7808)
Hello, I found a potential problem in R 2.1.0 (and R 2.0.1) I expect that > tmp <- FUN(x1, x2, x3, x4) > as.data.frame(tmp) is the same as > as.data.frame(FUN(x1, x2, x3, x4)) since the tmp variable in this case is unnecessary. However, below I will demonstrate that under an odd set of conditions, I can correctly perform as.data.frame(tmp), but not as.data.frame(FUN(x1, x2, x3,
2006 Nov 29
1
Removing terms from formula
R-help, Given a simple linear model, say lm(x ~ y + z), I would like to remove model terms that are factors with only one level. Thus, if 'z' were a factor with only one level, lm(x ~ y + z) becomes lm(x ~ y + 1). Likewise, if both 'y' and 'z' are one-level factors, then the resulting calculation is simply lm(x ~ 1). Unfortunately, I have not been able to come up with an
2006 May 22
3
Wishlist: Vignettes on CRAN
I was recently browsing through CRAN's Finance task view to remind myself of the publicly available packages relevant to my work. As the reference manuals are all online, I am able to flip through the available functions to get an idea of the package's scope before downloading. That said, many authors have taken the time to additionally provide a useful vignette which provides a better