Displaying 20 results from an estimated 70000 matches similar to: "Length of string?"
2011 Nov 07
3
Upgrade R?
I am trying to upgrade to R 2.14 from R 2.13.1 I have compied all the
libraries from the 'library' directory in my existing installation (2.13.1)
to the installed R 2.14. Now I want to uninstall the old installation (R
2.13.1) and I get the error:
Internal Error: Cannot find utCompiledCode record for this version of the
uninstaller.
Any ideas?
Kevin
[[alternative HTML
2011 Nov 08
3
window?
Can someone enlighten me on why the following doesn't work?
setwd('C:/Temp/R')
d <- rep(1:53,2)
(s <- ts(d, frequency=53, start=c(2000,10)))
n <- length(s)
k <- n%/%3
for(i in (n-k):n)
{
st <- c(start(s)[1] + (start(s)[2] + i)%/%frequency(s), (start(s)[2] +
i) %% frequency(s))
ed <- c(start(s)[1] +
2010 Mar 22
2
Factors attribute?
I noticed that when I fit a linear model using 'lm' there is an attribute called "factors" that is added to the "term". It doesn't seem to appear for 'model.matrix', just 'lm'. I have been unable to find where it gets constructed or what it means? It looks like a two dimensional array that I may be able to use so I would just like to get some
2011 Nov 10
3
Title for a group of plots?
I can get multiple plots on a page like:
op <- par(mfcol = c(3, 1))
What I was wondering is if there is a way to have a title for the whole
page? I can specify the title for each individual plot like:
plot(xxx, main=".")
But I would like a 'title' for the group of plots. Is this possible?
Thank you.
Kevin
[[alternative HTML version deleted]]
2011 Oct 22
7
"Plotting" text?
I noticed that the text() command adds text to a plot. Is there a way to
either make the plot blank or add text to a "blank sheet". I would like
to "plot" a page that contains just text, no plot lines, labels, etc.
Suggestions?
Kevin
[[alternative HTML version deleted]]
2011 Nov 14
1
string to list()
I can get an array of strings for the data that I want using 'paste()' as
follows:
paste('ma', 1:am$arma[2], '=', coef(am)[1:am$arma[2] + am$arma[1]], sep='')
This results in a vector of strings like:
[1] "ma1=1.17760133668255" "ma2=0.649795570407939" "ma3=0.329456750858276"
What I would like is
fixed.pars <-
2011 Nov 15
3
if/else scope
What is wrong with the following?
x <- 1:2
if(x[1] > 0)
{
if(x[2] > 0)
{
print("1 & 2 > 0")
}
else
{
print("1 > 0")
}
}
else
{
if(x[2] > 0)
{
2011 Nov 26
3
Time series merge?
I have two time series
a <- ts(1:10, start=c(1,6), end=c(2,5), frequency=10)
b <- ts(1:5, start=c(2,1), end=c(2,5), frequency=10)
Obviously 'b' is a subset of 'a'. I want a single index value indicating
where that start of 'b' lines up with the start of 'a'. So in this simple
example I would expect an index of 5. I was playing with 'merge'.
2010 Mar 06
1
Interpretation of 'swtich'
In browsing the source I see the following construct:
res <- switch(type, working = , response = r, deviance = ,
pearson = if (is.null(object$weights))
r
else r * sqrt(object$weights), partial = r)
I understand that 'switch' will execute the code that is matched by its corresponding string value (in this case 'type'). What I don't
2011 Nov 18
4
length of empty string
Hi all,
Can somebody explain why length("") returns 1 and not 0? How do I test
if a given string is the empty string?
Thanks,
Steffen.
[[alternative HTML version deleted]]
2012 Jan 23
2
Logrithmic histogram?
I have some data where the frequency is heavily weighted on the lower end.
So I have lots of low values with very few higher values. I would like to
find breakpoints that cover the data with as much detail as possible. I find
that if I use hist() to automatically find the breaks for me it finds breaks
that are too coarse for the low values. I have tried the other algorithms
(like 'Scott'
2002 May 18
5
Length of a string
Hi,
Suppose I have created something like this in R:
foo <- "myfoo"
and I want to find out the number of character in foo (in other words, R
should return 5 since "myfoo" has 5 charactors.
How can I do it? I tried:
length(foo)
but it returned 1.
Cheers,
Kevin
------------------------------------------------------------------------------
Ko-Kang Kevin Wang
2009 Mar 17
2
sweep?
I am having a hard time understanding just what 'sweep' does. The documentation states:
Return an array obtained from an input array by sweeping out a summary statistic.
So what does it mean "weeping out a summary statistic"?
Thank you.
Kevin
2012 Jan 21
2
Legend that is big?
I can put a legend on a plot with something like:
legend('bottom', leg.txt, horiz = TRUE, fill = colors)
But what if the arrays leg.txt and colors are too big? I would still like to
provide a legend but to save space I would like to just show small boxes
with the color filled in so it will still fit on the plot. If I could adjust
the size of the boxes (at least in one dimension)
2009 Nov 15
2
Relase positive with log and zero of negative with 0
This is a very simple question but I couldn't form a site search quesry that would return a reasonable result set.
Say I have a vector:
x <- c(0,2,3,4,5,-1,-2)
I want to replace all of the values in 'x' with the log of x. Naturally this runs into problems since some of the values are negative or zero. So how can I replace all of the positive elements of x with the log(x) and the
2011 Nov 15
2
Controlling the precision of the digits printed
Has anyone come across the right combinations to print a limited number of
digits? My trial and error approach is taking too much time. Here is what I
have tried:
> op <- options()
> a <- c(1e-10,1,2,3,.5,.25)
> names(a) <- c("A", "B", "C", "D", "E", "F")
> # default
> a
A B C D
2012 Jan 24
1
Interactive map graphics.
I just watched
http://www.youtube.com/watch?v=iSXNfZESR5I
and there is a section where Hadley Wickham showed demonstrated a county map
of the US that was interactive. This is exactly what I would like. I have
downloaded ggplot2 but still failed to find out how to even read in and plot
something like a US map let alone add the kind of interactivity that was
shown in this demo. Anyone else
2011 Nov 22
1
Missing data?
I was wondering what the best approach is for missing data in a time series.
I give an example using xts but I would like to know what seems to be the
"best" method. Say I have
library(xts)
xts.ts <- xts(1:4,as.Date(c("1970-01-01", "1970-1-3", "1980-10-10",
"2007-8-19")), frequency=52)
I would like to turn this into a time series (still
2010 Jan 03
3
F77_CALL, F77_NAME definition
I give up. Maybe it is my search (Windows) but I cannot seem to find the definition of the F77_CALL or F77_NAME macros. Either there are too many matches or the search just doesn't find it. For example where is the source for:
F77_CALL(dpotri)
?
Thank you.
Kevin
2011 Nov 15
1
Plot alignment with mtext
I would like the text plotted with 'mtext' to be alighned like it is for
printing on the console. Here is what I have:
> print(emt)
ME RMSE MAE
MPE MAPE MASE
original -1.034568e+07 1.097695e+08 2.433160e+07 -31.30554 37.47713
1.5100050
xreg 1.561235e+01 2.008599e+03 9.089473e+02 267.05490 280.66734