Displaying 20 results from an estimated 20000 matches similar to: "Use of paste with apply()"
2004 Oct 04
4
Off-Topic: LaTeX package listings
Hola!
I ask here since I learnt from this list that the LaTeX package listings
should be good
for typesetting R code. I encountered one problem:
\begin{lstlisting}
X %*% V
\end{lstlisting}
in the output the * in %*% disappears! same with %/%, etc, the /
disappears.
Any ideas?
Kjetil
--
Kjetil Halvorsen.
Peace is the most effective weapon of mass construction.
--
2004 Nov 06
3
foreign(read.spss) in rw2000 and re2001beta
I encountered something strange with read.spss (package foreign, version
0.7 with R2.0.0 and
version 0.8 with R2.0.1 beta, windows XP)
I made a test file test.sav with SPSS version 11.5.1
containing only one numeric variable, with a value label
for one value not occuring in the file. According to ?read.spss
this should result in a factor, but it results in all NA. Using the
argument
2005 May 28
3
Incompatibility with VGAM
I just discovered that when the VGAM package (not on CRAN) is loaded,
glm() doesn't work. This is because VGAM defines a family function()
which gets found
by glm() in place of the family function from stats.
Then VGAM:::family returns an object which doesn't have a $family
component, (it has a component
$vfamily).
I thought namespaces should protect us from this happening?
Kjetil
--
2004 Dec 08
2
Strange error from R CMD INSTALL
I am trying to install a local package and get this unexpected
error:
---------- Making package UMSA ------------
adding build stamp to DESCRIPTION
installing R files
installing data files
installing man source files
installing indices
Error: couldn't find function "na.omit"
Execution halted
na.omit of course is in package stats, and that is listed in the
Depends field in
2003 Aug 16
4
unclass
Have I been sleeping in class?
rw1071 from CRAN, windows XP
incidencia is made by a call to tapply
> class(incidencia)
[1] "array"
> incidencia <- unclass(incidencia)
> class(incidencia)
[1] "array"
Kjetil Halvorsen
2004 Sep 24
2
rw2000dev: problems with library(foreign)
I get the following
> library(foreign)
Error in namespaceExport(ns, exports) : undefined exports: write.foreign
Error in library(foreign) : package/namespace load failed for 'foreign'
with rw2000dev as of (2004-09-17
Kjetil
--
Kjetil Halvorsen.
Peace is the most effective weapon of mass construction.
-- Mahdi Elmandjra
2005 Mar 29
2
strange error with rw2010dev
With rw2010dev I get a strange protect(): protection stack overflow
error with a small data frame which otherwise is usable:
If anybody wants to have a look I can provide an RData file
with the problematic data frame.
Doesn't seem to be necessary, the following simulated example
generates the error:
> testmat <- matrix(1:80, 20,4)
> dim(testmat)
[1] 20 4
> str(testmat)
int
2003 Aug 22
2
converting factor to numeric
Hola!
The R FAQ says:
7.12 How do I convert factors to numeric?
It may happen that when reading numeric data into R (usually, when
reading in a file), they come in as factors. If f is such a factor
object, you can use
as.numeric(as.character(f))
to get the numbers back. More efficient, but harder to remember, is
as.numeric(levels(f))[as.integer(f)]
In any case, do not call as.numeric()
2003 Jul 17
2
Minor nuisance with rw1071
Hola!
Starting with rw1071, just after starting Rgui the scope is not with
Rconsole, but some other place. This means I have to do a mouse click
in the Rconsole before starting to write the first command. Since I
always forget this, I end up writing the first command twice.
This is of course only a minor nuisance, but why is focus no longer
set to Rconsole window when start-up?
This is on
2003 Sep 02
2
identify with image
Hola!
I will want to identify pixels in an image with the mouse, for
so getting the image data from the matrix(es), for use in subsequent
discriminant analysis. But the following bombs R:
(windows XP, rw1071)
> str(baboon)
list()
- attr(*, "size")= int [1:2] 512 512
- attr(*, "cellres")= num [1:2] 1 1
- attr(*, "bbox")= num [1:4] 0 0 512 512
- attr(*,
2010 Jan 30
3
Competiciín de classificación!!! Fwd: [R] Classification of supernovae - a challenge
Hola!
Este mail llegó a r-help hoy, yo lo mandó también a esta lista. Es
interesante
con competiciones de predicción/clasificación! ¿Alguien que quiere cooperar?
Kjetil
---------- Forwarded message ----------
From: Kjetil Halvorsen <kjetilbrinchmannhalvorsen@gmail.com>
Date: Fri, Jan 29, 2010 at 12:19
Subject: Fwd: [R] Classification of supernovae - a challenge
To: Kjetil Halvorsen
2005 Apr 30
2
Warning from Rcmd check - data could not find data set
This is rw2010 from CRAN.
When running Rcmd check
on a package I get:
Warning in utils::data(list = al, envir = data_env) :
data set 'vowel.test' not found
Warning in utils::data(list = al, envir = data_env) :
data set 'vowel.train' not found
Warning in utils::data(list = al, envir = data_env) :
data set 'waveform.test' not found
Warning in utils::data(list
2005 Apr 30
2
Warning from Rcmd check - data could not find data set
This is rw2010 from CRAN.
When running Rcmd check
on a package I get:
Warning in utils::data(list = al, envir = data_env) :
data set 'vowel.test' not found
Warning in utils::data(list = al, envir = data_env) :
data set 'vowel.train' not found
Warning in utils::data(list = al, envir = data_env) :
data set 'waveform.test' not found
Warning in utils::data(list
2003 Mar 21
2
rsync
Hola!
I am now downloading r-devel to compile it on windows XP. The CRAN
source code page says "you will prefere to use rsync". I am googling
around, and cannot find anything about rsync on windows.
Anybody has any experience with rsync on windows?
Kjetil
2004 Aug 27
2
Packing of data files in packages
Hola!
I am writing a package with some large data files, so it would be good to
use the feature of zipping data.
However, I use .R files to read in the data from one (sometimes more)
files, so Rcmd build --zip-data
gives a package which does'nt work. How should I do it, is it better ti
zip each data file individually and use the functions to read from
zipped files, or are there some other
2004 Oct 29
1
as.list.matrix
I found the need of converting a matrix into a list of its columns
(for use with do.call), and was surprised there was no method
as.list.matrix, it could easily be a part of as.list default
I wrote
my.as.list.matrix <- function(mat) {
if(!is.matrix(mat))stop("Argument must be a matrix")
n <- NCOL(mat)
res <- vector(mode="list", length=n)
2004 Dec 23
1
small problem with R CMD check
On trying with very smll test packages
to try drilling down to som problems earlier reported in this list,
I detected the following:
R CMD check
on a package with an R subdirectory empty, reports:
* checking R files for syntax errors ... ERROR
Syntax error in file
On removing the empty subdirectory, the
error disappears.
Kjetil
--
Kjetil Halvorsen.
Peace is the most effective weapon of
2003 Jul 29
2
Problems with Rcmd build --- windows
Hola!
I am using Rcmd build --binary ... on a windows XP system, and am
encountering a strange problem. Rcmd claims there are syntax errors
in one of mine .Rd files
******* Syntax error: mismatched or missing brackets in
I take "brackets" to mean [], and I have none of them in the file,
and don't think they are needed. Rcmd prints out the offending file,
and in the printout I
2004 Dec 09
2
finding the most frequent row
I am bootstrapping using a function that I have defined. The "Statistic" of the function is an array of 10 numbers. Therefore if I use 1000 replications, the "t" matrix will have 1000 rows each of which is a bootstrap replicate of this 10 number array (10 columns). Is there any easy way in R to determine which row appears the most frequently?
Thanks,
Lisa Pappas
Huntsman
2004 Sep 17
3
Removing constants from a data frame
Suppose I have
x<-data.frame(v1=1:4, v2=c(2,4,NA,7), v3=rep(1,4),
v4=LETTERS[1:4],v5=rep('Z',4))
or a much larger frame, and I wish to test for and remove the constant
numeric columns.
I made:
is.constant<-function(x){identical(min(x),max(x))}
and
apply(x,2,is.constant) # Works for numerics
x[,-which(apply(x,2,is.constant))]
I'd really like to be able to