[R] Creating an R package in windows- where to put images?

2012-12-09 Thread Subramanian S
My R version: 2.15.1- windows

While creating an R package in windows, i want to include an image (a .gif
image) that will finally be in the package. A function in my package will
call the gif image. Where should i put the images before running Rcmd
build mypkg or Rcmd INSTALL --build mypkg, so that after creating the
package, the .zip file / .tar.gz/ .tgz would have the gif image in the
correct place in each OS.  Basically two questions (1) which directory
should i put the gif image before building the pkg and (2)how do i specify
the path in the function that will call the gif image?

[[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] Creating an R package in windows- where to put images?

2012-12-09 Thread Subramanian S
Thank you Jeff for that..

Thanks Tyler.. that worked.. i put the image in inst/extdata and then built
the pkg..and gave the path using system.file().. thanx again

[[alternative HTML version deleted]]

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


[R] Error msg in rpanel

2012-09-09 Thread Dr Subramanian S
I am working on the r panel package. Now if i have a function that uses a
radiogroup button, and if i attempt to run the function from inside the
rpanel menu, i get this error:


Error in panel$intname : $ operator is invalid for atomic vectors

However if i run the function per se i.e. not from inside the rpanel
menu, but by calling it independently, the above error doesn't appear.
Here is a simple example. Try running the whole code versus just
running the add() function. The former results in the above error and
the latter doesn't.

install.packages(c(rpanel,tkrplot))
my.menu - function(panel) {
library(rpanel,tkrplot)
if (panel$menu==Add){
add()
  }
else
panel
}

main.panel - rp.control(title = Main Menu,size=c(200,150))
rp.menu(panel = main.panel, var = menu,
labels = list(list(Addition, Add)),
action = my.menu)

#  function to do adddition

add - function(){
  my.draw - function(panel) {
 if(panel$vals==numbers){
  val-as.numeric(panel$nmbr1)+as.numeric(panel$nmbr2)
}
else if(panel$vals==strings){
  val - paste(as.character(panel$nmbr1), and ,as.character(panel$nmbr2))
}
plot(1:10, 1:10, type=n, xlab=, ylab=,
   axes=FALSE, frame = TRUE)
text(5, 5, paste(Result: , val),cex=1.4)

panel
  }

  my.redraw - function(panel) {
rp.tkrreplot(panel, my.tkrplot)
panel
  }

  my.panel - rp.control(title = Addition)
  rp.textentry(panel = my.panel, var = nmbr1,
   labels = First: , action = my.redraw, initval=100)
  rp.textentry(panel = my.panel, var = nmbr2,
   labels = Second:, action = my.redraw, initval=200)
  rp.radiogroup(panel = my.panel, var = vals,
values = c(numbers, strings),
action = my.redraw, title = Type)
  rp.tkrplot(panel = my.panel, name = my.tkrplot, plotfun = my.draw)

}

[[alternative HTML version deleted]]

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


[R] How to display result of a calculation within panel

2012-04-10 Thread Subramanian S
How do i make rpanel print the value of a calculation in the rpanel itself
- in a space just below the submit button?

The calculation uses user inputs (using rp.textentry) and takes the values
entered as input to the function via function (myRpanel)

e.g.


myfunction - function(myRpanel){
z- myRpanel$x + myRpanel$y
return(z)
}

myRpanel - rp.control(My new function)
rp.textentry(myRpanel, x, myfunction, x :, initval = 20)
rp.textentry(myRpanel, y, myfunction, y :, initval = 10)
rp.button(myRpanel, title = Submit, action = myfunction)



Thank you
Subramanian

[[alternative HTML version deleted]]

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


[R] How to Get option prices of first date and expiry date alone

2011-07-08 Thread Subramanian S
i have option prices of 1 month option contract for several days in a csv
file. The data is in chronological order of dates. Within each date, price
quotes for each strike appears (about 30 strikes per month- so there are in
30 rows per day for many days and many months). i want only the quote on the
first date of the month (when the options are introduced) and on the last
Thursday of the month or the previous day if the last Thursday is a holiday
(i.e. the date when the options expire). i want the rows for all strikes for
only these two dates alone (i.e. 30 begin date of each month + 30 rows
expiry date each month) for all months in my data. Please guide.

Subramanian

[[alternative HTML version deleted]]

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


[R] installing packages from a directory on the computer

2010-06-22 Thread Subramanian S
i wish to know how to set a folder in computer as a mirror from which i can
install packages
i am aware of the menu approach- Packagesinstall from local zip files but
i wish to know the command line approach because i dont have internet access
on the computer  where i will be using R.

i have put the zip files of packages in
C:\R\packages\bin\windows\contrib\2.11

i have put the following lines in Rprofile.site

 local({r - getOption(repos)
   r[CRAN] - file://C:/R/packages/
   options(repos=r)})

but when i run install.packages(package_name_here), i get the following
message:

Warning in gzfile(file, r) :
  cannot open compressed file
'//C:/R/packages/bin/windows/contrib/2.11/PACKAGES', probable reason 'No
such file or directory'
Error in gzfile(file, r) : cannot open the connection


Please help

[[alternative HTML version deleted]]

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


[R] installing packages from a directory on the computer

2010-06-22 Thread Subramanian S
i wish to know how to set a folder in computer as a mirror from which i can
install packages
i am aware of the menu approach- Packagesinstall from local zip files but
i wish to know the command line approach because i dont have internet access
on the computer  where i will be using R.

i have put the zip files of packages in
C:\R\packages\bin\windows\contrib\2.11

i have put the following lines in Rprofile.site

 local({r - getOption(repos)
   r[CRAN] - file://C:/R/packages/
   options(repos=r)})

but when i run install.packages(package_name_here), i get the following
message:

Warning in gzfile(file, r) :
  cannot open compressed file
'//C:/R/packages/bin/windows/contrib/2.11/PACKAGES', probable reason 'No
such file or directory'
Error in gzfile(file, r) : cannot open the connection


Please help

[[alternative HTML version deleted]]

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


[R] installing packages from a directory on the computer

2010-06-22 Thread Subramanian S
Peter, i tried the file.choose() method of installing from local zip files;
its easy to install few packages that way. but you see if there are many
packages(say 10 or 12), then i wont be able to install the packages on
which the packages that i want to install depend because i guess i cant set
dependencies=TRUE by this method.

here is what i tried
i replaced http://my.local.cran; (code below) in Rprofile.site with
file://C:/R/packages/ and then did

install.packages(c(pkg1, pkg2, ...),dependencies=TRUE) in R console but
dint succeed..

# set a CRAN mirror
 local({r - getOption(repos)
  r[CRAN] - http://my.local.cran/;
   options(repos=r)})

Would Appreciate help

[[alternative HTML version deleted]]

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


[R] Installing packages from folder on the computer

2010-06-22 Thread Subramanian S
i am able to install zip files of packages from local zip files using the
file.choose() for the package argument in install.packages() function in R
console and also from the Packages menuinstall from local zip files. But
if there are many packages to install (say 15 or 20), then i have to factor
in dependencies of 15-20 packages which may be more than 100 or 200 packages
in all to be installed. i'd have to go and choose so many of them.

so, i want a command line solution.

here is what i tried:

following the CRAN Miror's hierarchy of the directory where package zip
files are, i have put zip files of packages in:
C:\R\packages\bin\windows\contrib\2.11

To set this folder as my Mirror to install packages from, in Rprofile.site i
replaced http://my.local.cran;  with file://C:/R/packages/ (full code
given below) and then in R console i enter:

install.packages(c(pkg1, pkg2, ...),dependencies=TRUE)

but dint succeed.

Error message: Warning in gzfile(file, r) :
  cannot open compressed file
'//C:/R/packages/bin/windows/contrib/2.11/PACKAGES', probable reason 'No
such file or directory'
Error in gzfile(file, r) : cannot open the connection

# code in Rprofile.site to set a CRAN mirror
 local({r - getOption(repos)
  r[CRAN] - http://my.local.cran/;
   options(repos=r)})


have changed this to:

 local({r - getOption(repos)
  r[CRAN] - file://C:/R/packages/
   options(repos=r)})

Pls help.

[[alternative HTML version deleted]]

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


[R] installing packages from a directory on the computer

2010-06-22 Thread Subramanian S
i tried

pkgs - c(pkg1, pkg2, pkg3)
install.packages(pkgs, repos = NULL,
+ contriburl =
file:///C:/R/packages/bin/windows/contrib/2.11,
+ dependencies = TRUE)

i have put the zip files in C:/R/packages/bin/windows/contrib/2.11
 ***  and extracted the packages.gz file in this folder ***

It works. Thank you Peter.

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