Re: [R] stringr package question

2015-08-13 Thread Mauricio Romero
thanks that makes sense... in the previous version of R it worked for
some reason.

On Thu, Aug 13, 2015 at 4:33 PM, Sarah Goslee sarah.gos...@gmail.com
wrote:

 Hi,

 The + is a special character in regular expressions. If you want to
 match a literal + you need to escape it:

 str_extract(+proj=utm +zone=19 +datum=WGS84 +units=m +no_defs
 +ellps=WGS84 +towgs84=0,0,0, \\+proj=[a-zA-Z0-9]*)

 Sarah


 On Thu, Aug 13, 2015 at 2:55 PM, Mauricio Romero
 mauricioromerolond...@gmail.com wrote:
  Hi,
 
  I'm running R 3.2.1 and im having an unexpected problem... when I run the
  follwing code it returns an error
 
  library(stringr)
  str_extract(+proj=utm +zone=19 +datum=WGS84 +units=m +no_defs
 +ellps=WGS84
  +towgs84=0,0,0, +proj=[a-zA-Z0-9]*)
 
  But I can't find whats wrong with my code.
 
  Thanks
 
  Mauricio
 


[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] stringr package question

2015-08-13 Thread Mauricio Romero
Hi,

I'm running R 3.2.1 and im having an unexpected problem... when I run the
follwing code it returns an error

library(stringr)
str_extract(+proj=utm +zone=19 +datum=WGS84 +units=m +no_defs +ellps=WGS84
+towgs84=0,0,0, +proj=[a-zA-Z0-9]*)

But I can't find whats wrong with my code.

Thanks

Mauricio

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] Bug in raster projectRaster?

2015-06-01 Thread Mauricio Romero
Hi,

I'm sorry I cant post a reproducible example, but the data sets involve are
too large. I'm currently trying to create a mosaic from 2 different Landsat
7 scenes. One of them is in UTM 18 and the other in UTM 17. Before using
the mosaic command, I'm doing

LandsatTransform=projectRaster(from=LandsatUTM17, to=LandsatUTM18)

but i get a raster that is full of NAs and the following warning message

Warning message:
In .rasterFromRasterFile(grdfile, band = band, objecttype, ...) :
  size of values file does not match the number of cells (given the data
type)

Not sure what to do. Any help is really appreciated.

Thanks,

Mauricio

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
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] reading a .mdf file in R

2011-05-08 Thread Mauricio Romero
Hi,

 

I have a very large .mdf database (36 GB) that I want to import to R. 

I'm using a computer with 64 GB of RAM, running on windows server 2008 R2
with SQL.

 

Could anyone guide me through the process. I have absolutely no idea what to
do.

 

Thanks,

 

 

Mauricio Romero 

 


[[alternative HTML version deleted]]

__
R-help@r-project.org 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] 'RQuantLib for 2.12 version

2011-03-29 Thread Mauricio Romero
Dear R users,

I have been trying to use RQuantLib in the 2.12.2 R version. I downloaded
the .zip file from
http://sourceforge.net/projects/quantlib/files/QuantLib/
http://sourceforge.net/projects/quantlib/files/QuantLib/ which didn't work,
so I 

I downloaded the package source from
http://sourceforge.net/projects/quantlib/files/QuantLib/1.0.1/
http://sourceforge.net/projects/quantlib/files/QuantLib/1.0.1/ 

 

Then I run:

install.packages(RQuantLib_0.3.6.tar.gz, type=source, repos=NULL)

and get the following error:

 

Installing package(s) into 'C:\Users\Mauricio\Documents/R/win-library/2.12'

(as 'lib' is unspecified)

* installing *source* package 'RQuantLib' ...

 

   **

   WARNING: this package has a configure script

 It probably needs manual configuration

   **

 

 

** libs

 

*** arch - i386

cygwin warning:

  MS-DOS style path detected: C:/PROGRA~1/R/R-212~1.2/etc/i386/Makeconf

  Preferred POSIX equivalent is:
/cygdrive/c/PROGRA~1/R/R-212~1.2/etc/i386/Makeconf

  CYGWIN environment variable option nodosfilewarning turns off this
warning.

  Consult the user's guide for more details about POSIX paths:

http://cygwin.com/cygwin-ug-net/using.html#using-pathnames

g++ -IC:/PROGRA~1/R/R-212~1.2/include
-IC:/Users/Mauricio/Documents/R/win-library/2.12/Rcpp/include   -I -I.
-O2 -Wall  -c asian.cpp -o asian.o

asian.cpp:26:23: fatal error: rquantlib.h: No such file or directory

compilation terminated.

make: *** [asian.o] Error 1

ERROR: compilation failed for package 'RQuantLib'

* removing 'C:/Users/Mauricio/Documents/R/win-library/2.12/RQuantLib'

Warning messages:

1: running command 'C:\PROGRA~1\R\R-212~1.2/bin/i386/R CMD INSTALL -l
C:\Users\Mauricio\Documents/R/win-library/2.12   RQuantLib_0.3.6.tar.gz'
had status 1 

2: In install.packages(RQuantLib_0.3.6.tar.gz, type = source, repos =
NULL) :

  installation of package 'RQuantLib_0.3.6.tar.gz' had non-zero exit status

 

 

Any ideas?

 

Thanks,

 

Mauricio Romero 


[[alternative HTML version deleted]]

__
R-help@r-project.org 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] nominal response model

2010-10-15 Thread Mauricio Romero
Is there a way to estimate a nominal response model?

 

To be more specific let's say I want to calibrate:

\pi_{v}(\theta_j)=\frac{e^{\xi_{v}+\lambda_{v}\theta_j}}{\sum_{h=1}^m
e^{\xi_{h}+\lambda_{h}\theta_j}}

 

Where $\theta_j$ is a the dependent variable and I need to estimate
$\xi_{h}$ and $\lambda_{h}$ for $h \in {1...,m}$.

 

Thank you,

 

 

Mauricio Romero 

Quantil S.A.S.

Cel: 3112231150

www.quantil.com.co

 

It is from the earth that we must find our substance; it is on the earth
that we must find solutions to the problems that promise to destroy all life
here

 


[[alternative HTML version deleted]]

__
R-help@r-project.org 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] vectorizing: selecting one record per group

2010-10-13 Thread Mauricio Romero
Hi,

 

I want to select a subsample from my data, choosing one record from each
group. I know how to do this with a for.

 

For example: lets say I have the data:

A=cbind(rnorm(100),runif(100),(rep(c(1,2,3,4,5),20)))

Where the third column is the group variable. Then what I want is to select
5 observations. Each one taken randomly from each group.

 

 

INDEX =NULL

i=1

for(index_g in  unique(A[,3])){

INDEX [i]=sample(which(A[,3]==index_g),1)

i=i+1

}

SEL=A[INDEX,]

 

 

Is there a way to do this without a “for”? in other words is there a way to
“vectorize” this?

 

Thank you,

 

 

Mauricio Romero 

Quantil S.A.S.

Bogotá,Colombia

www.quantil.com.co

 

It is from the earth that we must find our substance; it is on the earth
that we must find solutions to the problems that promise to destroy all life
here

 


[[alternative HTML version deleted]]

__
R-help@r-project.org 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] problem with predict from nnet package

2009-11-20 Thread Mauricio Romero
Hi,

 

I’m having mayor issues with predict from the nnet package.

I’m training a neural network for forecasting. I trained the network with
info from 1995 to 2009 and I want to forecast month by month 2010.(the
network forecasts one month at a  time).

 

Since I have to do iterative forecasting, im using predict several times
including, including the new forecast each time, but for some reason predict
doesn’t forecast after the first itereation.

 

Here is my code:

 

pronostico4=function(x,rezagosx,muestra, reps, tam, maxi,vo,net){

library(timeSeries)

library(nnet)

library(dummies)

x=as.timeSeries(x)

X=NULL

 for (k in 1:length(rezagosx)) {

 X=cbind(X, lag(diff(log(x)),rezagosx[k]))

 }

 

  pred=predict(net, X,type=raw)

  print(sum(is.na(pred)))

  pred[muestra]=diff(log(x))[muestra]

  pred=exp(diffinv(pred[is.na(pred)==0],xi=log(vo)) )

  muestra2=muestra

  muestra2[max(which(muestra2==1))+1]=TRUE

  print(length(pred))

  print(sum(muestra2))

  print(sum(is.na(X)))

  x[muestra2]=pred[1:sum(muestra2)]

  return(x)

  }

  

  

  muestra=(is.na(a[,Precio.Promedio.Bolsa])==0 
a[,año]2009)

  pred=a[,Precio.Promedio.Bolsa]

  pred[muestra==F]=NA

   pred=as.timeSeries(pred)

X=NULL

for (k in 1:length(rezagosx)) {

 X=cbind(X, lag(diff(log(pred)),rezagosx[k]))

 }

  net=nnet2(diff(log(pred)),X,muestra,reps,tam,maxi)

 

 

  for (i in 1:12){

 
pred=pronostico4(pred,rezagosx,muestra,reps,tam,maxi,vo,net)

  muestra[max(which(muestra==1))+1]=TRUE

  } 

 

 

 

Mauricio Romero 

Quantil S.A.

Cel: 3112231150

 

It is from the earth that we must find our substance; it is on the earth
that we must find solutions to the problems that promise to destroy all life
here

 


[[alternative HTML version deleted]]

__
R-help@r-project.org 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.