Displaying 20 results from an estimated 4000 matches similar to: "starting html help for a package?"
2008 Dec 03
3
alternative way to replicate()
Dear all,
I'm looking for an alternative way to replicate the "2," string for an
x number of times, and end up with one string containing "2," x times.
I can partly achieve this using replicate().
> y <- rep("2,", times=3)
> y
[1] "2," "2," "2,"
The output that I am looking for is, however, "2,2,2,". I also tried
2011 Oct 03
2
extracting p-values in scientific notation
Dear all
How does print.htest display the p-value in scientific notation?
> (x <- cor.test(iris[[1]], iris[[3]]))
Pearson's product-moment correlation
data: iris[[1]] and iris[[3]]
t = 21.65, df = 148, p-value < 2.2e-16
alternative hypothesis: true correlation is not equal to 0
95 percent confidence interval:
0.8270 0.9055
sample estimates:
cor
0.8718
Above the p-value comes
2008 Oct 30
2
"A critique of R and S-PLUS"
Dear all,
The other day I stumbled on this article, "A critique of R and S-PLUS"
[1], and got curious on whether the points outlined are (still) valid.
The article is quite old, dating 2004, but was updated several times.
Regards,
Liviu
[1] http://fluff.info/blog/arch/00000041.htm
--
Do you know how to read?
http://www.alienetworks.com/srtest.cfm
Do you know how to write?
2011 Aug 19
2
display only the top-right half of a correlation matrix?
Dear all
Is there an easy way to display only one half (top-right or
bottom-left) of a correlation matrix?
> require(Hmisc)
> rcorr(as.matrix(mtcars[ , 1:4]))
mpg cyl disp hp
mpg 1.00 -0.85 -0.85 -0.78
cyl -0.85 1.00 0.90 0.83
disp -0.85 0.90 1.00 0.79
hp -0.78 0.83 0.79 1.00
n= 32
P
mpg cyl disp hp
mpg 0 0 0
cyl 0 0 0
disp 0 0
2009 Oct 14
3
currency conversion function?
Dear all
Is there any R function that would perform currency conversion using
up-to-date exchange rates? I would be looking for a function that
allows to download recent exchange rates (say, from Yahoo!) and then
use these in converting currencies (say, USD to EUR).
I am not sure whether r-sig-finance would be more appropriate, but the
(off-)topic feels general enough to me. Thank you
Liviu
--
2011 Aug 10
3
convert 'list' to 'vector'?
Dear all
How does one convert a "non-symmetric" list to a vector? See below:
> x <- list()
> x[[1]] <- letters[1:5]
> x[[2]] <- letters[6:10]
> x[[3]] <- letters[11:12]
> x
[[1]]
[1] "a" "b" "c" "d" "e"
[[2]]
[1] "f" "g" "h" "i" "j"
[[3]]
[1] "k"
2009 Aug 20
4
expanding 1:12 months to Jan:Dec
Dear R users
I would like to do some spreadsheet style expansion of dates. For
example, I would need to obtain a vector of months. I approached in an
obviously wrong way:
> paste(01:12)
[1] "1" "2" "3" "4" "5" "6" "7" "8" "9" "10" "11" "12"
> as.Date(paste(01:12),
2009 May 15
4
replace "%" with "\%"
Dear all,
I'm trying to gsub() "%" with "\%" with no obvious success.
> temp1 <- c("mean", "sd", "0%", "25%", "50%", "75%", "100%")
> temp1
[1] "mean" "sd" "0%" "25%" "50%" "75%" "100%"
> gsub("%",
2012 May 05
3
alarm() doesn't beep
Dear all
I'd like to make a beeping sound in R, but alarm() doesn't beep? I
checked ?alarm but I couldn't find any pointers to system
configuration. Any ideas?
Regards
Liviu
> sessionInfo()
R version 2.14.2 (2012-02-29)
Platform: x86_64-pc-linux-gnu (64-bit)
locale:
[1] LC_CTYPE=en_US.UTF-8 LC_NUMERIC=C
[3] LC_TIME=en_US.UTF-8 LC_COLLATE=en_US.UTF-8
[5]
2012 Jul 10
3
fill 0-row data.frame with 1 line of NAs
Dear all
Is there a simpler method to achieve the following: When I obtain an
empty data.frame after subsetting, I need for it to contain one line
of NAs. Here's a dummy example:
> (.xb <- iris[ iris$Species=='zz', ])
[1] Sepal.Length Sepal.Width Petal.Length Petal.Width Species
<0 rows> (or 0-length row.names)
> dim(.xb)
[1] 0 5
> (.xa <-
2011 Aug 10
2
round() a data frame containing 'character' variables?
Dear all
It is difficult to use round(..., digits=2) on a data frame since one
has to first take care to remove non-numeric variables such as
'character' or 'factor':
> head(round(iris, 2))
Error in Math.data.frame(list(Sepal.Length = c(5.1, 4.9, 4.7, 4.6, 5, :
non-numeric variable in data frame: Species
> head(round(iris[1:4], 2))
Sepal.Length Sepal.Width Petal.Length
2009 Aug 26
2
faulty formatting of toLatex(sessionInfo())
Dear all
I am writing an Sweave document and have encountered formatting issues
with the "locale" part of toLatex(sessionInfo()). The fact that there
is no spaces between the various "locale" variables means that LaTeX
cannot easily find an appropriate place to break the lines, and some
will get printed off screen.
Below is the text output, and this .pdf document [1] shows the
2011 Mar 06
4
sorting & subsetting a data.frame
Dear all
This may be obvious, but I cannot get it working. I'm trying to subset
& sort a data frame in one go.
x <- iris
x$Species1 <- as.character(x$Species)
##subsetting alone works fine
with(x, x[Sepal.Length==6.7,])
##sorting alone works fine
with(x, x[order(Sepal.Length, rev(sort(Species1))),])
##gets subsetted, but not sorted as expected
with(x, x[(Sepal.Length==6.7) &
2009 Dec 21
2
checking Rd cross-references ... WARNING
Dear all
I am getting this strange error when checking my package. Would you
have an idea what causes it?
Thank you
Liviu
* checking Rd cross-references ... WARNING
Error in .find.package(package, lib.loc) :
there is no package called 'KernSmooth'
Calls: <Anonymous> -> lapply -> FUN -> .find.package
Execution halted
> sessionInfo ()
R version 2.10.0 (2009-10-26)
2010 Oct 23
1
command to start R and Rcmdr?
Dear all
I would like to start R with Rcmdr from the cli, without tweaking
Rprofile.site. This has been discussed in the past [1], but I don't
see a solution that (1) could be used with any working directory and
(2) would avoid starting Rcmdr on every R start-up.
Personally I tried the following, which starts R but not Rcmdr
liv at liv-laptop:~$ R --interactive -e 'require(Rcmdr)'
2011 Nov 24
2
proper work-flow with 'formula' objects and lm()
Dear all
I have a work-flow issue with lm(). When I use
> lm(y1~x1, anscombe)
Call:
lm(formula = y1 ~ x1, data = anscombe)
Coefficients:
(Intercept) x1
3.0001 0.5001
I get as expected the formula, "y1 ~ x1", in the print()ed results or
summary(). However, if I pass through a formula object
> (form <- formula(y1~x1))
y1 ~ x1
> lm(form, anscombe)
Call:
2011 Apr 07
1
plyr workaround to converting by() to a data frame
Dear all
Is there a clean plyr version of the following by() and do.call(rbind,
...) construct:
> df<-data.frame(a=1:10,b=11:20,c=21:30,grp1=c("x","y"),grp2=c("x","y"),grp3=c("x","y"))
> dfsum<-by(df[c("a","b","c")], df[c("grp1","grp2","grp3")], range)
>
2012 Apr 10
1
plyr: set '.progress' argument to default to "text"
Dear all
Is it possible to set globally the option .progress = "text" to all
the apply functions in 'plyr'. For example, current default is
daply(..., .progress = "none"). I would like to set it to daply(...,
.progress = "text"), so as to avoid writing the argument every time I
call such a function. I looked into ?daply and ?create_progress_bar
without much
2011 Nov 24
2
understanding all.equal() output: "Mean relative difference"
Dear all
How should one parse all.equal() output? I'm specifically referring to
the 'mean relative difference' messages. For example,
> all.equal(pi, 355/113)
[1] "Mean relative difference: 8.491368e-08"
But I'm not sure how to understand these messages. When they're close
to 0 (or 1xe-16), then it's intuitive. But when they're big,
> all.equal(1, 4)
2009 Jun 02
2
variance does not equal serial covariance of lag zero?
Dear all,
Does this make any sense:
var() = cov() != acf(lag.max=0, type="covariance")?
I have daily data of IBM for May 2005, and I'm using the logarithmic return:
> ibm200505$LRAdj.Close
[1] NA 0.0203152 0.0005508 -0.0148397 -0.0025182 0.0092025
-0.0013889
[8] 0.0098196 -0.0103757 -0.0274917 0.0005716 -0.0159842 -0.0074306
0.0091710
[15] 0.0002898 0.0226306