Displaying 20 results from an estimated 2000 matches similar to: "Recoding"
2001 Aug 30
1
imagenrgb: Function to display RGB images in R
I've writen this function (imagenrgb)
to display a (m,n,3) array
as a RGB image with ngris^3 colors and,optionally,
stretching. If option ver=F, it does not
display but saves a pseudocolor version of the image
as a list (so that subsequent displays are faster).
I'd appreciate feedback and improvements
and hope that it's useful for others.
Example of use:
> dim(imatest)
[1] 100
2001 Nov 20
2
is match slow?
I'm doing
m <- match(matriz, origen, 0)
where matriz is a 270x900 matrix and
origen a 11675 elements vector, and is taking
a very long time.
Is match a function
implemented in C? If not, would a C
code be faster?
Thanks
Agus
Dr. Agustin Lobo
Instituto de Ciencias de la Tierra (CSIC)
Lluis Sole Sabaris s/n
08028 Barcelona SPAIN
tel 34 93409 5410
fax 34 93411 0012
alobo at ija.csic.es
2008 Sep 12
2
Greyed text in the background of a plot
Hi!
Is there any way of having a greyed ("ghosted") text
(i.e, 2006) in the background of a plot?
I'm making a dynamic plot and would like to show the
year of each time step as a big greyed text in the background.
(the idea comes from Hans Rosling video:
http://video.google.com/videoplay?docid=4237353244338529080&sourceid=searchfeed
)
Thanks
Agus
--
Dr. Agustin Lobo
Institut
2008 May 19
2
Log or diary file
Hi!
Is it possible to set a file to which both
commands and output would get automatically
saved? I've tried with sink(), but only get
the output. I mean something
like a combined history and sink, as you
get with File/Save to File.. in the windows
GUI.
Tis is done with diary filename in Matlab,
and you can state diary on and
diary off to control what is being saved to
the file.
Thanks
Agus
2009 Jul 03
4
Function to eliminate blank space within strings?
Is there an specific function
to eliminate blank space within
strings?
Thanks
--
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: Agustin.Lobo at ija.csic.es
http://www.ija.csic.es/gt/obster
2007 Jul 24
1
Renamig a factor
Which is the proper way to rename a factor?
If I do:
test$Parc[test$Parc=="Ol?rdola"]<-"Ol?rdola"
R complains that
Warning message:
invalid factor level, NAs generated in: `[<-.factor`(`*tmp*`, test$Parc
== "Ol?rdola", value = "Ol?rdola")
Thanks
Agus
--
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
LLuis Sole
2008 Apr 18
1
space between plots
I've set
layout(matrix(c(1,3,2,4),ncol=2))
and
par(mar=c(0, 4, 4, 0) + 0.0) and
par(mar=c(0, 0, 4, 3) + 0.0)
for the upper-left and upper-right plots, but
still get an space between both plots,
is there any way to completely eliminate that space?
Thanks
Agus
--
Dr. Agustin Lobo
Institut de Ciencies de la Terra "Jaume Almera" (CSIC)
LLuis Sole Sabaris s/n
08028 Barcelona
Spain
2008 May 21
2
Proportional axes
Hi!
If I'm plotting 2 variables with the same units
(i.e. wing length of 2 species), how can I force that X
and Y axes have the same size for length unit? For example, if
X ranges from 0 to 10 and Y ranges from 10 to 30, I want
Y axis to be twice as long as X axis. I know I can just
put xlim and ylim from 0 to 30, i.e.,
plot(runif(10,0,10),runif(10,10,30),xlim=c(0,30),ylim=c(0,30))
but this
2009 Sep 02
1
Problem at subsetting matrix by using dimnames
Given:
> mitest <- matrix(1:16,ncol=4)
> dimnames(mitest)[[1]] <- c("a","b","c","d")
> dimnames(mitest)[[2]] <- c("a","b","c","d")
> mitest
a b c d
a 1 5 9 13
b 2 6 10 14
c 3 7 11 15
d 4 8 12 16
I can do:
> mitest[cbind(c(1,2,3),c(2,3,2))]
[1] 5 10 7
but using the names does not
2008 Jul 28
1
Converting from char to POSIX:
Given char vector delme2:
> str(delme2)
chr [1:1065] "30-1-08 8:48:21" "30-1-08 8:55:17" "30-1-08 9:00:22" ...
I do:
> delme3 <- strptime(delme2,format="%d-%m-%y %H:%M:%S")
But then:
> str(delme3)
POSIXlt[1:9], format: "2008-01-30 08:48:21" "2008-01-30 08:55:17" ...
> length(delme3)
[1] 9
whie
>
2009 May 12
2
ubuntu problem with 'r-cran-robustbase' [FWD Agustin Lobo]
Agustin, posted on R-help.
I think the problem is one of the debian/ubuntu package
'r-cran-robustbase' and its setup or (missing?) dependencies.
I can confirm Agustin's problem, working on Ubuntu 8.04.2
(8.04 is a "LTS" = long time support version).
apt-get install r-cran-robustbase
works fine, but when trying to load the package,
there's a DLL - dependency on
2008 Jun 24
2
subscripting in data frames with NA
Dear list:
Given
> str(b3)
'data.frame': 159 obs. of 6 variables:
$ index_pollution : num 8.228 10.513 0.549 0.915 10.416 ...
$ position_descrip: chr "2" "2" "2" NA ...
$ position_geo : chr "3" "0" "3" "3" ...
$ institution : Factor w/ 3 levels "digesa","mem",..: 3 3 3 3 3 3
2007 Oct 26
2
cut.dendrogram and cutree
Hi!
In the example:
hc <- hclust(dist(USArrests), "ave")
dend1 <- as.dendrogram(hc)
dend2 <- cut(dend1, h=70)
Do the branches "Branch 1", "Branch 2", "Branch 2"...in dend2$upper
str(dend2$upper)
--[dendrogram w/ 2 branches and 4 members at h = 152]
|--[dendrogram w/ 2 branches and 2 members at h = 77.6]
| |--leaf "Branch 1" (h=
2014 Apr 10
3
Unión de subconjuntos procedentes de bucles
Buenas tardes a todos los participantes del foro.
Me dirijo a vosotros porque estoy atascado con una duda de programación respecto al data frame:
> dd # Data frame de 5 variables, leído de un archivo txt
id sexo nacim origen final
1 1 0 02/09/1955 01/04/1985 01/02/2014
2 2 1 29/10/1951 15/08/1996 01/05/2009
3 3 0 30/10/1942 02/08/2000 01/02/2014
4 4 1
2009 May 12
2
[Fwd: Re: ubuntu problem with 'r-cran-robustbase' [FWD Agustin Lobo]]
Subject: Re: [R-sig-Debian] ubuntu problem with 'r-cran-robustbase' [FWD
Agustin Lobo]
Date: Tue, 12 May 2009 13:30:49 +0200
From: Agustin Lobo <aloboaleu at gmail.com>
Reply-To: aloboaleu at gmail.com
To: Dirk Eddelbuettel <edd at debian.org>
CC: Martin Maechler <maechler at stat.math.ethz.ch>,
R-SIG-Debian at stat.math.ethz.ch
References: <18953.17704.527898.355877
2009 Mar 08
2
prcomp(X,center=F) ??
I do not understand, from a PCA point of view, the option center=F
of prcomp()
According to the help page, the calculation in prcomp() "is done by a
singular value decomposition of the (centered and possibly scaled) data
matrix, not by using eigen on the covariance matrix" (as it's done by
princomp()) .
"This is generally the preferred method for numerical accuracy"
2018 Sep 29
4
Cambiar formato fecha
Holaefectivamente lubridate te podría servir
library(lubridate)
data$fecha_nueva<-dmy(data$ReviewData)
El Viernes 28 de septiembre de 2018 16:41, Javier Marcuzzi <javier.ruben.marcuzzi en gmail.com> escribió:
Estimada Miriam
Le respondo corto, estoy en el celular, escriba str(los datos), su fecha
puede ser en realidad texto. Hay varias formas, lubridate, pero yo aprendí
2013 Jul 19
1
copiar directorio en r
Muchas gracias Miguel.
Os pongo mi solución por si alguien necesita llamar a distintos tipos de
sistema.
setwd("C:/Users/usuario/Desktop/Pruebas/")
x <- sessionInfo()
sistema <- substr(x$R.version$system,1, 3 )
origen <- "Carp"
destino <- "Carp235"
switch(sistema,
x86 =
system(paste(Sys.getenv("COMSPEC"),"/c
2017 Aug 31
2
Conectar Access con R
Ya he visto como hacerlo:
conexion<-odbcConnect("rx")
Pero pense que podria elegir luego la bd que yo quisiera. Entiendo que de esta manera la base de datos siempre se tiene que llamar igual y estar en el mismo sitio, si no quiero andar modificando de nuevo la conexion con Windows. ¿Verdad?
Gracias
Jesús
________________________________
De: Jesús Para Fernández
2013 May 31
1
consulta
Hola Agustin
Creo que esto te podría valer
Tiempos<-rnorm(100)
Caudales<-rnorm(100)
qmed<-0
#Tiempos<-c(1,3,5)
#Caudales<-c(-1,1,-1)
zeros<-function(tiempo,valor,qmed){
orden<-order(tiempo)
tiempo<-tiempo[orden]
valor<-valor[orden]
zeros<-c()
for(i in 1:(length(tiempo)-1)){
if((valor[i]-qmed)*(valor[i+1]-qmed)<0){