similar to: how to transform string to "Camel Case"?

Displaying 20 results from an estimated 4000 matches similar to: "how to transform string to "Camel Case"?"

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]
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) &
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 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 --
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 <-
2010 Oct 09
4
same random numbers in different sessions
Dear all I'm using Xubuntu Lucid and I keep getting the same random numbers whenever I start a new session of R. For example, I keep getting > sample(1:1000, 1) [1] 87 or > rnorm(1:10) [1] -1.3618103 0.4241701 1.0720076 0.2208145 -0.5375314 -0.4846588 [7] 0.7576768 0.6527407 -0.6868786 0.8718527 I expected that some set.seed() instruction woudl be present in a config file in
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
2010 Dec 06
10
R crashes when making graphs
hi, i am running R with JGR and Deducer under Ubuntu Mint Lucid. since i updated to R 2.12 i can no longer make graphs - R just crashes. the full error report was posted to launchpad (https://bugs.launchpad.net/ubuntu/+source/openjdk-6/+bug/675905) without any success so far. anyone with a similar problem or helpful suggestions? thanks! kat
2012 Jun 21
4
convert 'character' vector containing mixed formats to 'Date'
Dear all I have a 'character' vector containing mixed formats (thanks Excel!) and I'd like to translate it into a default "%Y-%m-%d" Date vector. x <- c("1/3/2005", "13/04/2004", "2/5/2005", "2/5/2005", "7/5/2007", "22/04/2004", "21/04/2005", "20080430", "13/05/2003",
2009 Aug 04
2
100% CPU when running (cran2deb) JGR on Debian
Dear all, I installed the amd64 cran2deb [1] JGR binaries on a fresh Debian testing, and JGR is missbehaving. When JGR starts up, one core of the CPU goes to 100% and stays there, even though I am keeping it idle and not performing any operation. I tried JGR with both sun-java6-jdk and openjdk-6-jdk, debian-liv:/home/liviu# update-alternatives --config java There are 4 choices for the alternative
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
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)
2010 Nov 30
3
pca analysis: extract rotated scores?
Dear all I'm unable to find an example of extracting the rotated scores of a principal components analysis. I can do this easily for the un-rotated version. data(mtcars) .PC <- princomp(~am+carb+cyl+disp+drat+gear+hp+mpg, cor=TRUE, data=mtcars) unclass(loadings(.PC)) # component loadings summary(.PC) # proportions of variance mtcars$PC1 <- .PC$scores[,1] # extract un-rotated scores of
2009 Aug 16
2
bootstrapped correlation confint lower than -1 ?
Dear R users, Does the results below make any sense? Can the the interval of the correlation coefficient be between *-1.0185* and -0.8265 at 95% confidence level? Liviu > library(boot) > data(mtcars) > with(mtcars, cor.test(mpg, wt, met="spearman")) Spearman's rank correlation rho data: mpg and wt S = 10292, p-value = 1.488e-11 alternative hypothesis: true rho is not
2010 Feb 03
4
Interactively editing point labels in a graph
Dear experts, I would like to be able to interactively (if possible, with mouse and clik) edit point labels in graphs, particularly in multivariate graphs, such as the biplots you get after a correspondence analysis (with, for example, package ca), where labels tend to overlap. The graph aspect ratio is relevant (it needs to be mantained). And I'm working with Windows XP. In this kind of
2012 Aug 06
3
test if elements of a character vector contain letters
Dear all I'm pretty sure that I'm approaching the problem in a wrong way. Suppose the following character vector: > (x[1:10] <- paste(x[1:10], sample(1:10, 10), sep='')) [1] "a10" "b7" "c2" "d3" "e6" "f1" "g5" "h8" "i9" "j4" > x [1] "a10" "b7"
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)'
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