[R] Creating Tag

2017-11-01 Thread Hemant Sain
i want to tag categories to its menuname.
i have a csv containing menu item name and in other csv i have a column
containing some strings,
i want to pick that strings from categories and look into  menu items if
any menu item containing that string i want to create a new column next to
menu item name flagged as 1 otherwise 0
and the only condition is once a menu item flagged as 1 i don't need to
consider that menu item again to tag further in case of redundant strings
in categories only i want to search which are flagged as 0.
please help me with the R script.

*Menu Name*
9\ bobbie"
9\ chz steak"
9\ tuna"
provolone
20\ bobbie"
bottled soda 20oz
cran-slam ww
american
small chips
medium drink
9\ meatball"
capriotti's water
20'' chicken cheese steak
9\ veg turkey"
medium chips
9\ capastrami"
12\ bobbie"
12'' chicken cheese steak
cookie
12\ chz steak"
9\ cole turkey"
kid grilled cheese white
12\ italian"
12\ meatball"
12\ capastrami"
turkey sand w
20\ slaw be jo"
swiss
12\ cole turkey"
large drink
9\ ham&chz"
9'' chicken cheese steak
9\ slaw be jo"
turkey sand ww
stuffing
12\ turkey"
9\ italian"
12\ slaw be jo"
9\ grld italian"
12\ veg burger w/chz"
extra american
black&bleu salad
9\ turkey"
20\ turkey"
20\ capastrami"
ham sand w
12\ mushroom"
12\ grld italia"
italian salad
tuna sand ww
9\ roast beef"
20\ chz steak"
20\ mushroom"
9\ veg chzstk"
ham
genoa
12\ veg turkey"
12\ veggie cole turkey"
9\ mushroom"
cap's creation
mushrooms
salad chicken
20\ cole turkey"
1 pack chicken
kr  veg burger w/chz
12\ roast beef"
kid turkey n cheese white
20\ italian"
12\ ham&chz"
9\ employee sub"
roast beef kr
9\ veggie cole turkey"
12\ sausage"
tea
turkey sand kr
salad turkey
tuna sand kr
brownie
slice american cheese
1 oz pastrami
9\ cheese"
12\ italian up"
12\ capastrami up"
1 pack steak
delaware's finest small
the sampler sm
side ranch dressing
12\ veg turkey up"
20\ roast beef"
roast beef w
1oz turkey
12\ tuna"
20\ veg turkey"
12\ veg chzstk"
9\ sausage"
kid ham n cheese white
side italian dressing
salad provolone
20\ grld italia"
sample item 6
sample item 9
turkey
12\ slaw be jo up"
12\ meatball up"
1 oz roast beef
ham sand ww
delaware's finest large
side cole slaw large
large chips
20\ meatball"
12'' chick cheese stk up
12\ chz steak up"
12\ grld italia up"
cran-slam w
12\ bobbie up"
20\ cheese"
slice provolone
the sampler lg
meatball bar
slice ham
wise large chips
small side
sm soup
12\ tuna up"
12\ cole turkey up"
prosciutini
20\ veggie cole turkey"
soup
roast beef
20\ italian up"
20'' chick cheese stk up
20\ chz steak up"
20\ bobbie up"
20\ veg turkey up"
slice swiss
20\ capastrami up"
sample item 7
12\ ham&chz up"
salad swiss
12\ veggie cheese stk up"
california omelet
orange juice
exteme bac boy
dinner salad
chef salad
12\ turkey up"
the big cheese
combo it
fries cmb
sm pepsi
km cheese burger
#NAME?
#NAME?
kid grilled cheese wheat
kids ham cheese white box
calif. blt
bacon turkey melt
coffee
1-pc pancake
fries
tuna sand
biscuits & gravy
s-1/3 patty
x avocado
x chez
s-bacon
#NAME?
xtra egg
lg bev upcharge
sm ice tea
small soup
roast beef ww
salad tuna
med pepsi
20\ veg chzstk up"
day nm egg san
s-chkn brest
bell pepper
fruit
1 slice veggie turkey
s-toast
x sausage
1 pack sausage
chicken salad
lg pepsi
x dressing
large side
9\ firecracker turkey"
20\ sausage up"
20\ turkey up"
20\ veg chzstk"
lg ice tea
12\ roast beef up"
sample item 8
catering cap creation sal
the turkey lover sm
little italy sm
cookie tray
sd chk avo san
sm fry / 2 pc zucch
kid turkey n cheese wheat
junior chz burger
extra italian meat
chili chz fries
sm fry / 2 pc o ring
extra turkey








*CATEGORIES*
non-veg
chix
salmon
ch
chkn
brisket
brskt
bacon
bcn
chse
mahi
dog
shk
clam
parmesan
asiago
prosciutto
prosciutti
salami
Angus
hicken
chk
chick
wings
prk
pork
ham
bacon
ribs
fish
shrimp
tuna
beef
steak
stk
meatball
non-veg
chix
salmon
ch
chkn
brisket
brskt
bacon
bcn
chse
mahi
dog
shk
clam
parmesan 
asiago 
prosciutto 
prosciutti 
salami 
Angus
hicken 
chk 
chick 
wings
prk 
pork 
ham 
bacon 
ribs
fish 
shrimp
tuna
beef 
steak 
stk
meatball



























i want to tag categories to its menuname.
i have a csv containing menu item name and in other csv i have a colunmn 
containing some strings,
i want to pick that strings from categories and look into  menu items if any 
menu item containing that string i want to create a new column next to menu 
item name flagged as 1 otherwise 0
and the only condition is once a menu item flagged as 1 i dont need to consider 
that menu item again to tag further in case of redudant strings in categories 
only i want to search which are flagged as 0.
please help me with the r script.


Menu Name
9\ bobbie"
9\ chz steak"
9\ tuna"
provolone
20\ bobbie"
bottled soda 20oz
cran-slam ww
american
small chips
medium drink
9\ meatball"
capriotti's water
20'' chicken cheese steak
9\ veg turkey"
medium chips
9\ capastrami"
12\ bobbie"
12'' chicken cheese steak
cookie
12\ chz steak"
9\ cole turkey"
kid grilled cheese

Re: [R] run r script in r-fiddle

2017-11-01 Thread Martin Maechler
> Suzen, Mehmet 
> on Tue, 31 Oct 2017 19:27:30 +0100 writes:

> Dear List, According to datacamp support team,
> r-fiddle.org is not supported. We asked them to put it
> down as Professor Maechler suggested it is a waste of time
> for the R-help to respond to questions on something not
> maintained and severely outdated. If you would like to use
> R from your browser, you can embed the following into a
> web page:

>  src="https://cdn.datacamp.com/datacamp-light-latest.min.js";>
> 

> Currently, it supports R 3.4.0. See the code base, which
> is open source, here
> https://github.com/datacamp/datacamp-light

> Hope it helps.
> Best, Mehmet

Yes, it does!
Thank you very much, Mehmet, for reaching out to get these
clarifications and reporting back here.

I'm glad to be notified that datacamp seems to adhere to an open source
philosophy also in the tools they write: For datacamp-light they
_do_ adhere (*) to the much more strict 
GNU Public Licence (GPL) Free Software standard which emphasizes not
only the free availability of source code, but also other
freedoms, e.g., to *modify* and re-distribute under the GPL, see
https://en.wikipedia.org/wiki/GPL for much more.

An open Github repos alone is _no_ guarantee for that, and
unfortunately I think there's much software there where authors
don't care (or don't want) to use a "truly" free software
licence such as
(*) https://github.com/datacamp/datacamp-light/blob/master/LICENSE.md

Best,
Martin Maechler


> On 31 October 2017 at 15:09, Suzen, Mehmet
>  wrote:
>> On 31 October 2017 at 12:42, Martin Maechler
>>  wrote:
>>> Notably as I think it's been provided by a company that
>>> no longer exists under that name, and even if that'd be
>>> wrong, R-Fiddle does not seem free software (apart from
>>> the R parts, I hope !).
>> 
>> For the record, r-fiddle is maintained by datacamp:
>> 
https://www.datacamp.com/community/blog/r-fiddle-an-online-playground-for-r-code-2

__
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] beta binomial distribution installation

2017-11-01 Thread Eric Berger
Hi,
I did a quick search for other packages that provide the beta binomial
distribution and found "rmutil".

> install.packages("rmutil")

The package has the CDF (pbetabinom) and inverse CDF (qbetabinom) among
other functions.

HTH,
Eric



On Wed, Nov 1, 2017 at 7:50 AM, MCGUIRE, Rhydwyn <
rm...@doh.health.nsw.gov.au> wrote:

> Hi there,
>
> It looks like you also need the bioconductor package biobase, I found
> instructions for downloading that package here:
> www.bioconductor.org/install
>
> Good luck.
>
> Cheers,
> Rhydwyn
>
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Amany
> Abdel-Karim
> Sent: Wednesday, 1 November 2017 2:13 PM
> To: r-h...@stat.math.ethz.ch
> Subject: [R] beta binomial distribution installation
>
> Hello,
>
> I  tried to install package TailRank using the command install.packages
> (RankTail) and library (TailRank) but I got the following errors. So, how
> can I install TaiRank in Rstudio to have se beta-binomial distribution, CDF
> and inverse CDG of  beta-binomal?
>
> The commands I used are:
>
> > install.packages("TailRank")
>
> Installing package into C:/Users/stator-guest/Documents/R/win-library/3.4
>
> (as lib is unspecified)
>
> Warning in install.packages :
>
>   dependency Biobase is not available
>
> trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/TailRank_
> 3.1.3.zip'
>
> Content type 'application/zip' length 331270 bytes (323 KB)
>
> downloaded 323 KB
>
>
>
> package TailRank successfully unpacked and MD5 sums checked
>
>
>
> The downloaded binary packages are in
>
> C:\Users\stator-guest\AppData\Local\Temp\RtmpoVx40V\
> downloaded_packages
>
> > library(TailRank)
>
> Error: package or namespace load failed for TailRank in loadNamespace(i,
> c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
>
>  there is no package called Biobase
>
> In addition: Warning message:
>
> package TailRank was built under R version 3.4.2
>
>
>
>
> [[alternative HTML version deleted]]
>
> 
> __
> This email has been scanned for the NSW Ministry of Health by the Websense
> Hosted Email Security System.
> Emails and attachments are monitored to ensure compliance with the NSW
> Ministry of health's Electronic Messaging Policy.
> 
> __
> 
> ___
> Disclaimer: This message is intended for the addressee named and may
> contain confidential information.
> If you are not the intended recipient, please delete it and notify the
> sender.
> Views expressed in this message are those of the individual sender, and
> are not necessarily the views of the NSW Ministry of Health.
> 
> ___
> This email has been scanned for the NSW Ministry of Health by the Websense
> Hosted Email Security System.
> Emails and attachments are monitored to ensure compliance with the NSW
> Ministry of Health's Electronic Messaging Policy.
> 
> ___
> __
> 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.
>

[[alternative HTML version deleted]]

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


[R] R-3.4.2: make check stops at line 698 of tests/reg-tests-1d.R

2017-11-01 Thread Albrecht Kauffmann
Hi all,

after compiling R-3.4.2 on opensuse leap 42.3, make check failed. Until
R-3.4.1 I never had a problem with these tests. No, the programm stops
at the following line of tests/reg-tests-1d.R:

> ## available.packages() (not) caching in case of errors
> tools::assertWarning(ap1 <- available.packages(repos = "http://foo.bar";))
> tools::assertWarning(ap2 <- available.packages(repos = "http://foo.bar";)) 
error in assertCondition(expr, "warning",
   .exprString = d.expr) :  Got simpleError evaluating of ap2 <-
   available.packages(repo  ...: wanted warning

The error message is a result of:  ap2 <- available.packages(repos =
"http://foo.bar";),
not of the following condition in the test script:   stopifnot(nrow(ap1)
== 0, identical(ap1, ap2))  .

ap1 <- available.packages(repos = "http://foo.bar";) works well, but the
following line stops the program.

After replacing "http://foo.bar"; by "http://foo.poi"; (every phrase
different from "bar" works well), reg-test-1d.R passed without error
message the interpreter.

Has someone an idea why the original program code stops (only) at line
698: 
tools::assertWarning(ap2 <- available.packages(repos =
"http://foo.bar";))?

With many thanks for every hint,
Albrecht

-- 
  Albrecht Kauffmann
  alkau...@fastmail.fm

__
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] repeat a function

2017-11-01 Thread Eric.Pueyo
I want to populate the matrix prb through the function HWMProb <- function 
(a,j,dt) that encapsulates different functions (please see code below), using 
j= 0:2 for each j.

It only populates prb if I specify each function independently in the global 
environment and then run the loop with the iF statement, as per below.
for (j in 0:2) {
  if (j==0) {
prb["0","1"] <- ProbUP(a,j,dt)
prb["0","0"] <- ProbMID(a,j,dt)
prb["0","-1"] <- ProbDWN(a,j,dt)
  }
  else {
if (j==jmax) {
  prb[paste(j,sep = ""),"1"] <- TOPProbUP(a,j,dt)
  prb[paste(j,sep = ""),"0"] <- TOPProbMID(a,j,dt)
  prb[paste(j,sep = ""),"-1"] <- TOPProbDWN(a,j,dt)
  prb[paste(-j,sep = ""),"1"] <- BTTMProbUP(a,-j,dt)
  prb[paste(-j,sep = ""),"0"] <- BTTMProbMID(a,-j,dt)
  prb[paste(-j,sep = ""),"-1"] <- BTTMProbDWN(a,-j,dt)
}
else {
  prb[paste(j,sep = ""),"1"] <- ProbUP(a,j,dt)
  prb[paste(j,sep = ""),"0"] <- ProbMID(a,j,dt)
  prb[paste(j,sep = ""),"-1"] <- ProbDWN(a,j,dt)
  prb[paste(-j,sep = ""),"1"] <- ProbUP(a,-j,dt)
  prb[paste(-j,sep = ""),"0"] <- ProbMID(a,-j,dt)
  prb[paste(-j,sep = ""),"-1"] <- ProbDWN(a,-j,dt)
} # Close 2nd IF
  } # Close 1st IF
}

Many thanks in advance.
Kind regards,

Eric Pueyo
Investment Risk Analyst
Email:  eric.pu...@avivainvestors.com
D: +44 (0)20 7809 8070
No. 1 Undershaft, London EC3P 3DQ
Web: 
www.avivainvestors.com

jmax<-2
prb <-matrix(0L,nrow=5, ncol=3)
rownames(prb) <- c(seq(-2,2, by = 1))
colnames(prb) <- c(-1,0,1)
a<- 0.1
dt<-1

ExpX <-function(x,a,dt) {  ##Defines the 
Expectation of X on t+1 | t
ExpX <- x*exp(-a*dt)
ExpX
}
Mfactor<-function(a,dt)  {   ###Factor 
multiplicative
  Mfactor<- exp(-a*dt)-1
  Mfactor
}
VarX <-function(sigma,a,dt) { ###Defubes the 
Variance of X on t+1 | t
  VarX <- (sigma^2/(2*a))*(1-exp(-2*a*dt))
  VarX
}
DeltaX <-function(sigma,a,dt) {   ##Defines the change 
of X
  DeltaX<- sqrt(3*VarX(sigma,a,dt))
  DeltaX<-value(DeltaX)
}

Mfactor<-function(a,dt)  {   ###Factor 
multiplicative
  Mfactor<- exp(-a*dt)-1
  Mfactor
}

KNode<-function(sigma,x,a,j,dt) {##Central Node
  KNode<- round(ExpX(x,a,dt)/DeltaX(sigma,a,dt))
  KNode
}

### Probability Calculations taking into account different branches
HWMProb <- function (a,j,dt) {
  # DESCRIPTION #
  ProbUP<- function( a, j, dt) 1 / 6 + ((j ^ 2 * Mfactor(a, dt) ^ 2 + j * 
Mfactor(a, dt)) / 2) # Probability X going up
  ProbMID<- function(a, j, dt) 2 / 3 - (j ^ 2 * Mfactor(a, dt) ^ 2) 
 Probability X going middle
  ProbDWN<-function( a, j, dt) 1 / 6 + ((j ^ 2 * Mfactor(a, dt) ^ 2 - j * 
Mfactor(a, dt)) / 2)  ###  Probability X going down
  TOPProbUP<- function( a, j, dt) 7 / 6 + (j ^ 2 * Mfactor(a, dt) ^ 2 + 3 * j * 
Mfactor(a, dt)) / 2 ### Top branch probability going up
  TOPProbMID<- function(a, j, dt) -1 / 3 - j ^ 2 * Mfactor(a, dt) ^ 2 - 2 * j * 
Mfactor(a, dt)  ### Top branch probability going MID
  TOPProbDWN<- function( a, j, dt) 1 / 6 + (j ^ 2 * Mfactor(a, dt) ^ 2 + j * 
Mfactor(a, dt)) / 2   ### Top branch probability going DOWN
  BTTMProbUP<- function( a, j, dt) 1 / 6 + (j ^ 2 * Mfactor(a, dt) ^ 2 - j * 
Mfactor(a, dt)) / 2   ### Bottom branch probability going u
  BTTMProbMID<- function( a, j, dt) -1 / 3 - j ^ 2 * Mfactor(a, dt) ^ 2 + 2 * j 
* Mfactor(a, dt)   ### Bottom branch probability going MID
  BTTMProbDWN<- function( a, j, dt) 7 / 6 + (j ^ 2 * Mfactor(a, dt) ^ 2 - 3 * j 
* Mfactor(a, dt)) / 2  ### Bottom branch probability going DOWN

  if (j==0) {
prb["0","1"] <- ProbUP(a,j,dt)
prb["0","0"] <- ProbMID(a,j,dt)
prb["0","-1"] <- ProbDWN(a,j,dt)
  }
  else {
if (j==jmax) {
  prb[paste(j,sep = ""),"1"] <- TOPProbUP(a,j,dt)
  prb[paste(j,sep = ""),"0"] <- TOPProbMID(a,j,dt)
  prb[paste(j,sep = ""),"-1"] <- TOPProbDWN(a,j,dt)
  prb[paste(-j,sep = ""),"1"] <- BTTMProbUP(a,-j,dt)
  prb[paste(-j,sep = ""),"0"] <- BTTMProbMID(a,-j,dt)
  prb[paste(-j,sep = ""),"-1"] <- BTTMProbDWN(a,-j,dt)
}
else {
  prb[paste(j,sep = ""),"1"] <- ProbUP(a,j,dt)
  prb[paste(j,sep = ""),"0"] <- ProbMID(a,j,dt)
  prb[paste(j,sep = ""),"-1"] <- ProbDWN(a,j,dt)
  prb[paste(-j,sep = ""),"1"] <- ProbUP(a,-j,dt)
 prb[paste(-j,sep = ""),"0"] <- ProbMID(a,-j,dt)
  prb[paste(-j,sep = ""),"-1"] <- ProbDWN(a,-j,dt)
} # Cl

[R] Function to save results

2017-11-01 Thread Priya Arasu via R-help
Hi,I want the results to be saved automatically in a output text file after the 
script has finished running.

I used the sink function in the following example, but the results file 
(output.txt) was empty.

net <- loadNetwork("C://Users//Priya//Desktop//Attractor analysis_all 
genes//synaptogenesis//regulationof_dopamine_signaling_submodule3.txt")# First 
I loaded theinput file for which I want to identify attractors
attr <- sink("C://Users//Priya//Desktop//Attractor analysis_all 
genes//synaptogenesis//output.txt")# used the sink function to save the results 
from attr function

attr <- getAttractors(net, type="asynchronous")# then ran the script for 
identifying attractors
Is there any function to save the results before setting the script to run, so 
that results are automatically saved in a text file after the script has 
finished running?

Thank youPriya



[[alternative HTML version deleted]]

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


Re: [R] Function to save results

2017-11-01 Thread Eric Berger
Some comments:
1. sink() does not return a value. There is on point to set attr <-
sink(...). Just give the command sink("C://etc")
2. to complete the saving to the file you must give a second sink command
with no argument:  sink()
So your code would be (pseudo-code, not actual code)

sink( "filename" )
do something that prints output which will be captured by sink
sink()

HTH,
Eric



On Wed, Nov 1, 2017 at 1:32 PM, Priya Arasu via R-help  wrote:

> Hi,I want the results to be saved automatically in a output text file
> after the script has finished running.
>
> I used the sink function in the following example, but the results file
> (output.txt) was empty.
>
> net <- loadNetwork("C://Users//Priya//Desktop//Attractor analysis_all
> genes//synaptogenesis//regulationof_dopamine_signaling_submodule3.txt")#
> First I loaded theinput file for which I want to identify attractors
> attr <- sink("C://Users//Priya//Desktop//Attractor analysis_all
> genes//synaptogenesis//output.txt")# used the sink function to save the
> results from attr function
>
> attr <- getAttractors(net, type="asynchronous")# then ran the script for
> identifying attractors
> Is there any function to save the results before setting the script to
> run, so that results are automatically saved in a text file after the
> script has finished running?
>
> Thank youPriya
>
>
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


Re: [R] Function to save results

2017-11-01 Thread Eric Berger
Hi Priya,

You did not follow the logic of the pseudo-code.
The sink("filename"), sink() pair captures whatever output is generated
between the first sink statement and the second sink statement.
You need (possibly) to do:

sink("C://Users//Priya//Desktop//Attractor analysis_all
genes//synaptogenesis//attr.txt")


net <- loadNetwork("C://Users//Priya//Desktop//Attractor analysis_all
genes//synaptogenesis//regulationof_dopamine_signaling_submodule3.txt")

attr <- getAttractors(net, type="asynchronous")


sink()


HTH,

Eric






On Wed, Nov 1, 2017 at 4:10 PM, Priya Arasu  wrote:

> Hi Eric,
> I tried as you suggested but I could not find the output in the text file
> I created (attr.txt)
>
> net <- loadNetwork("C://Users//Priya//Desktop//Attractor analysis_all 
> genes//synaptogenesis//regulationof_dopamine_signaling_submodule3.txt")
>
> sink("C://Users//Priya//Desktop//Attractor analysis_all 
> genes//synaptogenesis//attr.txt")
>
>
> sink()
>
> attr <- getAttractors(net, type="asynchronous")
>
>
> Priya
>
>
> On Wednesday, 1 November 2017 6:54 PM, Eric Berger 
> wrote:
>
>
> Some comments:
> 1. sink() does not return a value. There is on point to set attr <-
> sink(...). Just give the command sink("C://etc")
> 2. to complete the saving to the file you must give a second sink command
> with no argument:  sink()
> So your code would be (pseudo-code, not actual code)
>
> sink( "filename" )
> do something that prints output which will be captured by sink
> sink()
>
> HTH,
> Eric
>
>
>
> On Wed, Nov 1, 2017 at 1:32 PM, Priya Arasu via R-help <
> r-help@r-project.org> wrote:
>
> Hi,I want the results to be saved automatically in a output text file
> after the script has finished running.
>
> I used the sink function in the following example, but the results file
> (output.txt) was empty.
>
> net <- loadNetwork("C://Users//Priya/ /Desktop//Attractor analysis_all
> genes//synaptogenesis// regulationof_dopamine_ signaling_submodule3.txt")#
> First I loaded theinput file for which I want to identify attractors
> attr <- sink("C://Users//Priya// Desktop//Attractor analysis_all
> genes//synaptogenesis//output. txt")# used the sink function to save the
> results from attr function
>
> attr <- getAttractors(net, type="asynchronous")# then ran the script for
> identifying attractors
> Is there any function to save the results before setting the script to
> run, so that results are automatically saved in a text file after the
> script has finished running?
>
> Thank youPriya
>
>
>
> [[alternative HTML version deleted]]
>
> __ 
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/ listinfo/r-help
> 
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html 
> and provide commented, minimal, self-contained, reproducible code.
>
>
>
>
>

[[alternative HTML version deleted]]

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


[R] Data invisible to read.csv

2017-11-01 Thread WRAY NICHOLAS via R-help
Hello   This relates to trying to upload csv files to R.  Essentially I have
some v large csv files, but in the column where the dates are appears the column
entry "00:00.0" for every line.  But in the formula bar appears a date as well,
for example "01/04/09 00:00.0", and this never appears in the main body of the
document

It's the dates I need but they seem to be invisible to the read.csv function by
which I'm uploading - that works, but simply gives "00:00.0" and not the date
bit.  I've never seen this before.  Does anyone know what's going on and how I
can get to the date string?

Thanks, Nick Wray
[[alternative HTML version deleted]]

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


Re: [R] Data invisible to read.csv

2017-11-01 Thread Jeff Newmiller
You are using terms and concepts that apply to spreadsheets, but do not apply 
to R or CSV files. Please conform to the Posting Guide and make a reproducible 
example [1][2][3] using R code to demonstrate your problem. I suspect you will 
find that your problem begins in your spreadsheet and not in R or the CSV file, 
but if not then the example will help us help you. 

[1] 
http://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example

[2] http://adv-r.had.co.nz/Reproducibility.html

[3] https://cran.r-project.org/web/packages/reprex/index.html (read the 
vignette)

-- 
Sent from my phone. Please excuse my brevity.

On November 1, 2017 7:30:03 AM PDT, WRAY NICHOLAS via R-help 
 wrote:
>Hello   This relates to trying to upload csv files to R.  Essentially I
>have
>some v large csv files, but in the column where the dates are appears
>the column
>entry "00:00.0" for every line.  But in the formula bar appears a date
>as well,
>for example "01/04/09 00:00.0", and this never appears in the main body
>of the
>document
>
>It's the dates I need but they seem to be invisible to the read.csv
>function by
>which I'm uploading - that works, but simply gives "00:00.0" and not
>the date
>bit.  I've never seen this before.  Does anyone know what's going on
>and how I
>can get to the date string?
>
>Thanks, Nick Wray
>   [[alternative HTML version deleted]]
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

__
R-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] googlesheets gs_reshape_cellfeed()

2017-11-01 Thread Ed Siefker
I have a google spreadsheet with a column of hyperlinks I want the URL from.
The googlesheets package can return this information with gs_read_cellfeed(),
but it needs to be reshaped with gs_reshape_cellfeed().  Problem is,
gs_reshape_cellfeed() returns the 'value' of the cells, not the
'input_value' making
it exactly like gs_read().

How do I extract input_value from a cell feed in a convenient format? I want a
data frame that looks exactly like the output of gs_read(), except returning
'input_value' instead of 'value'.

__
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] R-3.4.2: make check stops at line 698 of tests/reg-tests-1d.R

2017-11-01 Thread Duncan Murdoch

On 01/11/2017 8:11 AM, Albrecht Kauffmann wrote:

Hi all,

after compiling R-3.4.2 on opensuse leap 42.3, make check failed. Until
R-3.4.1 I never had a problem with these tests. No, the programm stops
at the following line of tests/reg-tests-1d.R:


## available.packages() (not) caching in case of errors
tools::assertWarning(ap1 <- available.packages(repos = "http://foo.bar";))
tools::assertWarning(ap2 <- available.packages(repos = "http://foo.bar";))

 error in assertCondition(expr, "warning",
.exprString = d.expr) :  Got simpleError evaluating of ap2 <-
available.packages(repo  ...: wanted warning

The error message is a result of:  ap2 <- available.packages(repos =
"http://foo.bar";),
not of the following condition in the test script:   stopifnot(nrow(ap1)
== 0, identical(ap1, ap2))  .


What error message did you see?



ap1 <- available.packages(repos = "http://foo.bar";) works well, but the
following line stops the program.

After replacing "http://foo.bar"; by "http://foo.poi"; (every phrase
different from "bar" works well), reg-test-1d.R passed without error
message the interpreter.

Has someone an idea why the original program code stops (only) at line
698:
tools::assertWarning(ap2 <- available.packages(repos =
"http://foo.bar";))?




Perhaps your system is resolving foo.bar to a web address.  If I use a 
URL for a web page that doesn't have a repository, I still get a 
warning, but the text of the error may explain why you don't.


Duncan Murdoch

__
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] Function to save results

2017-11-01 Thread Priya Arasu via R-help
Hi Eric,I tried as you suggested but I could not find the output in the text 
file I created (attr.txt)

net <- loadNetwork("C://Users//Priya//Desktop//Attractor analysis_all 
genes//synaptogenesis//regulationof_dopamine_signaling_submodule3.txt")sink("C://Users//Priya//Desktop//Attractor
 analysis_all genes//synaptogenesis//attr.txt")


sink()

attr <- getAttractors(net, type="asynchronous")
 Priya
 

On Wednesday, 1 November 2017 6:54 PM, Eric Berger  
wrote:
 

 Some comments:1. sink() does not return a value. There is on point to set attr 
<- sink(...). Just give the command sink("C://etc")2. to complete the 
saving to the file you must give a second sink command with no argument:  
sink()So your code would be (pseudo-code, not actual code)
sink( "filename" )do something that prints output which will be captured by 
sinksink()
HTH,Eric


On Wed, Nov 1, 2017 at 1:32 PM, Priya Arasu via R-help  
wrote:

Hi,I want the results to be saved automatically in a output text file after the 
script has finished running.

I used the sink function in the following example, but the results file 
(output.txt) was empty.

net <- loadNetwork("C://Users//Priya/ /Desktop//Attractor analysis_all 
genes//synaptogenesis// regulationof_dopamine_ signaling_submodule3.txt")# 
First I loaded theinput file for which I want to identify attractors
attr <- sink("C://Users//Priya// Desktop//Attractor analysis_all 
genes//synaptogenesis//output. txt")# used the sink function to save the 
results from attr function

attr <- getAttractors(net, type="asynchronous")# then ran the script for 
identifying attractors
Is there any function to save the results before setting the script to run, so 
that results are automatically saved in a text file after the script has 
finished running?

Thank youPriya



        [[alternative HTML version deleted]]

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




   
[[alternative HTML version deleted]]

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

Re: [R] Function to save results

2017-11-01 Thread Priya Arasu via R-help
Hi Eric,Thanks for the explanation. Is there a way to save the results 
automatically after the analysis gets over?. As I recently lost the results, 
because I didn't save the results. I don't want to run the sink or save command 
after the analysis is over rather run the command for saving the file before 
starting to run the analysis, so the file gets saved automatically after the 
script has finished running
Priya
 


On Wednesday, 1 November 2017 7:53 PM, Eric Berger  
wrote:
 

 Hi Priya,
You did not follow the logic of the pseudo-code. The sink("filename"), sink() 
pair captures whatever output is generated between the first sink statement and 
the second sink statement.You need (possibly) to do:
sink("C://Users//Priya// Desktop//Attractor analysis_all 
genes//synaptogenesis//attr. txt")
net <- loadNetwork("C://Users//Priya/ /Desktop//Attractor analysis_all 
genes//synaptogenesis// regulationof_dopamine_ signaling_submodule3.txt")attr 
<- getAttractors(net, type="asynchronous")
sink()
HTH,Eric


 
On Wed, Nov 1, 2017 at 4:10 PM, Priya Arasu  wrote:

Hi Eric,I tried as you suggested but I could not find the output in the text 
file I created (attr.txt)

net <- loadNetwork("C://Users//Priya/ /Desktop//Attractor analysis_all 
genes//synaptogenesis// regulationof_dopamine_ 
signaling_submodule3.txt")sink("C://Users//Priya// Desktop//Attractor 
analysis_all genes//synaptogenesis//attr. txt")


sink()

attr <- getAttractors(net, type="asynchronous")
 Priya
 

On Wednesday, 1 November 2017 6:54 PM, Eric Berger  
wrote:
 

 Some comments:1. sink() does not return a value. There is on point to set attr 
<- sink(...). Just give the command sink("C://etc")2. to complete the 
saving to the file you must give a second sink command with no argument:  
sink()So your code would be (pseudo-code, not actual code)
sink( "filename" )do something that prints output which will be captured by 
sinksink()
HTH,Eric


On Wed, Nov 1, 2017 at 1:32 PM, Priya Arasu via R-help  
wrote:

Hi,I want the results to be saved automatically in a output text file after the 
script has finished running.

I used the sink function in the following example, but the results file 
(output.txt) was empty.

net <- loadNetwork("C://Users//Priya/ /Desktop//Attractor analysis_all 
genes//synaptogenesis// regulationof_dopamine_ signaling_submodule3.txt")# 
First I loaded theinput file for which I want to identify attractors
attr <- sink("C://Users//Priya// Desktop//Attractor analysis_all 
genes//synaptogenesis//output. txt")# used the sink function to save the 
results from attr function

attr <- getAttractors(net, type="asynchronous")# then ran the script for 
identifying attractors
Is there any function to save the results before setting the script to run, so 
that results are automatically saved in a text file after the script has 
finished running?

Thank youPriya



        [[alternative HTML version deleted]]

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




   



   
[[alternative HTML version deleted]]

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

Re: [R] Creating Tag

2017-11-01 Thread Ulrik Stervbo
Hi Hermant,

It sounds lile grep from base or str_detect from the Stringr package is
what you want.

Best,
Ulrik

Hemant Sain  schrieb am Mi., 1. Nov. 2017, 08:31:

> i want to tag categories to its menuname.
> i have a csv containing menu item name and in other csv i have a column
> containing some strings,
> i want to pick that strings from categories and look into  menu items if
> any menu item containing that string i want to create a new column next to
> menu item name flagged as 1 otherwise 0
> and the only condition is once a menu item flagged as 1 i don't need to
> consider that menu item again to tag further in case of redundant strings
> in categories only i want to search which are flagged as 0.
> please help me with the R script.
>
> *Menu Name*
> 9\ bobbie"
> 9\ chz steak"
> 9\ tuna"
> provolone
> 20\ bobbie"
> bottled soda 20oz
> cran-slam ww
> american
> small chips
> medium drink
> 9\ meatball"
> capriotti's water
> 20'' chicken cheese steak
> 9\ veg turkey"
> medium chips
> 9\ capastrami"
> 12\ bobbie"
> 12'' chicken cheese steak
> cookie
> 12\ chz steak"
> 9\ cole turkey"
> kid grilled cheese white
> 12\ italian"
> 12\ meatball"
> 12\ capastrami"
> turkey sand w
> 20\ slaw be jo"
> swiss
> 12\ cole turkey"
> large drink
> 9\ ham&chz"
> 9'' chicken cheese steak
> 9\ slaw be jo"
> turkey sand ww
> stuffing
> 12\ turkey"
> 9\ italian"
> 12\ slaw be jo"
> 9\ grld italian"
> 12\ veg burger w/chz"
> extra american
> black&bleu salad
> 9\ turkey"
> 20\ turkey"
> 20\ capastrami"
> ham sand w
> 12\ mushroom"
> 12\ grld italia"
> italian salad
> tuna sand ww
> 9\ roast beef"
> 20\ chz steak"
> 20\ mushroom"
> 9\ veg chzstk"
> ham
> genoa
> 12\ veg turkey"
> 12\ veggie cole turkey"
> 9\ mushroom"
> cap's creation
> mushrooms
> salad chicken
> 20\ cole turkey"
> 1 pack chicken
> kr  veg burger w/chz
> 12\ roast beef"
> kid turkey n cheese white
> 20\ italian"
> 12\ ham&chz"
> 9\ employee sub"
> roast beef kr
> 9\ veggie cole turkey"
> 12\ sausage"
> tea
> turkey sand kr
> salad turkey
> tuna sand kr
> brownie
> slice american cheese
> 1 oz pastrami
> 9\ cheese"
> 12\ italian up"
> 12\ capastrami up"
> 1 pack steak
> delaware's finest small
> the sampler sm
> side ranch dressing
> 12\ veg turkey up"
> 20\ roast beef"
> roast beef w
> 1oz turkey
> 12\ tuna"
> 20\ veg turkey"
> 12\ veg chzstk"
> 9\ sausage"
> kid ham n cheese white
> side italian dressing
> salad provolone
> 20\ grld italia"
> sample item 6
> sample item 9
> turkey
> 12\ slaw be jo up"
> 12\ meatball up"
> 1 oz roast beef
> ham sand ww
> delaware's finest large
> side cole slaw large
> large chips
> 20\ meatball"
> 12'' chick cheese stk up
> 12\ chz steak up"
> 12\ grld italia up"
> cran-slam w
> 12\ bobbie up"
> 20\ cheese"
> slice provolone
> the sampler lg
> meatball bar
> slice ham
> wise large chips
> small side
> sm soup
> 12\ tuna up"
> 12\ cole turkey up"
> prosciutini
> 20\ veggie cole turkey"
> soup
> roast beef
> 20\ italian up"
> 20'' chick cheese stk up
> 20\ chz steak up"
> 20\ bobbie up"
> 20\ veg turkey up"
> slice swiss
> 20\ capastrami up"
> sample item 7
> 12\ ham&chz up"
> salad swiss
> 12\ veggie cheese stk up"
> california omelet
> orange juice
> exteme bac boy
> dinner salad
> chef salad
> 12\ turkey up"
> the big cheese
> combo it
> fries cmb
> sm pepsi
> km cheese burger
> #NAME?
> #NAME?
> kid grilled cheese wheat
> kids ham cheese white box
> calif. blt
> bacon turkey melt
> coffee
> 1-pc pancake
> fries
> tuna sand
> biscuits & gravy
> s-1/3 patty
> x avocado
> x chez
> s-bacon
> #NAME?
> xtra egg
> lg bev upcharge
> sm ice tea
> small soup
> roast beef ww
> salad tuna
> med pepsi
> 20\ veg chzstk up"
> day nm egg san
> s-chkn brest
> bell pepper
> fruit
> 1 slice veggie turkey
> s-toast
> x sausage
> 1 pack sausage
> chicken salad
> lg pepsi
> x dressing
> large side
> 9\ firecracker turkey"
> 20\ sausage up"
> 20\ turkey up"
> 20\ veg chzstk"
> lg ice tea
> 12\ roast beef up"
> sample item 8
> catering cap creation sal
> the turkey lover sm
> little italy sm
> cookie tray
> sd chk avo san
> sm fry / 2 pc zucch
> kid turkey n cheese wheat
> junior chz burger
> extra italian meat
> chili chz fries
> sm fry / 2 pc o ring
> extra turkey
>
>
>
>
>
>
>
>
> *CATEGORIES*
> non-veg
> chix
> salmon
> ch
> chkn
> brisket
> brskt
> bacon
> bcn
> chse
> mahi
> dog
> shk
> clam
> parmesan
> asiago
> prosciutto
> prosciutti
> salami
> Angus
> hicken
> chk
> chick
> wings
> prk
> pork
> ham
> bacon
> ribs
> fish
> shrimp
> tuna
> beef
> steak
> stk
> meatball
> __
> 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.

[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, se

Re: [R] Function to save results

2017-11-01 Thread David L Carlson
Let's try a simple example. 

> # Create a script file of commands
> # Note we must print the results of quantile explicitly
> cat("x <- rnorm(50)\nprint(quantile(x))\nstem(x)\n", file="Test.R")
> 
> # Test it by running it to the console
> source("Test.R")
0%25%50%75%   100% 
-2.4736219 -0.7915433 -0.1178056  0.7023577  2.9158617 

  The decimal point is at the |

  -2 | 510
  -1 | 7631110
  -0 | 998877733211
   0 | 011244889
   1 | 00045
   2 | 19

> 
> # Now run it and save the file
> sink("Testout.txt")
> source("Test.R")
> sink()
> 
> # What is located in "Testout.txt"?
> cat(readLines("Testout.txt"), sep="\n")
 0% 25% 50% 75%100% 
-2.47511893 -0.47919111  0.05761628  0.67403447  1.79825459 

  The decimal point is at the |

  -2 | 5
  -2 | 4
  -1 | 
  -1 | 432000
  -0 | 87755
  -0 | 442110
   0 | 001244
   0 | 556789
   1 | 113
   1 | 5788

> # Success

Depending on your operating system, you may also be able to save the output 
with File | Save to File.

---
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77843-4352

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Priya Arasu via 
R-help
Sent: Wednesday, November 1, 2017 9:57 AM
To: Eric Berger 
Cc: r-help@r-project.org
Subject: Re: [R] Function to save results

Hi Eric,Thanks for the explanation. Is there a way to save the results 
automatically after the analysis gets over?. As I recently lost the results, 
because I didn't save the results. I don't want to run the sink or save command 
after the analysis is over rather run the command for saving the file before 
starting to run the analysis, so the file gets saved automatically after the 
script has finished running Priya
 


On Wednesday, 1 November 2017 7:53 PM, Eric Berger  
wrote:
 

 Hi Priya,
You did not follow the logic of the pseudo-code. The sink("filename"), sink() 
pair captures whatever output is generated between the first sink statement and 
the second sink statement.You need (possibly) to do:
sink("C://Users//Priya// Desktop//Attractor analysis_all 
genes//synaptogenesis//attr. txt") net <- loadNetwork("C://Users//Priya/ 
/Desktop//Attractor analysis_all genes//synaptogenesis// regulationof_dopamine_ 
signaling_submodule3.txt")attr <- getAttractors(net, type="asynchronous")
sink()
HTH,Eric


 
On Wed, Nov 1, 2017 at 4:10 PM, Priya Arasu  wrote:

Hi Eric,I tried as you suggested but I could not find the output in the text 
file I created (attr.txt)

net <- loadNetwork("C://Users//Priya/ /Desktop//Attractor analysis_all 
genes//synaptogenesis// regulationof_dopamine_ 
signaling_submodule3.txt")sink("C://Users//Priya// Desktop//Attractor 
analysis_all genes//synaptogenesis//attr. txt")


sink()

attr <- getAttractors(net, type="asynchronous")
 Priya
 

On Wednesday, 1 November 2017 6:54 PM, Eric Berger  
wrote:
 

 Some comments:1. sink() does not return a value. There is on point to set attr 
<- sink(...). Just give the command sink("C://etc")2. to complete the 
saving to the file you must give a second sink command with no argument:  
sink()So your code would be (pseudo-code, not actual code) sink( "filename" )do 
something that prints output which will be captured by sinksink() HTH,Eric


On Wed, Nov 1, 2017 at 1:32 PM, Priya Arasu via R-help  
wrote:

Hi,I want the results to be saved automatically in a output text file after the 
script has finished running.

I used the sink function in the following example, but the results file 
(output.txt) was empty.

net <- loadNetwork("C://Users//Priya/ /Desktop//Attractor analysis_all 
genes//synaptogenesis// regulationof_dopamine_ signaling_submodule3.txt")# 
First I loaded theinput file for which I want to identify attractors attr <- 
sink("C://Users//Priya// Desktop//Attractor analysis_all 
genes//synaptogenesis//output. txt")# used the sink function to save the 
results from attr function

attr <- getAttractors(net, type="asynchronous")# then ran the script for 
identifying attractors Is there any function to save the results before setting 
the script to run, so that results are automatically saved in a text file after 
the script has finished running?

Thank youPriya



        [[alternative HTML version deleted]]

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




   



   
[[alternative HTML version deleted]]

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
a

Re: [R] R-3.4.2: make check stops at line 698 of tests/reg-tests-1d.R

2017-11-01 Thread Albrecht Kauffmann
Dear Duncan,

Many thanks!

Am Mi, 1. Nov 2017, um 16:17, schrieb Duncan Murdoch:
> On 01/11/2017 8:11 AM, Albrecht Kauffmann wrote:
> > Hi all,
> > 
> > after compiling R-3.4.2 on opensuse leap 42.3, make check failed. Until
> > R-3.4.1 I never had a problem with these tests. No, the programm stops
> > at the following line of tests/reg-tests-1d.R:
> > 
> >> ## available.packages() (not) caching in case of errors
> >> tools::assertWarning(ap1 <- available.packages(repos = "http://foo.bar";))
> >> tools::assertWarning(ap2 <- available.packages(repos = "http://foo.bar";))
> >  error in assertCondition(expr, "warning",
> > .exprString = d.expr) :  Got simpleError evaluating of ap2 <-
> > available.packages(repo  ...: wanted warning
> > 
> > The error message is a result of:  ap2 <- available.packages(repos =
> > "http://foo.bar";),
> > not of the following condition in the test script:   stopifnot(nrow(ap1)
> > == 0, identical(ap1, ap2))  .
> 
> What error message did you see?

after: R --vanilla <../R-3.4.2/tests/reg-tests-1d.R

I get 

...
> ## available.packages() (not) caching in case of errors
> tools::assertWarning(ap1 <- available.packages(repos = "http://foo.bar";))
> tools::assertWarning(ap2 <- available.packages(repos = "http://foo.bar";))
   Error in assertCondition(expr, "warning", .exprString = d.expr) : 
 Got simpleError during evaluating of ap2 <- available.packages(repo
  ...: wanted warning
 Calls:  -> assertCondition
 Evaluation stopped


> 
> > 
> > ap1 <- available.packages(repos = "http://foo.bar";) works well, but the
> > following line stops the program.
> > 
> > After replacing "http://foo.bar"; by "http://foo.poi"; (every phrase
> > different from "bar" works well), reg-test-1d.R passed without error
> > message the interpreter.
> > 
> > Has someone an idea why the original program code stops (only) at line
> > 698:
> > tools::assertWarning(ap2 <- available.packages(repos =
> > "http://foo.bar";))?
> > 
> 
> 
> Perhaps your system is resolving foo.bar to a web address.  If I use a 
> URL for a web page that doesn't have a repository, I still get a 
> warning, but the text of the error may explain why you don't.

There was a message, maybe a warning, but I don't understand it. Now I
installed R-3.4.2 also on another PC; there it works fine. Do you have
an idea, what went wrong here?

Albrecht Kauffmann

> 
> Duncan Murdoch

__
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] R-3.4.2: make check stops at line 698 of tests/reg-tests-1d.R

2017-11-01 Thread Duncan Murdoch

On 01/11/2017 12:02 PM, Albrecht Kauffmann wrote:

Dear Duncan,

Many thanks!

Am Mi, 1. Nov 2017, um 16:17, schrieb Duncan Murdoch:

On 01/11/2017 8:11 AM, Albrecht Kauffmann wrote:

Hi all,

after compiling R-3.4.2 on opensuse leap 42.3, make check failed. Until
R-3.4.1 I never had a problem with these tests. No, the programm stops
at the following line of tests/reg-tests-1d.R:


## available.packages() (not) caching in case of errors
tools::assertWarning(ap1 <- available.packages(repos = "http://foo.bar";))
tools::assertWarning(ap2 <- available.packages(repos = "http://foo.bar";))

  error in assertCondition(expr, "warning",
 .exprString = d.expr) :  Got simpleError evaluating of ap2 <-
 available.packages(repo  ...: wanted warning

The error message is a result of:  ap2 <- available.packages(repos =
"http://foo.bar";),
not of the following condition in the test script:   stopifnot(nrow(ap1)
== 0, identical(ap1, ap2))  .


What error message did you see?


after: R --vanilla <../R-3.4.2/tests/reg-tests-1d.R


Sorry, I wasn't clear.  I meant to ask what error message you get if you 
run the command that's supposed to generate a warning, i.e. run the code


ap1 <- available.packages(repos = "http://foo.bar";)
ap2 <- available.packages(repos = "http://foo.bar";)

and you'll likely see a warning on the first line, and an error on the 
second.  The text of that error may be informative.


Duncan Murdoch



I get

...

## available.packages() (not) caching in case of errors
tools::assertWarning(ap1 <- available.packages(repos = "http://foo.bar";))
tools::assertWarning(ap2 <- available.packages(repos = "http://foo.bar";))

Error in assertCondition(expr, "warning", .exprString = d.expr) :
  Got simpleError during evaluating of ap2 <- available.packages(repo
   ...: wanted warning
  Calls:  -> assertCondition
  Evaluation stopped






ap1 <- available.packages(repos = "http://foo.bar";) works well, but the
following line stops the program.

After replacing "http://foo.bar"; by "http://foo.poi"; (every phrase
different from "bar" works well), reg-test-1d.R passed without error
message the interpreter.

Has someone an idea why the original program code stops (only) at line
698:
tools::assertWarning(ap2 <- available.packages(repos =
"http://foo.bar";))?




Perhaps your system is resolving foo.bar to a web address.  If I use a
URL for a web page that doesn't have a repository, I still get a
warning, but the text of the error may explain why you don't.


There was a message, maybe a warning, but I don't understand it. Now I
installed R-3.4.2 also on another PC; there it works fine. Do you have
an idea, what went wrong here?

Albrecht Kauffmann



Duncan Murdoch


__
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] beta binomial distribution installation

2017-11-01 Thread Amany Abdel-Karim
Hello,

Thank you for your response. I need to install RankTail package since it 
contains the beta binomial distribution, CDF and inverse CDF in the usual form 
which I need to use. However rmutil package contain unusual forms for these 
functions. So it is easier for me to deal with the forms are contained in 
RankTail.

I tried to install  bioconductor package, using the following commands but I 
still got the following errors:


 (1) I tried biocLite() and then library ("TailRank"), I got the following 
errors.

> biocLite()
Error in biocLite() : could not find function "biocLite"
> library("TailRank")
Loading required package: oompaBase
Error: package or namespace load failed for �TailRank� in loadNamespace(i, 
c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
 there is no package called �Biobase�
In addition: Warning messages:
1: package �TailRank� was built under R version 3.4.2
2: package �oompaBase� was built under R version 3.4.2



(2) I tried to write the command biocLite(), then biocLite("TailRank"), I got 
the following errors:

> biocLite()
Error in biocLite() : could not find function "biocLite"
> biocLite("ilRank")
Error in biocLite("ilRank") : could not find function "biocLite"
> biocLite()
Error in biocLite() : could not find function "biocLite"
> biocLite("TailRank")
Error in biocLite("TailRank") : could not find function "biocLite"




>




Also, I checked under packages on the right side of the R window and I found 
TailRank , Description is Tail-Rank statistic, and version is 3.1.3. So, I 
tried to write the following code in the console window to check if the package 
works:

> N<-20
> u<-3
> v<-10
> p<-u/u+v
> x<-0:N

> yy<-dbb(x,N,u,v)


I got the following error:
Error in dbb(x, N, u, v) : could not find function "dbb"




>



I am confused because if the package TailRank is already there, why the 
pervious code does not work to calculate dbb (x,N,u,v) and I got error? If I do 
not have the package, would you please let me know the right commands I should 
write in the script window to install TaiRank because the commands I used 
(which I mentioned at the beginning of the email did not work and gave errors). 
I appreciate your help since I am a new user of R.


Amany





From: Eric Berger 
Sent: Wednesday, November 1, 2017 2:42 AM
To: MCGUIRE, Rhydwyn
Cc: Amany Abdel-Karim; r-h...@stat.math.ethz.ch
Subject: Re: [R] beta binomial distribution installation

Hi,
I did a quick search for other packages that provide the beta binomial 
distribution and found "rmutil".

> install.packages("rmutil")

The package has the CDF (pbetabinom) and inverse CDF (qbetabinom) among other 
functions.

HTH,
Eric



On Wed, Nov 1, 2017 at 7:50 AM, MCGUIRE, Rhydwyn 
mailto:rm...@doh.health.nsw.gov.au>> wrote:
Hi there,

It looks like you also need the bioconductor package biobase, I found 
instructions for downloading that package here: 
www.bioconductor.org/install

Good luck.

Cheers,
Rhydwyn

-Original Message-
From: R-help 
[mailto:r-help-boun...@r-project.org] On 
Behalf Of Amany Abdel-Karim
Sent: Wednesday, 1 November 2017 2:13 PM
To: r-h...@stat.math.ethz.ch
Subject: [R] beta binomial distribution installation

Hello,

I  tried to install package TailRank using the command install.packages 
(RankTail) and library (TailRank) but I got the following errors. So, how can I 
install TaiRank in Rstudio to have se beta-binomial distribution, CDF and 
inverse CDG of  beta-binomal?

The commands I used are:

> install.packages("TailRank")

Installing package into C:/Users/stator-guest/Documents/R/win-library/3.4

(as lib is unspecified)

Warning in install.packages :

  dependency Biobase is not available

trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/TailRank_3.1.3.zip'

Content type 'application/zip' length 331270 bytes (323 KB)

downloaded 323 KB



package TailRank successfully unpacked and MD5 sums checked



The downloaded binary packages are in


C:\Users\stator-guest\AppData\Local\Temp\RtmpoVx40V\downloaded_packages

> library(TailRank)

Error: package or namespace load failed for TailRank in loadNamespace(i, 
c(lib.loc, .libPaths()), versionCheck = vI[[i]]):

 there is no package called Biobase

In addition: Warning message:

package TailRank was built under R version 3.4.2




[[alternative HTML version deleted]]

__
This email has been scanned for the NSW Ministry of Health by the Websense 
Hosted Email Security System.
Emails and attachments are monitored to ensure compliance with the NSW Ministry 
of health's Electronic Messaging Policy.
__
__

[R] Correct subsetting in R

2017-11-01 Thread Elahe chalabi via R-help
Hi all,
I have two data frames that one of them does not have the column ID:

> str(data)
'data.frame':   499 obs. of  608 variables:
$ ID   : int  1 2 3 4 5 6 7 8 9 10 ...
$ alright  : int  1 0 0 0 0 0 0 1 2 1 ...
$ bad  : int  1 0 0 0 0 0 0 0 0 0 ...
$ boy  : int  1 2 1 1 0 2 2 4 2 1 ...
$ cooki: int  1 2 2 1 0 1 1 4 2 3 ...
$ curtain  : int  1 0 0 0 0 2 0 2 0 0 ...
$ dish : int  2 1 0 1 0 0 1 2 2 2 ...
$ doesnt   : int  1 0 0 0 0 0 0 0 1 0 ...
$ dont : int  2 1 4 2 0 0 2 1 2 0 ...
$ fall : int  3 1 0 0 1 0 1 2 3 2 ...
$ fell : int  1 0 0 0 0 0 0 0 0 0 ...

and the other one is:

> str(training)
'data.frame':   375 obs. of  607 variables:
$ alright  : num  1 0 0 0 1 2 1 0 0 0 ...
$ bad  : num  1 0 0 0 0 0 0 0 0 0 ...
$ boy  : num  1 1 2 2 4 2 1 0 1 0 ...
$ cooki: num  1 1 1 1 4 2 3 1 2 2 ...
$ curtain  : num  1 0 2 0 2 0 0 0 0 0 ...
$ dish : num  2 1 0 1 2 2 2 1 4 1 ...
$ doesnt   : num  1 0 0 0 0 1 0 0 0 0 ...
$ dont : num  2 2 0 2 1 2 0 0 1 0 ...
$ fall : num  3 0 0 1 2 3 2 0 2 0 ...
$ fell : num  1 0 0 0 0 0 0 0 0 0 ...
Does anyone know how should I get the IDs of training from data?
thanks for any help!
Elahe

__
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] R-3.4.2: make check stops at line 698 of tests/reg-tests-1d.R

2017-11-01 Thread Albrecht Kauffmann
Am Mi, 1. Nov 2017, um 17:40, schrieb Duncan Murdoch:
> On 01/11/2017 12:02 PM, Albrecht Kauffmann wrote:
> > Dear Duncan,
> > 
> > Many thanks!
> > 
> > Am Mi, 1. Nov 2017, um 16:17, schrieb Duncan Murdoch:
> >> On 01/11/2017 8:11 AM, Albrecht Kauffmann wrote:
> >>> Hi all,
> >>>
> >>> after compiling R-3.4.2 on opensuse leap 42.3, make check failed. Until
> >>> R-3.4.1 I never had a problem with these tests. No, the programm stops
> >>> at the following line of tests/reg-tests-1d.R:
> >>>
>  ## available.packages() (not) caching in case of errors
>  tools::assertWarning(ap1 <- available.packages(repos = "http://foo.bar";))
>  tools::assertWarning(ap2 <- available.packages(repos = "http://foo.bar";))
> >>>   error in assertCondition(expr, "warning",
> >>>  .exprString = d.expr) :  Got simpleError evaluating of ap2 <-
> >>>  available.packages(repo  ...: wanted warning
> >>>
> >>> The error message is a result of:  ap2 <- available.packages(repos =
> >>> "http://foo.bar";),
> >>> not of the following condition in the test script:   stopifnot(nrow(ap1)
> >>> == 0, identical(ap1, ap2))  .
> >>
> >> What error message did you see?
> > 
> > after: R --vanilla <../R-3.4.2/tests/reg-tests-1d.R
> 
> Sorry, I wasn't clear.  I meant to ask what error message you get if you 
> run the command that's supposed to generate a warning, i.e. run the code
> 
Oops! Here are the resulting error messages, which are not the same:
> ap1 <- available.packages(repos = "http://foo.bar";)
Warning: Cannot access to the index of the repository
http://foo.bar/src/contrib:
  line beginning with ' ap2 <- available.packages(repos = "http://foo.bar";)
Error in readRDS(dest) : unknown input format

On my other PC, the same lines give 2 times the same error message:
"Warning: Cannot access to the index of the repository
http://foo.bar/src/contrib: Cannot open URL
'http://foo.bar/src/contrib/PACKAGES' "

Indeed, the second error message on the present PC is different. What
may be the cause?

Many thanks 
Albrecht

> 
> and you'll likely see a warning on the first line, and an error on the 
> second.  The text of that error may be informative.
> 
> Duncan Murdoch
> 
> > 
> > I get
> > 
> > ...
> >> ## available.packages() (not) caching in case of errors
> >> tools::assertWarning(ap1 <- available.packages(repos = "http://foo.bar";))
> >> tools::assertWarning(ap2 <- available.packages(repos = "http://foo.bar";))
> > Error in assertCondition(expr, "warning", .exprString = d.expr) :
> >   Got simpleError during evaluating of ap2 <- available.packages(repo
> >...: wanted warning
> >   Calls:  -> assertCondition
> >   Evaluation stopped
> > 
> > 
> >>
> >>>
> >>> ap1 <- available.packages(repos = "http://foo.bar";) works well, but the
> >>> following line stops the program.
> >>>
> >>> After replacing "http://foo.bar"; by "http://foo.poi"; (every phrase
> >>> different from "bar" works well), reg-test-1d.R passed without error
> >>> message the interpreter.
> >>>
> >>> Has someone an idea why the original program code stops (only) at line
> >>> 698:
> >>> tools::assertWarning(ap2 <- available.packages(repos =
> >>> "http://foo.bar";))?
> >>>
> >>
> >>
> >> Perhaps your system is resolving foo.bar to a web address.  If I use a
> >> URL for a web page that doesn't have a repository, I still get a
> >> warning, but the text of the error may explain why you don't.
> > 
> > There was a message, maybe a warning, but I don't understand it. Now I
> > installed R-3.4.2 also on another PC; there it works fine. Do you have
> > an idea, what went wrong here?
> > 
> > Albrecht Kauffmann
> > 
> >>
> >> Duncan Murdoch
>

__
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] beta binomial distribution installation

2017-11-01 Thread Eric Berger
Hi Amany,
I had no trouble installing TailRank and bioconductor using the link Rhydwyn
 provided.
I was curious about your statement that TailRank uses a different
parameterization for the betabinomial distribution than rmutil.
I looked at the documentation for the two packages and the transformation
to go from one to the other is straightforward.
If you want, you can do the following.
Let (N,u,v) be the parameters used in TailRank and (N,m,s) the parameters
used in rmutil. The correspondence is:

N = N, m  = u/(u+v), s = u+v.

This means you can define functions such as:

mypbb <- function(x,N,u,v) { rmutil::pbetabinom(x,N,u/(u+v),u+v) }   # CDF
myqbb <- function(x,N,u,v) { rmutil:qbetabinom{x,N,u/(u+v),u+v) }  #
inverse CDF

HTH,
Eric





On Wed, Nov 1, 2017 at 6:09 PM, Amany Abdel-Karim 
wrote:

> Hello,
>
> Thank you for your response. I need to install RankTail package since it
> contains the beta binomial distribution, CDF and inverse CDF in the usual
> form which I need to use. However rmutil package contain unusual forms for
> these functions. So it is easier for me to deal with the forms are
> contained in RankTail.
>
> I tried to install  bioconductor package, using the following commands
> but I still got the following errors:
>
>
>  (1) I tried biocLite() and then library ("TailRank"), I got the following
> errors.
>
> > biocLite()Error in biocLite() : could not find function "biocLite"> 
> > library("TailRank")Loading required package: oompaBaseError: package or 
> > namespace load failed for ‘TailRank’ in loadNamespace(i, c(lib.loc, 
> > .libPaths()), versionCheck = vI[[i]]):
>  there is no package called ‘Biobase’In addition: Warning messages:1: package 
> ‘TailRank’ was built under R version 3.4.2 2: package ‘oompaBase’ was built 
> under R version 3.4.2
>
>
> (2) I tried to write the command biocLite(), then biocLite("TailRank"), I got 
> the following errors:
>
> > biocLite()Error in biocLite() : could not find function "biocLite"> 
> > biocLite("ilRank")Error in biocLite("ilRank") : could not find function 
> > "biocLite"> biocLite()Error in biocLite() : could not find function 
> > "biocLite"> biocLite("TailRank")Error in biocLite("TailRank") : could not 
> > find function "biocLite"
>
> >
>
>
> Also, I checked under packages on the right side of the R window and I
> found TailRank , Description is Tail-Rank statistic, and version is 3.1.3.
> So, I tried to write the following code in the console window to check if
> the package works:
>
> > N<-20> u<-3> v<-10> p<-u/u+v> x<-0:N
>
> > yy<-dbb(x,N,u,v)
>
>
> I got the following error:Error in dbb(x, N, u, v) : could not find function 
> "dbb"
>
> >
>
> I am confused because if the package TailRank is already there, why the
> pervious code does not work to calculate dbb (x,N,u,v) and I got error? If
> I do not have the package, would you please let me know the right commands
> I should write in the script window to install TaiRank because the commands
> I used (which I mentioned at the beginning of the email did not work and
> gave errors). I appreciate your help since I am a new user of R.
>
>
> Amany
>
>
>
> --
>
> *From:* Eric Berger 
> *Sent:* Wednesday, November 1, 2017 2:42 AM
> *To:* MCGUIRE, Rhydwyn
> *Cc:* Amany Abdel-Karim; r-h...@stat.math.ethz.ch
> *Subject:* Re: [R] beta binomial distribution installation
>
> Hi,
> I did a quick search for other packages that provide the beta binomial
> distribution and found "rmutil".
>
> > install.packages("rmutil")
>
> The package has the CDF (pbetabinom) and inverse CDF (qbetabinom) among
> other functions.
>
> HTH,
> Eric
>
>
>
> On Wed, Nov 1, 2017 at 7:50 AM, MCGUIRE, Rhydwyn <
> rm...@doh.health.nsw.gov.au> wrote:
>
>> Hi there,
>>
>> It looks like you also need the bioconductor package biobase, I found
>> instructions for downloading that package here:
>> www.bioconductor.org/install
>>
>> Good luck.
>>
>> Cheers,
>> Rhydwyn
>>
>> -Original Message-
>> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Amany
>> Abdel-Karim
>> Sent: Wednesday, 1 November 2017 2:13 PM
>> To: r-h...@stat.math.ethz.ch
>> Subject: [R] beta binomial distribution installation
>>
>> Hello,
>>
>> I  tried to install package TailRank using the command install.packages
>> (RankTail) and library (TailRank) but I got the following errors. So, how
>> can I install TaiRank in Rstudio to have se beta-binomial distribution, CDF
>> and inverse CDG of  beta-binomal?
>>
>> The commands I used are:
>>
>> > install.packages("TailRank")
>>
>> Installing package into C:/Users/stator-guest/Documents/R/win-library/3.4
>>
>> (as lib is unspecified)
>>
>> Warning in install.packages :
>>
>>   dependency Biobase is not available
>>
>> trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/TailRank_3
>> .1.3.zip'
>>
>> Content type 'application/zip' length 331270 bytes (323 KB)
>>
>> downloaded 323 KB
>>
>>
>>
>> package TailRank successfully unpacked and MD5 sums checked
>>

Re: [R] Correct subsetting in R

2017-11-01 Thread Eric Berger
matches <- merge(training,data,by=intersect(names(training),names(data)))

HTH,
Eric


On Wed, Nov 1, 2017 at 6:13 PM, Elahe chalabi via R-help <
r-help@r-project.org> wrote:

> Hi all,
> I have two data frames that one of them does not have the column ID:
>
> > str(data)
> 'data.frame':   499 obs. of  608 variables:
> $ ID   : int  1 2 3 4 5 6 7 8 9 10 ...
> $ alright  : int  1 0 0 0 0 0 0 1 2 1 ...
> $ bad  : int  1 0 0 0 0 0 0 0 0 0 ...
> $ boy  : int  1 2 1 1 0 2 2 4 2 1 ...
> $ cooki: int  1 2 2 1 0 1 1 4 2 3 ...
> $ curtain  : int  1 0 0 0 0 2 0 2 0 0 ...
> $ dish : int  2 1 0 1 0 0 1 2 2 2 ...
> $ doesnt   : int  1 0 0 0 0 0 0 0 1 0 ...
> $ dont : int  2 1 4 2 0 0 2 1 2 0 ...
> $ fall : int  3 1 0 0 1 0 1 2 3 2 ...
> $ fell : int  1 0 0 0 0 0 0 0 0 0 ...
>
> and the other one is:
>
> > str(training)
> 'data.frame':   375 obs. of  607 variables:
> $ alright  : num  1 0 0 0 1 2 1 0 0 0 ...
> $ bad  : num  1 0 0 0 0 0 0 0 0 0 ...
> $ boy  : num  1 1 2 2 4 2 1 0 1 0 ...
> $ cooki: num  1 1 1 1 4 2 3 1 2 2 ...
> $ curtain  : num  1 0 2 0 2 0 0 0 0 0 ...
> $ dish : num  2 1 0 1 2 2 2 1 4 1 ...
> $ doesnt   : num  1 0 0 0 0 1 0 0 0 0 ...
> $ dont : num  2 2 0 2 1 2 0 0 1 0 ...
> $ fall : num  3 0 0 1 2 3 2 0 2 0 ...
> $ fell : num  1 0 0 0 0 0 0 0 0 0 ...
> Does anyone know how should I get the IDs of training from data?
> thanks for any help!
> Elahe
>
> __
> 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.
>

[[alternative HTML version deleted]]

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


Re: [R] Function to save results

2017-11-01 Thread Eric Berger
Hi Priya,
I think your original question may have been phrased in a way that caused
David and me some confusion.
I think sink() may not be the function that is appropriate in your case.
Sink() is used to capture output to the console (so to speak).
You are trying to save the results of calculations returned, in this case
in the variable 'attr'.
You need to do something like:

attr <- getAttractors( ... )
saveRDS( attr, "filename.RDS")

and then later you can read the results back in another R session:

savedAttr <- readRDS("filename.RDS")

Look at the documentation ?saveRDS and ?readRDS

HTH,
Eric

On Wed, Nov 1, 2017 at 6:02 PM, David L Carlson  wrote:

> Let's try a simple example.
>
> > # Create a script file of commands
> > # Note we must print the results of quantile explicitly
> > cat("x <- rnorm(50)\nprint(quantile(x))\nstem(x)\n", file="Test.R")
> >
> > # Test it by running it to the console
> > source("Test.R")
> 0%25%50%75%   100%
> -2.4736219 -0.7915433 -0.1178056  0.7023577  2.9158617
>
>   The decimal point is at the |
>
>   -2 | 510
>   -1 | 7631110
>   -0 | 998877733211
>0 | 011244889
>1 | 00045
>2 | 19
>
> >
> > # Now run it and save the file
> > sink("Testout.txt")
> > source("Test.R")
> > sink()
> >
> > # What is located in "Testout.txt"?
> > cat(readLines("Testout.txt"), sep="\n")
>  0% 25% 50% 75%100%
> -2.47511893 -0.47919111  0.05761628  0.67403447  1.79825459
>
>   The decimal point is at the |
>
>   -2 | 5
>   -2 | 4
>   -1 |
>   -1 | 432000
>   -0 | 87755
>   -0 | 442110
>0 | 001244
>0 | 556789
>1 | 113
>1 | 5788
>
> > # Success
>
> Depending on your operating system, you may also be able to save the
> output with File | Save to File.
>
> ---
> David L Carlson
> Department of Anthropology
> Texas A&M University
> College Station, TX 77843-4352
>
> -Original Message-
> From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Priya
> Arasu via R-help
> Sent: Wednesday, November 1, 2017 9:57 AM
> To: Eric Berger 
> Cc: r-help@r-project.org
> Subject: Re: [R] Function to save results
>
> Hi Eric,Thanks for the explanation. Is there a way to save the results
> automatically after the analysis gets over?. As I recently lost the
> results, because I didn't save the results. I don't want to run the sink or
> save command after the analysis is over rather run the command for saving
> the file before starting to run the analysis, so the file gets saved
> automatically after the script has finished running Priya
>
>
>
> On Wednesday, 1 November 2017 7:53 PM, Eric Berger <
> ericjber...@gmail.com> wrote:
>
>
>  Hi Priya,
> You did not follow the logic of the pseudo-code. The sink("filename"),
> sink() pair captures whatever output is generated between the first sink
> statement and the second sink statement.You need (possibly) to do:
> sink("C://Users//Priya// Desktop//Attractor analysis_all
> genes//synaptogenesis//attr. txt") net <- loadNetwork("C://Users//Priya/
> /Desktop//Attractor analysis_all genes//synaptogenesis//
> regulationof_dopamine_ signaling_submodule3.txt")attr <- getAttractors(net,
> type="asynchronous")
> sink()
> HTH,Eric
>
>
>
> On Wed, Nov 1, 2017 at 4:10 PM, Priya Arasu 
> wrote:
>
> Hi Eric,I tried as you suggested but I could not find the output in the
> text file I created (attr.txt)
>
> net <- loadNetwork("C://Users//Priya/ /Desktop//Attractor analysis_all
> genes//synaptogenesis// regulationof_dopamine_ 
> signaling_submodule3.txt")sink("C://Users//Priya//
> Desktop//Attractor analysis_all genes//synaptogenesis//attr. txt")
>
>
> sink()
>
> attr <- getAttractors(net, type="asynchronous")
>  Priya
>
>
> On Wednesday, 1 November 2017 6:54 PM, Eric Berger <
> ericjber...@gmail.com> wrote:
>
>
>  Some comments:1. sink() does not return a value. There is on point to set
> attr <- sink(...). Just give the command sink("C://etc")2. to complete
> the saving to the file you must give a second sink command with no
> argument:  sink()So your code would be (pseudo-code, not actual code) sink(
> "filename" )do something that prints output which will be captured by
> sinksink() HTH,Eric
>
>
> On Wed, Nov 1, 2017 at 1:32 PM, Priya Arasu via R-help <
> r-help@r-project.org> wrote:
>
> Hi,I want the results to be saved automatically in a output text file
> after the script has finished running.
>
> I used the sink function in the following example, but the results file
> (output.txt) was empty.
>
> net <- loadNetwork("C://Users//Priya/ /Desktop//Attractor analysis_all
> genes//synaptogenesis// regulationof_dopamine_ signaling_submodule3.txt")#
> First I loaded theinput file for which I want to identify attractors attr
> <- sink("C://Users//Priya// Desktop//Attractor analysis_all
> genes//synaptogenesis//output. txt")# used the sink function to save the
> results from attr function
>
> attr <- ge

Re: [R] Function to save results

2017-11-01 Thread David L Carlson
No. You have not used it correctly. It was an example. Put your commands 
between the two sink functions. That will save any printed out put that results 
from those commands. It will not save attr, but you did not ask how to do that.

David C

On Nov 1, 2017 12:21 PM, Priya Arasu  wrote:
Hi David,
Thank you for the example.
When I try to use the cat function, I get an error


cat(attr<-getAttractors(net, type="asynchronous"))

Error in cat(attr <- getAttractors(net, type = "asynchronous")) :
  argument 1 (type 'pairlist') cannot be handled by 'cat'

Please let me know, if I have used the function in right way?.
Thank you
Priya











On Wednesday, 1 November 2017 9:32 PM, David L Carlson  
wrote:


Let's try a simple example.

> # Create a script file of commands
> # Note we must print the results of quantile explicitly
> cat("x <- rnorm(50)\nprint(quantile(x))\nstem(x)\n", file="Test.R")
>
> # Test it by running it to the console
> source("Test.R")
0%25%50%75%  100%
-2.4736219 -0.7915433 -0.1178056  0.7023577  2.9158617

  The decimal point is at the |

  -2 | 510
  -1 | 7631110
  -0 | 998877733211
  0 | 011244889
  1 | 00045
  2 | 19

>
> # Now run it and save the file
> sink("Testout.txt")
> source("Test.R")
> sink()
>
> # What is located in "Testout.txt"?
> cat(readLines("Testout.txt"), sep="\n")
0%25%50%75%100%
-2.47511893 -0.47919111  0.05761628  0.67403447  1.79825459

  The decimal point is at the |

  -2 | 5
  -2 | 4
  -1 |
  -1 | 432000
  -0 | 87755
  -0 | 442110
  0 | 001244
  0 | 556789
  1 | 113
  1 | 5788

> # Success

Depending on your operating system, you may also be able to save the output 
with File | Save to File.

---
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77843-4352

-Original Message-
From: R-help 
[mailto:r-help-boun...@r-project.org] On 
Behalf Of Priya Arasu via R-help
Sent: Wednesday, November 1, 2017 9:57 AM
To: Eric Berger mailto:ericjber...@gmail.com>>
Cc: r-help@r-project.org
Subject: Re: [R] Function to save results

Hi Eric,Thanks for the explanation. Is there a way to save the results 
automatically after the analysis gets over?. As I recently lost the results, 
because I didn't save the results. I don't want to run the sink or save command 
after the analysis is over rather run the command for saving the file before 
starting to run the analysis, so the file gets saved automatically after the 
script has finished running Priya



On Wednesday, 1 November 2017 7:53 PM, Eric Berger 
mailto:ericjber...@gmail.com>> wrote:


Hi Priya,
You did not follow the logic of the pseudo-code. The sink("filename"), sink() 
pair captures whatever output is generated between the first sink statement and 
the second sink statement.You need (possibly) to do:
sink("C://Users//Priya// Desktop//Attractor analysis_all 
genes//synaptogenesis//attr. txt") net <- loadNetwork("C://Users//Priya/ 
/Desktop//Attractor analysis_all genes//synaptogenesis// regulationof_dopamine_ 
signaling_submodule3.txt")attr <- getAttractors(net, type="asynchronous")
sink()
HTH,Eric



On Wed, Nov 1, 2017 at 4:10 PM, Priya Arasu 
mailto:galaxie2...@yahoo.co.in>> wrote:

Hi Eric,I tried as you suggested but I could not find the output in the text 
file I created (attr.txt)

net <- loadNetwork("C://Users//Priya/ /Desktop//Attractor analysis_all 
genes//synaptogenesis// regulationof_dopamine_ 
signaling_submodule3.txt")sink("C://Users//Priya// Desktop//Attractor 
analysis_all genes//synaptogenesis//attr. txt")


sink()

attr <- getAttractors(net, type="asynchronous")
 Priya


On Wednesday, 1 November 2017 6:54 PM, Eric Berger 
mailto:ericjber...@gmail.com>> wrote:


Some comments:1. sink() does not return a value. There is on point to set attr 
<- sink(...). Just give the command sink("C://etc")2. to complete the 
saving to the file you must give a second sink command with no argument:  
sink()So your code would be (pseudo-code, not actual code) sink( "filename" )do 
something that prints output which will be captured by sinksink() HTH,Eric


On Wed, Nov 1, 2017 at 1:32 PM, Priya Arasu via R-help 
mailto:r-help@r-project.org>> wrote:

Hi,I want the results to be saved automatically in a output text file after the 
script has finished running.

I used the sink function in the following example, but the results file 
(output.txt) was empty.

net <- loadNetwork("C://Users//Priya/ /Desktop//Attractor analysis_all 
genes//synaptogenesis// regulationof_dopamine_ signaling_submodule3.txt")# 
First I loaded theinput file for which I want to identify attractors attr <- 
sink("C://Users//Priya// Desktop//Attractor analysis_all 
genes//synaptogenesis//output. txt")# used the sink function to save the 
results from attr function

attr <- getAttractors(net, type="asyn

Re: [R] Correct subsetting in R

2017-11-01 Thread Elahe chalabi via R-help
But they row.names() cannot give me the IDs






On Wednesday, November 1, 2017 9:45 AM, David Wolfskill  
wrote:



On Wed, Nov 01, 2017 at 04:13:42PM +, Elahe chalabi via R-help wrote:

> Hi all,
> I have two data frames that one of them does not have the column ID:
> 
> > str(data)
> 'data.frame':499 obs. of  608 variables:
> $ ID   : int  1 2 3 4 5 6 7 8 9 10 ...
> $ alright  : int  1 0 0 0 0 0 0 1 2 1 ...
> $ bad  : int  1 0 0 0 0 0 0 0 0 0 ...
> $ boy  : int  1 2 1 1 0 2 2 4 2 1 ...
> $ cooki: int  1 2 2 1 0 1 1 4 2 3 ...
> $ curtain  : int  1 0 0 0 0 2 0 2 0 0 ...
> $ dish : int  2 1 0 1 0 0 1 2 2 2 ...
> $ doesnt   : int  1 0 0 0 0 0 0 0 1 0 ...
> $ dont : int  2 1 4 2 0 0 2 1 2 0 ...
> $ fall : int  3 1 0 0 1 0 1 2 3 2 ...
> $ fell : int  1 0 0 0 0 0 0 0 0 0 ...
> 
> and the other one is:
> 
> > str(training)
> 'data.frame':375 obs. of  607 variables:
> $ alright  : num  1 0 0 0 1 2 1 0 0 0 ...
> $ bad  : num  1 0 0 0 0 0 0 0 0 0 ...
> $ boy  : num  1 1 2 2 4 2 1 0 1 0 ...
> $ cooki: num  1 1 1 1 4 2 3 1 2 2 ...
> $ curtain  : num  1 0 2 0 2 0 0 0 0 0 ...
> $ dish : num  2 1 0 1 2 2 2 1 4 1 ...
> $ doesnt   : num  1 0 0 0 0 1 0 0 0 0 ...
> $ dont : num  2 2 0 2 1 2 0 0 1 0 ...
> $ fall : num  3 0 0 1 2 3 2 0 2 0 ...
> $ fell : num  1 0 0 0 0 0 0 0 0 0 ...
> Does anyone know how should I get the IDs of training from data?
> thanks for any help!
> Elahe
> 

row.names() appears to be what is wanted.

Peace,
david
-- 
David H. Wolfskillr...@catwhisker.org
Unsubstantiated claims of "Fake News" are evidence that the claimant lies again.

See http://www.catwhisker.org/~david/publickey.gpg for my public key.

__
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] Function to save results

2017-11-01 Thread Priya Arasu via R-help
Hi David,Thank you for the example.When I try to use the cat function, I get an 
error

cat(attr<-getAttractors(net, type="asynchronous"))Error in cat(attr <- 
getAttractors(net, type = "asynchronous")) : 
  argument 1 (type 'pairlist') cannot be handled by 'cat'

Please let me know, if I have used the function in right way?. 
Thank you
Priya






 
 

On Wednesday, 1 November 2017 9:32 PM, David L Carlson  
wrote:
 

 Let's try a simple example. 

> # Create a script file of commands
> # Note we must print the results of quantile explicitly
> cat("x <- rnorm(50)\nprint(quantile(x))\nstem(x)\n", file="Test.R")
> 
> # Test it by running it to the console
> source("Test.R")
        0%        25%        50%        75%      100% 
-2.4736219 -0.7915433 -0.1178056  0.7023577  2.9158617 

  The decimal point is at the |

  -2 | 510
  -1 | 7631110
  -0 | 998877733211
  0 | 011244889
  1 | 00045
  2 | 19

> 
> # Now run it and save the file
> sink("Testout.txt")
> source("Test.R")
> sink()
> 
> # What is located in "Testout.txt"?
> cat(readLines("Testout.txt"), sep="\n")
        0%        25%        50%        75%        100% 
-2.47511893 -0.47919111  0.05761628  0.67403447  1.79825459 

  The decimal point is at the |

  -2 | 5
  -2 | 4
  -1 | 
  -1 | 432000
  -0 | 87755
  -0 | 442110
  0 | 001244
  0 | 556789
  1 | 113
  1 | 5788

> # Success

Depending on your operating system, you may also be able to save the output 
with File | Save to File.

---
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77843-4352

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Priya Arasu via 
R-help
Sent: Wednesday, November 1, 2017 9:57 AM
To: Eric Berger 
Cc: r-help@r-project.org
Subject: Re: [R] Function to save results

Hi Eric,Thanks for the explanation. Is there a way to save the results 
automatically after the analysis gets over?. As I recently lost the results, 
because I didn't save the results. I don't want to run the sink or save command 
after the analysis is over rather run the command for saving the file before 
starting to run the analysis, so the file gets saved automatically after the 
script has finished running Priya
 


    On Wednesday, 1 November 2017 7:53 PM, Eric Berger  
wrote:


 Hi Priya,
You did not follow the logic of the pseudo-code. The sink("filename"), sink() 
pair captures whatever output is generated between the first sink statement and 
the second sink statement.You need (possibly) to do:
sink("C://Users//Priya// Desktop//Attractor analysis_all 
genes//synaptogenesis//attr. txt") net <- loadNetwork("C://Users//Priya/ 
/Desktop//Attractor analysis_all genes//synaptogenesis// regulationof_dopamine_ 
signaling_submodule3.txt")attr <- getAttractors(net, type="asynchronous")
sink()
HTH,Eric


 


Hi Eric,I tried as you suggested but I could not find the output in the text 
file I created (attr.txt)

net <- loadNetwork("C://Users//Priya/ /Desktop//Attractor analysis_all 
genes//synaptogenesis// regulationof_dopamine_ 
signaling_submodule3.txt")sink("C://Users//Priya// Desktop//Attractor 
analysis_all genes//synaptogenesis//attr. txt")


sink()

attr <- getAttractors(net, type="asynchronous")
 Priya


    On Wednesday, 1 November 2017 6:54 PM, Eric Berger  
wrote:


 Some comments:1. sink() does not return a value. There is on point to set attr 
<- sink(...). Just give the command sink("C://etc")2. to complete the 
saving to the file you must give a second sink command with no argument:  
sink()So your code would be (pseudo-code, not actual code) sink( "filename" )do 
something that prints output which will be captured by sinksink() HTH,Eric


On Wed, Nov 1, 2017 at 1:32 PM, Priya Arasu via R-help  
wrote:

Hi,I want the results to be saved automatically in a output text file after the 
script has finished running.

I used the sink function in the following example, but the results file 
(output.txt) was empty.

net <- loadNetwork("C://Users//Priya/ /Desktop//Attractor analysis_all 
genes//synaptogenesis// regulationof_dopamine_ signaling_submodule3.txt")# 
First I loaded theinput file for which I want to identify attractors attr <- 
sink("C://Users//Priya// Desktop//Attractor analysis_all 
genes//synaptogenesis//output. txt")# used the sink function to save the 
results from attr function

attr <- getAttractors(net, type="asynchronous")# then ran the script for 
identifying attractors Is there any function to save the results before setting 
the script to run, so that results are automatically saved in a text file after 
the script has finished running?

Thank youPriya



        [[alternative HTML version deleted]]

__  R-help@r-project.org mailing 
list -- To UNSUBSCRIBE and more, see https://stat.ethz.ch/mailman/ 
listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/ 
posting-guide.html and 

Re: [R] R-3.4.2: make check stops at line 698 of tests/reg-tests-1d.R

2017-11-01 Thread Duncan Murdoch


On 01/11/2017 1:08 PM, Albrecht Kauffmann wrote:

Am Mi, 1. Nov 2017, um 17:40, schrieb Duncan Murdoch:

On 01/11/2017 12:02 PM, Albrecht Kauffmann wrote:

Dear Duncan,

Many thanks!

Am Mi, 1. Nov 2017, um 16:17, schrieb Duncan Murdoch:

On 01/11/2017 8:11 AM, Albrecht Kauffmann wrote:

Hi all,

after compiling R-3.4.2 on opensuse leap 42.3, make check failed. Until
R-3.4.1 I never had a problem with these tests. No, the programm stops
at the following line of tests/reg-tests-1d.R:


## available.packages() (not) caching in case of errors
tools::assertWarning(ap1 <- available.packages(repos = "http://foo.bar";))
tools::assertWarning(ap2 <- available.packages(repos = "http://foo.bar";))

   error in assertCondition(expr, "warning",
  .exprString = d.expr) :  Got simpleError evaluating of ap2 <-
  available.packages(repo  ...: wanted warning

The error message is a result of:  ap2 <- available.packages(repos =
"http://foo.bar";),
not of the following condition in the test script:   stopifnot(nrow(ap1)
== 0, identical(ap1, ap2))  .


What error message did you see?


after: R --vanilla <../R-3.4.2/tests/reg-tests-1d.R


Sorry, I wasn't clear.  I meant to ask what error message you get if you
run the command that's supposed to generate a warning, i.e. run the code


Oops! Here are the resulting error messages, which are not the same:

ap1 <- available.packages(repos = "http://foo.bar";)

Warning: Cannot access to the index of the repository
http://foo.bar/src/contrib:
   line beginning with '
ap2 <- available.packages(repos = "http://foo.bar";)

Error in readRDS(dest) : unknown input format

On my other PC, the same lines give 2 times the same error message:
"Warning: Cannot access to the index of the repository
http://foo.bar/src/contrib: Cannot open URL
'http://foo.bar/src/contrib/PACKAGES' "

Indeed, the second error message on the present PC is different. What
may be the cause?


It looks as though one of your PCs is returning a file in response to 
the request, rather than signalling that the URL is not found.


If you go into a browser like Firefox and try to open the URL

http://foo.bar/src/contrib/PACKAGES

what do you see on the two systems?  I get a message from Firefox that 
the server is not found.


Some ISPs respond to requests for nonexistent URLs with a message, 
basically an ad for something or other.  Maybe that's what you're getting.


In any case, this looks like a bug in R:  the first request failed, but 
something got cached, and then the second request got an error reading 
the cached value.


Duncan Murdoch

__
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] Function to save results

2017-11-01 Thread Rui Barradas

Hello,

If cat is giving you an error try print(attr <- ...etc...)

Hope this helps,

Rui Barradas

Em 01-11-2017 17:21, Priya Arasu via R-help escreveu:

Hi David,Thank you for the example.When I try to use the cat function, I get an 
error

cat(attr<-getAttractors(net, type="asynchronous"))Error in cat(attr <- getAttractors(net, 
type = "asynchronous")) :
   argument 1 (type 'pairlist') cannot be handled by 'cat'

Please let me know, if I have used the function in right way?.
Thank you
Priya









 On Wednesday, 1 November 2017 9:32 PM, David L Carlson  
wrote:


  Let's try a simple example.


# Create a script file of commands
# Note we must print the results of quantile explicitly
cat("x <- rnorm(50)\nprint(quantile(x))\nstem(x)\n", file="Test.R")

# Test it by running it to the console
source("Test.R")

 0%25%50%75%  100%
-2.4736219 -0.7915433 -0.1178056  0.7023577  2.9158617

   The decimal point is at the |

   -2 | 510
   -1 | 7631110
   -0 | 998877733211
   0 | 011244889
   1 | 00045
   2 | 19



# Now run it and save the file
sink("Testout.txt")
source("Test.R")
sink()

# What is located in "Testout.txt"?
cat(readLines("Testout.txt"), sep="\n")

 0%25%50%75%100%
-2.47511893 -0.47919111  0.05761628  0.67403447  1.79825459

   The decimal point is at the |

   -2 | 5
   -2 | 4
   -1 |
   -1 | 432000
   -0 | 87755
   -0 | 442110
   0 | 001244
   0 | 556789
   1 | 113
   1 | 5788


# Success


Depending on your operating system, you may also be able to save the output 
with File | Save to File.

---
David L Carlson
Department of Anthropology
Texas A&M University
College Station, TX 77843-4352

-Original Message-
From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Priya Arasu via 
R-help
Sent: Wednesday, November 1, 2017 9:57 AM
To: Eric Berger 
Cc: r-help@r-project.org
Subject: Re: [R] Function to save results

Hi Eric,Thanks for the explanation. Is there a way to save the results 
automatically after the analysis gets over?. As I recently lost the results, 
because I didn't save the results. I don't want to run the sink or save command 
after the analysis is over rather run the command for saving the file before 
starting to run the analysis, so the file gets saved automatically after the 
script has finished running Priya



 On Wednesday, 1 November 2017 7:53 PM, Eric Berger  
wrote:


  Hi Priya,
You did not follow the logic of the pseudo-code. The sink("filename"), sink() 
pair captures whatever output is generated between the first sink statement and the 
second sink statement.You need (possibly) to do:
sink("C://Users//Priya// Desktop//Attractor analysis_all genes//synaptogenesis//attr. txt") net <- 
loadNetwork("C://Users//Priya/ /Desktop//Attractor analysis_all genes//synaptogenesis// regulationof_dopamine_ 
signaling_submodule3.txt")attr <- getAttractors(net, type="asynchronous")
sink()
HTH,Eric





Hi Eric,I tried as you suggested but I could not find the output in the text 
file I created (attr.txt)

net <- loadNetwork("C://Users//Priya/ /Desktop//Attractor analysis_all genes//synaptogenesis// 
regulationof_dopamine_ signaling_submodule3.txt")sink("C://Users//Priya// Desktop//Attractor 
analysis_all genes//synaptogenesis//attr. txt")


sink()

attr <- getAttractors(net, type="asynchronous")
  Priya


 On Wednesday, 1 November 2017 6:54 PM, Eric Berger  
wrote:


  Some comments:1. sink() does not return a value. There is on point to set attr <- sink(...). Just 
give the command sink("C://etc")2. to complete the saving to the file you must give a 
second sink command with no argument:  sink()So your code would be (pseudo-code, not actual code) 
sink( "filename" )do something that prints output which will be captured by sinksink() 
HTH,Eric


On Wed, Nov 1, 2017 at 1:32 PM, Priya Arasu via R-help  
wrote:

Hi,I want the results to be saved automatically in a output text file after the 
script has finished running.

I used the sink function in the following example, but the results file 
(output.txt) was empty.

net <- loadNetwork("C://Users//Priya/ /Desktop//Attractor analysis_all genes//synaptogenesis// 
regulationof_dopamine_ signaling_submodule3.txt")# First I loaded theinput file for which I want to 
identify attractors attr <- sink("C://Users//Priya// Desktop//Attractor analysis_all 
genes//synaptogenesis//output. txt")# used the sink function to save the results from attr function

attr <- getAttractors(net, type="asynchronous")# then ran the script for 
identifying attractors Is there any function to save the results before setting the script 
to run, so that results are automatically saved in a text file after the script has finished 
running?

Thank youPriya



 [[alternative HTML version deleted]]

__  R-help@r-project.org mailing 
list -- To UNSUBSCRIBE 

Re: [R] beta binomial distribution installation

2017-11-01 Thread David Winsemius

> On Nov 1, 2017, at 9:09 AM, Amany Abdel-Karim  wrote:
> 
> Hello,
> 
> Thank you for your response. I need to install RankTail package since it 
> contains the beta binomial distribution, CDF and inverse CDF in the usual 
> form which I need to use. However rmutil package contain unusual forms for 
> these functions. So it is easier for me to deal with the forms are contained 
> in RankTail.
> 
> I tried to install  bioconductor package, using the following commands but I 
> still got the following errors:
> 
> 
> (1) I tried biocLite() and then library ("TailRank"), I got the following 
> errors.

It appears you failed to follow the full instructions which were to execute:

source("https://bioconductor.org/biocLite.R";)
biocLite()

The first line creates the biocLite function within your workspace.

-- 
David.


> 
>> biocLite()
> Error in biocLite() : could not find function "biocLite"
>> library("TailRank")
> Loading required package: oompaBase
> Error: package or namespace load failed for �TailRank� in loadNamespace(i, 
> c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
> there is no package called �Biobase�
> In addition: Warning messages:
> 1: package �TailRank� was built under R version 3.4.2
> 2: package �oompaBase� was built under R version 3.4.2
> 
> 
> 
> (2) I tried to write the command biocLite(), then biocLite("TailRank"), I got 
> the following errors:
> 
>> biocLite()
> Error in biocLite() : could not find function "biocLite"
>> biocLite("ilRank")
> Error in biocLite("ilRank") : could not find function "biocLite"
>> biocLite()
> Error in biocLite() : could not find function "biocLite"
>> biocLite("TailRank")
> Error in biocLite("TailRank") : could not find function "biocLite"
> 
> 
> 
> 
>> 
> 
> 
> 
> 
> Also, I checked under packages on the right side of the R window and I found 
> TailRank , Description is Tail-Rank statistic, and version is 3.1.3. So, I 
> tried to write the following code in the console window to check if the 
> package works:
> 
>> N<-20
>> u<-3
>> v<-10
>> p<-u/u+v
>> x<-0:N
> 
>> yy<-dbb(x,N,u,v)
> 
> 
> I got the following error:
> Error in dbb(x, N, u, v) : could not find function "dbb"
> 
> 
> 
> 
>> 
> 
> 
> 
> I am confused because if the package TailRank is already there, why the 
> pervious code does not work to calculate dbb (x,N,u,v) and I got error? If I 
> do not have the package, would you please let me know the right commands I 
> should write in the script window to install TaiRank because the commands I 
> used (which I mentioned at the beginning of the email did not work and gave 
> errors). I appreciate your help since I am a new user of R.
> 
> 
> Amany
> 
> 
> 
> 
> 
> From: Eric Berger 
> Sent: Wednesday, November 1, 2017 2:42 AM
> To: MCGUIRE, Rhydwyn
> Cc: Amany Abdel-Karim; r-h...@stat.math.ethz.ch
> Subject: Re: [R] beta binomial distribution installation
> 
> Hi,
> I did a quick search for other packages that provide the beta binomial 
> distribution and found "rmutil".
> 
>> install.packages("rmutil")
> 
> The package has the CDF (pbetabinom) and inverse CDF (qbetabinom) among other 
> functions.
> 
> HTH,
> Eric
> 
> 
> 
> On Wed, Nov 1, 2017 at 7:50 AM, MCGUIRE, Rhydwyn 
> mailto:rm...@doh.health.nsw.gov.au>> wrote:
> Hi there,
> 
> It looks like you also need the bioconductor package biobase, I found 
> instructions for downloading that package here: 
> www.bioconductor.org/install
> 
> Good luck.
> 
> Cheers,
> Rhydwyn
> 
> -Original Message-
> From: R-help 
> [mailto:r-help-boun...@r-project.org] On 
> Behalf Of Amany Abdel-Karim
> Sent: Wednesday, 1 November 2017 2:13 PM
> To: r-h...@stat.math.ethz.ch
> Subject: [R] beta binomial distribution installation
> 
> Hello,
> 
> I  tried to install package TailRank using the command install.packages 
> (RankTail) and library (TailRank) but I got the following errors. So, how can 
> I install TaiRank in Rstudio to have se beta-binomial distribution, CDF and 
> inverse CDG of  beta-binomal?
> 
> The commands I used are:
> 
>> install.packages("TailRank")
> 
> Installing package into C:/Users/stator-guest/Documents/R/win-library/3.4
> 
> (as lib is unspecified)
> 
> Warning in install.packages :
> 
>  dependency Biobase is not available
> 
> trying URL 
> 'https://cran.rstudio.com/bin/windows/contrib/3.4/TailRank_3.1.3.zip'
> 
> Content type 'application/zip' length 331270 bytes (323 KB)
> 
> downloaded 323 KB
> 
> 
> 
> package TailRank successfully unpacked and MD5 sums checked
> 
> 
> 
> The downloaded binary packages are in
> 
>
> C:\Users\stator-guest\AppData\Local\Temp\RtmpoVx40V\downloaded_packages
> 
>> library(TailRank)
> 
> Error: package or namespace load failed for TailRank in loadNamespace(i, 
> c(lib.loc, .libPaths()), versionCheck = vI[[i]]):
> 
> there is no package called Biobase
> 
> In addition: Warning message:
> 

Re: [R] Correct subsetting in R

2017-11-01 Thread Elahe chalabi via R-help

It's not what I want, the first data frame has 499 observations and the second 
data frame is a subset of the first one but with 375 observations. I want 
something that returns the ID for training data frame  


On Wednesday, November 1, 2017 10:18 AM, Eric Berger  
wrote:



matches <- merge(training,data,by=intersect(names(training),names(data)))

HTH,
Eric



On Wed, Nov 1, 2017 at 6:13 PM, Elahe chalabi via R-help  
wrote:

Hi all,
>I have two data frames that one of them does not have the column ID:
>
>> str(data)
>'data.frame':   499 obs. of  608 variables:
>$ ID   : int  1 2 3 4 5 6 7 8 9 10 ...
>$ alright  : int  1 0 0 0 0 0 0 1 2 1 ...
>$ bad  : int  1 0 0 0 0 0 0 0 0 0 ...
>$ boy  : int  1 2 1 1 0 2 2 4 2 1 ...
>$ cooki: int  1 2 2 1 0 1 1 4 2 3 ...
>$ curtain  : int  1 0 0 0 0 2 0 2 0 0 ...
>$ dish : int  2 1 0 1 0 0 1 2 2 2 ...
>$ doesnt   : int  1 0 0 0 0 0 0 0 1 0 ...
>$ dont : int  2 1 4 2 0 0 2 1 2 0 ...
>$ fall : int  3 1 0 0 1 0 1 2 3 2 ...
>$ fell : int  1 0 0 0 0 0 0 0 0 0 ...
>
>and the other one is:
>
>> str(training)
>'data.frame':   375 obs. of  607 variables:
>$ alright  : num  1 0 0 0 1 2 1 0 0 0 ...
>$ bad  : num  1 0 0 0 0 0 0 0 0 0 ...
>$ boy  : num  1 1 2 2 4 2 1 0 1 0 ...
>$ cooki: num  1 1 1 1 4 2 3 1 2 2 ...
>$ curtain  : num  1 0 2 0 2 0 0 0 0 0 ...
>$ dish : num  2 1 0 1 2 2 2 1 4 1 ...
>$ doesnt   : num  1 0 0 0 0 1 0 0 0 0 ...
>$ dont : num  2 2 0 2 1 2 0 0 1 0 ...
>$ fall : num  3 0 0 1 2 3 2 0 2 0 ...
>$ fell : num  1 0 0 0 0 0 0 0 0 0 ...
>Does anyone know how should I get the IDs of training from data?
>thanks for any help!
>Elahe
>
>__ 
>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-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] Adding Records to a Table in R

2017-11-01 Thread Paul Bernal
Dear R friends,

I am currently working with time series data, and I have a table(as data
frame) that has looks like this (TransitDate are in format = "%e-%B-%Y") :

TransitDate   Transits  CargoTons
1985-04-011002500
1985-05-011354500
1985-06-011201750
1985-07-011003750
1985-08-012001250

The problem is, that there are several periods that don´t exist in the
table, so it has the following behavior:

TransitDateTransits  CargoTons
1985-04-01100 1000
1985-07-01100 1080
1985-12-01500 3785
1986-04-01325 4200
.
.
2017-09-01400 2350 (*this is the last observation)

You can see in the last table fragment that the series jumps from
1985-04-01 to 1985-07-01, then it jumps from there to 1985-12-01 making the
time series quite irregular (non-constant chronologically speaking).

What I want to do is create a dummy table that has the sequence from the
first observation (1985-04-01) up to the last one (2017-09-01) and then
develop a code that checks if the dates contained in the dummy table exist
in the original table, if they don´t exist then add those dates and put
zeroes on the fields.

How can I achieve this?

Any help will be greatly appreciated,

Best regards,

Paul

[[alternative HTML version deleted]]

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

Re: [R] Correct subsetting in R

2017-11-01 Thread Eric Berger
training$TrainingRownum <- 1:nrow(training)
data$DataRownum <- 1:nrow(data)
matches <- merge(training,data,by=intersect(names(training),names(data)))

The data frame 'matches' now has additional columns telling you the row in
each data frame corresponding to the matched items.

Regards,
Eric

On Wed, Nov 1, 2017 at 9:29 PM, Elahe chalabi 
wrote:

>
> It's not what I want, the first data frame has 499 observations and the
> second data frame is a subset of the first one but with 375 observations. I
> want something that returns the ID for training data frame
>
>
> On Wednesday, November 1, 2017 10:18 AM, Eric Berger <
> ericjber...@gmail.com> wrote:
>
>
>
> matches <- merge(training,data,by=intersect(names(training),names(data)))
>
> HTH,
> Eric
>
>
>
> On Wed, Nov 1, 2017 at 6:13 PM, Elahe chalabi via R-help <
> r-help@r-project.org> wrote:
>
> Hi all,
> >I have two data frames that one of them does not have the column ID:
> >
> >> str(data)
> >'data.frame':   499 obs. of  608 variables:
> >$ ID   : int  1 2 3 4 5 6 7 8 9 10 ...
> >$ alright  : int  1 0 0 0 0 0 0 1 2 1 ...
> >$ bad  : int  1 0 0 0 0 0 0 0 0 0 ...
> >$ boy  : int  1 2 1 1 0 2 2 4 2 1 ...
> >$ cooki: int  1 2 2 1 0 1 1 4 2 3 ...
> >$ curtain  : int  1 0 0 0 0 2 0 2 0 0 ...
> >$ dish : int  2 1 0 1 0 0 1 2 2 2 ...
> >$ doesnt   : int  1 0 0 0 0 0 0 0 1 0 ...
> >$ dont : int  2 1 4 2 0 0 2 1 2 0 ...
> >$ fall : int  3 1 0 0 1 0 1 2 3 2 ...
> >$ fell : int  1 0 0 0 0 0 0 0 0 0 ...
> >
> >and the other one is:
> >
> >> str(training)
> >'data.frame':   375 obs. of  607 variables:
> >$ alright  : num  1 0 0 0 1 2 1 0 0 0 ...
> >$ bad  : num  1 0 0 0 0 0 0 0 0 0 ...
> >$ boy  : num  1 1 2 2 4 2 1 0 1 0 ...
> >$ cooki: num  1 1 1 1 4 2 3 1 2 2 ...
> >$ curtain  : num  1 0 2 0 2 0 0 0 0 0 ...
> >$ dish : num  2 1 0 1 2 2 2 1 4 1 ...
> >$ doesnt   : num  1 0 0 0 0 1 0 0 0 0 ...
> >$ dont : num  2 2 0 2 1 2 0 0 1 0 ...
> >$ fall : num  3 0 0 1 2 3 2 0 2 0 ...
> >$ fell : num  1 0 0 0 0 0 0 0 0 0 ...
> >Does anyone know how should I get the IDs of training from data?
> >thanks for any help!
> >Elahe
> >
> >__ 
> >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.
> >
>

[[alternative HTML version deleted]]

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


Re: [R] Adding Records to a Table in R

2017-11-01 Thread Eric Berger
Hi Paul,

#First I set up some sample data since I don't have a copy of your data
dtOrig <- as.Date( c("1985-04-01","1985-07-01","1985-12-01","1986-04-01"))
dfOrig <- data.frame( TransitDate=dtOrig, Transits=c(100,100,500,325),
CargoTons=c(1000,1080,3785,4200) )

#Generate the complete set of dates as a data frame
dfDates<- data.frame( TransitDate=seq(from=as.Date("1985-04-01"),by="1
month",length=13) )

# do the merge adding the "missing" rows (where NA will appear)
dfNew  <- merge(dfDates, dfOrig, by="TransitDate", all.x=TRUE )

# replace the NA's by zero
dfNew[is.na(dfNew)] <- 0

HTH,
Eric


On Wed, Nov 1, 2017 at 9:45 PM, Paul Bernal  wrote:

> Dear R friends,
>
> I am currently working with time series data, and I have a table(as data
> frame) that has looks like this (TransitDate are in format = "%e-%B-%Y") :
>
> TransitDate   Transits  CargoTons
> 1985-04-011002500
> 1985-05-011354500
> 1985-06-011201750
> 1985-07-011003750
> 1985-08-012001250
>
> The problem is, that there are several periods that don´t exist in the
> table, so it has the following behavior:
>
> TransitDateTransits  CargoTons
> 1985-04-01100 1000
> 1985-07-01100 1080
> 1985-12-01500 3785
> 1986-04-01325 4200
> .
> .
> 2017-09-01400 2350 (*this is the last observation)
>
> You can see in the last table fragment that the series jumps from
> 1985-04-01 to 1985-07-01, then it jumps from there to 1985-12-01 making the
> time series quite irregular (non-constant chronologically speaking).
>
> What I want to do is create a dummy table that has the sequence from the
> first observation (1985-04-01) up to the last one (2017-09-01) and then
> develop a code that checks if the dates contained in the dummy table exist
> in the original table, if they don´t exist then add those dates and put
> zeroes on the fields.
>
> How can I achieve this?
>
> Any help will be greatly appreciated,
>
> Best regards,
>
> Paul
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

[[alternative HTML version deleted]]

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

Re: [R] R-3.4.2: make check stops at line 698 of tests/reg-tests-1d.R

2017-11-01 Thread Albrecht Kauffmann
Dear Duncan,

thank you very much, that is it! Indeed, there was activated in my
internet router the "telekom navigation help". When I am (or the system
is) looking for an not existent url, this "help" opens its own website.
After deactivation of telekom navigation help, the normal message
(server not found) comes. I never gave attention to this "help",
although it is bothering sometimes; now it is switched off in my
residence. However, in Germany this problem probably frequently arises,
therefor, it should be considered in the respective code for testing R
after compilation.  

All the best,
Albrecht
-- 
  Albrecht Kauffmann
  alkau...@fastmail.fm

Am Mi, 1. Nov 2017, um 19:24, schrieb Duncan Murdoch:
> 
> On 01/11/2017 1:08 PM, Albrecht Kauffmann wrote:
> > Am Mi, 1. Nov 2017, um 17:40, schrieb Duncan Murdoch:
> >> On 01/11/2017 12:02 PM, Albrecht Kauffmann wrote:
> >>> Dear Duncan,
> >>>
> >>> Many thanks!
> >>>
> >>> Am Mi, 1. Nov 2017, um 16:17, schrieb Duncan Murdoch:
>  On 01/11/2017 8:11 AM, Albrecht Kauffmann wrote:
> > Hi all,
> >
> > after compiling R-3.4.2 on opensuse leap 42.3, make check failed. Until
> > R-3.4.1 I never had a problem with these tests. No, the programm stops
> > at the following line of tests/reg-tests-1d.R:
> >
> >> ## available.packages() (not) caching in case of errors
> >> tools::assertWarning(ap1 <- available.packages(repos = 
> >> "http://foo.bar";))
> >> tools::assertWarning(ap2 <- available.packages(repos = 
> >> "http://foo.bar";))
> >error in assertCondition(expr, "warning",
> >   .exprString = d.expr) :  Got simpleError evaluating of ap2 <-
> >   available.packages(repo  ...: wanted warning
> >
> > The error message is a result of:  ap2 <- available.packages(repos =
> > "http://foo.bar";),
> > not of the following condition in the test script:   stopifnot(nrow(ap1)
> > == 0, identical(ap1, ap2))  .
> 
>  What error message did you see?
> >>>
> >>> after: R --vanilla <../R-3.4.2/tests/reg-tests-1d.R
> >>
> >> Sorry, I wasn't clear.  I meant to ask what error message you get if you
> >> run the command that's supposed to generate a warning, i.e. run the code
> >>
> > Oops! Here are the resulting error messages, which are not the same:
> >> ap1 <- available.packages(repos = "http://foo.bar";)
> > Warning: Cannot access to the index of the repository
> > http://foo.bar/src/contrib:
> >line beginning with ' > 
> >> ap2 <- available.packages(repos = "http://foo.bar";)
> > Error in readRDS(dest) : unknown input format
> > 
> > On my other PC, the same lines give 2 times the same error message:
> > "Warning: Cannot access to the index of the repository
> > http://foo.bar/src/contrib: Cannot open URL
> > 'http://foo.bar/src/contrib/PACKAGES' "
> > 
> > Indeed, the second error message on the present PC is different. What
> > may be the cause?
> 
> It looks as though one of your PCs is returning a file in response to 
> the request, rather than signalling that the URL is not found.
> 
> If you go into a browser like Firefox and try to open the URL
> 
> http://foo.bar/src/contrib/PACKAGES
> 
> what do you see on the two systems?  I get a message from Firefox that 
> the server is not found.
> 
> Some ISPs respond to requests for nonexistent URLs with a message, 
> basically an ad for something or other.  Maybe that's what you're
> getting.
> 
> In any case, this looks like a bug in R:  the first request failed, but 
> something got cached, and then the second request got an error reading 
> the cached value.
> 
> Duncan Murdoch

__
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] R-3.4.2: make check stops at line 698 of tests/reg-tests-1d.R

2017-11-01 Thread Jeff Newmiller
This idea of hijacking failed connections has been tried before and it breaks 
many things beyond R software and most ISPs have given up on doing this. If 
you, who have this "feature" at hand can figure out a reliable way to detect 
this then it might be "considered". However, it seems unlikely that a general 
solution can be found after all this time, so the better option is probably for 
you to disable this "feature".
-- 
Sent from my phone. Please excuse my brevity.

On November 1, 2017 1:52:16 PM PDT, Albrecht Kauffmann  
wrote:
>Dear Duncan,
>
>thank you very much, that is it! Indeed, there was activated in my
>internet router the "telekom navigation help". When I am (or the system
>is) looking for an not existent url, this "help" opens its own website.
>After deactivation of telekom navigation help, the normal message
>(server not found) comes. I never gave attention to this "help",
>although it is bothering sometimes; now it is switched off in my
>residence. However, in Germany this problem probably frequently arises,
>therefor, it should be considered in the respective code for testing R
>after compilation.  
>
>All the best,
>Albrecht

__
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] "prob" package alternative

2017-11-01 Thread Tiby Kantrowitz
The prob package has been archived because it depends upon some other
packages which have issues.

However, such projects as Introduction to Probability and Statistics in R
depend upon it for learning. There are a few other resources that also use
it.

Does anyone know of any workarounds?

Someone at stack exchange mentioned using R 2.9. However, that broke my
RStudio (WSOD) and the dependent packages still wouldn't install, anyway.

Suggestions?

Thanks!

Best -

Tiby

[[alternative HTML version deleted]]

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


[R] Cox Regression : Spline Coefficient Interpretation?

2017-11-01 Thread Kosta S.
Hi,

I'm using a Cox-Regression to estimate hazard rates on prepayments.

I'm using the "pspline" function to face non-linearity, but I have no clue
how to interpret the result.
Unfortunately I did not find enough information on the "pspline" function
wether in the survival package nor using google..

I got following output:

* library(survival)*


>
>
>
>
>
>
>
>
>
>
>
>
>
> *> Option.test2<-coxph(Surv(START,STOP,ZEROBAL==1)~pspline(OPTION),
> data=FNMA)coxph(formula = Surv(START, STOP, ZEROBAL == 1) ~
> pspline(OPTION), data = FNMA)> > Option.test2> Call:> coxph(formula =
> Surv(START, STOP, ZEROBAL == 1) ~ pspline(OPTION), > data = FNMA)>
>  coef  se(coef)   se2 Chisq   DF
> p> pspline(OPTION), linear   -0.13340.01310.0131  104.4325
> 1.00 <0.0002> pspline(OPTION), nonlin
> 1747.1295 3.05 <0.0002> Iterations: 8 outer, 19
> Newton-Raphson>  Theta= 0.991 > Degrees of freedom for terms= 4 >
> Likelihood ratio test=2136  on 4.05 df, p=0  n= 3390429 >  *


Thanks,

KS

[[alternative HTML version deleted]]

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


Re: [R] Cox Regression : Spline Coefficient Interpretation?

2017-11-01 Thread Bert Gunter
??

It is unclear to me what "How to interpret the result" means. Note that the
survival package is very well documented and there is a vignette
specifically on the topic of the use of "Spline terms in a Cox model." Have
you studied it?

If you want to discuss the statistical issues, e.g. of survival modeling
or the technical details of penalized smoothing splines, that is mostly OT
here: stats.stackexchange.com would probably be a better place to post for
that. This list is mostly about R programming rather than statistics,
although they do sometimes intersect.

If I have misunderstood your question, you might wish to clarify exactly
what it is that you are seeking in another post.

Finally, as you can see from the below, post in PLAIN TEXT ONLY, as html
can get mangled by the server on this plain text mailing list.

Cheers,
Bert



Bert Gunter

"The trouble with having an open mind is that people keep coming along and
sticking things into it."
-- Opus (aka Berkeley Breathed in his "Bloom County" comic strip )

On Wed, Nov 1, 2017 at 1:12 PM, Kosta S.  wrote:

> Hi,
>
> I'm using a Cox-Regression to estimate hazard rates on prepayments.
>
> I'm using the "pspline" function to face non-linearity, but I have no clue
> how to interpret the result.
> Unfortunately I did not find enough information on the "pspline" function
> wether in the survival package nor using google..
>
> I got following output:
>
> * library(survival)*
>
>
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> >
> > *> Option.test2<-coxph(Surv(START,STOP,ZEROBAL==1)~pspline(OPTION),
> > data=FNMA)coxph(formula = Surv(START, STOP, ZEROBAL == 1) ~
> > pspline(OPTION), data = FNMA)> > Option.test2> Call:> coxph(formula =
> > Surv(START, STOP, ZEROBAL == 1) ~ pspline(OPTION), > data = FNMA)>
> >  coef  se(coef)   se2 Chisq   DF
> > p> pspline(OPTION), linear   -0.13340.01310.0131
> 104.4325
> > 1.00 <0.0002> pspline(OPTION), nonlin
> > 1747.1295 3.05 <0.0002> Iterations: 8 outer, 19
> > Newton-Raphson>  Theta= 0.991 > Degrees of freedom for terms= 4 >
> > Likelihood ratio test=2136  on 4.05 df, p=0  n= 3390429 >  *
>
>
> Thanks,
>
> KS
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/
> posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


Re: [R] "prob" package alternative

2017-11-01 Thread David Winsemius

> On Nov 1, 2017, at 12:51 PM, Tiby Kantrowitz  wrote:
> 
> The prob package has been archived because it depends upon some other
> packages which have issues.
> 
> However, such projects as Introduction to Probability and Statistics in R
> depend upon it for learning. There are a few other resources that also use
> it.
> 
> Does anyone know of any workarounds?
> 
> Someone at stack exchange mentioned using R 2.9.

I'm not sure I would trust that person. They seem a bit uninformed.

> However, that broke my
> RStudio (WSOD) and the dependent packages still wouldn't install, anyway.

The latest version of pkg-prob at the Archive directory of CRAN indicates that 
it was last updated within this year. The DESCRIPTION file indicates that it 
does not need compilation, but:

Depends: combinat, fAsianOptions

So there should be code in text files in its ../R directory which can be 
sourced from that directory.

~myuser_name$ ls /Users/../Downloads/prob/R 
characteristicfunctions.r   simulation.rutils-spaces.r
genData.R   spaces-examples.r   utils-subsets.r
misc.r  spaces-prob.r
prob.r  utils-events.r


Or you can install from source after downloading:

install.packages("~/Downloads/prob", repo=NULL,type="source")

# Success


>  library(prob)   # So does require having several other packages
Loading required package: combinat

Attaching package: ‘combinat’

The following object is masked from ‘package:utils’:

combn

Loading required package: fAsianOptions
Loading required package: timeDate

Attaching package: ‘timeDate’

The following object is masked from ‘package:cairoDevice’:

Cairo

The following objects are masked from ‘package:PerformanceAnalytics’:

kurtosis, skewness

Loading required package: timeSeries

Attaching package: ‘timeSeries’

The following object is masked from ‘package:zoo’:

time<-

Loading required package: fBasics


Rmetrics Package fBasics
Analysing Markets and calculating Basic Statistics
Copyright (C) 2005-2014 Rmetrics Association Zurich
Educational Software for Financial Engineering and Computational Science
Rmetrics is free software and comes with ABSOLUTELY NO WARRANTY.
https://www.rmetrics.org --- Mail to: i...@rmetrics.org
Loading required package: fOptions


Rmetrics Package fOptions
Pricing and Evaluating Basic Options
Copyright (C) 2005-2014 Rmetrics Association Zurich
Educational Software for Financial Engineering and Computational Science
Rmetrics is free software and comes with ABSOLUTELY NO WARRANTY.
https://www.rmetrics.org --- Mail to: i...@rmetrics.org

Attaching package: ‘prob’

The following objects are masked from ‘package:dplyr’:

intersect, setdiff, union

The following objects are masked from ‘package:base’:

intersect, setdiff, union

> 
> 
> 
> Tiby
> 
>   [[alternative HTML version deleted]]

A specific suggestion would be that you read the listinfo and the Posting Guide 
and learn to post in plain text.
> 
> __
> 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.

David Winsemius
Alameda, CA, USA

'Any technology distinguishable from magic is insufficiently advanced.'   
-Gehm's Corollary to Clarke's Third Law

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