Displaying 20 results from an estimated 30000 matches similar to: "sorting character vectors"
2010 Mar 26
1
BaselR
BaselR - The new R meeting
We are pleased to announce the new R meeting to be held in Basel,
Switzerland.
BaselR will be held from 6:30-9:30pm on Tues, Apr 27 at TransBARent:
http://transbarent.business.sv-group.ch
Doors open at 6:30,pm with the presentations starting at 7:00pm
Introduction: What is Basel R?
Andreas Krause:... Graphing Pharma Data
Yann Abraham: Graphics
Charles Roosen: Web
2002 May 21
2
using axis with newline characters
Wondering if I missed anything or if that's a problem with R:
I want to have many x axis tickmarks and labels such that it makes sense to put them on multiple "lines".
The newline character seems to be ignored though for axis labels:
plot(1:33, axes=F)
axis(1, 9, 9)
axis(1, 11, "\n11")
axis(1)
# whereas
title("one\ntwo")
works as I expect it to work.
In
2003 Nov 14
6
index of max value ?
Is there a function in R, which would return index of maximum value
in a vector ?
e.g.
> v <- round(10*rnorm(8))
> v
[1] 6 -3 -6 15 7 9 0 -19
> max(v)
[1] 15
??? index.max(v)
??? 4
2001 May 09
1
matrix: suspected integer overflow
Is the following a known issue, in particular in terms of message clarity of the latter two?
> matrix(0, 10^8, 10^8)
Error: cannot allocate vector of size 2064896 Kb
> matrix(0, 20, 10^10)
Error in matrix(0, 20, 10^10) : negative length vectors are not allowed
> matrix(0, 10^10, 10^10)
Error: cannot allocate vector of size 0 Kb
# looks better for arrays:
> array (0, c(20, 10^10))
2003 Dec 10
3
e1071:svm - default epsilon = 0.1 (NOT 0.5) (PR#5671)
In e1071 package/svm default epsilon value is set to 0.1 and not 0.5
as documentation says.
R
2003 Nov 12
4
column extraction by name ?
I have a data frame (df) with colums x, y and z.
e.g. df <- data.frame(x = sample(4), y = sample(4), z = sample(4))
I can extract column z by: df$z or df[3]
I can also extract columns x,y by: df[1:2] or by df[-3].
Is it possible to extract x,y columns in a "symbolic" fashion i.e.
by equivalent of df[-z] (which is illegal) ???
Or alternativeley, is there an equivalent of
2003 Dec 09
2
problem with pls(x, y, ..., ncomp = 16): Error in inherit s( x, "data.frame") : subscript out of bounds
I don't know the details of pls (in the pls.pcr package, I assume), but if
you use validation="CV", that says you want to use CV to select the best
number of components. Then why would you specify ncomp as well?
Andy
> From: ryszard.czerminski at pharma.novartis.com
>
> When I try to use ncomp parameter in pls procedure I get
> following error:
>
> >
2003 Oct 27
2
how to select random rows ?
How can I select random subsets (rows!) from a data set ?
If I generate simple data set
> a <- data.frame(x=1:2, y = NaN, z = 2:1)
> a
x y z
1 1 NaN 2
2 2 NaN 1
I can select random subsets (colums) very easily using sample function:
> sample(a, 2)
z y
1 2 NaN
2 1 NaN
I expected that using transpose of a would do the same for rows, but I am
getting
rather unexpected
2003 Oct 24
5
how to remove NaN columns ?
How can I remove columns with NaN entries ?
Here is my simple example:
> data <- read.csv("test.csv")
> xdata <- data[3:length(data)]
> xs <- lapply(xdata, function(x){(x - mean(x))/sqrt(var(x))})
> x <- data.frame(xs)
> x
C D E F
1 -0.7071068 NaN -0.7071068 -0.7071068
2 0.7071068 NaN 0.7071068 0.7071068
2003 Oct 31
3
print(), cat() and simple I/O in R
I am trying to produce rather mundane output of the form e.g.
pi, e = 3.14 2.718
The closest result I achieved so far with print() is:
> print (c(pi, exp(1)), digits = 3)
[1] 3.14 2.72
> print(c("pi, e =", pi, exp(1)), digits = 3)
[1] "pi, e =" "3.14159265358979" "2.71828182845905"
I understand that c() promotes floats to strings and
2007 May 09
4
Unit Testing Frameworks: summary and brief discussion
Greetings -
I'm finally finished review, here's what I heard:
============ from Tobias Verbeke:
anthony.rossini@novartis.com wrote:
> Greetings!
>
> After a quick look at current programming tools, especially with regards
> to unit-testing frameworks, I've started looking at both "butler" and
> "RUnit". I would be grateful to receieve real
2004 Mar 02
2
row.names are dropped when extracting one column ?
Apparently row names are dropped when I extract
single column from a data frame. Why this behaviour ?
> y <- as.matrix(df[,1:2]); length(row.names(y))
[1] 324
> y <- as.matrix(df[,1:1]); length(row.names(y))
[1] 0
Best regards,
Ryszard
2004 Jan 15
2
prcomp scale error (PR#6433)
Full_Name: Ryszard Czerminski
Version: 1.8.1
OS: GNU/Linux
Submission from: (NULL) (205.181.102.120)
prcomp(..., scale = TRUE) does not work correctly:
$ uname -a
Linux 2.4.20-28.9bigmem #1 SMP Thu Dec 18 13:27:33 EST 2003 i686 i686 i386
GNU/Linux
$ gcc --version
gcc (GCC) 3.2.2 20030222 (Red Hat Linux 3.2.2-5)
> a <- matrix(rnorm(6), nrow = 3)
> sum((scale(a %*% svd(cov(a))$u, scale
2003 Jun 18
2
Private: Problem with tapply/lapply and sample (PR#3286)
Full_Name: Peter Gedeck
Version: R1.6.2 and R1.7.0
OS: Windows XP
Submission from: (NULL) (194.191.169.72)
Hello,
I marked the bug report Private, as I don't want my email address on the web
server. The problem that I found is best explained using an example.
index <- 1:6
cluster <- c(1,1,1,2,2,3)
tapply(index,cluster,sample)
gives
$"1"
[1] 2 1 3
$"2"
[1] 4 5
2004 Feb 03
2
problem with read.table
Any ideas why read.table complains about not correct number of elements in
line
while readLine/strsplit indicate that all lines have the same number of
elements ?
R
> tbl <- read.table('tmp', header = T, sep = '\t')
Error in scan(file = file, what = what, sep = sep, quote = quote, dec =
dec, :
line 32 did not have 27 elements
> lines <-
2006 Dec 28
13
Sorting/Ordering Search Results
Hello All,
I am having an issue with AAF and sorting results of a search. Right
now, I have results being split onto pages of 10. The results are being
sorted alphabetically, but not across multiple pages - it''s just sorting
the 10 it pulls down on each page. I noticed another post from April
regarding this same issue (http://www.ruby-forum.com/topic/62993#66934)
where the issue was
2007 Jul 09
2
Problems with sorting of search results
Hey ..
maybe someone got a hint for me .. I''ve got a
problem with the sorting of search results ..
strangely enough, the sorting is fine on my mac
development environment, but not okay on my
linux live system.
I got a field in my index called hierarchy. It
contains long strings like:
Living together > Family > Brother-In-Law
Living together > Family > Marriage > Wife
2004 Jun 09
4
how to initialize random seed properly ?
I want to start R processes on multiple processors from single shell
script
and I want all of them to have different random seeds.
One way of doing this is
sleep 2 # (with 'sleep 1' I am often getting the same number)
...
set.seed(unclass(Sys.time()))
Is there a simpler way without a need to sleep between invoking
different R processes ?
Ryszard
2006 Oct 16
10
Sorting by score
Hi I think this is a very easy question but here goes:
I want to sort my results by a boolean field and then by score, I
thought this would be a default configuration but apparently not.
sort_fields = []
sort_fields << Ferret::Search::SortField.new(:sponsored, :reverse =>
:true)
that is my current code, how do iu alter it so that the results are then
sorted by highest score first?
2008 Jan 03
2
confidence interval too small in nlme?
Hello,
I am interested in using nlme to model repeated measurements, but I don't seem
to get good CIs.
With the code below I tried to generate data sets according to the model given
by equations (1.4) and (1.5) on pages 7 and 8 of Pinheiro and Bates 2000 (having
chosen values for beta, sigma.b and sigma similar to those estimated in the
text).
For each data set I used lme() to fit a model,