[R] some general advice sought on the use of gctorture()

2015-04-24 Thread Franckx Laurent
Dear all

I have bumped into the dreaded 'segfault' error type when running some C++ code 
using .Call().

I have already undertaken several attempts to debug the C++ code with gdb(), 
but until now I have been unable to pinpoint the origin of the problem. There 
are two elements that I think are puzzling (a) this .Call() has worked fine for 
about three years, for a variety of data (b)  the actual crash occurs at random 
points during the execution of the function (well, random from a human eye's 
point of view).

From what I understand in the R extensions manual, the actual problem may 
have been around for a while before the actual call to the C++ code. As 
recommended in the manual, I am now using  gctorture() to try to pinpoint the 
origins of the problem. I can, alas, only confirm that gctorture() has an 
enormous impact on execution time, even for operations that are normally 
executed within the blink of an eye. From what I have seen until now, 
executing all the R code before the crash with gctorture(TRUE) could take 
months.

I suppose then that the best way to proceed would be to proceed backward from 
the point where the crash occurs when gctorture(FALSE).

I have tried to find some concrete examples of good practices in the use of 
gctorture() to identify memory problems in R, but most of what I have found on 
the web is simply a copy of the help page. Does anybody know more concrete and 
elaborated examples that could give an indication on how to best proceed 
further?





Laurent Franckx, PhD
Senior researcher sustainable mobility
VITO NV | Boeretang 200 | 2400 Mol
Tel. ++ 32 14 33 58 22| mob. +32 479 25 59 07 | Skype: laurent.franckx | 
laurent.fran...@vito.be | Twitter @LaurentFranckx




VITO Disclaimer: http://www.vito.be/e-maildisclaimer

__
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.


Re: [R] error message: ReadItem: unknown type 64, perhaps written by later version of R

2015-03-06 Thread Franckx Laurent


 -Original Message-
 From: Prof Brian Ripley [mailto:rip...@stats.ox.ac.uk]
 Sent: vrijdag 6 maart 2015 10:23
 To: Franckx Laurent; r-help@r-project.org
 Subject: Re: [R] error message: ReadItem: unknown type 64, perhaps written
 by later version of R

 On 05/03/2015 20:34, Franckx Laurent wrote:
  Dear all
 
  I get the following error message when I try to load one  specific RData
 object in R:
 
   Error: ReadItem: unknown type 64, perhaps written by later
  version of R
 
 
  The error message is odd because (a) this RData object was created just
 one hour berfore in a  previous script (in a series of R scripts called in 
 batch
 mode), so it would seem to me that it has been created by the same version
 of R that is now calling it (b) this script is looping over several 
 scenarios and
 years, and the error only occurs for one very specific combination of
 scenarios and years. This object is about 6 Gb large, which is the same  size 
 as
 the other objects that were called in previous instances.

 What is 'odd' is that you missed the 'perhaps'.

 The most likely explanation is an I/O error when the file was written:
 it is 'perhaps' corrupted.



Dear Professor Riply,

Thank you for your suggestion.

The possibility of an I/O error in the writing of the file is actually 
something I had anticipated. The saving of the file is immediately followed by 
a test - see the code below.

save(list = skimlistname, file = 
file.path(pathsony[[rdata]],skimlistnamerdata))
if(file.exists(file.path(pathsony[[rdata]],skimlistnamerdata))) {
cat(skimlistnamerdata,  has been created. \n , file = 
warningfile, sep = , append = TRUE)
} else {
stop(skimlistnamerdata,  has not been created correctly. \n )
}

My understanding was that this test code would stop the execution of the 
program if the file had not been saved correctly.
Moreover, each of my script starts with a verification whether any error 
message is contained in the Rout of the preceding scripts, and stops execution 
immediately if this is indeed the case.
Therefore, I should not even have reached the point where R tries to load the 
file in memory.
Is there any alternative to verifying whether a file has been created correctly 
without actually loading it?
Sincerely,
Laurent Franckx



  I load the RData with the following command (where pathsony[[rdata]] is
 the folder with the RData and skimlistrdata is the file I try to load):
 
   load( file.path(pathsony[[rdata]],skimlistrdata))
 
 
  The problem occurs both when I run the script in batch mode or when I run
 it interactively.
 
  I use a  x86_64-pc-linux-gnu and  R version 3.1.2 (2014-10-31).
 
 
  Laurent Franckx, PhD
  Senior researcher sustainable mobility VITO NV | Boeretang 200 | 2400
  Mol Tel. ++ 32 14 33 58 22| mob. +32 479 25 59 07 | Skype:
  laurent.franckx | laurent.fran...@vito.be | Twitter @LaurentFranckx


 --
 Brian D. Ripley,  rip...@stats.ox.ac.uk
 Emeritus Professor of Applied Statistics, University of Oxford
 1 South Parks Road, Oxford OX1 3TG, UK
VITO Disclaimer: http://www.vito.be/e-maildisclaimer
__
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] error message: ReadItem: unknown type 64, perhaps written by later version of R

2015-03-05 Thread Franckx Laurent
Dear all

I get the following error message when I try to load one  specific RData object 
in R:

Error: ReadItem: unknown type 64, perhaps written by later version of R


The error message is odd because (a) this RData object was created just one 
hour berfore in a  previous script (in a series of R scripts called in batch 
mode), so it would seem to me that it has been created by the same version of R 
that is now calling it (b) this script is looping over several scenarios and 
years, and the error only occurs for one very specific combination of scenarios 
and years. This object is about 6 Gb large, which is the same  size as the 
other objects that were called in previous instances.

I load the RData with the following command (where pathsony[[rdata]] is the 
folder with the RData and skimlistrdata is the file I try to load):

load( file.path(pathsony[[rdata]],skimlistrdata))


The problem occurs both when I run the script in batch mode or when I run it 
interactively.

I use a  x86_64-pc-linux-gnu and  R version 3.1.2 (2014-10-31).


Laurent Franckx, PhD
Senior researcher sustainable mobility
VITO NV | Boeretang 200 | 2400 Mol
Tel. ++ 32 14 33 58 22| mob. +32 479 25 59 07 | Skype: laurent.franckx | 
laurent.fran...@vito.be | Twitter @LaurentFranckx




VITO Disclaimer: http://www.vito.be/e-maildisclaimer

__
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.


Re: [R] difference between max in summary table and max function

2015-02-16 Thread Franckx Laurent
Thanks for the clarification. The basic error on my side was that I had 
misunderstood the digits option in the summary, I had not understood that 
even integer numbers might end up being rounded. Problem is solved now.

-Original Message-
From: Allen Bingham [mailto:aebingh...@gmail.com]
Sent: zaterdag 14 februari 2015 8:16
To: 'Martyn Byng'; r-help@r-project.org
Cc: Franckx Laurent
Subject: RE: [R] difference between max in summary table and max function

I thought I'd chime in ... submitting the following:

   ?summary

Provides the following documentation for the default for generalized argument 
(other than class=data.frame, factor, or matrix):

   ## Default S3 method:
   summary(object, ..., digits = max(3, getOption(digits)-3))

so passing along the object testrow w/o a corresponding argument for digits 
... defaults to digits=4 (assuming your system has the same default option of 
digits = 7 that mine does).

... and since later in the documentation it indicates that digits is an:

   integer, used for number formatting with signif()

so noting that all of the values you reported from summary(testrow) all have
4 significant digits (including the Max. of 131500) (excepting the min value of 
1), summary() is doing what it is documented to do.

... sorry for being pedantic --- but doing so to point out how helpful the ? 
command can be sometimes.

Hope this helps.

__
Allen Bingham
Bingham Statistical Consulting
aebingh...@gmail.com
LinkedIn Profile: www.linkedin.com/pub/allen-bingham/3b/556/325





-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Martyn Byng
Sent: Friday, February 13, 2015 3:15 AM
To: Franckx Laurent; r-help@r-project.org
Subject: Re: [R] difference between max in summary table and max function

Its a formatting thing, try

summary(testrow,digits=20)

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Franckx Laurent
Sent: 13 February 2015 11:00
To: r-help@r-project.org
Subject: [R] difference between max in summary table and max function

Dear all

I have found out that the max in the summary of an integer vector is not always 
equal to the actual maximum of that vector. For example:


 testrow - c(1:131509)
 summary(testrow)
   Min. 1st Qu.  MedianMean 3rd Qu.Max.
  1   32880   65760   65760   98630  131500
 max(testrow)
[1] 131509

This has occurred both in a Windows and in a Linux environment.

Does this mean that the max value in the summary is only an approximation?

Best regards

Laurent Franckx, PhD
Senior researcher sustainable mobility
VITO NV | Boeretang 200 | 2400 Mol
Tel. ++ 32 14 33 58 22| mob. +32 479 25 59 07 | Skype: laurent.franckx | 
laurent.fran...@vito.be | Twitter @LaurentFranckx




VITO Disclaimer: http://www.vito.be/e-maildisclaimer

__
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.


This e-mail has been scanned for all viruses by Star.\ _...{{dropped:11}}

__
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] difference between max in summary table and max function

2015-02-13 Thread Franckx Laurent
Dear all

I have found out that the max in the summary of an integer vector is not always 
equal to the actual maximum of that vector. For example:


 testrow - c(1:131509)
 summary(testrow)
   Min. 1st Qu.  MedianMean 3rd Qu.Max.
  1   32880   65760   65760   98630  131500
 max(testrow)
[1] 131509

This has occurred both in a Windows and in a Linux environment.

Does this mean that the max value in the summary is only an approximation?

Best regards

Laurent Franckx, PhD
Senior researcher sustainable mobility
VITO NV | Boeretang 200 | 2400 Mol
Tel. ++ 32 14 33 58 22| mob. +32 479 25 59 07 | Skype: laurent.franckx | 
laurent.fran...@vito.be | Twitter @LaurentFranckx




VITO Disclaimer: http://www.vito.be/e-maildisclaimer

__
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] use of effects coding in instrumental variables estimation

2014-01-31 Thread Franckx Laurent
Dear all,

I am estimating a model with instrumental variables using ivreg() (from the 
AER library). When the regressors and the instruments are limited to 
continuous variables, things work fine.

However, I have some regressors, such as income, for which I only have 
categorical data (very low income, low income etc).

I have used the following procedure for effects coding (where  
one_car_dist_car_fam  is the dataframe with the sample observations and   
totink_ovg is the categorical variable):

one_car_dist_car_fam$totink_ovg - 
as.factor(one_car_dist_car_fam$totink_ovg)

contrasts(one_car_dist_car_fam$totink_ovg)  - contr.sum(7)


See http://www.ats.ucla.edu/stat/r/library/contrast_coding.htm for a refernece.


Ordinary least squares works fine with this approach (where voorby is the 
dependent variable en totpr11 is a continuous regressor):


 common_from - formula(voorby ~ totpr11+ totink_ovg)

 dist_ols - lm(common_from, data =  one_car_dist_car_fam)


However, when I apply this to ivreg(), I get the following result (I have now 
added an endogenous variable  verbrgem and the instruments  gewleeg + cyl + 
kw):

 common_from - formula(voorby ~ totpr11  +  totink_ovg   + verbrgem )

 form_for_iv - update.formula(common_from, ~ . | totpr11+ 
totink_ovg+ gewleeg + cyl + kw  )

 dist_iv -ivreg( form_for_iv, data =  one_car_dist_car_fam)

Error in lm.fit(xz, y, offset = offset, ...) : 0 (non-NA) cases

In addition: Warning messages:

1: In Ops.factor(totpr11, totink_ovg) : + not meaningful for factors

2: In Ops.factor(totpr11, totink_ovg) : + not meaningful for factors


Does anyone have an idea why this occurs with ivreg() and not with lm()?

Of course, I still have the backup of doing the effects coding manually, but 
I would first like to know whether there is an elegant way out of this specific 
problem.



Laurent Franckx, PhD
Senior researcher sustainable mobility
VITO NV | Boeretang 200 | 2400 Mol
Tel. ++ 32 14 33 58 22| mob. +32 479 25 59 07 | Skype: laurent.franckx | 
laurent.fran...@vito.be | Twitter @LaurentFranckx












VITO Disclaimer: http://www.vito.be/e-maildisclaimer

__
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] error message system is computationally singular under mlogit

2014-01-29 Thread Franckx Laurent
Dear all,

I am trying to estimate a multinomial logit model with mlogit.

The data I use for the estimation have the following format (in the full data 
set, there are many more explanatory variables, but I omit them here for the 
sake of simplicity):

 head(sample)
choice  cl_vint_com gezinsid pr_tot
10   1  411060112   2176.015
2   0   2   411060112   2240.531
3   0   3   411060112   3649.945
4   0   4   411060112   3255.782
5   0   5   411060112   5391.076
6   0   6   411060112   3740.085

choice is 1 if the alternative is chosen and 0 otherwise
 cl_vint_com   is the ID of the alternative
gezinsid   is the ID of the individuals
pr_tot is the price of each alternative.

I use the following steps for the estimation:

two_carmodel_data - mlogit.data(sample, choice = choice, shape = long, 
alt.var = cl_vint_com, chid.var = gezinsid )
formula_2cars - mFormula(choice  ~ pr_tot  )
mod_res - mlogit(formula_2cars, two_carmodel_data)

This leads to the following error messages:

  Error in solve.default(H, g[!fixed]) :  system is computationally 
singular: reciprocal condition number = 5.17802e-25


From the documentation of the mlogit package, I do not see any mistake in my 
formulation of mFormula()   (pr_tot is an alternative specific variable).

I have found some internet discussions of users facing a similar problem, and I 
understand that in some cases, this may be due to some alternatives that are 
never chosen in the sample (leading to separation problems).

However, I have eliminated all alternatives that are never chosen, and the 
problem persists. The output of the following table confirms that no 
quasi-separation occurs):

table(sample $pr_tot , sample $choice)

I have probably made a very trivial mistake leading to collinerarity, but I do 
not see where (after all, mlogit takes care of setting the alternative-specific 
constant for the 1st alternative to zero, doesn't it?)

Please advice.


Laurent Franckx, PhD
Senior researcher sustainable mobility
VITO NV | Boeretang 200 | 2400 Mol
Tel. ++ 32 14 33 58 22| mob. +32 479 25 59 07 | Skype: laurent.franckx | 
laurent.fran...@vito.be | Twitter @LaurentFranckx









#verify whether all cl_vint are chosen to avoid strict separation
test_for_separ - table(input_for_NLOGIT_all_alt_joined$cl_vint_com 
,input_for_NLOGIT_all_alt_joined$choice)
test_for_separ_sel - test_for_separ[test_for_separ$1 == 0, ]















VITO Disclaimer: http://www.vito.be/e-maildisclaimer

__
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.


Re: [R] error message system is computationally singular under mlogit

2014-01-29 Thread Franckx Laurent
Dear Bert

In the example below, I use just one variable (apparently I mixed up the 
formatting in the original mail) :

two_carmodel_data - mlogit.data(sample, choice = choice, shape = long, 
alt.var = cl_vint_com, chid.var = gezinsid )

formula_2cars  - mFormula(choice  ~ pr_tot  )

mod_res - mlogit(formula_2cars,  two_carmodel_data)



Thus, the only source of colinearity I can imagine is between  pr_tot   and 
the dummies for alternative-specific constant, but I thought mlogit 
automatically took care of setting one of them equal to zero.

Cheers

Laurent



-Original Message-
From: Bert Gunter [mailto:gunter.ber...@gene.com]
Sent: woensdag 29 januari 2014 16:43
To: Franckx Laurent
Cc: r-help@r-project.org
Subject: Re: [R] error message system is computationally singular under mlogit

Advice: I would guess that  you are overfitting. Simplify your model.
Drop some of the variables.You probably have (near) linear dependencies in your 
design matrix.

-- Cheers,
Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

Data is not information. Information is not knowledge. And knowledge is 
certainly not wisdom.
H. Gilbert Welch




On Wed, Jan 29, 2014 at 7:33 AM, Franckx Laurent laurent.fran...@vito.be 
wrote:
 Dear all,

 I am trying to estimate a multinomial logit model with mlogit.

 The data I use for the estimation have the following format (in the full data 
 set, there are many more explanatory variables, but I omit them here for the 
 sake of simplicity):

 head(sample)
 choice  cl_vint_com gezinsid pr_tot
 10   1  411060112   2176.015
 2   0   2   411060112   2240.531
 3   0   3   411060112   3649.945
 4   0   4   411060112   3255.782
 5   0   5   411060112   5391.076
 6   0   6   411060112   3740.085

 choice is 1 if the alternative is chosen and 0 otherwise
 cl_vint_com   is the ID of the alternative gezinsid   is the ID of
 the individuals pr_tot is the price of each alternative.

 I use the following steps for the estimation:

 two_carmodel_data - mlogit.data(sample, choice = choice, shape =
 long, alt.var = cl_vint_com, chid.var = gezinsid ) formula_2cars
 - mFormula(choice  ~ pr_tot  ) mod_res - mlogit(formula_2cars,
 two_carmodel_data)

 This leads to the following error messages:

   Error in solve.default(H, g[!fixed]) :  system is
 computationally singular: reciprocal condition number = 5.17802e-25


 From the documentation of the mlogit package, I do not see any mistake in my 
 formulation of mFormula()   (pr_tot is an alternative specific variable).

 I have found some internet discussions of users facing a similar problem, and 
 I understand that in some cases, this may be due to some alternatives that 
 are never chosen in the sample (leading to separation problems).

 However, I have eliminated all alternatives that are never chosen, and the 
 problem persists. The output of the following table confirms that no 
 quasi-separation occurs):

 table(sample $pr_tot , sample $choice)

 I have probably made a very trivial mistake leading to collinerarity,
 but I do not see where (after all, mlogit takes care of setting the
 alternative-specific constant for the 1st alternative to zero, doesn't
 it?)

 Please advice.


 Laurent Franckx, PhD
 Senior researcher sustainable mobility VITO NV | Boeretang 200 | 2400
 Mol Tel. ++ 32 14 33 58 22| mob. +32 479 25 59 07 | Skype:
 laurent.franckx | laurent.fran...@vito.be | Twitter @LaurentFranckx









 #verify whether all cl_vint are chosen to avoid strict separation
 test_for_separ - table(input_for_NLOGIT_all_alt_joined$cl_vint_com
 ,input_for_NLOGIT_all_alt_joined$choice)
 test_for_separ_sel - test_for_separ[test_for_separ$1 == 0, ]















 VITO Disclaimer: http://www.vito.be/e-maildisclaimer

 __
 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.
VITO Disclaimer: http://www.vito.be/e-maildisclaimer
__
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] passing of longitude and lattitude arguments to read URL in Google Maps and extract routes

2013-07-02 Thread Franckx Laurent
Dear all

I try to use Google Maps to calculate travel times per transit between an 
origin an destination.

The guidelines for the search can be found at: 
https://developers.google.com/maps/documentation/directions/#TravelModes

When I submit the latitude and the longitude of the origin and destination as 
literals, things work fine.

For instance, the following code executes correctly and we obtain the distance 
and trip duration (the output of the search is in JSON format and is converted 
to an R object with fromJSON)

library(rjson)
library(gooJSON)
route - url('http://maps.googleapis.com/maps/api/directions/json?  

origin=51.13854,4.384575destination=51.13156,4.387118region=besensor=falsemode=transitdeparture_time=1372665319')
route_file  - file(route_file.json)
L - readLines(route,-1)
writeLines(L, route_file)
close(route)
routesR_zone1_to_zone20 - fromJSON( file = route_file )
routesR_zone1_to_zone20$routes[[1]][[3]][[1]]$distance$value/1000
routesR_zone1_to_zone20$routes[[1]][[3]][[1]]$duration$value/60


However, what I am really interested in is to repeat this operation for 
thousands of origin-destination pairs. The longitude and the latitude of the 
origins and destinations then become variables.

For instance:

 lat_or
[1] 51.13854
 long_or
[1] 4.384575
 lat_des
[1] 51.13156
 long_des
[1] 4.387118
 route - url('http://maps.googleapis.com/maps/api/directions/json?

origin=lat_or,long_ordestination=lat_des,long_desregion=besensor=falsemode=transitdeparture_time=1372665319')
 route_file  - file(route_file.json)
 L - readLines(route,-1)
 writeLines(L, route_file)
 close(route)
 routesR_zone1_to_zone20 - fromJSON( file = route_file )
 routesR_zone1_to_zone20
$routes
list()

$status
[1] NOT_FOUND

Thus, although the coordinates are the same as in the previous example, this 
time, no route is found.

I suppose that the problem is that, when the url is accessed, lat_or etc are 
not translated in the corresponding numeric values, and that Google tries to 
calculate the route between the literals  lat_or,long_or and  
lat_des,long_des.

Does anyone have a suggestion on how to circumvent the problem?




Laurent Franckx, PhD
VITO NV
Boeretang 200, 2400 MOL, Belgium
Tel. + 32 14 33 58 22
Skype: laurent.franckx
laurent.fran...@vito.be
Visit our website: www.vito.be/english and http://www.vito.be/transport











[http://www.vito.be/e-maildisclaimer/vito.png]


Ontdek hoe VITO de transitie naar een duurzame maatschappij op gang trekt: 
www.vito.be/duurzaamheidsverslag2012http://www.vito.be/duurzaamheidsverslag2012
Discover how VITO initiates the transition towards a sustainable society: 
www.vito.be/sustainabilityreport2012http://www.vito.be/sustainabilityreport2012


VITO Disclaimer: http://www.vito.be/e-maildisclaimer

__
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.


Re: [R] passing of longitude and lattitude arguments to read URL in Google Maps and extract routes

2013-07-02 Thread Franckx Laurent
Dear David

Thank you for the suggestion.
The following works fine:

or_dest - 
paste0(origin=,lat_or,,,long_or,destination=,lat_des,,,long_des)
url_to_google - paste( 
http://maps.googleapis.com/maps/api/directions/json?,or_dest,sensor=falsemode=transitdeparture_time=1372665319,sep=;
 )
route - url(url_to_google)

Problem solved, thus.

-Original Message-
From: David Winsemius [mailto:dwinsem...@comcast.net]
Sent: dinsdag 2 juli 2013 15:56
To: Franckx Laurent
Cc: 'r-help'
Subject: Re: [R] passing of longitude and lattitude arguments to read URL in 
Google Maps and extract routes


On Jul 2, 2013, at 1:59 AM, Franckx Laurent wrote:

 Dear all

 I try to use Google Maps to calculate travel times per transit between an 
 origin an destination.

 The guidelines for the search can be found at:
 https://developers.google.com/maps/documentation/directions/#TravelMod
 es

 When I submit the latitude and the longitude of the origin and destination as 
 literals, things work fine.

 For instance, the following code executes correctly and we obtain the
 distance and trip duration (the output of the search is in JSON format
 and is converted to an R object with fromJSON)

library(rjson)
library(gooJSON)
route - url('http://maps.googleapis.com/maps/api/directions/json? 
  
 origin=51.13854,4.384575destination=51.13156,4.387118region=besensor=falsemode=transitdeparture_time=1372665319')
route_file  - file(route_file.json)
L - readLines(route,-1)
writeLines(L, route_file)
close(route)
routesR_zone1_to_zone20 - fromJSON( file = route_file )
routesR_zone1_to_zone20$routes[[1]][[3]][[1]]$distance$value/1000
routesR_zone1_to_zone20$routes[[1]][[3]][[1]]$duration$value/60


 However, what I am really interested in is to repeat this operation for 
 thousands of origin-destination pairs. The longitude and the latitude of the 
 origins and destinations then become variables.

 For instance:

 lat_or
[1] 51.13854
 long_or
[1] 4.384575
 lat_des
[1] 51.13156
 long_des
[1] 4.387118
 route - url('http://maps.googleapis.com/maps/api/directions/json?   
  
 origin=lat_or,long_ordestination=lat_des,long_desregion=besensor=falsemode=transitdeparture_time=1372665319')
 route_file  - file(route_file.json) L - readLines(route,-1)
 writeLines(L, route_file)
 close(route)
 routesR_zone1_to_zone20 - fromJSON( file = route_file )
 routesR_zone1_to_zone20
$routes
list()

$status
[1] NOT_FOUND

 Thus, although the coordinates are the same as in the previous example, this 
 time, no route is found.

 I suppose that the problem is that, when the url is accessed, lat_or etc are 
 not translated in the corresponding numeric values, and that Google tries 
 to calculate the route between the literals  lat_or,long_or and  
 lat_des,long_des.

Yes. That seems likely. R would not interpret a text literal. I don't 
understand why you are not using the ordinary text handling function 'paste0'.

?paste0

 lat_or - 51.13854
long_or - 4.384575
lat_des -  51.13156
long_des - 4.387118

 paste0(origin=,lat_or,,,long_or,destination=,lat_des,,,long_d
 es)
[1] origin=51.13854,4.384575destination=51.13156,4.387118


(Also tested on Mac with R 3.0.0 RC using Google JSON Data Interpreter for R, 
Version: 1.0.01.)

--
David.

 Does anyone have a suggestion on how to circumvent the problem?




 Laurent Franckx, PhD
 VITO NV
 Boeretang 200, 2400 MOL, Belgium

--

David Winsemius
Alameda, CA, USA

[http://www.vito.be/e-maildisclaimer/vito.png]


Ontdek hoe VITO de transitie naar een duurzame maatschappij op gang trekt: 
www.vito.be/duurzaamheidsverslag2012http://www.vito.be/duurzaamheidsverslag2012
Discover how VITO initiates the transition towards a sustainable society: 
www.vito.be/sustainabilityreport2012http://www.vito.be/sustainabilityreport2012


VITO Disclaimer: http://www.vito.be/e-maildisclaimer

__
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] passing of arguments to R CMD BATCH in bash script that is submitted to torque (Linux platform)

2013-06-15 Thread Franckx Laurent
Dear all

I want to call R repeatedly in batch mode from a bash script that is then 
submitted to torque.

My calls to R depend on optional arguments.

When I introduce these arguments as literals, the calls work fine, for instance:

R CMD BATCH  --no-save --args PERIOD='08' YEAR='2008' SC='BAU'  
preparecostvectors.R

However, the arguments PERIOD, YEAR and SC are really variables over which I 
'loop'.

When these variables are defined in the same script as the call to R CMD BATCH, 
this still works, for instance:

year=2008
sc=BAU
R CMD BATCH  --no-save --args PERIOD='08' YEAR=\$year\ SC=\$sc\   
preparecostvectors.R

Things go wrong when the script is called from another script, for instanced 
with:

qsub -v year=2008,sc=BAU  ATLAS_assign.sh

echo $sc and echo $year in ATLAS_assign.sh yield BAU and 2008 
respectively.

Thus, as far as I can see, nothing goes wrong in the passing of the optional 
arguments in qsub.

However,

R CMD BATCH  --no-save --args PERIOD='08' YEAR=\$year\ SC=\$sc\   
preparecostvectors.R

is not executed. I do not get even an Rout file, so I suppose the R script is 
not even called.

I suppose there is something wrong in the format in which I submit year and sc, 
but I do not see what.


Laurent Franckx, PhD
VITO NV
Boeretang 200, 2400 MOL, Belgium
Tel. + 32 14 33 58 22
Skype: laurent.franckx
laurent.fran...@vito.be
Visit our website: www.vito.be/english and http://www.vito.be/transport











[http://www.vito.be/e-maildisclaimer/vito.png]


Ontdek hoe VITO de transitie naar een duurzame maatschappij op gang trekt: 
www.vito.be/duurzaamheidsverslag2012http://www.vito.be/duurzaamheidsverslag2012
Discover how VITO initiates the transition towards a sustainable society: 
www.vito.be/sustainabilityreport2012http://www.vito.be/sustainabilityreport2012


VITO Disclaimer: http://www.vito.be/e-maildisclaimer

__
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] adding class attributes to strings: works in a loop, but not directly

2013-05-29 Thread Franckx Laurent
Dear all

I try to assign class attributes to strings. Depending on the approach I use, 
it works (including method dispatch) or fails.

Let me clarify with an example.

Let:

 AONtptmodelist - c(FOOT,BICY)


When I assign class attributes directly to these strings, it fails:

 class(BICY) - AONmode
Error in class(BICY) - AONmode :
  target of assignment expands to non-language object

However, when I assign the attributes in a loop, it does work:

 for(tptmode in AONtptmodelist) {
+ class(tptmode) - AONmode
+ cat(The value of is.object(tptmode) for  , tptmode , is:  , 
is.object(tptmode) , .\n)
+ cat(The class of  , tptmode , is:  , class(tptmode) , .\n)
+ }
The value of is.object(tptmode) for  FOOT is:  TRUE .
The class of  FOOT is:  AONmode .
The value of is.object(tptmode) for  BICY is:  TRUE .
The class of  BICY is:  AONmode .

Moreover, within this loop, method dispatch works correctly.

However, when I start a new loop over the same vector, I get:

 for(tptmode in AONtptmodelist) {
+ cat(The value of is.object(tptmode) for  , tptmode , is:  , 
is.object(tptmode) , .\n)
+ cat(The class of  , tptmode , is:  , class(tptmode) , .\n)
+ }
The value of is.object(tptmode) for  FOOT is:  FALSE .
The class of  FOOT is:  character .
The value of is.object(tptmode) for  BICY is:  FALSE .
The class of  BICY is:  character .


I find this troublesome for two reasons. First, I do not understand the 
difference between the two approaches. Why can I assign a class attribute to a 
string when it is called in a loop, but not directly? And why is the class 
attribution not permanent? Second, the problem was concealed until now 
precisely because I assigned the attributes in a link. However, I would like to 
centralise my class definition in one single place in my code, thus outside the 
loop where the methods are called.



Laurent Franckx, PhD
VITO NV
Boeretang 200, 2400 MOL, Belgium
Tel. + 32 14 33 58 22
Skype: laurent.franckx
laurent.fran...@vito.be
Visit our website: www.vito.be/english and http://www.vito.be/transport











[http://www.vito.be/e-maildisclaimer/vito.png]


Ontdek hoe VITO de transitie naar een duurzame maatschappij op gang trekt: 
www.vito.be/duurzaamheidsverslag2012http://www.vito.be/duurzaamheidsverslag2012


VITO Disclaimer: http://www.vito.be/e-maildisclaimer

__
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.


Re: [R] adding class attributes to strings: works in a loop, but not directly

2013-05-29 Thread Franckx Laurent
Dear Nello
Thanks for the clarification.
It was of course an elementary mistake to assume that the for loop would modify 
the original AONtptmodelist.
I also understand now that the issues was that I cannot attribute a class to a 
literal.
Your proposed alternative seems to work now, including the method dispatch.
Regards
Laurent


-Original Message-
From: Blaser Nello [mailto:nbla...@ispm.unibe.ch]
Sent: woensdag 29 mei 2013 15:56
To: Franckx Laurent; r-help@r-project.org
Subject: RE: [R] adding class attributes to strings: works in a loop, but not 
directly

There are two separate issues that seem to be unclear.
Concerning the class assignment: You cannot assign a class to a character 
string. You can assign a class to an object that contains a character string:

 a - b
# ok
 class(a) - AONmode
# not ok
 class(b) - AONmode
Error in class(b) - AONmode :
  target of assignment expands to non-language object

Concerning your for-loop: for (tptmode in AONtptmodelist) creates a new object 
tptmode and changes this. This will in no way alter your object AONtptmodelist. 
If you want to have the elements of AONtptmodelist have a different class, you 
could for instance create a new object newAONtptmodelist as follows:

newAONtptmodelist - lapply(AONtptmodelist, function(x){
  class(x) - AONmode
  return(x)
})

Best,
Nello

-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]
On Behalf Of Franckx Laurent
Sent: Mittwoch, 29. Mai 2013 13:49
To: 'r-help@r-project.org'
Subject: [R] adding class attributes to strings: works in a loop, but not 
directly

Dear all

I try to assign class attributes to strings. Depending on the approach I use, 
it works (including method dispatch) or fails.

Let me clarify with an example.

Let:

 AONtptmodelist - c(FOOT,BICY)


When I assign class attributes directly to these strings, it fails:

 class(BICY) - AONmode
Error in class(BICY) - AONmode :
  target of assignment expands to non-language object

However, when I assign the attributes in a loop, it does work:

 for(tptmode in AONtptmodelist) {
+ class(tptmode) - AONmode
+ cat(The value of is.object(tptmode) for  , tptmode , is:  ,
+ is.object(tptmode) , .\n) cat(The class of  , tptmode , is:  ,
+ class(tptmode) , .\n) }
The value of is.object(tptmode) for  FOOT is:  TRUE .
The class of  FOOT is:  AONmode .
The value of is.object(tptmode) for  BICY is:  TRUE .
The class of  BICY is:  AONmode .

Moreover, within this loop, method dispatch works correctly.

However, when I start a new loop over the same vector, I get:

 for(tptmode in AONtptmodelist) {
+ cat(The value of is.object(tptmode) for  , tptmode , is:  ,
+ is.object(tptmode) , .\n) cat(The class of  , tptmode , is:  ,
+ class(tptmode) , .\n) }
The value of is.object(tptmode) for  FOOT is:  FALSE .
The class of  FOOT is:  character .
The value of is.object(tptmode) for  BICY is:  FALSE .
The class of  BICY is:  character .


I find this troublesome for two reasons. First, I do not understand the 
difference between the two approaches. Why can I assign a class attribute to a 
string when it is called in a loop, but not directly? And why is the class 
attribution not permanent? Second, the problem was concealed until now 
precisely because I assigned the attributes in a link. However, I would like to 
centralise my class definition in one single place in my code, thus outside the 
loop where the methods are called.



Laurent Franckx, PhD
VITO NV
Boeretang 200, 2400 MOL, Belgium
Tel. + 32 14 33 58 22
Skype: laurent.franckx
laurent.fran...@vito.be
Visit our website: www.vito.be/english and http://www.vito.be/transport











[http://www.vito.be/e-maildisclaimer/vito.png]


Ontdek hoe VITO de transitie naar een duurzame maatschappij op gang
trekt:
www.vito.be/duurzaamheidsverslag2012http://www.vito.be/duurzaamheidsver
slag2012


VITO Disclaimer: http://www.vito.be/e-maildisclaimer

__
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.


[http://www.vito.be/e-maildisclaimer/vito.png]


Ontdek hoe VITO de transitie naar een duurzame maatschappij op gang trekt: 
www.vito.be/duurzaamheidsverslag2012http://www.vito.be/duurzaamheidsverslag2012


VITO Disclaimer: http://www.vito.be/e-maildisclaimer

__
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] error occurring in batch mode, not interactive mode: how to find cause of problem

2013-02-04 Thread Franckx Laurent
Dear all,

I use R version 2.15.1 on  x86_64-pc-linux-gnu (64-bit).

I run a simulation where I have to call a series of R scripts in batch mode.

When I run the following two lines, this works well for PERIOD='17' but not for 
PERIOD='08':

R CMD BATCH  --no-save --args PERIOD='08' YEAR='203O' SC='BAU'  
preparecostvectors.R preparecostvectors08_2030.Rout
R CMD BATCH  --no-save --args PERIOD='17' YEAR='2030' SC='BAU'  
preparecostvectors.R preparecostvectors17_2030.Rout

The error message I get for PERIOD='08' is (but I do not think this is relevant 
for my main question):

Error in names(votlist) - votname :
  'names' attribute [3] must be the same length as the vector [0]

I get this error message for all values of YEAR.

Oddly enough, when I run the script preparecostvectors.R interactively, all 
works perfectly fine. However, this is not a structural solution, because I 
need to be able to run my simulation for a large number of years.

I was wondering if any tools exist that could help me to reconstruct what went 
wrong in batch mode. I think I am familiar with most debugging tools in 
interactive mode, but how can I trace the origin of the problem when I get an 
error in batch mode?

Just to avoid any misunderstanding: I am not asking any help on the error 
message itself, just some suggestions on how I could trace what goes wrong when 
running R in batch mode.


Laurent Franckx, PhD
VITO NV
Boeretang 200, 2400 MOL, Belgium
Tel. + 32 14 33 58 22
Skype: laurent.franckx
laurent.fran...@vito.be
Visit our website: www.vito.be/english and http://www.vito.be/transport






VITO Disclaimer: http://www.vito.be/e-maildisclaimer

__
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] Error in memory.size(size) when calling R in batch mode (but not in interactive mode)

2012-11-09 Thread Franckx Laurent
Dear all

I use a 64 bit Windows7 system with 16 GB memory.
I have run an R script in batch mode with the following command:
  R CMD BATCH  masterassignment_2012_11_09.r --save
The execution was terminated with the following error message:

Error in memory.size(size) :  don't be silly!: your machine has a 4Gb 
address limit


I never get this error message in an interactive session (and I don't think I 
should, taking into account the system). To be sure, I have just double checked 
this again in an interactive session, and it works fine.

There are two possible explanations I can think of:
a) The command line doesn't know the system, i.e. it thinks it works on a 
32bit system (is this possible at all?)
b) I run R on a remote desktop, and the command line thinks I am calling R from 
my laptop

Anyway, I wouldn't know how to solve this.

In case you wonder why I run R in batch mode at all: I have a series of 
iterations in my model, each of which is taking huge amount of memory. Although 
I regularly impose a garbage collection, after two or three iterations, R 
crashes when used interactively. I thought that running and exiting R after 
each iteration would be the only effective way to clean up memory. If you 
have any other solutions, I would be happy to hear about them as well.



Laurent Franckx, PhD
VITO NV
Boeretang 200, 2400 MOL, Belgium
Tel. + 32 14 33 58 22
Skype: laurent.franckx
laurent.fran...@vito.be
Visit our website: www.vito.be/english and http://www.vito.be/transport







 [http://www.vito.be/e-maildisclaimer/bsds.png]  http://bsds.vito.be

VITO Disclaimer: http://www.vito.be/e-maildisclaimer

__
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.


Re: [R] Error in memory.size(size) when calling R in batch mode (but not in interactive mode)

2012-11-09 Thread Franckx Laurent
Thank you for the hint.

In batch mode, I got:

R version 2.15.1 (2012-06-22)
Platform: i386-pc-mingw32/i386 (32-bit)

In interactive mode, I got:


R version 2.15.1 (2012-06-22)
Platform: x86_64-pc-mingw32/x64 (64-bit)


And I have found the cause. In my path, I had still included 
C:\R-2.15.1\bin\i386 (I had copied an old batch file, and overlooked this).

The problem is solved now.


-Original Message-
From: Milan Bouchet-Valat [mailto:nalimi...@club.fr]
Sent: vrijdag 9 november 2012 14:34
To: Franckx Laurent
Cc: 'r-help@r-project.org'
Subject: Re: [R] Error in memory.size(size) when calling R in batch mode (but 
not in interactive mode)

Le vendredi 09 novembre 2012 à 10:43 +, Franckx Laurent a écrit :
 Dear all

 I use a 64 bit Windows7 system with 16 GB memory.
 I have run an R script in batch mode with the following command:
   R CMD BATCH  masterassignment_2012_11_09.r --save The execution
 was terminated with the following error message:

 Error in memory.size(size) :  don't be silly!: your machine
 has a 4Gb address limit


 I never get this error message in an interactive session (and I don't
 think I should, taking into account the system). To be sure, I have
 just double checked this again in an interactive session, and it works
 fine.

 There are two possible explanations I can think of:
 a) The command line doesn't know the system, i.e. it thinks it
 works on a 32bit system (is this possible at all?)
 b) I run R on a remote desktop, and the command line thinks I am
 calling R from my laptop
c) When you run R CMD BATCH, the 32-bit version of R is used, while when you 
run it interactively, you start the 64-bit version.

To check this, add sessionInfo() to your batch script, and have a look at the 
output.


Hope this helps

 Anyway, I wouldn't know how to solve this.

 In case you wonder why I run R in batch mode at all: I have a series
 of iterations in my model, each of which is taking huge amount of
 memory. Although I regularly impose a garbage collection, after two or
 three iterations, R crashes when used interactively. I thought that
 running and exiting R after each iteration would be the only effective
 way to clean up memory. If you have any other solutions, I would be
 happy to hear about them as well.



 Laurent Franckx, PhD
 VITO NV
 Boeretang 200, 2400 MOL, Belgium
 Tel. + 32 14 33 58 22
 Skype: laurent.franckx
 laurent.fran...@vito.be
 Visit our website: www.vito.be/english and
 http://www.vito.be/transport






 
  [http://www.vito.be/e-maildisclaimer/bsds.png]  http://bsds.vito.be

 VITO Disclaimer: http://www.vito.be/e-maildisclaimer

 __
 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.


 [http://www.vito.be/e-maildisclaimer/bsds.png]  http://bsds.vito.be

VITO Disclaimer: http://www.vito.be/e-maildisclaimer
__
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] R/C++ interfaces: crashes when using .c(), followed by correct results when R restarted

2012-09-20 Thread Franckx Laurent
Dear all


I have written a function in C++  , equil_distC, that I am calling from an R 
script.

In the last few days, R has repeatedly crashed when calling this function, or 
delivered obviously wrong outputs. However, when I restarted R after the crash, 
the results turned out to be OK most of the time although I had not modified 
the C++ code.

Although the code runs correctly now, I am not sure why it does work right now, 
and didn't just an hour ago.

Let me summarize the main steps I undertook:

* After having modified the script with the C++ code, I compiled it using R CMD 
SHLIB mylatestversion.cpp - no problems occurred then.
* Next, I loaded the dll into R with
dyn.load(C:\\Ccodefortransortmodel\\ mylatestversion.dll)
* Next, I called equil_distC with
testres2 - .C(equil_distC, as.integer(rowmaxfiets),as.integer(colmaxfiets), 
as.double(nodes), as.integer(links_dist_calc), as.integer(cyclepathsfirstline), 
as.integer(numzones), as.integer(numnodes), as.integer(numlinks), result = 
double(6))
* About half of the time, whenever I had changed the C++ code, the results were 
either nonsensical or R crashed.
* When R did not crash, I unloaded the dll with:
dyn.unload(C:\\Ccodefortransortmodel\\equildistCforodpair_2012_09_20v8.dll)
* Next, I deleted the .dll and the .o of the most recent version, I modified 
the C++ code and I ran the above procedure again.
* In most cases when R crashed, a new run of the procedure above resulted in 
correct results, even though the C++ code was not modified.

I have also noticed that, in several cases, apparently irrelevant changes to 
the code would lead to a crash. This occurred for instance when I replaced %d 
with %f in Rprintf()) - my first conjecture was actually that this was the root 
of the problem, but the code runs correctly now with %f.

My own conjecture is that, some way or another, old versions of equil_distC 
kept on circulating in memory.

For instance, even after a dyn.unload of all previous versions of the dll, 
is.loaded(equil_distC) would still lead to a TRUE.

I would like to understand the structural reason for these problems. Again, the 
problem is not the C++ code - it does run correctly now, although it had 
crashed in the previous run.


Best regards



Laurent Franckx, PhD
VITO NV
Boeretang 200, 2400 MOL, Belgium
Tel. + 32 14 33 58 22
Skype: laurent.franckx
laurent.fran...@vito.be








 [http://www.vito.be/e-maildisclaimer/bsds.png]  http://bsds.vito.be

VITO Disclaimer: http://www.vito.be/e-maildisclaimer

__
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] LoadLibrary failure: : %1 is not a valid Win32 application although arch x64 has been specified

2012-09-17 Thread Franckx Laurent
Dear all,

I have problems loading a library in the 64 version of R.

The following happens:


· I have a file, equildistC.cpp, which contains a few lines of C++ code.

· I have compiled the file using the following commands:
PATH =  
c:\Rtools\bin;C:\Rtools\gcc-4.6.3\bin;C:\Rtools\gcc-4.6.3\bin64;C:\Rtools\gcc-4.6.3\i686-w64-mingw32;C:\R-2.15.1\bin\i386;C:\R-2.15.1\bin\x64;c:\windows;c:\windows\system32;C:\Windows\SysWOW64
R --arch x64 CMD SHLIB equildistC.cpp

· I have received no messages indicating problem during compilation, 
and both the equildistC.o and the equildistC.dll have been created.

· When I load the dll in the 32bit version of R with 
dyn.load(C:\\Ccodefortransortmodel\\equildistC.dll), things appear to go well.

· However, in the 64 bit version, I get the message:
Error in inDL(x, as.logical(local), as.logical(now), ...) :
  unable to load shared object 'C:/Ccodefortransortmodel/equildistC.dll':
  LoadLibrary failure:  %1 is not a valid Win32 application.


I have googled the error message. Initially I had omitted “--arch x64” when 
compiling the file, but even after specifying the architecture, the error 
persists.
However, I definitely need to be able to run my code on the 64 version.


Kind regards
Laurent


[http://www.vito.be/e-maildisclaimer/bsds.png] http://bsds.vito.be
VITO Disclaimer: http://www.vito.be/e-maildisclaimer

[[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.


Re: [R] LoadLibrary failure: : %1 is not a valid Win32 application although arch x64 has been specified

2012-09-17 Thread Franckx Laurent
Problem solved, thank you.

-Original Message-
From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com]
Sent: maandag 17 september 2012 13:05
To: Franckx Laurent
Cc: 'r-help@r-project.org'
Subject: Re: [R] LoadLibrary failure: : %1 is not a valid Win32 application 
although arch x64 has been specified

On 12-09-17 3:56 AM, Franckx Laurent wrote:
 Dear all,

 I have problems loading a library in the 64 version of R.

 The following happens:


 * I have a file, equildistC.cpp, which contains a few lines of C++ 
 code.

 * I have compiled the file using the following commands:
 PATH =
 c:\Rtools\bin;C:\Rtools\gcc-4.6.3\bin;C:\Rtools\gcc-4.6.3\bin64;C:\Rto
 ols\gcc-4.6.3\i686-w64-mingw32;C:\R-2.15.1\bin\i386;C:\R-2.15.1\bin\x6
 4;c:\windows;c:\windows\system32;C:\Windows\SysWOW64
 R --arch x64 CMD SHLIB equildistC.cpp

That runs the 32 bit version of R (since you list it first in your path).  I 
don't see any docs that state that it will pay attention to the --arch 
directive.  (The docs say that syntax is supported under Unix-alikes, not under 
Windows.)





 * I have received no messages indicating problem during compilation, 
 and both the equildistC.o and the equildistC.dll have been created.

 * When I load the dll in the 32bit version of R with 
 dyn.load(C:\\Ccodefortransortmodel\\equildistC.dll), things appear to go 
 well.

 * However, in the 64 bit version, I get the message:
 Error in inDL(x, as.logical(local), as.logical(now), ...) :
unable to load shared object 'C:/Ccodefortransortmodel/equildistC.dll':
LoadLibrary failure:  %1 is not a valid Win32 application.


 I have googled the error message. Initially I had omitted --arch x64 when 
 compiling the file, but even after specifying the architecture, the error 
 persists.
 However, I definitely need to be able to run my code on the 64 version.

Then you should take the 32 bit version out of your path.

Duncan Murdoch



 Kind regards
 Laurent

 
 [http://www.vito.be/e-maildisclaimer/bsds.png] http://bsds.vito.be
 VITO Disclaimer: http://www.vito.be/e-maildisclaimer

   [[alternative HTML version deleted]]



 This body part will be downloaded on demand.



 [http://www.vito.be/e-maildisclaimer/bsds.png]  http://bsds.vito.be

VITO Disclaimer: http://www.vito.be/e-maildisclaimer

__
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.


Re: [R] use of ddply() within function

2012-09-07 Thread Franckx Laurent
Problem solved, thanks.
I've used this instead: COSTaux_AVCAR - 
ddply(CARaux,c(SC,YEAR),.fun = function(xx){sum(xx[  ,costcarin])})




-Original Message-
From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us]
Sent: donderdag 6 september 2012 14:56
To: Franckx Laurent; 'r-help@r-project.org'
Subject: Re: [R] use of ddply() within function

As the footer says, provide commented, _minimal_, self-contained, reproducible 
code.
This is hardly minimal or reproducible.

Anyway, this probably ought to qualify as a plyr FAQ of some sort: don't use 
the summarise function as the FUN argument within a function. Define a named or 
anonymous function of your own as the help page for ddply describes. Too many 
layers of syntactic sugar are involved for summarise to work within a function.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
---
Sent from my phone. Please excuse my brevity.

Franckx Laurent laurent.fran...@vito.be wrote:

Dear all,

I am encountering problems with the application of ddply within the
body of a self-defined function.

The script is the following:


moncostcarmoto - function(costtype){
costaux_result - data.frame()
for (purp in PURPcount){for (per in PERcount){
 costcarin = paste(c(CS_,costtype,CAR),collapse=)
   costmotoin = paste(c(CS_,costtype,MOTO),collapse=)
   browser()
COSTaux_AVCAR -
ddply(CARaux,c(SC,YEAR),summarize,costcsolo =
sum(CARaux[[costcarin]]))
COSTaux_AVMOTO-
ddply(CARaux,c(SC,YEAR),summarize,costmoto=
sum(CARaux[[costmotoin]] ))
COSTaux   -
join(COSTaux_AVCAR,COSTaux_AVMOTO,by=c(SC,YEAR))
   COSTaux[ ,PURP] - as.factor(purp)
   COSTaux[ ,PER]  - as.factor(per)
costaux_result - rbind(costaux_result,COSTaux)
   }}

return(costaux_result)
}

Summarizing what it is supposed to do:


* In previous step of our analysis, we have constructed a
dataframe, CARaux. CARaux represents different cost categories (fuel
prices, taxes, maintenance) etc for cars and motorcycles. The costs are
differentiated according to the projection year (YEAR) considered,
the policy scenario considered (SC) and the car type considered.

* The function moncostcarmoto takes as only argument one of
four possible aggregate cost types: MONCOST_EXCLTAX,
TAX,FUELCOST and MONCOST_INCLTAX.

* The output of the function is a  summary of the costs per
YEAR and SCENARIO, represented for all possible trip purposes
(enumerated in PURPcount) and period of the day (enumerated in
PERcount). Note that these costs do not depend on PURP and PER in the
base scenario, but this is something I may want to modify in the future
(and which explains why I iterate over these categories).

The function fails in the following line:

COSTaux_AVCAR -
ddply(CARaux,c(SC,YEAR),summarize,costcsolo =
sum(CARaux[[costcarin]]))

With the following error message:

Error in (function(x, i, exact) if (is.matrix(i)) as.matrix(x)[[i]]
else .subset2(x,  :
  object 'costcarin' not found

When I debugged the function, I found the following:

Browse[1] costcarin
[1] CS_MONCOST_EXCLTAXCAR
Browse[1] summary(CARaux[[costcarin]])
 Min.   1st Qu.Median  Mean   3rd Qu.  Max.
0.000 0.000 0.0001605 0.0166700 0.0048570 0.1633000
Browse[1] COSTaux_AVCAR -
ddply(CARaux,c(SC,YEAR),summarize,costcsolo =
sum(CARaux[[CS_MONCOST_EXCLTAXCAR]]))
Browse[1] summary(COSTaux_AVCAR)
   SC   YEAR costcsolo
  BAU:31  Min.   :2000Min.   :6.202
1st Qu.:2008  1st Qu.:6.202
Median :2015   Median :6.202
Mean   :2015   Mean   :6.202
   3rd Qu.:2022  3rd Qu.:6.202
Max.   :2030   Max.   :6.202
Browse[1] COSTaux_AVCAR -
ddply(CARaux,c(SC,YEAR),summarize,costcsolo =
sum(CARaux[[costcarin]]))
Error in (function(x, i, exact) if (is.matrix(i)) as.matrix(x)[[i]]
else .subset2(x,  :
  object 'costcarin' not found


Thus, providing CARaux[[CS_MONCOST_EXCLTAXCAR]] as an argument to
ddply() works, but CARaux[[costcarin]] does not, although costcarin =
CS_MONCOST_EXCLTAXCAR.


Best regards
Laurent






VITO Disclaimer: http://www.vito.be/e

[R] use of ddply() within function

2012-09-06 Thread Franckx Laurent
Dear all,

I am encountering problems with the application of ddply within the body of a 
self-defined function.

The script is the following:


moncostcarmoto - function(costtype){
costaux_result - data.frame()
for (purp in PURPcount){for (per in PERcount){
   costcarin = 
paste(c(CS_,costtype,CAR),collapse=)
   costmotoin = 
paste(c(CS_,costtype,MOTO),collapse=)
   browser()
   COSTaux_AVCAR - 
ddply(CARaux,c(SC,YEAR),summarize,costcsolo = sum(CARaux[[costcarin]]))
   COSTaux_AVMOTO- 
ddply(CARaux,c(SC,YEAR),summarize,costmoto= sum(CARaux[[costmotoin]] ))
   COSTaux   - 
join(COSTaux_AVCAR,COSTaux_AVMOTO,by=c(SC,YEAR))
COSTaux[ ,PURP] - as.factor(purp)
   COSTaux[ ,PER]  - as.factor(per)
   costaux_result - rbind(costaux_result,COSTaux)
   }}

return(costaux_result)
}

Summarizing what it is supposed to do:


* In previous step of our analysis, we have constructed a dataframe, 
CARaux. CARaux represents different cost categories (fuel prices, taxes, 
maintenance) etc for cars and motorcycles. The costs are differentiated 
according to the projection year (YEAR) considered, the policy scenario 
considered (SC) and the car type considered.

* The function moncostcarmoto takes as only argument one of four 
possible aggregate cost types: MONCOST_EXCLTAX, TAX,FUELCOST and 
MONCOST_INCLTAX.

* The output of the function is a  summary of the costs per YEAR and 
SCENARIO, represented for all possible trip purposes (enumerated in PURPcount) 
and period of the day (enumerated in PERcount). Note that these costs do not 
depend on PURP and PER in the base scenario, but this is something I may want 
to modify in the future (and which explains why I iterate over these 
categories).

The function fails in the following line:

COSTaux_AVCAR - ddply(CARaux,c(SC,YEAR),summarize,costcsolo = 
sum(CARaux[[costcarin]]))

With the following error message:

Error in (function(x, i, exact) if (is.matrix(i)) as.matrix(x)[[i]] else 
.subset2(x,  :
  object 'costcarin' not found

When I debugged the function, I found the following:

Browse[1] costcarin
[1] CS_MONCOST_EXCLTAXCAR
Browse[1] summary(CARaux[[costcarin]])
 Min.   1st Qu.Median  Mean   3rd Qu.  Max.
0.000 0.000 0.0001605 0.0166700 0.0048570 0.1633000
Browse[1] COSTaux_AVCAR - 
ddply(CARaux,c(SC,YEAR),summarize,costcsolo = 
sum(CARaux[[CS_MONCOST_EXCLTAXCAR]]))
Browse[1] summary(COSTaux_AVCAR)
   SC   YEAR costcsolo
  BAU:31  Min.   :2000Min.   :6.202
1st Qu.:2008  1st Qu.:6.202
Median :2015   Median :6.202
Mean   :2015   Mean   :6.202
   3rd Qu.:2022  3rd Qu.:6.202
Max.   :2030   Max.   :6.202
Browse[1] COSTaux_AVCAR - 
ddply(CARaux,c(SC,YEAR),summarize,costcsolo = sum(CARaux[[costcarin]]))
Error in (function(x, i, exact) if (is.matrix(i)) as.matrix(x)[[i]] else 
.subset2(x,  :
  object 'costcarin' not found


Thus, providing CARaux[[CS_MONCOST_EXCLTAXCAR]] as an argument to ddply() 
works, but CARaux[[costcarin]] does not, although costcarin = 
CS_MONCOST_EXCLTAXCAR.


Best regards
Laurent






VITO Disclaimer: http://www.vito.be/e-maildisclaimer

[[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.


Re: [R] creation of package failed

2012-08-15 Thread Franckx Laurent
Problem solved - thanks for the help.
It was indeed an issue with the path: not just leaving out the blanks, but also 
putting the Rtoolds folders in front.
This is actually emphasized in the R Installation and Administration manual, 
but while considering all types of complicated conjectures, I had lost sight of 
this specific point.
I can only confirm that, under Windows, the Rtools directories really, really 
need to be put in front.


Van: Uwe Ligges [lig...@statistik.tu-dortmund.de]
Verzonden: dinsdag 14 augustus 2012 16:43
Aan: Franckx Laurent
CC: 'r-help@r-project.org'
Onderwerp: Re: [R] creation of package failed

On 14.08.2012 10:16, Franckx Laurent wrote:
 Thanks for the quick response.

 Concerning your first point: the spaces in  Inno Setup 5 are not spaces 
 between different directories, this was just the name of the directory as 
 suggested during the installation procedure. Anyway, I have now added 
 underscores between the individual words in the directory name and in the 
 path definition.


No, you have to have

C:\R\R-2.15.0\bin\x64;c:\R\Rtools\bin;C.

rather than
C:\R\R-2.15.0\bin\x64; c:\R\Rtools\bin; C

as you wrote in your original message.



 Second, let me try to be more specific.

 Basically, what I have done is modifying a few functions in an existing 
 package, in order to test whether my modifications would be an improvement 
 compared to the existing functionalities. I have therefore kept most of the 
 package as it was, including the folder structure. I have never encountered 
 any difficulties with the installation of the old package.

 However, in order to avoid confusion between the existing package (let's call 
 it oldpackage) and my trials (let's call them newpackage), I have 
 modified the name of the file with R code that contains the modified 
 functions. I have also given a separate name to my package, and I have 
 modified the NAMESPACE accordingly.

 The original package also contained C++ code, which was duly put in the src 
 folder. When I first tried to build my package, I had forgotten to first 
 delete the  dll created when oldpackage was built and I got warnings that 
 the dll files had not been declared. I have deleted them now. (I is not 
 completely clear to me whether I should run R CMD SHLIB firstccfile.cc 
 secondccfile.cc -o newpackage.dll or not

No, that happens automatically when your package is installed (i.e. when
calling R CMD INSTALL).


- I have tried to do both with and without).

 Now, when I run R CMD build 
 Y:\Unit_TEM\3_TRAM\Projecten\N9393_ruimte_transport_model\newpackage, I get 
 the following messages:

  *checking for file ' 
 Y:\Unit_TEM\3_TRAM\Projecten\N9393_ruimte_transport_model\newpackage/DESCRIPTION'
   OK
  *preparing 'newpackage':
  *checking DESCRIPTION meta-information ... OK
  *cleaning src
  *checking for LF line-endings in source and make files
  *checking for empty or unneeded directories
  *looking to see if a 'data/datalist' file should be added
  *building 'newpackage.tar_0.1-6.gz'


Are you sure this is the error message?

That should be *building 'newpackage_0.1-6.tar.gz'

So we really need to see your package in order to learn why this fails.

Uwe Ligges



   ERROR
  Packaging into .tar.gz failed




 When I check the package with R CMD check 
 Y:\Unit_TEM\3_TRAM\Projecten\N9393_ruimte_transport_model\newpackage, I get 
 the following info from 00install


  * installing *source* package 'newpackage'...
  ** libs

  *** arch - i386
  ERROR: compilation failed for package 'newpackage'
  * removing 'C:/Users/franckxl/newpackage.Rcheck/newpackage'

 And the following info from the corresponding log file:

  * using log directory 'C:/Users/franckxl/newpackage.Rcheck'
  * using R version 2.15.0 (2012-03-30)
  * using platform: x86_64-pc-mingw32 (64-bit)
  * using session charset: ISO8859-1
  * checking for file 'newpackage/DESCRIPTION' ... OK
  * this is package 'newpackage' version '0.1-6'
  * checking package namespace information ... OK
  * checking package dependencies ... OK
  * checking if this is a source package ... WARNING
  Subdirectory 'newpackage/src' contains object files
   firstccfile.o secondccfile.o
  * checking if there is a namespace ... OK
  * checking for .dll and .exe files ... OK
  * checking whether package 'newpackage' can be installed ... ERROR
  Installation failed.
  See 'C:/Users/franckxl/newpackage.Rcheck/00install.out' for details.


 I have verified similar error messages that were reported on various 
 discussion forums, and most answers I have seen suggested that this may be 
 due to Rtools not being installed. However, I have re-installed the most 
 recent version of Rtools this morning

Re: [R] creation of package failed

2012-08-14 Thread Franckx Laurent
Thanks for the quick response.

Concerning your first point: the spaces in  Inno Setup 5 are not spaces 
between different directories, this was just the name of the directory as 
suggested during the installation procedure. Anyway, I have now added 
underscores between the individual words in the directory name and in the path 
definition.

Second, let me try to be more specific.

Basically, what I have done is modifying a few functions in an existing 
package, in order to test whether my modifications would be an improvement 
compared to the existing functionalities. I have therefore kept most of the 
package as it was, including the folder structure. I have never encountered any 
difficulties with the installation of the old package.

However, in order to avoid confusion between the existing package (let's call 
it oldpackage) and my trials (let's call them newpackage), I have modified 
the name of the file with R code that contains the modified functions. I have 
also given a separate name to my package, and I have modified the NAMESPACE 
accordingly.

The original package also contained C++ code, which was duly put in the src 
folder. When I first tried to build my package, I had forgotten to first delete 
the  dll created when oldpackage was built and I got warnings that the dll 
files had not been declared. I have deleted them now. (I is not completely 
clear to me whether I should run R CMD SHLIB firstccfile.cc secondccfile.cc -o 
newpackage.dll or not - I have tried to do both with and without).

Now, when I run R CMD build 
Y:\Unit_TEM\3_TRAM\Projecten\N9393_ruimte_transport_model\newpackage, I get 
the following messages:

*checking for file ' 
Y:\Unit_TEM\3_TRAM\Projecten\N9393_ruimte_transport_model\newpackage/DESCRIPTION'
  OK
*preparing 'newpackage':
*checking DESCRIPTION meta-information ... OK
*cleaning src
*checking for LF line-endings in source and make files
*checking for empty or unneeded directories
*looking to see if a 'data/datalist' file should be added
*building 'newpackage.tar_0.1-6.gz'
 ERROR
Packaging into .tar.gz failed


When I check the package with R CMD check 
Y:\Unit_TEM\3_TRAM\Projecten\N9393_ruimte_transport_model\newpackage, I get the 
following info from 00install


* installing *source* package 'newpackage'...
** libs

*** arch - i386
ERROR: compilation failed for package 'newpackage'
* removing 'C:/Users/franckxl/newpackage.Rcheck/newpackage'

And the following info from the corresponding log file:

* using log directory 'C:/Users/franckxl/newpackage.Rcheck'
* using R version 2.15.0 (2012-03-30)
* using platform: x86_64-pc-mingw32 (64-bit)
* using session charset: ISO8859-1
* checking for file 'newpackage/DESCRIPTION' ... OK
* this is package 'newpackage' version '0.1-6'
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... WARNING
Subdirectory 'newpackage/src' contains object files
 firstccfile.o secondccfile.o
* checking if there is a namespace ... OK
* checking for .dll and .exe files ... OK
* checking whether package 'newpackage' can be installed ... ERROR
Installation failed.
See 'C:/Users/franckxl/newpackage.Rcheck/00install.out' for details.


I have verified similar error messages that were reported on various discussion 
forums, and most answers I have seen suggested that this may be due to Rtools 
not being installed. However, I have re-installed the most recent version of 
Rtools this morning, so I cannot see how this could be the source of the 
problem. (At least, if it is sufficient to  install the R 2.15.x toolchain in a 
package that includes a C++ interface - I do not find the explanation in the R 
installation and administration manual very clear on this specific point.)

I hope this is sufficient information to clarify the problem.

-Original Message-
From: Uwe Ligges [mailto:lig...@statistik.tu-dortmund.de]
Sent: maandag 13 augustus 2012 19:29
To: Franckx Laurent
Cc: 'r-help@r-project.org'
Subject: Re: [R] creation of package failed



On 13.08.2012 17:10, Franckx Laurent wrote:
 Dear all
 I am trying to build a package, and get the error message: packaging into 
 .tar.gz failed.
 I have also installed the same package directly from a locally created zip 
 file.  In this case, the package is put correctly under 
 C:\R\R-2.15.0\library. However, when I check the package, I get another error 
 message, stating ERROR: compilation failed for package.
 I use a 64 bit computer.
 Before attempting the installation, I had created the following path: PATH =  
 C:\R\R-2.15.0\bin\x64; c:\R\Rtools\bin; C:\R\Rtools\gcc-4.6.3\bin64;  
 C:\MiKTeX\miktex\miktex\bin;  c:\windows; c:\windows\system32; 
 C:\Windows\SysWOW64; C:\Program

Re: [R] creation of package failed

2012-08-14 Thread Franckx Laurent
I should add to the previous mail that the installation has worked correctly 
under Cygwin after I had deleted the following files in the source directory: 
firstccfile.o and
secondccfile.o
However, this does not solve the problem under Windows.


-Original Message-
From: Franckx Laurent
Sent: dinsdag 14 augustus 2012 10:16
To: 'Uwe Ligges'
Cc: 'r-help@r-project.org'
Subject: RE: [R] creation of package failed

Thanks for the quick response.

Concerning your first point: the spaces in  Inno Setup 5 are not spaces 
between different directories, this was just the name of the directory as 
suggested during the installation procedure. Anyway, I have now added 
underscores between the individual words in the directory name and in the path 
definition.

Second, let me try to be more specific.

Basically, what I have done is modifying a few functions in an existing 
package, in order to test whether my modifications would be an improvement 
compared to the existing functionalities. I have therefore kept most of the 
package as it was, including the folder structure. I have never encountered any 
difficulties with the installation of the old package.

However, in order to avoid confusion between the existing package (let's call 
it oldpackage) and my trials (let's call them newpackage), I have modified 
the name of the file with R code that contains the modified functions. I have 
also given a separate name to my package, and I have modified the NAMESPACE 
accordingly.

The original package also contained C++ code, which was duly put in the src 
folder. When I first tried to build my package, I had forgotten to first delete 
the  dll created when oldpackage was built and I got warnings that the dll 
files had not been declared. I have deleted them now. (I is not completely 
clear to me whether I should run R CMD SHLIB firstccfile.cc secondccfile.cc -o 
newpackage.dll or not - I have tried to do both with and without).

Now, when I run R CMD build 
Y:\Unit_TEM\3_TRAM\Projecten\N9393_ruimte_transport_model\newpackage, I get 
the following messages:

*checking for file ' 
Y:\Unit_TEM\3_TRAM\Projecten\N9393_ruimte_transport_model\newpackage/DESCRIPTION'
  OK
*preparing 'newpackage':
*checking DESCRIPTION meta-information ... OK
*cleaning src
*checking for LF line-endings in source and make files
*checking for empty or unneeded directories
*looking to see if a 'data/datalist' file should be added
*building 'newpackage.tar_0.1-6.gz'
 ERROR
Packaging into .tar.gz failed


When I check the package with R CMD check 
Y:\Unit_TEM\3_TRAM\Projecten\N9393_ruimte_transport_model\newpackage, I get the 
following info from 00install


* installing *source* package 'newpackage'...
** libs

*** arch - i386
ERROR: compilation failed for package 'newpackage'
* removing 'C:/Users/franckxl/newpackage.Rcheck/newpackage'

And the following info from the corresponding log file:

* using log directory 'C:/Users/franckxl/newpackage.Rcheck'
* using R version 2.15.0 (2012-03-30)
* using platform: x86_64-pc-mingw32 (64-bit)
* using session charset: ISO8859-1
* checking for file 'newpackage/DESCRIPTION' ... OK
* this is package 'newpackage' version '0.1-6'
* checking package namespace information ... OK
* checking package dependencies ... OK
* checking if this is a source package ... WARNING
Subdirectory 'newpackage/src' contains object files
 firstccfile.o secondccfile.o
* checking if there is a namespace ... OK
* checking for .dll and .exe files ... OK
* checking whether package 'newpackage' can be installed ... ERROR
Installation failed.
See 'C:/Users/franckxl/newpackage.Rcheck/00install.out' for details.


I have verified similar error messages that were reported on various discussion 
forums, and most answers I have seen suggested that this may be due to Rtools 
not being installed. However, I have re-installed the most recent version of 
Rtools this morning, so I cannot see how this could be the source of the 
problem. (At least, if it is sufficient to  install the R 2.15.x toolchain in a 
package that includes a C++ interface - I do not find the explanation in the R 
installation and administration manual very clear on this specific point.)

I hope this is sufficient information to clarify the problem.

-Original Message-
From: Uwe Ligges [mailto:lig...@statistik.tu-dortmund.de]
Sent: maandag 13 augustus 2012 19:29
To: Franckx Laurent
Cc: 'r-help@r-project.org'
Subject: Re: [R] creation of package failed



On 13.08.2012 17:10, Franckx Laurent wrote:
 Dear all
 I am trying to build a package, and get the error message: packaging into 
 .tar.gz failed.
 I have also installed the same package directly from a locally created zip 
 file.  In this case, the package is put

[R] creation of package failed

2012-08-13 Thread Franckx Laurent
Dear all
I am trying to build a package, and get the error message: packaging into 
.tar.gz failed.
I have also installed the same package directly from a locally created zip 
file.  In this case, the package is put correctly under C:\R\R-2.15.0\library. 
However, when I check the package, I get another error message, stating ERROR: 
compilation failed for package.
I use a 64 bit computer.
Before attempting the installation, I had created the following path: PATH =  
C:\R\R-2.15.0\bin\x64; c:\R\Rtools\bin; C:\R\Rtools\gcc-4.6.3\bin64;  
C:\MiKTeX\miktex\miktex\bin;  c:\windows; c:\windows\system32; 
C:\Windows\SysWOW64; C:\Program Files (x86)\Inno Setup 5.
I have re-installed today the most recent version of Rtools.
Does anyone have an idea what is going wrong here?

Laurent Franckx, PhD
Expert
VITO NV
Boeretang 200, 2400 MOL, Belgium
Tel. + 32 14 33 58 22
Skype: laurent.franckx
laurent.fran...@vito.be
Visit our website: www.vito.be/english and http://www.vito.be/transport







http://www.vito.be/e-maildisclaimer

__
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] CPU usage while running R code

2012-07-04 Thread Franckx Laurent
I am currently running an R program on a computer with 16 Gb memory (Windows7, 
64 bit). When I look at the task manager, I see that only 4 out of the 8 CPUs 
are being used. Is this due to some missing in the R code, or should I change 
something to the settings of the computer?


Laurent Franckx, PhD
Expert
VITO NV
Boeretang 200, 2400 MOL, Belgium
Tel. + 32 14 33 58 22
Skype: laurent.franckx
laurent.fran...@vito.be
Visit our website: www.vito.be/english and http://www.vito.be/transport







http://www.vito.be/e-maildisclaimer

__
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] R/C++ interfaces: documentation for SET_STRING_ELT, PROTECT, etc...

2012-06-08 Thread Franckx Laurent
Dear all,

I am reading C++ code that is called in an R package. It is not clear to me 
what SET_STRING_ELT, getAttrib, etc exactly do.

I understand that these are macros that have been declared in Rinternals.h and 
who are used for the correct translation of the R data structures, but I have 
not found their definition, and it is not clear to me what they do to their 
inputs and what type of output they generate precisely.

I have consulted several resources (Writing R extensions, Gentleman's R 
programming for bioinformatics, Chamber's Software for Data Analysis), who 
do mention these macros, but the discussion remains very general (and too 
general for me to understand the code that I am deciphering).

I have not found a description on CRAN either. Does anybody know an accessible 
documentation  that could help me forward?


Laurent Franckx, PhD
VITO NV
Boeretang 200, 2400 MOL, Belgium
Tel. + 32 14 33 58 22
Skype: laurent.franckx
laurent.fran...@vito.be







http://www.vito.be/e-maildisclaimer

__
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] Error: could not find function

2011-09-28 Thread Franckx Laurent
Dear all

I have written a function, calibrateCES, in which a function is called, 
BPGC, which was written in the enclosure of calibrateCES. Until the most 
recent version of my program, calibrateCES always used BPGC as planned. 
Following a modification which does not affect BPGC directly (although it 
does affect one of the arguments of BPGC), I now get the following error 
message: 
Error: could not find function BPGC
When I defined BPGC in calibrateCES, the problem disappears, but this is 
definitely not the solution I want, because I want BPGC to be available for 
other functions as well. 


Laurent Franckx



Uniting expertise from different fields of technology enhances the development 
of innovative methods for sustainable production.
Join the third edition of the international congress 'Innovation for 
Sustainable Production 2012'
May, 6-9, 2012 - Bruges (Belgium)
http://www.i-sup2012.org
---
This e-mail, any attachments and the information it contains are confidential 
and meant only for the use of the addressee(s) only.  Access to this e-mail by 
anyone other than the addressee(s) is unauthorized.  If you are not the 
intended addressee (or responsible for delivery of the message to such person), 
you may not use, copy, distribute or deliver to anyone this message (or any 
part of its contents) or take any action in reliance on it.  In such case, you 
should destroy this message and notify the sender immediately.  If you have 
received this e-mail in error, please notify us immediately by e-mail or 
telephone and delete the e-mail from any computer.
All reasonable precautions have been taken to ensure no viruses are present in 
this e-mail and its attachments.  As our company cannot accept responsibility 
for any loss or damage arising from the use of this e-mail or attachments we 
recommend that you subject these to your virus checking procedures prior to use.

__
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.