Displaying 20 results from an estimated 10000 matches similar to: "Dynamically build variable names"
2010 May 21
1
S4 method defined but not used
Dear R developers,
I am having a slightly weird issue with a S4 method defined in my package adegenet 1.2-4, with R 2.11.0. As far as I know, the problem is new, and the code implementing the method has not changed for more than a year and worked well so far.
The problem is the following. I define, in the package, a method "[" for the S4 class 'genind'. The method's
2010 May 28
5
difference in sort order linux/Windows (R.2.11.0)
Dear R users,
I'm a bit perplexed with the effect sort has here, as it is different on
Windows vs. linux.
It makes my factor levels and subsequent plots different on the two systems.
Given:
types <- c("PC-D-Euro-0", "PC-D-Euro-1", "PC-D-Euro-2", "PC-D-Euro-3",
"PC-D-Euro-4", "PC-D-Euro-5", "PC-D-Euro-6",
2010 Jul 14
2
qplot in ggplot2 not working any longer - (what did I do?)
This is the first time that I have tried to update packages with a
tinkered around with .Rprofile. I start R with R --vanilla and it
does not load my .Rprofile, but when I issue the command
update.packages() R downloads the packages as expected, but then seems
to load .Rprofile before compiling the packages sources. What am I
doing wrong?
kindest regards,
Stephen Sefick
see- Session info
2010 Jun 16
2
Backslash in paste() function
Hi,
I'm trying to build a vector of latex commands. However, I need the command strings to begin with a backslash "\". I have:
test <- c('foo','bar')
and I need to rebuild the array, encapsulating the text items with latex stuff, like this:
paste("\parbox[b]{3cm}{", test, "}", fill=TRUE)
Actually, cat() prints the string fine if one uses
2010 May 09
2
Non-zero exit status for survival package
I'm running R 2.11 on Karmic. I'm having difficulty installing quite a
few packages with the returned error message of "installation of package
"[whatever the packages happens to be]" had non-zero exit status. I know
this message sometimes is caused by incorrect or missing java packages
and the like. I generally don't have issues with the installation of R
or R packages
2010 May 13
1
results of pnorm as either NaN or Inf
I stumbled across this and I am wondering if this is unexpected behavior
or if I am missing something.
> pnorm(-1.0e+307, log.p=TRUE)
[1] -Inf
> pnorm(-1.0e+308, log.p=TRUE)
[1] NaN
Warning message:
In pnorm(q, mean, sd, lower.tail, log.p) : NaNs produced
> pnorm(-1.0e+309, log.p=TRUE)
[1] -Inf
I don't know C and am not that skilled with R, so it would be hard for me
to look into
2010 Jan 07
1
regex question on escaping "." (and a couple other regex questions as well)
I have an example where escaping "." does not seem to be behaving
consistently, but perhaps it is due to my misunderstanding. Could someone
explain to me why the below produces the output it does?
It seems to me that in the second example, where I am being more precise
about specifying that a "." (dot) should be between the numbers, should
produce the same output as the first
2008 May 28
1
Search&replace string?
Hi there,
I would like to know if it is possible to modify a text file with a R function.
In fact I would like to know if a function "Search & Replace" exists.
My problem is to create config files from a Base file in which I have to modify values of parameters.
My Base File:
#...
#...
Param1= V1_1
#...
Param2 = V2_1
Param3 = V3_1
#...
What I would like for each created file
2014 Nov 22
3
R string comparisons may vary with platform (plain text)
A colleague?s R program behaved differently when I ran it, and we thought
we traced it probably to different results from string comparisons as
below, with different R versions. However the platforms also differed. A
friend ran it on a few machines and found that the comparison behavior
didn?t correlate with R version, but rather with platform.
I wonder if you?ve seen this. If it?s not some
2010 Jul 09
2
Compress string memCompress/Decompress
Hello,
I would like to compress a long string (character vector), store the compressed string in the text field of a SQLite database (using RSQLite), and then load the text back into memory and decompress it back into the the original string. My character vector can be compressed considerably using standard gzip/bzip2 compression. In theory it should be much faster for me to compress/decompress
2010 May 26
2
segfault on 2.11.0 with large POSIXct vector using as.character
Running "as.character" on a large POSIXct causes a segfault on my 2.11
(2010-04-22) install. Seems to crash at around 9e4 ... on OSX and Ubuntu at
least.
> invisible(as.character(Sys.time()+1:7e4))
> invisible(as.character(Sys.time()+1:8e4))
> invisible(as.character(Sys.time()+1:9e4))
Error: segfault from C stack overflow
> invisible(as.character(Sys.time()+1:5e5))
Error:
2015 Aug 13
2
Bug in rank with utf8?
Yes, collation is a strange thing, and?
Collation order will depend on locale settings, and there are quite a few cases where the collation order of two items is not defined.
To add to the confusion, on OSX Mavericks, I see
> x <- "\u0663"
> y <- 3
>
> x == y
[1] FALSE
> rank(c(x, y))
[1] 2 1
> x
[1] "?"
> x == y
[1] FALSE
> x > y
[1] TRUE
2011 Sep 15
2
Unexpected behavior from which.max (or possibly max)
Hi all,
I was recently writing a script to identify the value and id of the maximum
observation in a sliding window when I ran into some unexpected behavior. I
have included an example.
> test <- c()
> test$elev <- c(1:200)
> test$i <- 1
> test$window <- 10
The following works for me:
> check.max <- function(x){obs.max <- x$elev[x$i:x$i+x$window]; obs.max}
2014 Jan 17
1
rexp, different results on 32/64 bit
Hi all,
I just run into this today. Apparently rexp() sometimes gives different
slightly results for the same seed on 32 bit and 64 bit machines. runif()
is the same for both, so the problem seems to be in rexp().
64 bit Linux is the same as 64 bit OSX, and R-devel gives the same results
as R-3.0.2.
Best,
Gabor
# ---------------------------------------------
> options(digits=22) ;
2010 Oct 28
2
scatterplot3d; scaling point symbols to depth of graph
Hi
I'm trying to scale the point symbols on a 3d plot so that the ones at the front are larger than the ones at the back. I'm trying to give the image some perspective.
Given this code...
library(scatterplot3d)
data=array(c(0,5,9), c(3,3))
scatterplot3d(data, pch=19, cex.symbols=10-data[,2], color=c("red","blue","black"));
> data
[,1] [,2] [,3]
2008 Jun 11
4
Matrix transformation problem
ng,
I have a matrix (x) with binary content. Each row of the matrix holds exactly one 1, and the rest of the row is zeros. The thing is that I need to 'collapse' the matrix to one column where each row holds the original column index of the 1's (y). Sometimes, the matrix is quite large, so I have a perfomance problem.
x <- matrix(c(1,0,0, 0,0,1, 0,1,0, 0,0,1, 0,1,0,
2011 Feb 07
2
Error with named chunks in Sweave with the development version of R
Dear all,
There seems to be a problem with named chunks in Sweave with the version
of R under development (downloaded yesterday). When I sweave the file
toto.Rnw described at the end of this mail (Ubuntu 10.04 LTS), the
function Sweave returns an Internal error:
> utils::Sweave("toto.Rnw")
Writing to file toto.tex
Processing code chunks ...
1 : echo term verbatim (label=a)
2
2011 Apr 01
3
Syntax coloring in R console
Dear all,
I am a happy user of R console, but I would like to see syntax
coloring. I use R 2.12 in Ubuntu Linux.
I have found the packages "xterm256" and "highlight", but I was not
able to figure out how to use it to highlight the syntax in console
output.
Also, I tried several GUI interfaces, but I was not able to find
something that suits me better than the default R
2011 Apr 10
1
deparse operators in expressions
Hi,
I observed a slight problem in deparse(): it will add spaces around
most operators except /. I wonder if this is easy to fix. I know this
is quite trivial, but I will appreciate if / is not treated as an
exception. Examples:
> deparse(expression(1/1))
[1] "expression(1/1)"
> deparse(expression(1+1))
[1] "expression(1 + 1)"
> deparse(expression(1%in%1))
[1]
2016 Jan 08
5
rgl.snapshot only captures a small portion what's visible in the RGL device window on CentOS 7
Hello,
As an example, I ran the following code:
library("rgl")
example(plot3d)
rgl.snapshot("test.png")
The full plot is visible in the window titled RGL device 1 [Focus], but only a small