[R] Renamig a factor

2007-07-24 Thread Agustin Lobo
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 Sabaris s/n
08028 Barcelona
Spain
Tel. 34 934095410
Fax. 34 934110012
email: [EMAIL PROTECTED]
http://www.ija.csic.es/gt/obster

__
R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Bhat: installation problem(2)

2004-02-11 Thread Agustin . Lobo
Sorry I went too fast:
copying a "Built:" field
to DESCRIPTION
 makes library(Bhat) not
to issue any error message but
although "package:Bhat" is in
workspace 2, it's empty. This
fix does not work.

Agus

PLEASE NOTE NEW E-MAIL ADDRESS
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
e-mail [EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Bhat: installation problem

2004-02-11 Thread Agustin . Lobo
Hi!

I'm trying to install package Bhat on
a Win machine, had a problem and figured out
a fix, but would like to report the
problem and make sure the fix is correct. This is what I do:
1. Download Bhat_0.9-07.tar.gz
2. Uncompress it and compress it back to Bhat_0.9-07.zip
3. Install from the R windows gui (that
apparentely requires the zip compression and cannot 
deal with the tar.gz)

But when I type
library(Bhat)

I get:

Error in testRversion(descfirlds): This package has not been installed
properly. See Note in ?library

There it says that a "Built:" field should exist in DESCRIPTION.
As it is not there, I've copied a Built field from another
package and now library(Bhat) seems to work. But, is this
fix correct?

Thanks for any help on this,

Agus

PLEASE NOTE NEW E-MAIL ADDRESS
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
e-mail [EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html


[R] Subseting in a 3D array

2003-10-15 Thread Agustin Lobo

Hi!

I have a 3d array:
> dim(ib5km15.dbc)
[1] 190 241  19

and a set of positions to extract:
> ib5km.lincol.random[1:3,]
 [,1] [,2]
[1,]   78   70
[2,]   29  213
[3,]  180   22

Geting the values of a 2D array
for that set of positions would
be:

> ima <- ib5km15.dbc[,,1]
> ima[ib5km.lincol.random[1:10,]]

but don't find the way for the case
of the 3D array:

> ib5km15.dbc[ib5km.lincol.random[1:10,],]
Error in ib5km15.dbc[ib5km.lincol.random[1:10, ], ] :
incorrect number of dimensions

Could anyone suggest the way of subseting
the 3D array to get a vector of z values
for each position recorded in ib5km.lincol.random?
(avoiding the use of for loops).

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
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] clim.pact (fwd)

2003-07-10 Thread Agustin Lobo

I'm trying to use the clim.pact
package but I cannot find the
descritions of "map object or "field object". For example,
according to the man page of function "map":

"
Description 
Produces maps. 

Usage 
map(x,y=NULL,col="black",lwd=1,lty=1,sym=TRUE, plot=TRUE,inv.col=FALSE) 

Arguments x A map object.
...
"

and according to the man page of plotField:

"
Usage 
plotField(x,lon=NULL,lat=NULL,tim=NULL,mon=NULL, 
col="black",lty=1,lwd=1,what="ano") 

Arguments x A field object.
"

retrieve.nc might be a clue, but the
files mentioned in the man page are not included
in the package:

"
Description 
Reads a netCDF file and picks out vectors that look like 
lngitude, latitude and time. Returns the first 3-D field in the file.
Usage
retrieve.nc(f.name="data/ncep_t2m.nc",..
.../...

Examples
X.1 <- retrieve.nc("data/mpi-gsdio_t2m.nc", 
x.rng=c(-60,40),y.rng=c(50,75)) 
X.2 <- retrieve.nc("data/mpi-gsdio_slp.nc", 
x.rng=c(-60,40),y.rng=c(50,75))
"

I've downloaded a sample nc file from 
http://www.epic.noaa.gov/java/ncBrowse/
but don't get to use plotField.

Does anyone have any experience using this 
package?

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
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Problem with fitdistr for beta

2003-07-04 Thread Agustin Lobo

I have the following problem:

I have a vector x of data (0 a <- rbeta(100,0.1,0.1)
> fitdistr(x=a, "beta", start=list(shape1=0.1,shape2=0.1))1)
>  shape1   shape2
  0.09444627   0.12048753
 (0.01120670) (0.01550129)

but sometimes does not:
> a <- rbeta(100,0.1,0.1)
> fitdistr(x=a, "beta", start=list(shape1=0.1,shape2=0.1))1)
> Error in optim(start, mylogfn, x = x, hessian = TRUE, ...) :
Function cannot be evaluated at initial parameters

Unfortunately, my data fall in the second case

I've searched for any weird value that be present in the
cases in which fitdistr exits with the error message, but
could not find any.

Any help?
(please if anyone answers be sure to answer to my address as well,
I cannot subscribe to the list)

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
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] ylim in plot(corresp(,df=2))

2003-03-10 Thread Agustin Lobo

Hi!

If I do:

plot(corresp(a, nf = 2),xlim=c(-1,2),ylim=c(-1,1))

while the xlim takes effect, the ylim does not,
no matter the values given for ylim.

Is this intentional? is this an error?
(I think this might be related with
line 41 in biplot.default in mva)

(using R 1.6.2 on a linux (suse 7.3) box.)

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
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
https://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] Disregard:"problem at installing Rade"

2003-03-04 Thread Agustin Lobo

Excuses to the list,

this problem is a "peculiarity" of my system that
I (thought) had solved, but after installing 
a (non-R) package seems to be here again.

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
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] problem at installing Rade

2003-03-04 Thread Agustin Lobo

Hi!

I try to install the R version of ade4 on a linux (suse7.3) box
with R 1.6.2 (from rpm)
and get 
/usr/local/bin/R INSTALL ade4_1.00.tar.gz
tar: /usr/local/lib/libpthread.so.0: version `GLIBC_2.2' not found 
(required by /lib/librt.so.1)
ERROR: cannot extract package from 'ade4_1.00.tar.gz'

But I actually have glibc 2.2.4 
(at least this is what my suse's Yast conf. tool 
tells me, perhaps there is a more direct way of checking 
it?)

Having used the rpm for R, should I use the
rpm for ade4? 

Thanks 

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
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help


[R] inserting elements in a list

2003-02-17 Thread Agustin Lobo

I've searched the doc for insert
and could not find the way to do the following,
hope someone can help:

Let's say we have a vector:
> a
[1] "1" "2" "3" "5" "6" "3"

and we want to insert a "7" after
any given "3", i.e., we want vector a 
to become:

[1] "1" "2" "3" "7" "5" "6" "3" "7"

That is, how can we replce one
element by more than one elements?
(...causing the vector to go beyond its
length)

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
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



[R] make check errors

2003-01-14 Thread Agustin Lobo

After make check in a linux suse7.3
with

./configure --enable-R-shlib --with-blas=/usr/lib/libatlas.a --with-gnome
--with-gnome-includes=/opt/gnome/include --with-gnome-libs=/opt/gnome/lib
--with-libglade-config=/opt/gnome/bin/libglade-config


I run make and make check. I get, at the end:

running strict specific tests
make[3]: Entering directory `/usr/local/R-1.6.2/tests'
running code in 'eval-etc.R' ... OK
comparing 'eval-etc.Rout' to './eval-etc.Rout.save' ...1d0
< WARNING: ignoring environment value of R_HOME
make[3]: *** [eval-etc.Rout] Error 1
make[3]: Leaving directory `/usr/local/R-1.6.2/tests'
make[2]: *** [test-Specific] Error 2
make[2]: Leaving directory `/usr/local/R-1.6.2/tests'
make[1]: *** [test-all-basics] Error 1
make[1]: Leaving directory `/usr/local/R-1.6.2/tests'
make: *** [check] Error 2

What should I do to fix these errors?

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
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



[R] R-release.diff.gz: "patch detected! Assume -R? [n]"

2003-01-14 Thread Agustin Lobo
Hi!

I'm upgrading to 1.6.2. (linux suse7.3). 
I see that there is
a patch in R-release.diff.gz.

1. Is this patch stable? In other words, is
it adviced that I install R-release.diff.gz ?

2. When I do:

zcat R-release.diff.gz | patch -p1 -E

I get many lines such as:

patching file AUTHORS
Reversed (or previously applied) patch detected!  Assume -R? [n]

Should I just accept the default answer?

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
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



[R] 3D array display with (x,g)gobi from R

2003-01-03 Thread Agustin Lobo

Does anyone know if it is possible to display
an R 3D array with ggobi or xgobi?
For example, if I try 
ggobi(cubo) 
where cubo is  an
array with dimensions (100,100,22)
I get
"Error in as.data.frame.default(data) : can't coerce array into a
data.frame"

Should I transform the array
into a dataframe with columns
x,y,x,value 

?

Is there any other way?
My goal is to visualize an slice,
select a cell, and plot
the values in the z axis
for that cell.

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
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help



[R] calling R from python (fwd)

2002-12-23 Thread Agustin Lobo
A question for a (experienced) user of the RPython package on
linux.

I'm trying to call R from python on a linux (Suse 7.3) box.

After installing  R CMD INSTALL -c RSPython_0.5-2.tar.gz

I start python and do:

>>> import sys
>>> sys.path.append('/usr/local/lib/R/library/RSPython')
>>> sys.path.append('/usr/local/lib/R/library/RSPython/Python')
>>> sys.path.append('/usr/local/lib/R/library/RSPython/libs')
>>> sys.path.append('/usr/local/lib/R/library/RSPython/man')
>>> sys.path.append('/usr/local/lib/R/library/R/RSPython')
>>> sys.path.append('/usr/local/lib/R/library/RSPython/R/RSPython')
>>> sys.path.append('/usr/local/lib/R/library/RSPython/R')
>>> sys.path.append('/usr/local/lib/R/library/RSPython/include')
>>> sys.path.append('/usr/local/lib/R/include/R_ext')
>>> import RS
Traceback (most recent call last):
  File "", line 1, in ?
  File "/usr/local/lib/R/library/RSPython/Python/RS.py", line 1, in ?
import RSInternal
ImportError: /usr/local/lib/R/library/RSPython/libs/RSInternal.so:
undefined symbol: R_GlobalEnv
>>> import RS
>>> RS.call("rnorm", 10);
Traceback (most recent call last):
  File "", line 1, in ?
AttributeError: 'RS' module has no attribute 'call'

Any idea of what am I doing wrong? Where should R_GlobalEnv
be defined?

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
[EMAIL PROTECTED]

__
[EMAIL PROTECTED] mailing list
http://www.stat.math.ethz.ch/mailman/listinfo/r-help