similar to: How to use current value of variable in function definition?

Displaying 20 results from an estimated 10000 matches similar to: "How to use current value of variable in function definition?"

2010 Jul 27
3
Checking package licences including dependencies?
I only recently discovered options("available_packages_filters" = list(add = TRUE, "license/FOSS")) [cf. help("available.packages", package="utils") in R 2.10.0 or later] which goes nicely with my options("checkPackageLicense" = TRUE) [new in R 2.11]. But now I want to purge my library of packages I would not have installed had I known about
2009 Jul 02
5
save the result into a word file
Hi, everyone: I forget on how to save a result from R as a word document. For example, if I run the linear regression and want to save the result: summary(lm(y~x) in a word file. So I can show it later to my clients. Any idea on how to do this? Thanks a lot, Suyan
2010 Jul 01
2
Documentation for library() and how to specify missing arguments
I can, after carefully reading about the returned values, see why library("MASS", "MASS", character.only=TRUE) has to chose between loading the package and displaying the help (I thought I had found a nice shortcut), but wouldn't the documentation be better if it said that the two are incompatible and that package= takes precedence over help=? As an aside, is there a
2009 Jun 11
2
How to order an data.table by values of an column?
Hello! Can you help me? How to order an data.table by values of an column? Per example: Table no initial Categ Perc 468  31.52 351  27.52 0  0.77 234  22.55 117  15.99 table final Categ Perc 0  0.77 117  15.99 234  22.55 351  27.52 468  31.52 Lesandro Veja quais são os assuntos do momento no Yahoo! +Buscados [[alternative HTML version deleted]]
2009 Jun 04
3
Fast way of finding top-n values of a long vector
If x is a (long) vector and n << length(x), what is a fast way of finding the top-n values of x? Some suggestions (calculating the ratio of the two top values): library("rbenchmark") set.seed(1); x <- runif(1e6, max=1e7); x[1] <- NA; benchmark( replications=20, columns=c("test","elapsed"), order="elapsed" , sort = {a<-sort(x,
2011 Mar 14
4
Serial Date
Hello R Help, I'm working in a project with a software that register date and time data in serial time format. This format is used by excel, for exemple. In this format, 40597.3911423958 is 2011/2/23 09:23:15. First part is number os days since 1900/1/1, and second part is a fraction of a day. I need to make this transformation in R, and use it to make some algebrian operations. I found that
2009 Jun 17
3
tiff() woes
Hello all, a friend has a problem with tiff() which I was unable to help about. I searched the error messages to no avail. When he tries: tiff(filename = "FedeWhyDoesntThisBloodyWork.tif", width = 5, height = 5, units = "cm", bg = "white", res = 1200) Error in tiff(filename = "FedeWhyDoesntThisBloodyWork.tif", width = 5, : unable to start device
2011 Mar 14
7
creating character vector
Is there a way to convince R to create a character vector without using the quotes? This works ex1 <- c("first","second") but when I try this it doesn't ext <- as.character(c(first,second)) it complains. I have many variables to put into character vectors so dispensing with the quotes would be useful. Thanks Jim =============================== Dr. Jim Maas
2010 Jul 26
3
Cluster analysis
Hi all, I have no idea if this question is to easy to be answered, but I?m starting with R. So, here we go. I have a large dataset with a lot of steps a judicial case. A sample is attached. I?d like to do a cluster analysis to try to understand with one is the most usual path followed by this legal cases. After that, I?d like to plot a cluster tree. In the attached sample, the column: -
2011 Aug 22
3
Ignoring loadNamespace errors when loading a file
On a Unix machine I ran caret::rfe using the multicore package, and I saved the resulting object using save(lm2, file = "lm2.RData"). [Reproducible example below.] When I try to load("lm2.RData") on my Windows laptop, I get Error in loadNamespace(name) : there is no package called 'multicore' I completely understand the error and I would like to ignore it and
2010 Jul 22
4
SQL/R
Dear R users, I want to aggregate data in the following way: ### X <- data.frame(u = c("T1","T1","T1","T2"), v=c("a","a","b","a")) X library(sqldf) sqlOut <- sqldf("select count(distinct(v)) from X group by u") sqlOut ### Now I want to get the same result without using SQL. How can I achieve that ?
2011 Mar 16
2
how do we read netcdf / hdf files in R?
Dear R Users, How do we read netcdf / hdf format files in R ? Also, can we convert netcdf to hdf format in R? Great Thanks, Best Regards, Yogesh [[alternative HTML version deleted]]
2011 Mar 18
2
Need help with error
Hi R users, I am getting the following error when using the splsda function in R v2.12.1: "Error in switch(classifier, logistic = { : EXPR must be a length 1 vector" What does this mean and how do I fix this? Thank you in advance! Best, Savi
2010 Jun 04
1
Reading newlines with read.table?
I have a text file that is UTF-16LE encoded with CRLF line endings and '@' as field separators that I want to read in R on a Linux system. Which would be fine as read.table("foo.txt", file.encoding = "UTF-16LE", sep = "@", ...) *except* that the data may contain the LF character which R treats as end-of-line and then barfs that there are too few elements
2010 Jul 01
1
How best to set library search path so user libraries come first
I want my local libraries to have priority over the system installed ones, which, as far as I can make out from help(".libPaths"), means they have to come first in that list (it doesn't actually_say_ so, but that seems to be the idea). We have R_LIBS_USER which looks made for specifying where I keep my own libraries. Unfortunately it comes last in .libPaths() [which appears to
2010 Jul 16
2
Recommended way of requiring packages of a certain version?
What is the recommended way of requiring a certain version when loading a package (or, indeed, from R itself)? Perl has the require module version use module version require version use version constructs which is kind of what I am looking for (especially 'use' which is evaluated at compile time), but R seems to have lost the version= argument to require(). The best I have been able
2009 Jun 12
1
Changing CRAN package compile option defaults?
Is there an easy way to override the compile options when installing packages from CRAN on Unix-style systems? I tried setting CFLAGS, CXXFLAGS, and FFLAGS but they are not picked up. For example (with a random package and adding -mtune only to try to get rid of the default) export CFLAGS="-march=native -mtune=native" export CXXFLAGS="-march=native -mtune=native" R CMD
2010 Jun 30
1
Sweave PDF files show plot symbols as "q"
I'm guessing this is a FAQ but I can't find it and that it is probably not exclusive R related but relevant so I thought I'd ask: When I view the PDF output from Sweave (e.g. Example 1 from the author's web site at [1]) on a Linux system using the standard PDF viewer [2], the circles for the outliers in the plot [boxplot(Ozone ~ Month, data = airquality)] show up as the letter
2010 Aug 06
1
[OT] R on Atlas library
Dear List, I am aware this is slightly off-topic, but I am sure there are people who already had the problem and who perhaps solved it. I am running long-lasting model fits using constrOptim command. At work there is a linux computer (Quad Core, debian) on which I already have compiled R and Atlas, in the hope that things will go faster on that machine. Atlas offers the possibility to be
2010 Aug 19
1
Can you share a working example of R program aided by fast BLAS?
Can one of you give me an R program that displays the benefits an accelerated BLAS in R? Here's why I ask, in case you wonder: In a linux cluster, I've hit some bumps in the road. The worst one by far was that I installed R, then GotoBLAS2 with default settings, and after that, jobs using Rmpi were *really* *really* slow. I mean horrible. If a job took 15 minutes when run by itself,