c# free pdf viewer : Add pdf pages to word application SDK cloud windows wpf html class R-admin3-part783

Chapter6:Add-onpackages
26
## forFortran9xcode
FCFLAGS=-g -O -mtune=native
Another useis tooverridethesettingsinabinaryinstallationofR.Forexample,tousea
differentFortrancompileronOSX
F77 = /usr/local/gfortran/bin/gfortran
FC = = /usr/local/gfortran/bin/gfortran
FLIBS = -L/usr/local/gfortran/lib/gcc/x86_64-apple-darwin14/5.2.0
-L/usr/local/gfortran/lib -lgfortran -lquadmath -lm
(linesplitforlegibilityhere).
There is s also provision for a a site-wide Makevars.site e file under R_HOME/etc (in n a a sub-
architecture-specificdirectoryifappropriate).ThisisreadimmediatelyafterMakeconf,andan
alternativefilecanbespecifiedbyenvironmentvariableR_MAKEVARS_SITE.
Note that these mechanisms do not work with packages s which fail topass settings s down
tosub-makes,perhapsreadingetc/Makeconf inmakefilesinsubdirectories. . Fortunatelysuch
packagesareunusual.
6.3.4 Multiplesub-architectures
Wheninstallingpackagesfromtheirsources,therearesomeextraconsiderationsoninstallations
whichusesub-architectures.ThesearecommonlyusedonWindowsbutcaninprinciplebeused
onotherplatforms.
WhenasourcepackageisinstalledbyabuildofRwhichsupportsmultiplesub-architectures,
thenormalinstallationprocess installsthepackages for allsub-architectures. . Theexceptions
are
Unix-alikes
wherethereisanconfigurescript,orafilesrc/Makefile.
Windows
wherethereisanon-emptyconfigure.winscript,orafilesrc/Makefile.win(with
someexceptions where the package isknowntohaveanarchitecture-independent
configure.win,orif--force-biarchorfield‘Biarch’intheDESCRIPTIONfileis
usedtoassertso).
Inthosecases only thecurrent architectureis installed. . Further r sub-architectures canbein-
stalledby
R CMD D INSTALL --libs-only pkg
usingthepathtoR orR--archtoselect theadditionalsub-architecture. . ThereisalsoRCMD
INSTALL--merge-multiarchtobuildandmergethetwoarchitectures,startingwithasource
tarball.
6.3.5 Byte-compilation
The base and recommended packages s are e byte-compiledby default. . Other r packages s canbe
byte-compiled on n installation n by using g RCMDINSTALL with h option n --byte-compile e or by
install.packages(type="source",INSTALL_opts="--byte-compile").
Notallcontributedpackagesworkcorrectlywhenbyte-compiled. Formostpackages(espe-
ciallythosewhichmakeextensiveuseofcompiledcode)thespeed-upissmall.Unlessapackage
isusedfrequentlythetimespentinbyte-compilationcanoutweighthetimesavedinexecution:
alsobyte-compilationcanaddsubstantiallytotheinstalledsizeofthepackage.
Byte-compilationcanbecontrolledonaper-packagebasisbythe‘ByteCompile’fieldinthe
DESCRIPTIONfile.
Add pdf pages to word - insert pages into PDF file in C#.net, ASP.NET, MVC, Ajax, WinForms, WPF
Guide C# Users to Insert (Empty) PDF Page or Pages from a Supported File Format
add pages to pdf file; adding page to pdf in preview
Add pdf pages to word - VB.NET PDF Page Insert Library: insert pages into PDF file in vb.net, ASP.NET, MVC, Ajax, WinForms, WPF
Easy to Use VB.NET APIs to Add a New Blank Page to PDF Document
adding page numbers to pdf document; add pdf pages together
Chapter6:Add-onpackages
27
6.3.6 Externalsoftware
SomeR packagescontaincompiledcodewhichlinkstoexternalsoftwarelibraries. . Unlessthe
externallibraryisstaticallylinked(whichis doneasmuchaspossiblefor binarypackages on
Windows andOSX),thelibrarieshavetobefoundwhenthepackageis loadedandnotjust
whenitisinstalled. HowthisshouldbedonedependsontheOS(andinsomecasestheversion).
For Unix-alikes except t OS S X X the primary mechanism m is the e ld.so cache e controlled by
ldconfig: externaldynamic c libraries recordedinthatcache willbefound. . Standardlibrary
locations will be e covered by y the cache, and well-designedsoftware e will add its s locations (as
for example openmpidoes onFedora). . The e secondary mechanismis to consult the environ-
ment variable LD_LIBRARY_PATH. . Now w theR script controlsthat variable,andsetsit tothe
concatenationofR_LD_LIBRARY_PATH,R_JAVA_LD_LIBRARY_PATHandtheenvironmentvalueof
LD_LIBRARY_PATH.ThefirsttwohavedefaultswhicharenormallysetwhenRisinstalled(but
canbeoverriddenintheenvironment)soLD_LIBRARY_PATHisthebestchoiceforausertoset.
On OS X the primary mechanism is s to embed d the absolute e pathto o dependent t dynamic
libraries intoanobjectwhenit iscompiled. . Few w Rpackages arrangetodoso, butit canbe
edited
6
via install_name_tool— thatonly dealswithdirectdependencies andthosewould
alsoneedtobecompiledtoincludetheabsolutepathsoftheirdependencies. Ifthe e choiceof
absolutepathis tobe deferredtoloadtime, , howthey y areresolvedis describedinmandyld:
theroleofLD_LIBRARY_PATH isreplacedonOSXby DYLD_LIBRARY_PATHandlatterly DYLD_
FALLBACK_LIBRARY_PATH. Running g RCMDotool-L L on the e package e shared d object will show
where(ifanywhere)itsdependenciesareresolved. DYLD_FALLBACK_LIBRARY_PATHispreferred
(and it t is that whichis manipulated d by y the R R script), but t as from10.11 (‘El l Capitan’) ) the
defaultbehaviourhadbeenchangedforsecurityreasonstodiscardtheseenvironmentvariables
wheninvokingashellscript(andRisashellscript). Thatmakestheonlyportableoptionto
setR_LD_LIBRARY_PATHintheenvironment,somethinglike
export R_LD_LIBRARY_PATH="‘R RHOME‘/lib:/opt/local/lib"
ThepreciserulesforwhereWindowslooksforDLLsarecomplexanddependontheversion
of Windows. . Butfor r present purposesthe mainsolution n isto putthe directoriescontaining
theDLLs thepackage links to(andany those DLLs link to)on n the PATH. . 64-bit t versions of
Windowswillignore32-bitDLLsfrom64-bitRandviceversa.
The danger withany ofthemethods whichinvolve setting environmentvariables is ofin-
advertently maskingasystemlibrary. . This s islessfor DYLD_FALLBACK_LIBRARY_PATHandfor
appending toPATHonWindows(asitshouldalreadycontainthesystemlibrarypaths).
6.4 Updatingpackages
Thecommandupdate.packages()isthesimplestwaytoensurethatallthepackagesonyour
systemareuptodate. Itdownloads s the list ofavailablepackages andtheircurrent versions,
comparesitwiththoseinstalledandofferstofetchandinstallanythathavelaterversionson
therepositories.
An alternative e interface e to keeping packages s up-to-date e is s provided by the command
packageStatus(),whichreturnsanobjectwithinformationonallinstalledpackagesandpack-
ages availableatmultiplerepositories. . Theprint t andsummarymethods give anoverview of
installedandavailablepackages,theupgrademethodofferstofetchandinstallthelatestver-
sionsofoutdatedpackages.
Onesometimes-usefuladditionalpieceofinformationthat packageStatus()returnsisthe
statusofapackage,as"ok","upgrade"or"unavailable"(inthecurrentlyselectedreposito-
ries).Forexample
> inst t <- - packageStatus()$inst
6
Theyneedtohavebeencreatedusing-headerpad_max_install_names,whichisthedefaultforanRpackage.
VB.NET Create PDF from Word Library to convert docx, doc to PDF in
File: Split PDF; C# Page: Insert PDF pages; C# Page: Delete PDF pages; C# Read C# Read: PDF Image Extract; C# Write: Insert text into PDF; C# Write: Add Image to
add pages to pdf in preview; add document to pdf pages
C# PDF insert image Library: insert images into PDF in C#.net, ASP
C#.NET PDF SDK - Add Image to PDF Page in C#.NET. How to Insert & Add Image, Picture or Logo on PDF Page Using C#.NET. Add Image to PDF Page Using C#.NET.
add page numbers to pdf reader; add page to a pdf
Chapter6:Add-onpackages
28
> inst[inst$Status s != "ok", c("Package", "Version", "Status")]
Package Version
Status
Biobase
Biobase
2.8.0 unavailable
RCurl
RCurl
1.4-2
upgrade
Rgraphviz
Rgraphviz 1.26.0 0 unavailable
rgdal
rgdal 0.6-27
upgrade
6.5 Removingpackages
Packagescanberemovedinanumberofways.Fromacommandprompttheycanberemoved
by
R CMD D REMOVE E -l /path/to/library y pkg1 1 pkg2 ...
FromarunningRprocesstheycanberemovedby
> remove.packages(c("pkg1", , "pkg2"),
lib = = file.path("path", , "to", "library"))
Finally,onecanjustremovethepackagedirectoryfromthelibrary.
6.6 Settingupapackagerepository
Utilitiessuchasinstall.packagescanbepointedatany
CRAN
-stylerepository,andRusers
maywanttosetuptheirown.The‘base’ofarepositoryisaURLsuchashttp://www.stats.
ox.ac.uk/pub/RWin: thismustbeanURLschemethatdownload.packagessupports(which
alsoincludes‘ftp://’and‘file://’and(fromR3.3.0andperhapsearlier)‘https://’).Under
thatbaseURLthereshouldbedirectorytreesforoneormoreofthefollowingtypesofpackage
distributions:
 "source":locatedatsrc/contribandcontaining.tar.gzfiles.Otherformsofcompres-
sioncanbeused,e.g..tar.bz2or.tar.xzfiles.Completerepositoriescontainthesources
correspondingtoany binarypackages,andinanycaseit iswise to havea src/contrib
areawithapossiblyemptyPACKAGESfile.
 "win.binary": : locatedatbin/windows/contrib/x.yforRversionsx.y.zandcontaining
.zipfilesforWindows.
 "mac.binary.mavericks": : located d at bin/macosx/mavericks/contrib/3.y for the
CRANbuildfor‘Mavericks’(andlater)forRversions3.y.z,containing.tgzfiles.
EachterminaldirectorymustalsocontainaPACKAGESfile.Thiscanbeaconcatenationofthe
DESCRIPTIONfilesofthepackagesseparatedbyblanklines,butonlyafewofthefieldsareneeded.
Thesimplestwaytosetupsuchafileistousefunctionwrite_PACKAGESinthetoolspackage,
anditshelpexplainswhichfieldsareneeded. OptionallytherecanalsobeaPACKAGES.gzfile,
agzip-compressedversionofPACKAGES—asthiswillbedownloadedinpreferencetoPACKAGES
itshouldbeincludedforlargerepositories. (Ifyouhaveamis-configuredserverthatdoesnot
reportcorrectlynon-existentfilesyoumayneedPACKAGES.gz.)
Toaddyourrepositorytothelistofferedby setRepositories(),seethehelpfileforthat
function.
Incompleterepositoriesarebetterspecifiedvia acontriburlargumentthanvia beingset
asarepository.
Arepositorycancontainsubdirectories,whenthedescriptionsinthePACKAGESfileofpack-
agesinsubdirectoriesmustincludealineoftheform
Path: path/to/subdirectory
—onceagainwrite_PACKAGESisthesimplestwaytosetthisup.
C# PDF File & Page Process Library SDK for C#.net, ASP.NET, MVC
File: Split PDF; C# Page: Insert PDF pages; C# Page: Delete PDF pages; C# Read C# Read: PDF Image Extract; C# Write: Insert text into PDF; C# Write: Add Image to
add page numbers pdf; add and delete pages in pdf online
VB.NET PDF Page Delete Library: remove PDF pages in vb.net, ASP.
In order to run the sample code, the following steps would be necessary. Add necessary references: How to VB.NET: Delete Consecutive Pages from PDF.
adding page numbers to a pdf in reader; add page to pdf
Chapter6:Add-onpackages
29
6.7 Checkinginstalledsourcepackages
It canbeconvenient to runRCMDcheck onaninstalled d package, particularly y ona platform
which uses s sub-architectures. . The e outline e of f how w to do this is, withthe source package in
directorypkg(oratarballfilename):
R CMD D INSTALL -l libdir r pkg g > pkg.log g 2>&1
R CMD D check -l libdir --install=check:pkg.log g pkg
Wheresub-architecturesareinusetheRCMDchecklinecanberepeatedwithadditionalarchi-
tecturesby
R --arch h arch CMD check k -l libdir r --extra-arch --install=check:pkg.log g pkg
where--extra-archselectsonlythosecheckswhichdependontheinstalledcodeandnotthose
whichanalysethesources. (If f multiplesub-architectures failonlybecausetheyneeddifferent
settings,e.g.environment variables, , --no-multiarch h may need d to be addedto the INSTALL
lines.) OnUnix-alikesthearchitecturetorunisselectedby--arch: thiscanalsobeusedon
Windows withR_HOME/bin/R.exe,butitismoreusualtoselectthepathtotheRcmd.exeof
thedesiredarchitecture.
SoonWindowstoinstall,checkandpackagefordistributionasourcepackagefromatarball
whichhasbeentestedonanotherplatformonemightuse
.../bin/i386/Rcmd INSTALL -l libdir tarball --build > > pkg.log g 2>&1
.../bin/i386/Rcmd check k -l libdir r --extra-arch --install=check:pkg.log g pkg
.../bin/x64/Rcmd check -l libdir --extra-arch h --install=check:pkg.log g pkg
whereonemightwanttorunthesecondandthirdlinesinadifferentshellwithdifferentsettings
forenvironmentvariablesandthepath(tofindexternalsoftware,notablyforGtk+).
RCMDINSTALLcandoai386installandthenaddthex64DLLfromasinglecommandby
R CMD D INSTALL --merge-multiarch h -l libdir r tarball
and--buildcanbeaddedtozipuptheinstallation.
C# PDF Page Delete Library: remove PDF pages in C#.net, ASP.NET
options, including setting a single page, a series of pages, and random pages to be C#.NET Project DLLs for Deleting PDF Document Page. Add necessary references
add page numbers to pdf document; add pages to pdf document
VB.NET PDF Convert to Word SDK: Convert PDF to Word library in vb.
All PDF pages can be converted to separate Word files within a short time in In order to convert PDF document to Word file using VB.NET Add necessary references
add page numbers to pdf using preview; add pages to pdf without acrobat
30
7 InternationalizationandLocalization
Internationalizationreferstotheprocessofenablingsupportformanyhumanlanguages,and
localizationtoadaptingtoaspecificcountryandlanguage.
CurrentbuildsofRsupportallthecharactersetsthattheunderlyingOScanhandle.These
are interpreted according to the current t locale, a a sufficiently y complicatedtopic to o merit a
separate section. . NotethoughthatR R has nobuilt-insupport for right-to-left languages and
bidirectionaloutput,relyingontheOSservices. Forexample,howcharactervectorsinUTF-8
containingbothEnglishdigitsandHebrewcharactersareprintedisOS-dependent(andperhaps
locale-dependent).
Theotheraspectoftheinternationalizationissupportforthetranslationofmessages. This
isenabledinalmostallbuildsofR.
7.1 Locales
Alocale isadescriptionofthelocalenvironmentoftheuser,includingthepreferredlanguage,
theencodingofcharacters,thecurrencyusedandits conventions,andso on. . Aspectsofthe
localeareaccessedbytheRfunctionsSys.getlocaleandSys.localeconv.
ThesystemofnaminglocalesisOS-specific. Thereisquitewideagreementonschemes,but
notonthedetailsoftheirimplementation. Alocaleneedstospecify
 Ahumanlanguage.Thesearegenerallyspecifiedbyalower-casetwo-characterabbreviation
followingISO639(seee.g.https://en.wikipedia.org/wiki/ISO_639-1).
 A‘territory’,usedmainlytospecifythecurrency.Thesearegenerallyspecifiedbyanupper-
casetwo-characterabbreviationfollowingISO3166(seee.g.https://en.wikipedia.org/
wiki/ISO_3166).
 Acharsetencoding,whichdeterminesbothhowabytestreamshouldbedividedintocharac-
ters,andwhichcharactersthesubsequencesofbytesrepresent.Sometimesthecombination
oflanguageandterritoryisusedtospecifytheencoding,forexampletodistinguishbetween
traditionalandsimplifiedChinese.
 Optionally, , a modifier, for r example to indicate that Austria is s to o be considered pre-or
post-Euro.Themodifierisalsousedtoindicatethescript(@latin,@cyrillicforSerbian,
@iqtelif)orlanguagedialect(e.g.@saaho,adialectofAfar,and@bokmaland@nynorsk,
dialectsofNorwegianregardedbysomeOSesasseparatelanguages,noandnn).
Risprincipallyconcernedwiththefirst(fortranslations)andthird. Notethatthecharset
maybededuciblefromthelanguage,assomeOSesofferonlyonecharsetperlanguage.
7.1.1 LocalesunderUnix-alikes
ModernLinuxusestheXPG
1
localespecificationswhichhavetheform‘en_GB’,‘en_GB.UTF-8’,
‘aa_ER.UTF-8@saaho’, ‘de_AT.iso885915@euro’, the components s being in the order listed
above. (See e manlocaleandlocale-a for moredetails.) ) Similarschemes s areusedby most
Unix-alikes: some(includingsomedistributionsofLinux)use‘.utf8’ratherthan‘.UTF-8’.
Note that t whereas UTF-8 locales are e nowadays s almost universally used, , locales s such as
‘en_GB’use8-bitencodingsforbackwardscompatibility.
7.1.2 LocalesunderWindows
Windowsalsouseslocales,butspecifiedinaratherlessconciseway. Mostuserswillencounter
localesonlyviadrop-downmenus,but moreinformationandlists canbefoundat https://
1
‘X/OpenPortabilityGuide’,whichhashadseveralversions.
VB.NET PDF Password Library: add, remove, edit PDF file password
VB: Add Password to PDF with Permission Settings Applied. This VB.NET example shows how to add PDF file password with access permission setting.
add page number to pdf preview; add a page to a pdf online
VB.NET PDF insert image library: insert images into PDF in vb.net
VB.NET PDF - Add Image to PDF Page in VB.NET. Guide VB.NET Programmers How to Add Images in PDF Document Using XDoc.PDF SDK for VB.NET.
add page to existing pdf file; add blank page to pdf preview
Chapter7:InternationalizationandLocalization
31
msdn.microsoft.com/en-us/library/hzz3tw78(v=vs.80)(orifMicrosoftmovesityetagain,
searchfor‘Windowslanguagecountrystrings’).
Itoffersonlyoneencodingperlanguage.
Some care is s needed d with Windows’ locale names. . For r example, , chinese e is s Traditional
ChineseandnotSimplifiedChineseasusedinmostoftheChinese-speakingworld.
7.1.3 LocalesunderOSX
OSXsupportslocalesinitsownparticularway,buttheRGUItriestomakethiseasierforusers.
Seehttps://developer.apple.com/documentation/MacOSX/Conceptual/BPInternational/
forhowusers cansettheir locales. . AswithWindows,endusers s willgenerally only seelists
oflanguages/territories. UsersofRinaterminalmayneedtosetthelocaletosomethinglike
‘en_GB.UTF-8’ifitdefaultsto‘C’(asitsometimesdoeswhenlogginginremotelyandforbatch
jobs: note whetherTerminalsetstheLANGenvironmentvariableis s an(advanced)preference,
butdoessobydefault).
InternallyOSXusesaformsimilartoLinux: themaindifferencefromotherUnix-alikesis
thatwhereacharactersetisnotspecifieditisassumedtobeUTF-8.
7.2 Localizationofmessages
Thepreferredlanguageformessagesisbydefaulttakenfromthelocale.Thiscanbeoverridden
firstbythesettingoftheenvironmentvariableLANGUAGEandthen
2
bytheenvironmentvariables
LC_ALL,LC_MESSAGESandLANG.(Thelastthreearenormallyusedtosetthelocaleandsoshould
not beneeded,butthefirstisonlyusedtoselectthelanguageformessages.) ) Thecodetries
hardtomaplocales tolanguages, , butonsomesystems s (notably Windows) the locale names
neededfortheenvironmentvariableLC_ALLdonotallcorrespondtoXPGlanguagenamesand
soLANGUAGEmayneedtobeset.(Oneexampleis‘LC_ALL=es’onWindowswhichsetsthelocale
toEstonianandthelanguagetoSpanish.)
It is usually possible to o change e the language once e R R is running via a (not t Windows)
Sys.setlocale("LC_MESSAGES","new_locale"),orbysettinganenvironmentvariable such
asLANGUAGE,provided
3
thelanguageyouarechangingtocanbeoutputinthecurrentcharacter
set.ButthisisOS-specific,andhasbeenknowntostopworkingonanOSupgrade.
Messagesaredividedintodomains,andtranslationsmaybeavailableforsomeorallmessages
inadomain.Rmakesuseofthefollowingdomains.
 DomainRfortheC-levelerrorandwarningmessagesfromtheRinterpreter.
 DomainR-pkgfortheRstop,warningandmessagemessagesineachpackage,including
R-baseforthebasepackage.
 DomainpkgfortheC-levelmessagesineachpackage.
 DomainRGuiforthemenusetcoftheRforWindowsGUIfront-end.
DividingupthemessagesinthiswayallowsRtobeextensible:aspackagesareloaded,their
messagetranslationcataloguescanbeloadedtoo.
Rcanbebuiltwithoutsupportfortranslations,butitisenabledbydefault.
R-levelandC-leveldomainsaresubtlydifferent,forexampleinthewaystringsarecanoni-
calizedbeforebeingpassedfortranslation.
Translationsarelookedforbydomainaccordingtothecurrentlyspecifiedlanguage,asspecif-
icallyaspossible,soforexampleanAustrian(‘de_AT’)translationcataloguewillbeusedinpref-
erencetoagenericGermanone(‘de’)for anAustrianuser. . However,ifaspecifictranslation
2
OnsomesystemssettingLC_ALLorLC_MESSAGESto‘C’disablesLANGUAGE.
3
IfyoutrychangingfromFrenchtoRussianexceptinaUTF-8locale,youwillmostlikelyfindmessageschange
toEnglish.
Chapter7:InternationalizationandLocalization
32
catalogue exists butdoes not containatranslation,the lessspecificcataloguesareconsulted.
Forexample,Rhascataloguesfor‘en_GB’thattranslatetheAmericanisms(e.g.,‘gray’)inthe
standardmessages intoEnglish.
4
Twootherexamples: therearecataloguesfor‘es’,whichis
Spanishas writteninSpainandthese willbydefaultalsobeusedinSpanish-speakingLatin
Americancountries,andalsofor‘pt_BR’,whichareusedforBrazilianlocalesbutnotforlocales
specifyingPortugal.
Translations intherightlanguagebut thewrongcharsetaremadeuse ofby on-the-flyre-
encoding. The e LANGUAGE variable (only) can be a colon-separated list, for example ‘se:de’,
givingasetoflanguagesindecreasingorderofpreference. Onespecialvalueis‘en@quot’,which
canbe usedina UTF-8locale to have American error messages with pairs of single quotes
translatedtoUnicodedirectionalquotes.
Ifnosuitabletranslationcatalogueisfoundoraparticularmessageisnottranslatedinany
suitablecatalogue,‘English’
5
isused.
See https://developer.r-project.org/Translations30.htmlfor howtoprepareand
installtranslationcatalogues.
4
thelanguagewritteninEngland: somepeoplelivingintheUSAappropriatethisnamefortheirlanguage.
5
withAmericanisms.
33
8 Choosingbetween32-and64-bitbuilds
Almostallcurrent
CPU
shaveboth32-and64-bitsetsofinstructions. MostOSesrunningon
such
CPU
sofferthechoiceofbuildinga32-bitora64-bitversionofR (anddetailsaregiven
belowunderspecificOSes).Formosta32-bitversionisthedefault,butforsome(e.g.,‘x86_64’
LinuxandOSX>=10.6)64-bitis.
AllcurrentversionsofRuse32-bitintegersand
ISO
/
IEC
60559
1
double-precisionreals,and
socomputetothesameprecision
2
andwiththesamelimitsonthesizesofnumericalquantities.
Theprincipaldifferenceisinthesizeofthepointers.
64-bitbuildshavebothadvantagesanddisadvantages:
 Thetotalvirtualmemoryspacemadeavailabletoa32-bitprocessislimitedbythepointer
sizeto4GB,andonmostOSesto3GB(oreven2GB).Thelimitsfor64-bitprocessesare
muchlarger(e.g.8–128TB).
Rallocatesmemoryforlargeobjectsasneeded,andremoves anyunusedonesatgarbage
collection. Whenthesizesofobjectsbecomeanappreciablefractionoftheaddresslimit,
fragmentationoftheaddress spacebecomes anissue andtheremay benoholeavailable
thatisthesizerequested.Thiscancausemorefrequentgarbagecollectionortheinability
toallocatelargeobjects. Asaguide,thiswillbecomeanissuefor32-bitbuildswithobjects
morethan10%ofthesizeoftheaddressspace(around300Mb)orwhenthetotalsizeof
objectsinuseisaroundonethird(around1Gb).
 Only64-bitbuildssupport‘longvectors’,thosewith2
31
ormoreelements(whichneedsat
least16GBofstorageforeachnumericvector).
 Most32-bitOSesbydefaultlimitfilesizesto2GB(andthismayalsoapplyto32-bitbuilds
on64-bitOSes). Thiscanoftenbeworkedaround: andconfigureselectssuitabledefines
if this is possible. . (We e have also largely workedaroundthat limit on32-bit Windows.)
64-bitbuildshavemuchlargerlimits.
 Becausethepointersarelarger,R’sbasicstructuresarelarger. . ThismeansthatRobjects
take more space and(usually) ) moretime e tomanipulate. . So64-bit t builds ofR will, , all
other thingsbeing equal,runslower than32-bitbuilds. . (OnSparcSolaris s thedifference
was15-20%.)
 However,‘otherthings’maynotbeequal. Inthe e specificcaseof‘x86_64’vs s ‘ix86’,the
64-bitCPUhasfeatures(suchasSSE2instructions)whichareguaranteedtobepresentbut
areoptionalonthe32-bitCPU,andalsohasmoregeneral-purposeregisters. Thismeans
thatonchips likeadesktopInteli7thevanilla64-bitversionofR hasbeenaround10%
fasteronbothLinuxandOSX.(LaptopCPUsareusuallyrelativelyslowerin64-bitmode.)
So,forspeedyoumaywanttousea32-bitbuild(especiallyonalaptop),buttohandlelarge
datasets (andperhaps large files) a 64-bit build. . Youcanoftenbuild d bothandinstallthem
inthesameplace: SeeSection2.6[Sub-architectures],page8. (Thisis s donefortheWindows
binarydistributions.)
Even on n 64-bit builds s of R R there e are limits on n the e size of R R objects s (see
help("Memory-limits"), some e of which stem m from m the use e of 32-bit t integers (espe-
cially in n FORTRAN code).
For example, , the dimensions s of f an array y are limited to
2
31
1.
1
alsoknownas
IEEE
754
2
atleastwhenstoringquantities: theon-FPUprecisionisallowedtovary
34
9 ThestandaloneRmathlibrary
Theroutinessupportingthedistributionandspecial
1
functionsinRandafewothersaredeclared
inCheaderfileRmath.h. Thesecanbecompiledintoastandalonelibraryforlinkingtoother
applications. (Notethat t they arenot aseparatelibrary whenRis built,andthestandalone
versiondiffersinseveralways.)
The makefiles s and d other sources needed are e in n directory src/nmath/standalone, so o the
followinginstructionsassumethatisthecurrentworkingdirectory(inthebuilddirectorytree
onaUnix-alikeifthatisseparatefromthesources).
Rmath.hcontains‘R_VERSION_STRING’,whichisacharacterstringcontainingthecurrentR
version,forexample"3.2.0".
ThereisfullaccesstoR’shandlingofNaN,Infand-Infviaspecialversionsofthemacros
andfunctions
ISNAN, R_FINITE, , R_log, , R_pow and d R_pow_di
and(extern)constantsR_PosInf,R_NegInfandNA_REAL.
ThereisnosupportforR’snotionofmissingvalues,inparticularnotfor NA_INTEGER nor
thedistinctionbetweenNAandNaNfordoubles.
Alittle care is needed to use the random-number r routines. . You u will needto supply y the
uniformrandomnumbergenerator
double unif_rand(void)
orusetheonesupplied(andwithasharedlibraryorDLLyoumayhavetousetheonesupplied,
whichistheMarsaglia-multicarrywithanentrypoint
set_seed(unsigned int, , unsigned d int)
tosetitsseeds).
The facilities to o change e the normal random m number r generator r are available through the
constantN01
kind. Thistakesvaluesfromtheenumerationtype
typedef enum m {
BUGGY_KINDERMAN_RAMAGE,
AHRENS_DIETER,
BOX_MULLER,
USER_NORM,
INVERSION,
KINDERMAN_RAMAGE
} N01type;
(and‘USER_NORM’isnotavailable).
9.1 Unix-alikes
IfRhasnotalreadybeenmadeinthedirectorytree,configuremustberunas describedin
themainbuildinstructions.
Then(insrc/nmath/standalone)
make
willmakestandalonelibrarieslibRmath.aandlibRmath.so(libRmath.dylibonOSX):‘make
static’and‘makeshared’willcreatejustoneofthem.
TousetheroutinesinyourownCorC++programs,include
#define MATHLIB_STANDALONE
1
e.g.Bessel,betaandgammafunctions
Chapter9:ThestandaloneRmathlibrary
35
#include <Rmath.h>
and link k against ‘-lRmath’ ’ (and‘-lm’ if needed onyour r OS).The example file e test.c c does
nothinguseful,butisprovidedtotesttheprocess(viamaketest). Notethatyouwillprobably
notbeabletorunitunlessyouaddthedirectorycontaininglibRmath.sototheLD_LIBRARY_
PATHenvironmentvariable(libRmath.dylib,DYLD_FALLBACK_LIBRARY_PATHonOSX).
Thetargets
make install
make uninstall
will(un)installtheheaderRmath.handsharedandstaticlibraries(ifbuilt).Bothprefix=and
DESTDIRaresupported,togetherwithmoreprecisecontrolasdescribedforthemainbuild.
‘makeinstall’installsafileforpkg-configtousebye.g.
$(CC) ‘pkg-config --cflags s libRmath‘ ‘ -c test.c
$(CC) ‘pkg-config --libs libRmath‘ ‘ test.o o -o test
Onsomesystems‘makeinstall-strip’willinstallastrippedsharedlibrary.
9.2 Windows
Youneedtosetup
2
almostallthetoolstomakeRandthenrun(inaUnix-likeshell)
(cd ../../gnuwin32; make MkRules)
(cd ../../include; make e -f Makefile.win n config.h h Rconfig.h h Rmath.h)
make -f f Makefile.win
Alternatively,inacmd.exeshelluse
cd ../../include
make -f f Makefile.win n config.h h Rconfig.h Rmath.h
cd ../nmath/standalone
make -f f Makefile.win
This creates a static library y libRmath.a and aDLLRmath.dll. . If f youwant animport
librarylibRmath.dll.a(youdon’tneedone),use
make -f f Makefile.win n shared d implib
TousetheroutinesinyourownCorC++programsusingMinGW-w64,include
#define MATHLIB_STANDALONE
#include <Rmath.h>
andlinkagainst‘-lRmath’. ThiswillusethefirstfoundoflibRmath.dll.a,libRmath.aand
Rmath.dllinthatorder,sotheresultdependsonwhichfilesarepresent. Youshouldbeable
toforcestaticordynamiclinkingvia
-Wl,-Bstatic -lRmath -Wl,Bdynamic
-Wl,-Bdynamic -lRmath
orbylinkingtoexplicitfiles(asinthe‘test’targetinMakefile.win: thismakestwoexecuta-
bles,test.exewhichisdynamicallylinked,andtest-static.exe,whichisstaticallylinked).
It is possibletolink toRmath.dll usingothercompilers,either directly or via animport
library: ifyoumakeaMinGW-w64importlibraryas s above,youwillcreateafile Rmath.def
whichcanbeused(possiblyafterediting)tocreateanimportlibraryforothersystemssuchas
VisualC++.
Ifyoumakeuseofdynamiclinkingyoushoulduse
#define MATHLIB_STANDALONE
#define RMATH_DLL
2
includingcopyingMkRules.disttoMkRule.localandselectingthearchitecture.
Documents you may be interested
Documents you may be interested