Displaying 20 results from an estimated 7000 matches similar to: "xy.coords and log10"
2007 Nov 07
3
R as a programming language
Greetings -- coming from Python/Ruby perspective, I'm wondering about
certain features of R as a programming language.
Say I have a huge table t of the form
run ord unit words new
1 1 6939 1013 641
1 2 275 1001 518
1 3 3314 1008 488
1 4 14154 1018 463
1 5 2982 1006 421
Alternatively, it
2007 Nov 23
2
printing levels as tuples
I'm running rle() on a long vector, and get a result which looks like
> uc
Run Length Encoding
lengths: int [1:16753] 1 1 1 1 1 1 1 1 1 1 ...
values : int [1:16753] 29462748 22596107 18322820 14323315
12684505 9909036 7296916 6857692 5884755 5883697 ...
I can print uc$names or uc$levels separately. Is there any way to
print them together as tuples, looking like
(29462748, 1)
2008 Sep 17
1
creating horizontal dataframes with column names
Greetings -- in order to write back to SQL databases, one needs to
create a dataframe with values. I can get column names of an existing
table with sqlColumns. Say I have a vector of values (if they're all
the same type), or a list (if different). How do I create a dataframe
with column names given by my sqlColumns? To make it concrete, how do
we make a dataframe
A B C
1 2 3
2008 Oct 02
4
namespaces
I'd like to control my namespace thoroughly, separated by task. Is
there a way, in R session, to introduce namespaces for tasks
dynamically and switch them as needed? Or, is there a combination of
load/save workspace steps which can facilitate this?
Cheers,
Alexy
2006 Jan 21
1
Bug in xy.coords() or documentation error?
Hi,
I noticed the following problem with xy.coords() in R 2.2.1-patched
(version info at the foot of this email) and R 2.3.0 unstable
(subversion no: r37123):
> xy.coords(x = matrix(1:20, ncol = 2))
Error in xy.coords(x = matrix(1:20, ncol = 2)) :
argument "y" is missing, with no default
> xy.coords(x = matrix(1:20, ncol = 2), y = NULL)
$x
[1] 1 2 3 4 5 6 7 8 9
2008 Sep 09
2
splitting time vector into days
Greetings -- I have a dataframe a with one element a vector, time, of
POSIXct values. What's a good way to split the data frame into
periods of a$time, e.g. days, and apply a function, e.g. mean, to some
other column of the dataframe, e.g. a$value?
Cheers,
Alexy
2001 May 04
1
scoping error in xy.coords (PR#932)
Hola!
> rm(list=ls(all=TRUE))
> x <- 1:20
> y <- 1+x+rnorm(x)
> xy.coords(y ~ x,NULL)
... expected output, correct, but when called from inside lowess:
> lowess(y ~ x)
Error in xy.coords(x, y) : x and y lengths differ
> debug(xy.coords)
> lowess(y ~ x)
debugging in: xy.coords(x, y)
... long listing deleted
if (is.language(x)) {
if (inherits(x,
2007 Nov 27
2
exporting a split list
Using wk <- with(d, split(word, kind)), I get the following class table:
wk$`1`
[1] "a" "bra" ... # (*)
wk$`10`
"ca" "dabra" ...
Now I need to export it in the following format:
class num_members examples
1 23 a bra ...
10 4 ca dabra
For each class C such as `1`, I need to print the
2007 Nov 21
2
uniq -c
Is there an R analog of the Unix command uniq -c:
http://en.wikipedia.org/wiki/Uniq
Given an array x, uniq -c replaces each contiguous subsequence of
identical numbers with a tuple (count, number). E.g.
$ cat > usample
10
10
9
8
8
7
7
7
6
3
1
1
1
0
$ uniq -c usample
2 10
1 9
2 8
3 7
1 6
1 3
3 1
1 0
Cheers,
Alexy
2005 Dec 31
1
xy.coords
In ?xy.coords it says:
If 'y' is missing and 'x' is a
formula: of the form 'yvar ~ xvar'. 'xvar' and 'yvar' are used as
x and y variables.
list: containing components 'x' and 'y', these are used to define
plotting coordinates.
time series: the x values are taken to be 'time(x)' and the y
2009 Feb 24
2
growing dataframes with rbind
I'm growing a large dataframe by composing new rows and then doing
row <- compute.new.row.somehow(...)
d <- rbind(d,row)
Is this a fast/preferred way?
Cheers,
Alexy
2009 Jan 26
2
name scoping within dataframe index
Every time I have to prefix a dataframe column inside the indexing
brackets with the dataframe name, e.g.
df[df$colname==value,]
-- I am wondering, why isn't there an R scoping rule that search
starts with the dataframe names, as if we'd said
with(df, df[colname==value,])
-- wouldn't that be a reasonable default to prepend to the name search
path?
Cheers,
Alexy
2012 Apr 01
1
Error in xy.coords(x, NULL, log = log) : (list) object cannot be coerced to type 'double'
Hi there,
When I run the code below I get the error
Error in xy.coords(x, NULL, log = log) :(list) object cannot be coerced to
type 'double'
Any tips how I can resolve this?
>
> library("waveslim")
>
> vols=read.csv(file="C:/Users/ocuk/My Documents/Abs Vol.csv", header=TRUE,
> sep=",")
> x<-c(vols[,1])
> #x
> #data(ibm)
>
2008 Oct 29
2
Functional pattern-matching in R
I found there's a very good functional set of operations in R, such as
apply family, Hadley Wickham's lovely plyr, etc. There's even a
Reduce (a.k.a. fold). Now I wonder how can we do pattern-matching?
E.g., now I split dimensions like this:
m <- dim(V)[1] # R
n <- dim(V)[2] # still R
While even Matlab allows for
[m,n] = size(V) % MATLAB!
Ideally I'd be able to
2008 Oct 23
3
xy.coords in text
Hello,
I want to add text annotation about correlation on "pairs" plots. I
found that I could pass a function to the "panel" argument of pairs :
panel.annot <- function(x, y, ...) {
points(x, y, ...)
c <- cor.test(x, y)
legend("topleft", legend=substitute(rho == r, list(r=sprintf("%.2f",
c$estimate))), bty="n")
}
And then :
2006 Jun 04
4
xy.coords(MATRIX) bug in code or documentation (PR#8937)
Hi, people.
xy.coords() does not behave like its documentation says, when given some
matrices. ?xy.coords says:
If 'y' is 'NULL' and 'x' is a [...] formula [...] list [...]
time series [...] matrix with two columns [...]
In any other case, the 'x' argument is coerced to a vector and
returned as *y* component [...]
Now, consider this short
2012 Jun 19
1
help with xy.coords(x,y)
i am working on the project to analyze hedge fund performance, i would
appreciate that if you guys could spare some time helping me out with the R
code. Thanks.
The senario is:
i applied BOXPLOT() to plot the performance of all hedge funds with 7
strategies.
And right now in this boxplot I need to plot the points of 30 individual
hedge funds from my portfolio. And I applied POINTS() and
2007 Nov 21
3
shrink a dataframe for plotting
I get tables with millions of rows. For plotting to a screen-size
jpg, obviously just about 1000 points are enough. Instead of feeding
plot() the original millions of rows, I'd rather shrink the original
dataframe, using some kind of the following interpolation:
-- split dataframe into chunks of N rows each, e.g. 1000 rows each
-- compute average for each column
-- issue one new row
2008 Oct 09
1
R/OCaml?
Did anyone try to write R extensions in OCaml? What would it entail
to enable it?
Cheers,
Alexy
2011 Mar 23
1
rbind a heterogeneous row
I have a dataframe with many rows like this:
> df
X1 X2 X3 X4 X5 X6 X7 week d
sim1 FALSE TRUE TRUE TRUE TRUE TRUE TRUE 1 0.3064985
sim1 is the rowname, X1..X7,week,d are the column names. X1..X7 are factors, booleans in this case.
I need to add another row, represented by the following list:
list(rep(T,7),5,0.0)
-- i.e, TRUE in all boolean columns,