Displaying 20 results from an estimated 20000 matches similar to: "high and lowest with names"
2011 Aug 05
2
[?]apply functions or for loop
Hello,
First time posting to this mail list.
I'd like to use R in the most efficient way. I'm accomplishing what I want,
but feel there is a more R'ish way to do it. Just learning R.
*My goal: get ranks of value across rows with row names and column names
intact.*
I'm guessing one of the [?]apply functions will do what I need, but I
couldn't sort out which one (after a lot
2011 Sep 27
3
remove NaN from element in a vector in a list
Hello,
What is the best way to turn a matrix into a list removing NaN's? I'm new to
R...
Start:
> mt = matrix(c(1,4,NaN,5,3,6),2,3)
> mt
[,1] [,2] [,3]
[1,] 1 NaN 3
[2,] 4 5 6
Desired result:
> lst
[[1]]
[1] 1 3
[[2]]
[1] 4 5 6
Thanks!
Ben
[[alternative HTML version deleted]]
2011 Oct 11
1
apply for each value
Hello,
There has to be a more R'ish way to do this. I have two matrices, one has
the values I want, but I want to NA some of them. The other matrix has
binary values that tell me if I want to NA the values in the other matrix. I
produce a third matrix based on this. I've also tried apply() passing in
c(1,2) for rows and columns with no success yet.
Example (this works, but I'm
2011 Sep 02
2
previous monday date
Hello,
I'm attempting to return the date (in form '%Y-%m-%d') of the Monday
previous to the current date. For example: since it is 2011-09-02 today, I
would expect 2011-08-29 to be the return value.
I found the following in:
http://www.mail-archive.com/r-help@r-project.org/msg144184.html
Start quote from link:
prevmonday <- function(x) 7 * floor(as.numeric(x-1+4) / 7) +
2010 Jan 28
2
NA Replacement by lowest value?
Hi all,
I need to replace missing values in a matrix by 10 % of the lowest available value in the matrix. I've got a function I've used earlier to replace negative values by the lowest value, in a data frame, but I'm not sure how to modify it...
nonNeg = as.data.frame(apply(orig.df, 2, function(col) # Change negative values to a small value, close to zero
{
min.val =
2011 Oct 12
1
Tinn-R change editor background color
Hello,
Does anyone know how to change the Tinn-R editor background color? White is
rough on the eyes...
Thanks,
Ben
[[alternative HTML version deleted]]
2011 Aug 23
1
R.oo modify an object inside another classes method
Can someone show me how to modify one (R.oo) class's object inside another
(R.oo) class's method? Is that possible with the R.oo package? A quick
example or reference to an example would be outstanding...
Thanks,
Ben
[[alternative HTML version deleted]]
2011 Aug 29
1
character vector to text with returns
Hello,
Does anyone know how to convert this:
> msg
[1] "a"
[2] "b"
[3] "c"
To:
> msg
"a
b
c"
In other words, I need to convert a character vector to a single string with
carriage returns for each row.
Functionally, I'm attempting to send an email of a character vector in a way
that is readable in the email body. I can only input one
2011 Sep 10
1
DBS to R
Hello,
I have a bunch of data files all with "dbs" file extensions. They are
generated via a SQL query from another program and source. Does anyone know
(or have ideas) how to get the data from a dbs file type into R (or into
some other format that can imported to R)? I've searched online for 4 hours
now...
Thanks!
Ben
[[alternative HTML version deleted]]
2011 Oct 06
1
counts in quantiles in and from a matrix
Hello,
I'm trying to get the count of values in each row that are above and below
quantile thresholds. Thanks!
Example:
> x = matrix(1:30,5,6)
> x
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] 1 6 11 16 21 26
[2,] 2 7 12 17 22 27
[3,] 3 8 13 18 23 28
[4,] 4 9 14 19 24 29
[5,] 5 10 15 20 25 30
> qtl = t(apply(x, 1,
2011 Sep 22
1
R.oo: do work on data member at construction
Hello,
I'd like to 'do work' on data members upon construction (i.e. without
implementing it in a get method). Is this the best way to create data member
'z' upon construction? I'm thinking if .z=paste(x,y) below gets more complex
I'll run into issues.
setConstructorS3("MyClass", function(x=NA,y=NA,...) {
this <- extend(Object(), "MyClass",
2011 Aug 08
1
R.oo error upon construction
Hello,
Using the R.oo package, how do I throw an error if a field is not present
when the user of the class creates the object?
Using the example in the R.oo package:
setConstructorS3("Person", function(name, age) {
if (missing(name)) name <- NA;
if (missing(age)) age <- NA;
extend(Object(), "Person",
.name=name,
.age=age
)
})
[rest of class methods
2011 Sep 14
1
rJython matrix message
Hello,
I've posted something similar under a different subject and never received a
solution. Trying again with (hopefully) a better description.
Objective: Send a matrix of string data in an email message. The message
must have authentication and be sent via an R script.
I'm almost there!
Here is where I am at:
I collect long error message lines in 'errs', which is a matrix.
2011 Aug 15
1
2 matrix scatter x [a lot]
Hello,
I'm pretty new to R. Basically, how do I speed up the for loop below. Or
better yet, get rid of the for loop all together.
objective: plot two data sets column against column by index. These data
sets have alot NA's. Some columns are all NA's. I need the plots to overlay.
I don't like the plots in matplot(). Needs to be much faster than the code
below...
#simple sample
2011 Aug 26
1
R.oo data members / inheritance
If someone is able, can you tell me if there is a better way to do this?
More specifically, do I have to rewrite all of the data members stuff and
extend stuff of parent class in the child class? See below. Thanks in
advance!
Example 1:
setConstructorS3("ClassA", function(A,x) {
if(missing(A))A=15;
if(missing(x))x=NA;
extend(Object(), "ClassA",
.size = A,
.x=x
2004 Aug 06
4
Configuring icecast for lowest buffering/latency
Hi,
I'm using Icecast on a windows pc as a "gobetween" to output from a
streaming encoder, bounce it of an icecast server locally on the workstation
and then being picked up from the local icecast server and relayed on again.
(I'm using liveCaster from www.live.com as it allows me to send the audio
stream as UDP which is more efficient than HTTP streaming - unfortunately it
does
2011 Nov 07
1
RpgSQL row names
Hello,
Using the RpgSQL package, there must be a way to get the row names into the
table automatically. In the example below, I'm trying to get rid of the
cbind line, yet have the row names of the data frame populate a column.
> bentest = matrix(1:4,2,2)
> dimnames(bentest) = list(c('ra','rb'),c('ca','cb'))
> bentest
ca cb
ra 1 3
rb 2 4
>
2013 Sep 10
0
xtable Highlight the lowest and plus minus
I am using a similar dataset to the following:
a= c("Fruits", "Adam","errorA", "steve", "errorS",
"apples", 17.1,2.22, 3.2,1.1,
"oranges", 3.1,2.55, 18.1,3.2 )
a_table=data.matrix(t(matrix(a,nrow=5)))
I would like to highlight the smallest value in the Adam and Steve columns
and, also plus and minus the errors
2004 Aug 06
0
Configuring icecast for lowest buffering/latency
> How can I configure the Icecast server to use as minimum buffering as
> possible so I can reduce the latency that the http streaming on the local
> box introduces?
as far as I know, icecast and liveice have the smallest influence on the
delay in that chain. The biggest delay is produced by the client player's
buffer. Have your checked this out?
Why do you need such a low latency?
2012 Feb 28
1
group calculations with other columns for the ride
Hello,
I can get the median for each factor, but I'd like another column to go
with each factor. The nm column is a long name for the lvls column. So
unique work except for the order can get messed up.
Example:
x =