Re: [R] Help with "ERROR: lazy loading failed for package 'psycho'"

2018-06-06 Thread Bill Poling
Yep, terrific, that’s got it, thank you Eric!

WHP


From: Eric Berger [mailto:ericjber...@gmail.com]
Sent: Wednesday, June 06, 2018 7:50 AM
To: Bill Poling 
Cc: r-help (r-help@r-project.org) 
Subject: Re: [R] Help with "ERROR: lazy loading failed for package 'psycho'"

> install.packages("Matrix")


On Wed, Jun 6, 2018 at 2:24 PM, Bill Poling 
mailto:bill.pol...@zelis.com>> wrote:
Good morning. In my continuing pursuit of self-taught R programming I am 
interested in following the tutorial provided by 
Bloggers.com<http://Bloggers.com> "Beautiful and Powerful Correlation Tables in 
R"


https://www.r-bloggers.com/beautiful-and-powerful-correlation-tables-in-r-2/<https://www.r-bloggers.com/beautiful-and-powerful-correlation-tables-in-r-2/>
 3/

Although, I have hit a snag in the first step?

devtools::install_github("neuropsychology/psycho.R") # Install the newest 
version
library(psycho)
library(tidyverse)

I have installed both psycho & tidyverse pkgs, however, when I go to run the 
devtools::install_github("neuropsychology/psycho.R") piece I get this warning.

Downloading GitHub repo 
neuropsychology/psycho.R@master<mailto:neuropsychology/psycho.R@master>
from URL 
https://api.github.com/repos/neuropsychology/psycho.R/zipball/master<https://api.github.com/repos/neuropsychology/psycho.R/zipball/master>
Installing psycho
"C:/Users/bp/DOCUME~1/R/R-34~1.4/bin/x64/R" --no-site-file --no-environ 
--no-save --no-restore --quiet CMD INSTALL  \
  
"C:/Users/bp/AppData/Local/Temp/RtmpCkkmhB/devtools25601693478c/neuropsychology-psycho.R-b62e316"
 --library="C:/Users/bp/Documents/R/R-3.4.4/library" --install-tests

* installing *source* package 'psycho' ...
** R
** data
*** moving datasets to lazyload DB
** inst
** tests
** preparing package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = 
vI[[j]]) :
  there is no package called 'Matrix'
ERROR: lazy loading failed for package 'psycho'
* removing 'C:/Users/bp/Documents/R/R-3.4.4/library/psycho'
* restoring previous 'C:/Users/bp/Documents/R/R-3.4.4/library/psycho'
In R CMD INSTALL
Installation failed: Command failed (1)
> install.packages("psycho")
trying URL 
'https://cran.rstudio.com/bin/windows/contrib/3.4/psycho_0.2.3.zip<https://cran.rstudio.com/bin/windows/contrib/3.4/psycho_0.2.3.zip>'
Content type 'application/zip' length 1650628 bytes (1.6 MB)
downloaded 1.6 MB

Just a guess, but does this have to do with presetting my work directory?

setwd("C:/WHP/R/PracticeScripts and Testing Ideas")

Here is my session info:


> sessionInfo() #R version 3.4.4 (2018-03-15)

R version 3.4.4 (2018-03-15)

Platform: x86_64-w64-mingw32/x64 (64-bit)

Running under: Windows 7 x64 (build 7601) Service Pack 1


.libPaths() #"C:/Users/bp/Documents/R/R-3.4.4/library"

[1] "C:/Users/bp/Documents/R/R-3.4.4/library"


Thank you for any advice.

WHP

Confidentiality Notice This message is sent from Zelis. ...{{dropped:15}}

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


Confidentiality Notice This message is sent from Zelis. This transmission may 
contain information which is privileged and confidential and is intended for 
the personal and confidential use of the named recipient only. Such information 
may be protected by applicable State and Federal laws from this disclosure or 
unauthorized use. If the reader of this message is not the intended recipient, 
or the employee or agent responsible for delivering the message to the intended 
recipient, you are hereby notified that any disclosure, review, discussion, 
copying, or taking any action in reliance on the contents of this transmission 
is strictly prohibited. If you have received this transmission in error, please 
contact the sender immediately. Zelis, 2018.

[[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] Help with "ERROR: lazy loading failed for package 'psycho'"

2018-06-06 Thread Eric Berger
> install.packages("Matrix")


On Wed, Jun 6, 2018 at 2:24 PM, Bill Poling  wrote:

> Good morning. In my continuing pursuit of self-taught R programming I am
> interested in following the tutorial provided by Bloggers.com "Beautiful
> and Powerful Correlation Tables in R"
>
>
> https://www.r-bloggers.com/beautiful-and-powerful-
> correlation-tables-in-r-2/ 3/
>
> Although, I have hit a snag in the first step?
>
> devtools::install_github("neuropsychology/psycho.R") # Install the newest
> version
> library(psycho)
> library(tidyverse)
>
> I have installed both psycho & tidyverse pkgs, however, when I go to run
> the devtools::install_github("neuropsychology/psycho.R") piece I get this
> warning.
>
> Downloading GitHub repo neuropsychology/psycho.R@master
> from URL https://api.github.com/repos/neuropsychology/psycho.R/
> zipball/master
> Installing psycho
> "C:/Users/bp/DOCUME~1/R/R-34~1.4/bin/x64/R" --no-site-file --no-environ
> --no-save --no-restore --quiet CMD INSTALL  \
>   "C:/Users/bp/AppData/Local/Temp/RtmpCkkmhB/devtools25601693478c/
> neuropsychology-psycho.R-b62e316" 
> --library="C:/Users/bp/Documents/R/R-3.4.4/library"
> --install-tests
>
> * installing *source* package 'psycho' ...
> ** R
> ** data
> *** moving datasets to lazyload DB
> ** inst
> ** tests
> ** preparing package for lazy loading
> Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck
> = vI[[j]]) :
>   there is no package called 'Matrix'
> ERROR: lazy loading failed for package 'psycho'
> * removing 'C:/Users/bp/Documents/R/R-3.4.4/library/psycho'
> * restoring previous 'C:/Users/bp/Documents/R/R-3.4.4/library/psycho'
> In R CMD INSTALL
> Installation failed: Command failed (1)
> > install.packages("psycho")
> trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/psycho_0.
> 2.3.zip'
> Content type 'application/zip' length 1650628 bytes (1.6 MB)
> downloaded 1.6 MB
>
> Just a guess, but does this have to do with presetting my work directory?
>
> setwd("C:/WHP/R/PracticeScripts and Testing Ideas")
>
> Here is my session info:
>
>
> > sessionInfo() #R version 3.4.4 (2018-03-15)
>
> R version 3.4.4 (2018-03-15)
>
> Platform: x86_64-w64-mingw32/x64 (64-bit)
>
> Running under: Windows 7 x64 (build 7601) Service Pack 1
>
>
> .libPaths() #"C:/Users/bp/Documents/R/R-3.4.4/library"
>
> [1] "C:/Users/bp/Documents/R/R-3.4.4/library"
>
>
> Thank you for any advice.
>
> WHP
>
> Confidentiality Notice This message is sent from Zelis. ...{{dropped:15}}
>
> __
> 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] Help with "ERROR: lazy loading failed for package 'psycho'"

2018-06-06 Thread Bill Poling
Good morning. In my continuing pursuit of self-taught R programming I am 
interested in following the tutorial provided by Bloggers.com "Beautiful and 
Powerful Correlation Tables in R"


https://www.r-bloggers.com/beautiful-and-powerful-correlation-tables-in-r-2/ 3/

Although, I have hit a snag in the first step?

devtools::install_github("neuropsychology/psycho.R") # Install the newest 
version
library(psycho)
library(tidyverse)

I have installed both psycho & tidyverse pkgs, however, when I go to run the 
devtools::install_github("neuropsychology/psycho.R") piece I get this warning.

Downloading GitHub repo neuropsychology/psycho.R@master
from URL https://api.github.com/repos/neuropsychology/psycho.R/zipball/master
Installing psycho
"C:/Users/bp/DOCUME~1/R/R-34~1.4/bin/x64/R" --no-site-file --no-environ 
--no-save --no-restore --quiet CMD INSTALL  \
  
"C:/Users/bp/AppData/Local/Temp/RtmpCkkmhB/devtools25601693478c/neuropsychology-psycho.R-b62e316"
 --library="C:/Users/bp/Documents/R/R-3.4.4/library" --install-tests

* installing *source* package 'psycho' ...
** R
** data
*** moving datasets to lazyload DB
** inst
** tests
** preparing package for lazy loading
Error in loadNamespace(j <- i[[1L]], c(lib.loc, .libPaths()), versionCheck = 
vI[[j]]) :
  there is no package called 'Matrix'
ERROR: lazy loading failed for package 'psycho'
* removing 'C:/Users/bp/Documents/R/R-3.4.4/library/psycho'
* restoring previous 'C:/Users/bp/Documents/R/R-3.4.4/library/psycho'
In R CMD INSTALL
Installation failed: Command failed (1)
> install.packages("psycho")
trying URL 'https://cran.rstudio.com/bin/windows/contrib/3.4/psycho_0.2.3.zip'
Content type 'application/zip' length 1650628 bytes (1.6 MB)
downloaded 1.6 MB

Just a guess, but does this have to do with presetting my work directory?

setwd("C:/WHP/R/PracticeScripts and Testing Ideas")

Here is my session info:


> sessionInfo() #R version 3.4.4 (2018-03-15)

R version 3.4.4 (2018-03-15)

Platform: x86_64-w64-mingw32/x64 (64-bit)

Running under: Windows 7 x64 (build 7601) Service Pack 1


.libPaths() #"C:/Users/bp/Documents/R/R-3.4.4/library"

[1] "C:/Users/bp/Documents/R/R-3.4.4/library"


Thank you for any advice.

WHP

Confidentiality Notice This message is sent from Zelis. ...{{dropped:15}}

__
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] Help with Error Messages

2016-12-07 Thread Bert Gunter
Well, have you looked to see what:

https://cran.r-project.org/web/views/Spatial.html

has to offer? And, if so, why did you not follow their advice to post
on the r-sig-geo list; if not, you should consider posting there
rather than here.

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, Dec 7, 2016 at 9:53 AM, Jackson Hooten  wrote:
> Hello everyone,
> I am new to R and need help with a project I am currently running. I am
> tracking about 24 great white sharks in Mossel Bay South Africa. I wish to
> summarize these sharks' movements in and around the bay. In order to do
> that I have a shapefile of a map that I wish to import into R and use as a
> base layer to show the movements of the sharks. I have been searching
> everywhere online, but cannot seem to find anything that can show me how to
> import such a shapefile. Any advise?
>
> On top of that, I also wish to do a kernel density estimation of these
> sharks' movements on the map. My data consists of "x" and "y" (Latitude and
> Longitude) coordinates of where the sharks pinged, the date, and their ID.
> So far, I have been able to figure out some codes that will get me what I
> need as far as the kernel density estimations go.
>
> Code example:
>> kud.href<-kernelUD(shark.sp[,"id"], h="href", hlim=c(0.01,0.5), grid=500,
> extent=0.1)
>> image(kud.href,col=rev(heat.colors(50)))
>
> However, whenever I run this code:
>> kud95<-getverticeshr(kud,percent=95)
> I get this error message:
> Error in getverticeshr.estUD(x[[i]], percent, ida = names(x)[i], unin,  :
>   The grid is too small to allow the estimation of home-range.
> You should rerun kernelUD with a larger extent parameter
>
> Could anyone advise me on how to solve this problem? I have already tried
> to increase the "grid" as well as the "extent parameter" but continuously
> get this same error message. I read online somewhere, that one could use
> the "SpatialPixels" function to solve the problem, but they never put an
> example up, so I have no idea how to apply it. Thank you so much for your
> patience and assistance.
>
> Sincerely,
> Jackson
>
> [[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] Help with Error Messages

2016-12-07 Thread Jackson Hooten
Hello everyone,
I am new to R and need help with a project I am currently running. I am
tracking about 24 great white sharks in Mossel Bay South Africa. I wish to
summarize these sharks' movements in and around the bay. In order to do
that I have a shapefile of a map that I wish to import into R and use as a
base layer to show the movements of the sharks. I have been searching
everywhere online, but cannot seem to find anything that can show me how to
import such a shapefile. Any advise?

On top of that, I also wish to do a kernel density estimation of these
sharks' movements on the map. My data consists of "x" and "y" (Latitude and
Longitude) coordinates of where the sharks pinged, the date, and their ID.
So far, I have been able to figure out some codes that will get me what I
need as far as the kernel density estimations go.

Code example:
> kud.href<-kernelUD(shark.sp[,"id"], h="href", hlim=c(0.01,0.5), grid=500,
extent=0.1)
> image(kud.href,col=rev(heat.colors(50)))

However, whenever I run this code:
> kud95<-getverticeshr(kud,percent=95)
I get this error message:
Error in getverticeshr.estUD(x[[i]], percent, ida = names(x)[i], unin,  :
  The grid is too small to allow the estimation of home-range.
You should rerun kernelUD with a larger extent parameter

Could anyone advise me on how to solve this problem? I have already tried
to increase the "grid" as well as the "extent parameter" but continuously
get this same error message. I read online somewhere, that one could use
the "SpatialPixels" function to solve the problem, but they never put an
example up, so I have no idea how to apply it. Thank you so much for your
patience and assistance.

Sincerely,
Jackson

[[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] Help with error: arguments imply differing number of rows

2015-03-18 Thread Aman Gill
I did notice those differences, but I presumed they reflected different
values in each of the two objects, rather than a difference in the
structure of the objects, which I assume to be the cause of the error. For
example, the tip.label structure for each object is the same [1:9]
although each has different values (plant tribe names).

Would you mind explaining how these differences might pertain to the error
of arguments imply differing number of rows? I am not a very experienced
R user so I may be missing something here.

On Sat, Mar 14, 2015 at 11:44 AM, Boris Steipe boris.ste...@utoronto.ca
wrote:

 Not the same. Read carefully...

  $ edge   : int [1:15, 1:2] 10 11 12 13 14 14 13 12 15 15 ...
  $ edge   : int [1:15, 1:2] 10 11 12 13 14 15 15 14 16 16 ...
 ^^... etc

 B.


 On Mar 14, 2015, at 11:34 AM, Aman Gill ama...@gmail.com wrote:

  Thanks for the reply. The results of str() are indeed the same. Is there
  anything else I can check that might explain the difference?
 
  str(phyl_tree)
  List of 4
  $ edge   : int [1:15, 1:2] 10 11 12 13 14 14 13 12 15 15 ...
  $ Nnode  : int 7
  $ tip.label  : chr [1:9] Heliantheae Eupatorieae Helenieae
  Gnaphalieae ...
  $ edge.length: num [1:15] 1 1 1 1 1 1 2 1 2 1 ...
  - attr(*, class)= chr phylo
  - attr(*, order)= chr cladewise
 
  str(chem_tree)
  List of 4
  $ edge   : int [1:15, 1:2] 10 11 12 13 14 15 15 14 16 16 ...
  $ Nnode  : int 7
  $ tip.label  : chr [1:9] Heliantheae Helenieae Eupatorieae
  Astereae ...
  $ edge.length: num [1:15] 1 2 1 1 1 1 1 1 1 1 ...
  - attr(*, class)= chr phylo
  - attr(*, order)= chr cladewise
 
  str(phyl_data)
  int [1:35, 1:9] 0 0 0 1 0 0 0 0 0 1 ...
  - attr(*, dimnames)=List of 2
   ..$ : chr [1:35] Uroleucon_aeneum Uroleucon_aff_atripes
  Uroleucon_amamianum Uroleucon_ambrosiae ...
   ..$ : chr [1:9] Heliantheae Eupatorieae Helenieae Gnaphalieae
 ...
 
  str(chem_data)
  int [1:35, 1:9] 0 0 0 1 0 0 0 0 0 1 ...
  - attr(*, dimnames)=List of 2
   ..$ : chr [1:35] Uroleucon_aeneum Uroleucon_aff_atripes
  Uroleucon_amamianum Uroleucon_ambrosiae ...
   ..$ : chr [1:9] Heliantheae Helenieae Eupatorieae Astereae ...
 
 
  On Fri, Mar 13, 2015 at 7:31 AM, PIKAL Petr petr.pi...@precheza.cz
 wrote:
 
  Hi
 
  Without further information you probably do not get answers. Everything
  seems to be same so the only reason can be that the objects seems to be
  same but they have some inner distinctions, maybe type of variables.
 
  Are results of
 
  str(your.objects)
 
  same in equivalent objects?
 
  Cheers
  Petr
 
  -Original Message-
  From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Aman
  Gill
  Sent: Thursday, March 12, 2015 6:08 PM
  To: r-help@r-project.org
  Subject: [R] Help with error: arguments imply differing number of rows
 
  Hello,
 
  I am stuck trying to run an analysis using the package picante. I am
  running two very similar analyses. One works as expected, but when I
  try
  the other, I get the error:
 
  Error in data.frame(PD = PDs, SR = SR) :
   arguments imply differing number of rows: 34, 35
 
  This is strange to me since the data matrix is the same for both
  analyses
  (numbers of rows and columns are the same; the only difference is the
  order
  of the columns). Each analyses requires a phylogenetic tree (.tre
  file),
  and each tree is very similar. Any thoughts as to what's causing this
  problem? The problem may be specific to the function I'm using [pd()],
  but
  since the error is a data.frame error I thought I'd ask here. Here is
  the
  code I'm using:
 
  This works:
  phyl_tree - read.nexus(phyl.tre)
  phyl_data - as.matrix(read.table(phyl_matrix.txt), header=TRUE, sep
  =
  \t)
  pd.result - pd(phyl_data, phyl_tree, include.root = TRUE)
 
  This fails (this matrix.txt file is the same as above, except that
  columns
  are ordered to match the tree; I have also used the above matrix.txt
  file)
  chem_tree - read.nexus(chem.tre)
  chem_data - as.matrix(read.table(chem_matrix.txt), header=TRUE, sep
  =
  \t)
  pd_chem.result - pd(chem_data, chem_tree, include.root = TRUE)
 
  ERROR:
  Error in data.frame(PD = PDs, SR = SR) :
   arguments imply differing number of rows: 34, 35
 
 
  To illustrate that the data for each run are very similar (row and
  column
  names are also the same in both data files):
 
  phyl_tree
 
  Phylogenetic tree with 9 tips and 7 internal nodes.
 
  Tip labels:
  Heliantheae, Eupatorieae, Helenieae, Gnaphalieae, Anthemideae,
  Astereae, ...
  Node labels:
  root, minCyn, minCic, HelEurHel, HelEur, GnaAnthAst, ...
 
  Rooted; includes branch lengths.
 
  nrow(phyl_data)
  [1] 35
  ncol(phyl_data)
  [1] 9
  class(phyl_data)
  [1] matrix
 
 
  chem_tree
 
  Phylogenetic tree with 9 tips and 7 internal nodes.
 
  Tip labels:
  Heliantheae, Helenieae, Eupatorieae, Astereae, Gnaphlieae, Senecioneae,
  ...
  Node labels:
  root, minC, minAnth, minSen, minGna, HelHel

Re: [R] Help with error: arguments imply differing number of rows

2015-03-18 Thread MacQueen, Don
If this error had happened to me, then immediately after receiving that
error I would type
   traceback()
at the R prompt. Hopefully, that will provide some information about what
happened.

Based on:

Error in data.frame(PD = PDs, SR = SR) :
  arguments imply differing number of rows: 34, 35

It appears that PDs and SR, whatever they are (referring to the versions
on the right hand side of the equals sign), have or imply different
numbers of rows. For example, PDs could be a vector of length 34 and SR a
vector of length 35. Your task is to figure out how they got constructed
inside the pd() function, which will lead to why they are different. This
will require some understanding of what happens inside the pd() function,
and there, unfortunately, I can't help you.

Typing
  pd
at the R prompt might reveal the entire definition of the pd() function,
from which you might be able to trace the calculations.


-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 3/12/15, 10:07 AM, Aman Gill ama...@gmail.com wrote:

Hello,

I am stuck trying to run an analysis using the package picante. I am
running two very similar analyses. One works as expected, but when I try
the other, I get the error:

Error in data.frame(PD = PDs, SR = SR) :
  arguments imply differing number of rows: 34, 35

This is strange to me since the data matrix is the same for both analyses
(numbers of rows and columns are the same; the only difference is the
order
of the columns). Each analyses requires a phylogenetic tree (.tre file),
and each tree is very similar. Any thoughts as to what's causing this
problem? The problem may be specific to the function I'm using [pd()], but
since the error is a data.frame error I thought I'd ask here. Here is the
code I'm using:

This works:
phyl_tree - read.nexus(phyl.tre)
phyl_data - as.matrix(read.table(phyl_matrix.txt), header=TRUE, sep =
\t)
pd.result - pd(phyl_data, phyl_tree, include.root = TRUE)

This fails (this matrix.txt file is the same as above, except that columns
are ordered to match the tree; I have also used the above matrix.txt file)
chem_tree - read.nexus(chem.tre)
chem_data - as.matrix(read.table(chem_matrix.txt), header=TRUE, sep =
\t)
pd_chem.result - pd(chem_data, chem_tree, include.root = TRUE)

ERROR:
Error in data.frame(PD = PDs, SR = SR) :
  arguments imply differing number of rows: 34, 35


To illustrate that the data for each run are very similar (row and column
names are also the same in both data files):

 phyl_tree

Phylogenetic tree with 9 tips and 7 internal nodes.

Tip labels:
Heliantheae, Eupatorieae, Helenieae, Gnaphalieae, Anthemideae, Astereae,
...
Node labels:
root, minCyn, minCic, HelEurHel, HelEur, GnaAnthAst, ...

Rooted; includes branch lengths.

 nrow(phyl_data)
[1] 35
 ncol(phyl_data)
[1] 9
 class(phyl_data)
[1] matrix


 chem_tree

Phylogenetic tree with 9 tips and 7 internal nodes.

Tip labels:
Heliantheae, Helenieae, Eupatorieae, Astereae, Gnaphlieae, Senecioneae,
...
Node labels:
root, minC, minAnth, minSen, minGna, HelHel, ...

Rooted; includes branch lengths.

 nrow(chem_data)
[1] 35
 ncol(chem_data)
[1] 9
 class(chem_data)
[1] matrix

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


Re: [R] Help with error: arguments imply differing number of rows

2015-03-14 Thread Aman Gill
Thanks for the reply. The results of str() are indeed the same. Is there
anything else I can check that might explain the difference?

 str(phyl_tree)
List of 4
 $ edge   : int [1:15, 1:2] 10 11 12 13 14 14 13 12 15 15 ...
 $ Nnode  : int 7
 $ tip.label  : chr [1:9] Heliantheae Eupatorieae Helenieae
Gnaphalieae ...
 $ edge.length: num [1:15] 1 1 1 1 1 1 2 1 2 1 ...
 - attr(*, class)= chr phylo
 - attr(*, order)= chr cladewise

 str(chem_tree)
List of 4
 $ edge   : int [1:15, 1:2] 10 11 12 13 14 15 15 14 16 16 ...
 $ Nnode  : int 7
 $ tip.label  : chr [1:9] Heliantheae Helenieae Eupatorieae
Astereae ...
 $ edge.length: num [1:15] 1 2 1 1 1 1 1 1 1 1 ...
 - attr(*, class)= chr phylo
 - attr(*, order)= chr cladewise

 str(phyl_data)
 int [1:35, 1:9] 0 0 0 1 0 0 0 0 0 1 ...
 - attr(*, dimnames)=List of 2
  ..$ : chr [1:35] Uroleucon_aeneum Uroleucon_aff_atripes
Uroleucon_amamianum Uroleucon_ambrosiae ...
  ..$ : chr [1:9] Heliantheae Eupatorieae Helenieae Gnaphalieae ...

 str(chem_data)
 int [1:35, 1:9] 0 0 0 1 0 0 0 0 0 1 ...
 - attr(*, dimnames)=List of 2
  ..$ : chr [1:35] Uroleucon_aeneum Uroleucon_aff_atripes
Uroleucon_amamianum Uroleucon_ambrosiae ...
  ..$ : chr [1:9] Heliantheae Helenieae Eupatorieae Astereae ...


On Fri, Mar 13, 2015 at 7:31 AM, PIKAL Petr petr.pi...@precheza.cz wrote:

 Hi

 Without further information you probably do not get answers. Everything
 seems to be same so the only reason can be that the objects seems to be
 same but they have some inner distinctions, maybe type of variables.

 Are results of

 str(your.objects)

 same in equivalent objects?

 Cheers
 Petr

  -Original Message-
  From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Aman
  Gill
  Sent: Thursday, March 12, 2015 6:08 PM
  To: r-help@r-project.org
  Subject: [R] Help with error: arguments imply differing number of rows
 
  Hello,
 
  I am stuck trying to run an analysis using the package picante. I am
  running two very similar analyses. One works as expected, but when I
  try
  the other, I get the error:
 
  Error in data.frame(PD = PDs, SR = SR) :
arguments imply differing number of rows: 34, 35
 
  This is strange to me since the data matrix is the same for both
  analyses
  (numbers of rows and columns are the same; the only difference is the
  order
  of the columns). Each analyses requires a phylogenetic tree (.tre
  file),
  and each tree is very similar. Any thoughts as to what's causing this
  problem? The problem may be specific to the function I'm using [pd()],
  but
  since the error is a data.frame error I thought I'd ask here. Here is
  the
  code I'm using:
 
  This works:
  phyl_tree - read.nexus(phyl.tre)
  phyl_data - as.matrix(read.table(phyl_matrix.txt), header=TRUE, sep
  =
  \t)
  pd.result - pd(phyl_data, phyl_tree, include.root = TRUE)
 
  This fails (this matrix.txt file is the same as above, except that
  columns
  are ordered to match the tree; I have also used the above matrix.txt
  file)
  chem_tree - read.nexus(chem.tre)
  chem_data - as.matrix(read.table(chem_matrix.txt), header=TRUE, sep
  =
  \t)
  pd_chem.result - pd(chem_data, chem_tree, include.root = TRUE)
 
  ERROR:
  Error in data.frame(PD = PDs, SR = SR) :
arguments imply differing number of rows: 34, 35
 
 
  To illustrate that the data for each run are very similar (row and
  column
  names are also the same in both data files):
 
   phyl_tree
 
  Phylogenetic tree with 9 tips and 7 internal nodes.
 
  Tip labels:
  Heliantheae, Eupatorieae, Helenieae, Gnaphalieae, Anthemideae,
  Astereae, ...
  Node labels:
  root, minCyn, minCic, HelEurHel, HelEur, GnaAnthAst, ...
 
  Rooted; includes branch lengths.
 
   nrow(phyl_data)
  [1] 35
   ncol(phyl_data)
  [1] 9
   class(phyl_data)
  [1] matrix
 
 
   chem_tree
 
  Phylogenetic tree with 9 tips and 7 internal nodes.
 
  Tip labels:
  Heliantheae, Helenieae, Eupatorieae, Astereae, Gnaphlieae, Senecioneae,
  ...
  Node labels:
  root, minC, minAnth, minSen, minGna, HelHel, ...
 
  Rooted; includes branch lengths.
 
   nrow(chem_data)
  [1] 35
   ncol(chem_data)
  [1] 9
   class(chem_data)
  [1] matrix
 
[[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.

 
 Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou
 určeny pouze jeho adresátům.
 Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě
 neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie
 vymažte ze svého systému.
 Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email
 jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
 Odesílatel e-mailu neodpovídá za

Re: [R] Help with error: arguments imply differing number of rows

2015-03-14 Thread Boris Steipe
Not the same. Read carefully...
   
 $ edge   : int [1:15, 1:2] 10 11 12 13 14 14 13 12 15 15 ...
 $ edge   : int [1:15, 1:2] 10 11 12 13 14 15 15 14 16 16 ...
^^... etc

B.


On Mar 14, 2015, at 11:34 AM, Aman Gill ama...@gmail.com wrote:

 Thanks for the reply. The results of str() are indeed the same. Is there
 anything else I can check that might explain the difference?
 
 str(phyl_tree)
 List of 4
 $ edge   : int [1:15, 1:2] 10 11 12 13 14 14 13 12 15 15 ...
 $ Nnode  : int 7
 $ tip.label  : chr [1:9] Heliantheae Eupatorieae Helenieae
 Gnaphalieae ...
 $ edge.length: num [1:15] 1 1 1 1 1 1 2 1 2 1 ...
 - attr(*, class)= chr phylo
 - attr(*, order)= chr cladewise
 
 str(chem_tree)
 List of 4
 $ edge   : int [1:15, 1:2] 10 11 12 13 14 15 15 14 16 16 ...
 $ Nnode  : int 7
 $ tip.label  : chr [1:9] Heliantheae Helenieae Eupatorieae
 Astereae ...
 $ edge.length: num [1:15] 1 2 1 1 1 1 1 1 1 1 ...
 - attr(*, class)= chr phylo
 - attr(*, order)= chr cladewise
 
 str(phyl_data)
 int [1:35, 1:9] 0 0 0 1 0 0 0 0 0 1 ...
 - attr(*, dimnames)=List of 2
  ..$ : chr [1:35] Uroleucon_aeneum Uroleucon_aff_atripes
 Uroleucon_amamianum Uroleucon_ambrosiae ...
  ..$ : chr [1:9] Heliantheae Eupatorieae Helenieae Gnaphalieae ...
 
 str(chem_data)
 int [1:35, 1:9] 0 0 0 1 0 0 0 0 0 1 ...
 - attr(*, dimnames)=List of 2
  ..$ : chr [1:35] Uroleucon_aeneum Uroleucon_aff_atripes
 Uroleucon_amamianum Uroleucon_ambrosiae ...
  ..$ : chr [1:9] Heliantheae Helenieae Eupatorieae Astereae ...
 
 
 On Fri, Mar 13, 2015 at 7:31 AM, PIKAL Petr petr.pi...@precheza.cz wrote:
 
 Hi
 
 Without further information you probably do not get answers. Everything
 seems to be same so the only reason can be that the objects seems to be
 same but they have some inner distinctions, maybe type of variables.
 
 Are results of
 
 str(your.objects)
 
 same in equivalent objects?
 
 Cheers
 Petr
 
 -Original Message-
 From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Aman
 Gill
 Sent: Thursday, March 12, 2015 6:08 PM
 To: r-help@r-project.org
 Subject: [R] Help with error: arguments imply differing number of rows
 
 Hello,
 
 I am stuck trying to run an analysis using the package picante. I am
 running two very similar analyses. One works as expected, but when I
 try
 the other, I get the error:
 
 Error in data.frame(PD = PDs, SR = SR) :
  arguments imply differing number of rows: 34, 35
 
 This is strange to me since the data matrix is the same for both
 analyses
 (numbers of rows and columns are the same; the only difference is the
 order
 of the columns). Each analyses requires a phylogenetic tree (.tre
 file),
 and each tree is very similar. Any thoughts as to what's causing this
 problem? The problem may be specific to the function I'm using [pd()],
 but
 since the error is a data.frame error I thought I'd ask here. Here is
 the
 code I'm using:
 
 This works:
 phyl_tree - read.nexus(phyl.tre)
 phyl_data - as.matrix(read.table(phyl_matrix.txt), header=TRUE, sep
 =
 \t)
 pd.result - pd(phyl_data, phyl_tree, include.root = TRUE)
 
 This fails (this matrix.txt file is the same as above, except that
 columns
 are ordered to match the tree; I have also used the above matrix.txt
 file)
 chem_tree - read.nexus(chem.tre)
 chem_data - as.matrix(read.table(chem_matrix.txt), header=TRUE, sep
 =
 \t)
 pd_chem.result - pd(chem_data, chem_tree, include.root = TRUE)
 
 ERROR:
 Error in data.frame(PD = PDs, SR = SR) :
  arguments imply differing number of rows: 34, 35
 
 
 To illustrate that the data for each run are very similar (row and
 column
 names are also the same in both data files):
 
 phyl_tree
 
 Phylogenetic tree with 9 tips and 7 internal nodes.
 
 Tip labels:
 Heliantheae, Eupatorieae, Helenieae, Gnaphalieae, Anthemideae,
 Astereae, ...
 Node labels:
 root, minCyn, minCic, HelEurHel, HelEur, GnaAnthAst, ...
 
 Rooted; includes branch lengths.
 
 nrow(phyl_data)
 [1] 35
 ncol(phyl_data)
 [1] 9
 class(phyl_data)
 [1] matrix
 
 
 chem_tree
 
 Phylogenetic tree with 9 tips and 7 internal nodes.
 
 Tip labels:
 Heliantheae, Helenieae, Eupatorieae, Astereae, Gnaphlieae, Senecioneae,
 ...
 Node labels:
 root, minC, minAnth, minSen, minGna, HelHel, ...
 
 Rooted; includes branch lengths.
 
 nrow(chem_data)
 [1] 35
 ncol(chem_data)
 [1] 9
 class(chem_data)
 [1] matrix
 
  [[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.
 
 
 Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou
 určeny pouze jeho adresátům.
 Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě

Re: [R] Help with error: arguments imply differing number of rows

2015-03-13 Thread PIKAL Petr
Hi

Without further information you probably do not get answers. Everything seems 
to be same so the only reason can be that the objects seems to be same but they 
have some inner distinctions, maybe type of variables.

Are results of

str(your.objects)

same in equivalent objects?

Cheers
Petr

 -Original Message-
 From: R-help [mailto:r-help-boun...@r-project.org] On Behalf Of Aman
 Gill
 Sent: Thursday, March 12, 2015 6:08 PM
 To: r-help@r-project.org
 Subject: [R] Help with error: arguments imply differing number of rows

 Hello,

 I am stuck trying to run an analysis using the package picante. I am
 running two very similar analyses. One works as expected, but when I
 try
 the other, I get the error:

 Error in data.frame(PD = PDs, SR = SR) :
   arguments imply differing number of rows: 34, 35

 This is strange to me since the data matrix is the same for both
 analyses
 (numbers of rows and columns are the same; the only difference is the
 order
 of the columns). Each analyses requires a phylogenetic tree (.tre
 file),
 and each tree is very similar. Any thoughts as to what's causing this
 problem? The problem may be specific to the function I'm using [pd()],
 but
 since the error is a data.frame error I thought I'd ask here. Here is
 the
 code I'm using:

 This works:
 phyl_tree - read.nexus(phyl.tre)
 phyl_data - as.matrix(read.table(phyl_matrix.txt), header=TRUE, sep
 =
 \t)
 pd.result - pd(phyl_data, phyl_tree, include.root = TRUE)

 This fails (this matrix.txt file is the same as above, except that
 columns
 are ordered to match the tree; I have also used the above matrix.txt
 file)
 chem_tree - read.nexus(chem.tre)
 chem_data - as.matrix(read.table(chem_matrix.txt), header=TRUE, sep
 =
 \t)
 pd_chem.result - pd(chem_data, chem_tree, include.root = TRUE)

 ERROR:
 Error in data.frame(PD = PDs, SR = SR) :
   arguments imply differing number of rows: 34, 35


 To illustrate that the data for each run are very similar (row and
 column
 names are also the same in both data files):

  phyl_tree

 Phylogenetic tree with 9 tips and 7 internal nodes.

 Tip labels:
 Heliantheae, Eupatorieae, Helenieae, Gnaphalieae, Anthemideae,
 Astereae, ...
 Node labels:
 root, minCyn, minCic, HelEurHel, HelEur, GnaAnthAst, ...

 Rooted; includes branch lengths.

  nrow(phyl_data)
 [1] 35
  ncol(phyl_data)
 [1] 9
  class(phyl_data)
 [1] matrix


  chem_tree

 Phylogenetic tree with 9 tips and 7 internal nodes.

 Tip labels:
 Heliantheae, Helenieae, Eupatorieae, Astereae, Gnaphlieae, Senecioneae,
 ...
 Node labels:
 root, minC, minAnth, minSen, minGna, HelHel, ...

 Rooted; includes branch lengths.

  nrow(chem_data)
 [1] 35
  ncol(chem_data)
 [1] 9
  class(chem_data)
 [1] matrix

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


Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail

[R] Help with error: arguments imply differing number of rows

2015-03-12 Thread Aman Gill
Hello,

I am stuck trying to run an analysis using the package picante. I am
running two very similar analyses. One works as expected, but when I try
the other, I get the error:

Error in data.frame(PD = PDs, SR = SR) :
  arguments imply differing number of rows: 34, 35

This is strange to me since the data matrix is the same for both analyses
(numbers of rows and columns are the same; the only difference is the order
of the columns). Each analyses requires a phylogenetic tree (.tre file),
and each tree is very similar. Any thoughts as to what's causing this
problem? The problem may be specific to the function I'm using [pd()], but
since the error is a data.frame error I thought I'd ask here. Here is the
code I'm using:

This works:
phyl_tree - read.nexus(phyl.tre)
phyl_data - as.matrix(read.table(phyl_matrix.txt), header=TRUE, sep =
\t)
pd.result - pd(phyl_data, phyl_tree, include.root = TRUE)

This fails (this matrix.txt file is the same as above, except that columns
are ordered to match the tree; I have also used the above matrix.txt file)
chem_tree - read.nexus(chem.tre)
chem_data - as.matrix(read.table(chem_matrix.txt), header=TRUE, sep =
\t)
pd_chem.result - pd(chem_data, chem_tree, include.root = TRUE)

ERROR:
Error in data.frame(PD = PDs, SR = SR) :
  arguments imply differing number of rows: 34, 35


To illustrate that the data for each run are very similar (row and column
names are also the same in both data files):

 phyl_tree

Phylogenetic tree with 9 tips and 7 internal nodes.

Tip labels:
Heliantheae, Eupatorieae, Helenieae, Gnaphalieae, Anthemideae, Astereae, ...
Node labels:
root, minCyn, minCic, HelEurHel, HelEur, GnaAnthAst, ...

Rooted; includes branch lengths.

 nrow(phyl_data)
[1] 35
 ncol(phyl_data)
[1] 9
 class(phyl_data)
[1] matrix


 chem_tree

Phylogenetic tree with 9 tips and 7 internal nodes.

Tip labels:
Heliantheae, Helenieae, Eupatorieae, Astereae, Gnaphlieae, Senecioneae, ...
Node labels:
root, minC, minAnth, minSen, minGna, HelHel, ...

Rooted; includes branch lengths.

 nrow(chem_data)
[1] 35
 ncol(chem_data)
[1] 9
 class(chem_data)
[1] matrix

[[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] Help on error (Error: could not find function kernelUD)

2013-11-06 Thread jwd
On Tue, 5 Nov 2013 16:22:26 -0700
Angela Dwyer angela.dw...@rmbo.org wrote:

You didn't forget to load the library did you?  The bit of output you
provide doesn't show a library(adehabitat) line.  That needs to be run
before the function can be found.

JWDougherty

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


[R] Help on error (Error: could not find function kernelUD)

2013-11-05 Thread Angela Dwyer
Hello,

I am working through examples of generating Home Range using the
adehabitatHR package. Everything is going fine until I load the code for the
kernelUD function, it looks like this;

 data(puechabonsp)
 kud - kernelUD(puechabonsp$relocs[,1], h=href)
 kud

I then get an error of; Error: could not find function kernelUD

Any thoughts on what I am doing wrong to get this error, should that
function be built into the package?

Thanks!

Angela (aka very new to R)

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


[R] help with error: DV converted to a factor

2013-01-17 Thread cwladis
I've spent several days compiling the following code (I apologize in advance
- this code is very inelegant, and I'm sure could be written much more
efficiently, but I've stuck with whatever method I could get to work -
sometimes the more efficient code I just couldn't get to work without an
error, because of my R inexperience).  

My main motivation for writing the code is that I'd like to be able to
assess interaction effects, and so I want to be able to rotate through the
reference values so that I can assess different interaction effects than
simply the default ones reported by the single set of reference values given
in a single analysis.  The code below generates a lot more than that, but
since I am such an R newbie (and therefore struggling to learn so many
different things at once) I thought that if I could just generate one bit
matrix with all the pairwise comparisons, I could then pick out the stuff I
actually want later (probably just manually at first, but later hopefully by
automating my code to return a matrix with just the comparisons I want).

Here is the code:
DV-factors[,1]
IV-factors[,2]
int-factors[,3]
IV-IV[!is.na(IV)]
int-int[!is.na(int)]
#Limit our modification of reference values to categorical variables only by
redefining IV vector as IVcat
IVcat-IV
for(p in 1:length(IV)){

if((class(dataset[[toString(IV[p])]])==character)|(class(dataset[[toString(IV[p])]])==factor)){
IVcat[p]-IV[p]
}
else{IVcat[p]-}
}
IVcat-IVcat[!is.na(IVcat)]
#Create vectors (IVvalslist[n] for nth factor) for each IVcat containing
each possible value for that IV
IVvalslist-vector('list', length(IVcat))
for(i in 1:length(IVcat)){

assign(paste(IVvalues,i,sep=),unique(dataset[[toString(IVcat[i])]])[!is.na(unique(dataset[[toString(IVcat[i])]]))])
IVvalslist[i]-list(get(paste(IVvalues,i,sep=)))
}
#Create a data frame (refM) with every combination of values for each IVcat
refM-expand.grid(IVvalslist)
#Loop through all possible reference values, and then run the model, 
#and then compile the model summary output into a single matrix
#Go through each row of the matrix of possible reference value 
combinations 
for(j in 1:nrow(refM)){
#Go through each reference value for each factor in that row, 
and assign
#that reference value for that factor
for(k in 1:length(IVcat)){
dataset[[ toString(IVcat[k]) ]]-relevel(dataset[[ 
toString(IVcat[k])
]],ref=toString(refM[j,k]))
}
#Run model with new reference values from row j

model-paste(paste(DV[1],~1,sep=),paste(IV,collapse=+),paste(int,collapse=+),sep=+)

modeloutput-glm(model,family=binomial(logit),data=dataset)
#assigning all output from every possible combo of ref 
values to a single
matrix named coeffM
if(j==1){coeffM-coef(summary(modeloutput))}

if(j1){coeffM-rbind(coeffM,coef(summary(modeloutput)))}
}


*I tested each step of the code individually, and each individual step runs
fine.  However, when I run the whole set of code at once, I get the
following error message after the last line of R input above:

Warning in model.matrix.default(mt, mf, contrasts) :
  variable 'retention' converted to a factor
Error in weights * y : non-numeric argument to binary operator

And if I ask for R to return coeffM or modeloutput, it tells me that no such
objects exist.  *

The object factors is as follows:
 factors
   var1   var2 var3
1 retention method method*level
2  NA  level NA
3  NAgpa NA

And I can't give the actual dataset (named dataset above) here for human
subject reasons, but here is a made-up sample of what it looks like:

id  instructor   method success retention  levelcareer
1 1001  NAME1   online 1 1   LL 
  
career
2 1002  NAME2   face-to-face   1 1  UL  
lib. arts

  STEM required ethnicity   
   
gender age finaid  gpa
1 non-STEM  electiveAsian or Pacific Islander  M
 
28   1.97
2 non-STEM  maj. req.  Asian or Pacific Islander  F 

21   none3.01

  experiencecreditsyrsenrolled  course
1 no online exp.  22   1   NAME1_MAT100
2 no online exp.  33   2   NAME2_ENG100

If anyone can help me figure out what is going wrong here, I'd be incredibly
grateful!  I've tried searching repeatedly for this error, and the other
instances that I've found 

[R] help r error the integral is probably divergent

2012-05-22 Thread jlmdanderson
I constructed a likelihood function and then use optim to slove the mle.  It
gave the error like:
 LBCE.est-optim(c(2,2,1),LBCE,hessian=T)
Error in integrate(LBCE.fc.4.1, lower = 0, upper = Inf) : 
  the integral is probably divergent


However, when I checked the the function of LBCE.fc.4.1, it can generante
values with various pamameters.  
 LBCE.fc.4-integrate(LBCE.fc.4.1,lower=0,upper=Inf)$value
 LBCE.fc.4
[1] 1.047198

don't know how to check the error and solve the problem.

Please help me !

--
View this message in context: 
http://r.789695.n4.nabble.com/help-r-error-the-integral-is-probably-divergent-tp4631002.html
Sent from the R help mailing list archive at Nabble.com.

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



Re: [R] Help needed! Error in setwd(newdir) : cannot change working directory

2012-02-26 Thread R. Michael Weylandt
This is a mess -- please resend in plain text.

Also, there are not, to my knowledge, packages (not libraries) called
A, B, or C so your script doesn't even begin to look
reproducible were it legible.

Do you have read/write access to the directories in question?

Michael

On Sat, Feb 25, 2012 at 11:25 PM, ying chen ying_c...@live.com wrote:

 Hi Guys,

 I am new to R and just trying to write a small script to automate a couple 
 commands. But I run into the setwd(): cannot change working directory.
 I googled a little bit and tried all fixes/suggestions with no success.
 Basically I have a script that works from inside a directory with my data 
 (/home/sean/Rtest/Data01). Now I want to modify the script to make it run 
 from the upper directory (/home/sean/Rtest) because I have many data 
 directories under /Rtest, such as /home/sean/Rtest/Data01, 
 /home/sean/Rtest/Data02, /home/sean/Rtest/Data03,.
 I want to modify my script so that it will run from /Rtest, and with the data 
 directory name as arg passed to my R script. Here is my mytest02.R script:
# retrieve argsargs - commandArgs(TRUE);# store the current 
directoryinitial.dir - getwd();newdir - 
paste(initial.dir,args,sep=/);outfilename - 
paste(args,out,sep=.);# change to the new directorysetwd(newdir);# 
load the necessary librarieslibrary(A);  
#library(B);library(C);# set the output 
filesink(outfilename);    #data processing    #data 
processing    #data processing# close the output 
filesink();# unload the librariesdetach(package:A);  
#detach(package:B);detach(package:C);# change back to the original 
directorysetwd(initial.dir);
 Then I run the script by
sean@I7-3930K:~/Rtest$ R --slave --args Data01  mytest02.R
 I got the error message:
sean@I7-3930K:~/Rtest$ R --slave --args Data01  mytest02.RAttempting to 
load the environment ‘package:R.utils’Loading required package: 
R.methodsS3R.methodsS3 v1.2.1 (2010-09-18) successfully loaded. See 
?R.methodsS3 for help.Loading required package: utilsR.oo v1.8.3 
(2011-11-01) successfully loaded. See ?R.oo for help.Attaching package: 
‘R.oo’The following object(s) are masked from ‘package:R.methodsS3’: 
   throw.defaultThe following object(s) are masked from 
‘package:methods’:    getClass, getClasses, getMethodsThe following 
object(s) are masked from ‘package:base’:    attach, detach, 
environment, gc, load, saveR.utils v1.9.11 (2012-01-17) successfully 
loaded. See ?R.utils for help.Attaching package: ‘R.utils’The 
following object(s) are masked from ‘package:utils’:    timestampThe 
following object(s) are masked from ‘package:base’:    cat, commandArgs, 
getOption, inherits, isOpen, lapply, parse,    remove, warnings[1] 
/home/sean/Rtest[1] /home/sean/Rtest/NA       /home/sean/Rtest/TRUE  
  [3] /home/sean/Rtest/Data01[1] NA.out       TRUE.out     
Data01.outError in setwd(newdir) : cannot change working 
directoryExecution halted
 What did I do wrong?
 One more question, is there anyway to modify this script to make it work on 
 all data directories under /home/sean/Rtest by itself?
 Thanks a lot for the help!
 Ying

        [[alternative HTML version deleted]]


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


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


Re: [R] Help needed! Error in setwd(newdir) : cannot change working directory

2012-02-26 Thread ying chen





Hi,
I am sorry about the format it showed up. I do not know what happened as it 
looks fine when I read it using chrome on ubuntu 11.10 64bit. The packages A, 
B, C are not the real package names.  Basically I have  scriptA.R that works 
from inside a directory with my data (/home/sean/Rtest/Data01). Now I want to 
modify the script to make it run from the upper directory (/home/sean/Rtest) 
because I have many data directories under /Rtest, such as 
/home/sean/Rtest/Data01, /home/sean/Rtest/Data02, /home/sean/Rtest/Data03,. 
I want to modify my script so that it will run from /Rtest, and with the data 
directory name as arg passed to my R script. My point is that when I put the 
scriptA.R in data directory such as Data01, it works. Here are my scriptB.R 
script:
##scriptA.R#
# load the necessary librarieslibrary(A);  # A fake package namelibrary(B); 
 # B fake package namelibrary(C);  # C fake package name#data 
processing#data processing#data processing# unload the 
librariesdetach(package:A);  
detach(package:B);detach(package:C);q();###
But, when I tried to modify scriptA.R to scriptB.R to run it from the directory 
just above Data directories, I got the error message.
###scriptB.R###
# retrieve argsargs - commandArgs(TRUE);# store the current 
directoryinitial.dir - getwd();newdir - 
paste(initial.dir,args,sep=/);outfilename - paste(args,out,sep=.);# 
change to the new directorysetwd(newdir);# load the necessary 
librarieslibrary(A);  # A fake package namelibrary(B);  # B fake package 
namelibrary(C);  # C fake package name# set the output 
filesink(outfilename);#data processing#data 
processing#data processing# close the output filesink();# unload 
the librariesdetach(package:A);  #detach(package:B);detach(package:C);# 
change back to the original directorysetwd(initial.dir);
##
I run the scriptB.R by
sean@I7-3930K:~/Rtest$ R --slave --args Data01  scriptB.R
I got the error message:
sean@I7-3930K:~/Rtest$ R --slave --args Data01  scriptB.RAttempting to load 
the environment ‘package:R.utils’Loading required package: 
R.methodsS3R.methodsS3 v1.2.1 (2010-09-18) successfully loaded. See 
?R.methodsS3 for help.Loading required package: utilsR.oo v1.8.3 (2011-11-01) 
successfully loaded. See ?R.oo for help.
Attaching package: ‘R.oo’
The following object(s) are masked from ‘package:R.methodsS3’:
   throw.default
The following object(s) are masked from ‘package:methods’:
   getClass, getClasses, getMethods
The following object(s) are masked from ‘package:base’:
  attach, detach, environment, gc, load, save
R.utils v1.9.11 (2012-01-17) successfully loaded. See ?R.utils for help.
Attaching package: ‘R.utils’
The following object(s) are masked from ‘package:utils’:
timestamp
The following object(s) are masked from ‘package:base’:
cat, commandArgs, getOption, inherits, isOpen, lapply, parse,remove, 
warnings
[1] /home/sean/Rtest[1] /home/sean/Rtest/NA   /home/sean/Rtest/TRUE   
 [3] /home/sean/Rtest/Data01[1] NA.out   TRUE.out 
Data01.outError in setwd(newdir) : cannot change working directoryExecution 
halted
What did I do wrong? I think I have the right to read and write to the 
directories.
One more question, is there anyway to modify this script to make it work on all 
data directories under /home/sean/Rtest by itself?
Thanks a lot for the help!
Ying
sean@I7-3930K:~/Rtest$ ls -ltotal 56drwx-- 3 sean sean 4096 2012-02-25 
20:39 Data01drwx-- 2 sean sean 4096 2012-02-25 20:28 Data02drwx-- 2 
sean sean 4096 2012-02-26 07:41 Data03drwx-- 2 sean sean 4096 2012-02-25 
21:18 Data04drwx-- 2 sean sean 4096 2012-02-25 20:27 Data05-rw-r--r-- 1 
sean sean  437 2012-02-26 15:28 scriptA.R...
 From: michael.weyla...@gmail.com
 Date: Sun, 26 Feb 2012 12:48:57 -0500
 Subject: Re: [R] Help needed! Error in setwd(newdir) : cannot change working 
 directory
 To: ying_c...@live.com
 CC: r-help@r-project.org
 
 This is a mess -- please resend in plain text.
 
 Also, there are not, to my knowledge, packages (not libraries) called
 A, B, or C so your script doesn't even begin to look
 reproducible were it legible.
 
 Do you have read/write access to the directories in question?
 
 Michael
 
 On Sat, Feb 25, 2012 at 11:25 PM, ying chen ying_c...@live.com wrote:
 
  Hi Guys,
 
  I am new to R and just trying to write a small script to automate a couple 
  commands. But I run into the setwd(): cannot change working directory.
  I googled a little bit and tried all fixes/suggestions with no success.
  Basically I have a script that works from inside a directory with my data 
  (/home/sean/Rtest/Data01). Now I want to modify the script to make it run 
  from

Re: [R] Help needed! Error in setwd(newdir) : cannot change working directory

2012-02-26 Thread ying chen

Hi, 
 
I am sorry about the format it showed up. I do not know what happened as now it 
looks worse even on my own machine. I do not know what to do, I just add \n 
to the end of each line and hope it will come out OK this time. The packages A, 
B, C are not the real package names.  Basically I have  scriptA.R that works 
from inside a directory with my data (/home/sean/Rtest/Data01). Now I want to 
modify the script to make it run from the upper directory (/home/sean/Rtest) 
because I have many data directories under /Rtest, such as 
/home/sean/Rtest/Data01, /home/sean/Rtest/Data02, /home/sean/Rtest/Data03,. 
I want to modify my script so that it will run from /Rtest, and with the data 
directory name as arg passed to my R script. My point is that when I put the 
scriptA.R in data directory such as Data01, it works. Here are my scriptB.R 
script: 
 
##scriptA.R# 
 
# load the necessary libraries 
library(A);  # A fake package name 
library(B);  # B fake package name 
library(C);  # C fake package name 
#data processing 
#data processing 
#data processing 
# unload the libraries 
detach(package:A);   
detach(package:B); 
detach(package:C); 
q(); 
### 

But, when I tried to modify scriptA.R to scriptB.R to run it from the directory 
just above Data directories, I got the error message. 

###scriptB.R###

# retrieve args 
args - commandArgs(TRUE); 
# store the current directory 
initial.dir - getwd(); 
newdir - paste(initial.dir,args,sep=/); 
outfilename - paste(args,out,sep=.); 
# change to the new directory 
setwd(newdir); 
# load the necessary libraries 
library(A);  # A fake package name 
library(B);  # B fake package name 
library(C);  # C fake package name 
# set the output file 
sink(outfilename); 
#data processing 
#data processing 
#data processing 
# close the output file 
sink(); 
# unload the libraries 
detach(package:A);  # 
detach(package:B); 
detach(package:C); 
# change back to the original directory 
setwd(initial.dir); 

## 

I run the scriptB.R by 

sean@I7-3930K:~/Rtest$ R --slave --args Data01  scriptB.R 

I got the error message: 

sean@I7-3930K:~/Rtest$ R --slave --args Data01  scriptB.R 
Attempting to load the environment ‘package:R.utils’ 
Loading required package: R.methodsS3 
R.methodsS3 v1.2.1 (2010-09-18) successfully loaded. See ?R.methodsS3 for help. 
Loading required package: utils 
R.oo v1.8.3 (2011-11-01) successfully loaded. See ?R.oo for help. 

Attaching package: ‘R.oo’ 

The following object(s) are masked from ‘package:R.methodsS3’: 

   throw.default 

The following object(s) are masked from ‘package:methods’: 

   getClass, getClasses, getMethods 

The following object(s) are masked from ‘package:base’: 

  attach, detach, environment, gc, load, save 

R.utils v1.9.11 (2012-01-17) successfully loaded. See ?R.utils for help. 

Attaching package: ‘R.utils’ 

The following object(s) are masked from ‘package:utils’: 

timestamp 

The following object(s) are masked from ‘package:base’: 

cat, commandArgs, getOption, inherits, isOpen, lapply, parse, 
remove, warnings 

[1] /home/sean/Rtest 
[1] /home/sean/Rtest/NA   /home/sean/Rtest/TRUE 
[3] /home/sean/Rtest/Data01 
[1] NA.out   TRUE.out Data01.out 
Error in setwd(newdir) : cannot change working directory 
Execution halted 

What did I do wrong? I think I have the right to read and write to the 
directories. 

One more question, is there anyway to modify this script to make it work on all 
data directories under /home/sean/Rtest by itself? 

Thanks a lot for the help! 

Ying 

sean@I7-3930K:~/Rtest$ ls -l 
total 56 
drwx-- 3 sean sean 4096 2012-02-25 20:39 Data01 
drwx-- 2 sean sean 4096 2012-02-25 20:28 Data02 
drwx-- 2 sean sean 4096 2012-02-26 07:41 Data03 
drwx-- 2 sean sean 4096 2012-02-25 21:18 Data04 
drwx-- 2 sean sean 4096 2012-02-25 20:27 Data05 
-rw-r--r-- 1 sean sean  437 2012-02-26 15:28 scriptA.R 
... 

From: ying_c...@live.com
To: michael.weyla...@gmail.com
Date: Sun, 26 Feb 2012 16:00:20 -0500
CC: r-help@r-project.org
Subject: Re: [R] Help needed! Error in setwd(newdir) : cannot change working 
directory






Hi,
I am sorry about the format it showed up. I do not know what happened as it 
looks fine when I read it using chrome on ubuntu 11.10 64bit. The packages A, 
B, C are not the real package names.  Basically I have  scriptA.R that works 
from inside a directory with my data (/home/sean/Rtest/Data01). Now I want to 
modify the script to make it run from the upper directory (/home/sean/Rtest) 
because I have many data directories under /Rtest, such as 
/home/sean/Rtest/Data01, /home/sean/Rtest/Data02, /home/sean/Rtest/Data03

Re: [R] Help needed! Error in setwd(newdir) : cannot change working directory

2012-02-26 Thread Jeff Newmiller
Stop it with the fake code if you want help. In keeping with the posting 
guide, make one reproducible example that exhibits a real problem. For what it 
is worth, I don't have difficulty with setwd().
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

ying chen ying_c...@live.com wrote:






Hi,
I am sorry about the format it showed up. I do not know what happened
as it looks fine when I read it using chrome on ubuntu 11.10 64bit. The
packages A, B, C are not the real package names.  Basically I have 
scriptA.R that works from inside a directory with my data
(/home/sean/Rtest/Data01). Now I want to modify the script to make it
run from the upper directory (/home/sean/Rtest) because I have many
data directories under /Rtest, such as /home/sean/Rtest/Data01,
/home/sean/Rtest/Data02, /home/sean/Rtest/Data03,. I want to modify
my script so that it will run from /Rtest, and with the data directory
name as arg passed to my R script. My point is that when I put the
scriptA.R in data directory such as Data01, it works. Here are my
scriptB.R script:
##scriptA.R#
# load the necessary librarieslibrary(A);  # A fake package
namelibrary(B);  # B fake package namelibrary(C);  # C fake package
name#data processing#data processing   
#data processing# unload the librariesdetach(package:A); 
detach(package:B);detach(package:C);q();###
But, when I tried to modify scriptA.R to scriptB.R to run it from the
directory just above Data directories, I got the error message.
###scriptB.R###
# retrieve argsargs - commandArgs(TRUE);# store the current
directoryinitial.dir - getwd();newdir -
paste(initial.dir,args,sep=/);outfilename -
paste(args,out,sep=.);# change to the new directorysetwd(newdir);#
load the necessary librarieslibrary(A);  # A fake package
namelibrary(B);  # B fake package namelibrary(C);  # C fake package
name# set the output filesink(outfilename);#data
processing#data processing#data processing#
close the output filesink();# unload the librariesdetach(package:A); 
#detach(package:B);detach(package:C);# change back to the original
directorysetwd(initial.dir);
##
I run the scriptB.R by
sean@I7-3930K:~/Rtest$ R --slave --args Data01  scriptB.R
I got the error message:
sean@I7-3930K:~/Rtest$ R --slave --args Data01  scriptB.RAttempting to
load the environment �package:R.utils�Loading required package:
R.methodsS3R.methodsS3 v1.2.1 (2010-09-18) successfully loaded. See
?R.methodsS3 for help.Loading required package: utilsR.oo v1.8.3
(2011-11-01) successfully loaded. See ?R.oo for help.
Attaching package: �R.oo�
The following object(s) are masked from �package:R.methodsS3�:
   throw.default
The following object(s) are masked from �package:methods�:
   getClass, getClasses, getMethods
The following object(s) are masked from �package:base�:
  attach, detach, environment, gc, load, save
R.utils v1.9.11 (2012-01-17) successfully loaded. See ?R.utils for
help.
Attaching package: �R.utils�
The following object(s) are masked from �package:utils�:
timestamp
The following object(s) are masked from �package:base�:
cat, commandArgs, getOption, inherits, isOpen, lapply, parse,   
remove, warnings
[1] /home/sean/Rtest[1] /home/sean/Rtest/NA  
/home/sean/Rtest/TRUE[3] /home/sean/Rtest/Data01[1] NA.out   
TRUE.out Data01.outError in setwd(newdir) : cannot change
working directoryExecution halted
What did I do wrong? I think I have the right to read and write to the
directories.
One more question, is there anyway to modify this script to make it
work on all data directories under /home/sean/Rtest by itself?
Thanks a lot for the help!
Ying
sean@I7-3930K:~/Rtest$ ls -ltotal 56drwx-- 3 sean sean 4096
2012-02-25 20:39 Data01drwx-- 2 sean sean 4096 2012-02-25 20:28
Data02drwx-- 2 sean sean 4096 2012-02-26 07:41 Data03drwx-- 2
sean sean 4096 2012-02-25 21:18 Data04drwx-- 2 sean sean 4096
2012-02-25 20:27 Data05-rw-r--r-- 1 sean sean  437 2012-02-26 15:28
scriptA.R...
 From: michael.weyla...@gmail.com
 Date: Sun, 26 Feb 2012 12:48:57 -0500
 Subject: Re: [R] Help needed! Error in setwd(newdir) : cannot change
working directory
 To: ying_c...@live.com
 CC: r-help@r-project.org

Re: [R] Help needed! Error in setwd(newdir) : cannot change working directory

2012-02-26 Thread jim holtman
 16:00:20 -0500
 CC: r-help@r-project.org
  Subject: Re: [R] Help needed! Error in setwd(newdir) : cannot change
 working directory






 Hi,
 I am sorry about the format it showed up. I do not know what happened as
 it looks fine when I read it using chrome on ubuntu 11.10 64bit. The
 packages A, B, C are not the real package names.  Basically I have
  scriptA.R that works from inside a directory with my data
 (/home/sean/Rtest/Data01). Now I want to modify the script to make it run
 from the upper directory (/home/sean/Rtest) because I have many data
 directories under /Rtest, such as /home/sean/Rtest/Data01,
 /home/sean/Rtest/Data02, /home/sean/Rtest/Data03,. I want to modify my
 script so that it will run from /Rtest, and with the data directory name as
 arg passed to my R script. My point is that when I put the scriptA.R in
 data directory such as Data01, it works. Here are my scriptB.R script:
 ##scriptA.R#
 # load the necessary librarieslibrary(A);  # A fake package
 namelibrary(B);  # B fake package namelibrary(C);  # C fake package
 name#data processing#data processing
  #data processing# unload the librariesdetach(package:A);
  
 detach(package:B);detach(package:C);q();###
 But, when I tried to modify scriptA.R to scriptB.R to run it from the
 directory just above Data directories, I got the error message.
 ###scriptB.R###
 # retrieve argsargs - commandArgs(TRUE);# store the current
 directoryinitial.dir - getwd();newdir -
 paste(initial.dir,args,sep=/);outfilename - paste(args,out,sep=.);#
 change to the new directorysetwd(newdir);# load the necessary
 librarieslibrary(A);  # A fake package namelibrary(B);  # B fake
 package namelibrary(C);  # C fake package name# set the output
 filesink(outfilename);#data processing#data
 processing#data processing# close the output filesink();#
 unload the librariesdetach(package:A);
  #detach(package:B);detach(package:C);# change back to the original
 directorysetwd(initial.dir);
 ##
 I run the scriptB.R by
 sean@I7-3930K:~/Rtest$ R --slave --args Data01  scriptB.R
 I got the error message:
 sean@I7-3930K:~/Rtest$ R --slave --args Data01  scriptB.RAttempting to
 load the environment ‘package:R.utils’Loading required package:
 R.methodsS3R.methodsS3 v1.2.1 (2010-09-18) successfully loaded. See
 ?R.methodsS3 for help.Loading required package: utilsR.oo v1.8.3
 (2011-11-01) successfully loaded. See ?R.oo for help.
 Attaching package: ‘R.oo’
 The following object(s) are masked from ‘package:R.methodsS3’:
   throw.default
 The following object(s) are masked from ‘package:methods’:
   getClass, getClasses, getMethods
 The following object(s) are masked from ‘package:base’:
  attach, detach, environment, gc, load, save
 R.utils v1.9.11 (2012-01-17) successfully loaded. See ?R.utils for help.
 Attaching package: ‘R.utils’
 The following object(s) are masked from ‘package:utils’:
timestamp
 The following object(s) are masked from ‘package:base’:
cat, commandArgs, getOption, inherits, isOpen, lapply, parse,
  remove, warnings
 [1] /home/sean/Rtest[1] /home/sean/Rtest/NA
 /home/sean/Rtest/TRUE[3] /home/sean/Rtest/Data01[1] NA.out
 TRUE.out Data01.outError in setwd(newdir) : cannot change working
 directoryExecution halted
 What did I do wrong? I think I have the right to read and write to the
 directories.
 One more question, is there anyway to modify this script to make it work
 on all data directories under /home/sean/Rtest by itself?
 Thanks a lot for the help!
 Ying
 sean@I7-3930K:~/Rtest$ ls -ltotal 56drwx-- 3 sean sean 4096
 2012-02-25 20:39 Data01drwx-- 2 sean sean 4096 2012-02-25 20:28
 Data02drwx-- 2 sean sean 4096 2012-02-26 07:41 Data03drwx-- 2 sean
 sean 4096 2012-02-25 21:18 Data04drwx-- 2 sean sean 4096 2012-02-25
 20:27 Data05-rw-r--r-- 1 sean sean  437 2012-02-26 15:28 scriptA.R...
  From: michael.weyla...@gmail.com
  Date: Sun, 26 Feb 2012 12:48:57 -0500
  Subject: Re: [R] Help needed! Error in setwd(newdir) : cannot change
 working directory
  To: ying_c...@live.com
  CC: r-help@r-project.org
 
  This is a mess -- please resend in plain text.
 
  Also, there are not, to my knowledge, packages (not libraries) called
  A, B, or C so your script doesn't even begin to look
  reproducible were it legible.
 
  Do you have read/write access to the directories in question?
 
  Michael
 
  On Sat, Feb 25, 2012 at 11:25 PM, ying chen ying_c...@live.com wrote:
  
   Hi Guys,
  
   I am new to R and just trying to write a small script to automate a
 couple commands. But I run into the setwd(): cannot change working
 directory.
   I googled a little bit and tried all fixes/suggestions with no success

Re: [R] Help needed! Error in setwd(newdir) : cannot change working directory

2012-02-26 Thread Petr Savicky
On Sun, Feb 26, 2012 at 04:12:03PM -0500, ying chen wrote:
 
 Hi, 
  
 I am sorry about the format it showed up. I do not know what happened as now 
 it looks worse even on my own machine. I do not know what to do, I just add 
 \n to the end of each line and hope it will come out OK this time. The 
 packages A, B, C are not the real package names.  Basically I have  scriptA.R 
 that works from inside a directory with my data (/home/sean/Rtest/Data01). 
 Now I want to modify the script to make it run from the upper directory 
 (/home/sean/Rtest) because I have many data directories under /Rtest, such as 
 /home/sean/Rtest/Data01, /home/sean/Rtest/Data02, 
 /home/sean/Rtest/Data03,. I want to modify my script so that it will run 
 from /Rtest, and with the data directory name as arg passed to my R script. 
 My point is that when I put the scriptA.R in data directory such as Data01, 
 it works. Here are my scriptB.R script: 
  
 ##scriptA.R# 
  
 # load the necessary libraries 
 library(A);  # A fake package name 
 library(B);  # B fake package name 
 library(C);  # C fake package name 
 #data processing 
 #data processing 
 #data processing 
 # unload the libraries 
 detach(package:A);   
 detach(package:B); 
 detach(package:C); 
 q(); 
 ### 
 
 But, when I tried to modify scriptA.R to scriptB.R to run it from the 
 directory just above Data directories, I got the error message. 
 
 ###scriptB.R###
 
 # retrieve args 
 args - commandArgs(TRUE); 
 # store the current directory 
 initial.dir - getwd(); 
 newdir - paste(initial.dir,args,sep=/); 
 outfilename - paste(args,out,sep=.); 
 # change to the new directory 
 setwd(newdir); 

Print the variable newdir to see, whether it contains, what you expect.

 # load the necessary libraries 
 library(A);  # A fake package name 
 library(B);  # B fake package name 
 library(C);  # C fake package name 

Loading libraries in this way does not depend on the working directory.

 # set the output file 
 sink(outfilename); 
 #data processing 
 #data processing 
 #data processing 
 # close the output file 
 sink(); 
 # unload the libraries 
 detach(package:A);  # 
 detach(package:B); 
 detach(package:C); 
 # change back to the original directory 
 setwd(initial.dir); 
 
 ## 
 
 I run the scriptB.R by 
 
 sean@I7-3930K:~/Rtest$ R --slave --args Data01  scriptB.R 
 
 I got the error message: 
 
 sean@I7-3930K:~/Rtest$ R --slave --args Data01  scriptB.R 
 Attempting to load the environment ?package:R.utils? 
 Loading required package: R.methodsS3 
 R.methodsS3 v1.2.1 (2010-09-18) successfully loaded. See ?R.methodsS3 for 
 help. 
 Loading required package: utils 
 R.oo v1.8.3 (2011-11-01) successfully loaded. See ?R.oo for help. 
 
 Attaching package: ?R.oo? 
 
 The following object(s) are masked from ?package:R.methodsS3?: 
 
throw.default 
 
 The following object(s) are masked from ?package:methods?: 
 
getClass, getClasses, getMethods 
 
 The following object(s) are masked from ?package:base?: 
 
   attach, detach, environment, gc, load, save 
 
 R.utils v1.9.11 (2012-01-17) successfully loaded. See ?R.utils for help. 
 
 Attaching package: ?R.utils? 
 
 The following object(s) are masked from ?package:utils?: 
 
 timestamp 
 
 The following object(s) are masked from ?package:base?: 
 
 cat, commandArgs, getOption, inherits, isOpen, lapply, parse, 
 remove, warnings 
 
 [1] /home/sean/Rtest 
 [1] /home/sean/Rtest/NA   /home/sean/Rtest/TRUE 
 [3] /home/sean/Rtest/Data01 
 [1] NA.out   TRUE.out Data01.out 
 Error in setwd(newdir) : cannot change working directory 
 Execution halted 

Try print(newdir) before setwd(newdir).

Petr Savicky.

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


Re: [R] Help needed! Error in setwd(newdir) : cannot change working directory

2012-02-26 Thread Ivette
try setwd(choose.dir()) 

--
View this message in context: 
http://r.789695.n4.nabble.com/Help-needed-Error-in-setwd-newdir-cannot-change-working-directory-tp4421698p4422749.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Help needed! Error in setwd(newdir) : cannot change working directory

2012-02-25 Thread ying chen

Hi Guys,

I am new to R and just trying to write a small script to automate a couple 
commands. But I run into the setwd(): cannot change working directory.
I googled a little bit and tried all fixes/suggestions with no success.
Basically I have a script that works from inside a directory with my data 
(/home/sean/Rtest/Data01). Now I want to modify the script to make it run from 
the upper directory (/home/sean/Rtest) because I have many data directories 
under /Rtest, such as /home/sean/Rtest/Data01, /home/sean/Rtest/Data02, 
/home/sean/Rtest/Data03,.
I want to modify my script so that it will run from /Rtest, and with the data 
directory name as arg passed to my R script. Here is my mytest02.R script:
# retrieve argsargs - commandArgs(TRUE);# store the current 
directoryinitial.dir - getwd();newdir - 
paste(initial.dir,args,sep=/);outfilename - 
paste(args,out,sep=.);# change to the new directorysetwd(newdir);# 
load the necessary librarieslibrary(A);  
#library(B);library(C);# set the output 
filesink(outfilename);#data processing#data 
processing#data processing# close the output filesink();# 
unload the librariesdetach(package:A);  
#detach(package:B);detach(package:C);# change back to the original 
directorysetwd(initial.dir);
Then I run the script by
sean@I7-3930K:~/Rtest$ R --slave --args Data01  mytest02.R
I got the error message:
sean@I7-3930K:~/Rtest$ R --slave --args Data01  mytest02.RAttempting to 
load the environment ‘package:R.utils’Loading required package: 
R.methodsS3R.methodsS3 v1.2.1 (2010-09-18) successfully loaded. See 
?R.methodsS3 for help.Loading required package: utilsR.oo v1.8.3 
(2011-11-01) successfully loaded. See ?R.oo for help.Attaching package: 
‘R.oo’The following object(s) are masked from ‘package:R.methodsS3’:  
  throw.defaultThe following object(s) are masked from 
‘package:methods’:getClass, getClasses, getMethodsThe following 
object(s) are masked from ‘package:base’:attach, detach, environment, 
gc, load, saveR.utils v1.9.11 (2012-01-17) successfully loaded. See 
?R.utils for help.Attaching package: ‘R.utils’The following object(s) 
are masked from ‘package:utils’:timestampThe following object(s) 
are masked from ‘package:base’:cat, commandArgs, getOption, inherits, 
isOpen, lapply, parse,remove, warnings[1] /home/sean/Rtest[1] 
/home/sean/Rtest/NA   /home/sean/Rtest/TRUE[3] 
/home/sean/Rtest/Data01[1] NA.out   TRUE.out 
Data01.outError in setwd(newdir) : cannot change working 
directoryExecution halted
What did I do wrong?
One more question, is there anyway to modify this script to make it work on all 
data directories under /home/sean/Rtest by itself?
Thanks a lot for the help!
Ying

  
[[alternative HTML version deleted]]

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


Re: [R] Help with error: no acceptable C compiler found in $PATH

2011-11-17 Thread R. Michael Weylandt
Hstrangeif possible, this might be solvable by simply
updating to the release version R 2.14. If it's at all possible, I'd
start there.

Can you find the object it's unhappy about? On my machine, I do the following

1) Open Finder
2) Macintosh HD - Library - Frameworks - R.framework - Versions -
2.13 - Resources - library - RCurl - libs - x86_64 - RCurl.so

Going the other way, are you sure you have Curl on your system? I'm
pretty sure it's standard on all Macs but you never know...follow some
of the instructions given here: http://www.omegahat.org/RCurl/FAQ.html
 You should be able to type curl-config in the terminal and get a
meaningful response if it is.

Did you change something on the OS level recently? I don't really know
why this would have all fallen apart, I just re-reinstalled RCurl on R
2.13.2 OSX 10.5.8 with no problem at all.

Michael

On Wed, Nov 16, 2011 at 11:14 AM, Hari Easwaran hariharan...@gmail.com wrote:
 Hi Michael,
 Thanks for your response. Using the binary seems to solve partially. I am
 able to install (I think!) RCurl but not able to load the library. Below is
 the info you required and the error while loading RCurl.
 sessionInfo()
 R version 2.13.2 (2011-09-30)
 Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)
 locale:
 [1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8
 attached base packages:
 [1] stats     graphics  grDevices utils     datasets  methods   base
 install.packages(RCurl)
 trying URL
 'http://watson.nci.nih.gov/cran_mirror/bin/macosx/leopard/contrib/2.13/RCurl_1.7-0.tgz'
 Content type 'application/octet-stream' length 680511 bytes (664 Kb)
 opened URL
 ==
 downloaded 664 Kb

 The downloaded packages are in
 /var/folders/a6/a60JdPfrHC0ZAizZWyNM-E+++TI/-Tmp-//RtmpYE7JLJ/downloaded_packages
 library(RCurl)
 Loading required package: bitops
 Error in dyn.load(file, DLLpath = DLLpath, ...) :
   unable to load shared object
 '/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RCurl/libs/x86_64/RCurl.so':

 dlopen(/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RCurl/libs/x86_64/RCurl.so,
 6): Library not loaded:
 @rpath/R.framework/Versions/2.13/Resources/lib/libR.dylib
   Referenced from:
 /Library/Frameworks/R.framework/Versions/2.13/Resources/library/RCurl/libs/x86_64/RCurl.so
   Reason: image not found
 Error: package/namespace load failed for 'RCurl'
 Warning: dependency ‘Rcompression’ is not available
 also installing the dependency ‘XML’
 Seems like now I need 'Rcompression'. I googled this and found a
 Rcompression package 'zlib' (http://www.omegahat.org/Rcompression/). However
 the site says that zlib for Mac OS X: zlib is already included as part of
 Mac OS X.
 I am wondering what to do? To my bliss, why did the previous R version
 oblivious of these issues!
 Really appreciate any hep.
 SIncerely,
 Hari


 On Tue, Nov 15, 2011 at 11:33 PM, R. Michael Weylandt
 michael.weyla...@gmail.com wrote:

 Yes, you probably need some sort of C compiler, but why can't you just
 download the appropriate binary directly? I just did on OS X 10.5.8
 (admittedly for R 2.13.2, not 2.14) with no problems. The output of

 sessionInfo()
 install.packages(RCurl)

 if you don't mind please.

 Thanks,

 Michael

 On Tue, Nov 15, 2011 at 2:12 PM, Hari Easwaran hariharan...@gmail.com
 wrote:
  Dear all,
  I am trying to install a package from bioconductor (biomaRt) for which I
  need the RCurl package. I get the following main error message when I
  try
  to install RCurl (and its dependencies).
 
  configure: error: no acceptable C compiler found in $PATH
  See `config.log' for more details.
  ERROR: configuration failed for package ‘RCurl’
 
  I searched for possible solutions and read in some online mailing list
  that
  I might have to install Xcode to install the gcc compiler. I am not sure
  if
  I should do this because I have installed RCurl in previous versions of
  R
  without any problems (on this same computer). I upgraded to the latest R
  (R
  version 2.14.0) and faced this problem. So I downgraded to R version
  2.13.2
  and still cannot install RCurl. I think my last successful installation
  of
  RCurl was with R version 2.11.
 
  Following is the complete error message and my R version details.
  I really appreciate any help or suggestions.
 
  Sincerely,
  Hari
 
  trying URL '
  http://watson.nci.nih.gov/cran_mirror/src/contrib/XML_3.4-3.tar.gz'
  Content type 'application/octet-stream' length 906364 bytes (885 Kb)
  opened URL
  ==
  downloaded 885 Kb
 
  trying URL '
  http://watson.nci.nih.gov/cran_mirror/src/contrib/RCurl_1.7-0.tar.gz'
  Content type 'application/octet-stream' length 813252 bytes (794 Kb)
  opened URL
  ==
  downloaded 794 Kb
 
  * installing *source* package ‘XML’ ...
  checking for gcc... no
  checking for cc... no
  checking for cl.exe... no
  

Re: [R] Help with error: no acceptable C compiler found in $PATH

2011-11-16 Thread Hari Easwaran
Hi Michael,
Thanks for your response. Using the binary seems to solve partially. I am
able to install (I think!) RCurl but not able to load the library. Below is
the info you required and the error while loading RCurl.

* sessionInfo()*
R version 2.13.2 (2011-09-30)
Platform: x86_64-apple-darwin9.8.0/x86_64 (64-bit)

locale:
[1] en_US.UTF-8/en_US.UTF-8/C/C/en_US.UTF-8/en_US.UTF-8

attached base packages:
[1] stats graphics  grDevices utils datasets  methods   base

* install.packages(RCurl)*
trying URL '
http://watson.nci.nih.gov/cran_mirror/bin/macosx/leopard/contrib/2.13/RCurl_1.7-0.tgz
'
Content type 'application/octet-stream' length 680511 bytes (664 Kb)
opened URL
==
downloaded 664 Kb


The downloaded packages are in
/var/folders/a6/a60JdPfrHC0ZAizZWyNM-E+++TI/-Tmp-//RtmpYE7JLJ/downloaded_packages

* library(RCurl)*
Loading required package: bitops
Error in dyn.load(file, DLLpath = DLLpath, ...) :
  unable to load shared object
'/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RCurl/libs/x86_64/RCurl.so':

dlopen(/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RCurl/libs/x86_64/RCurl.so,
6): Library not loaded:
@rpath/R.framework/Versions/2.13/Resources/lib/libR.dylib
  Referenced from:
/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RCurl/libs/x86_64/RCurl.so
  Reason: image not found
Error: package/namespace load failed for 'RCurl'
Warning: dependency ‘Rcompression’ is not available
also installing the dependency ‘XML’

Seems like now I need 'Rcompression'. I googled this and found a
Rcompression package 'zlib' (http://www.omegahat.org/Rcompression/).
However the site says that zlib for Mac OS X: zlib is already included as
part of Mac OS X.

I am wondering what to do? To my bliss, why did the previous R version
oblivious of these issues!

Really appreciate any hep.

SIncerely,
Hari



On Tue, Nov 15, 2011 at 11:33 PM, R. Michael Weylandt 
michael.weyla...@gmail.com wrote:

 Yes, you probably need some sort of C compiler, but why can't you just
 download the appropriate binary directly? I just did on OS X 10.5.8
 (admittedly for R 2.13.2, not 2.14) with no problems. The output of

 sessionInfo()
 install.packages(RCurl)

 if you don't mind please.

 Thanks,

 Michael

 On Tue, Nov 15, 2011 at 2:12 PM, Hari Easwaran hariharan...@gmail.com
 wrote:
  Dear all,
  I am trying to install a package from bioconductor (biomaRt) for which I
  need the RCurl package. I get the following main error message when I try
  to install RCurl (and its dependencies).
 
  configure: error: no acceptable C compiler found in $PATH
  See `config.log' for more details.
  ERROR: configuration failed for package ‘RCurl’
 
  I searched for possible solutions and read in some online mailing list
 that
  I might have to install Xcode to install the gcc compiler. I am not sure
 if
  I should do this because I have installed RCurl in previous versions of R
  without any problems (on this same computer). I upgraded to the latest R
 (R
  version 2.14.0) and faced this problem. So I downgraded to R version
 2.13.2
  and still cannot install RCurl. I think my last successful installation
 of
  RCurl was with R version 2.11.
 
  Following is the complete error message and my R version details.
  I really appreciate any help or suggestions.
 
  Sincerely,
  Hari
 
  trying URL '
  http://watson.nci.nih.gov/cran_mirror/src/contrib/XML_3.4-3.tar.gz'
  Content type 'application/octet-stream' length 906364 bytes (885 Kb)
  opened URL
  ==
  downloaded 885 Kb
 
  trying URL '
  http://watson.nci.nih.gov/cran_mirror/src/contrib/RCurl_1.7-0.tar.gz'
  Content type 'application/octet-stream' length 813252 bytes (794 Kb)
  opened URL
  ==
  downloaded 794 Kb
 
  * installing *source* package ‘XML’ ...
  checking for gcc... no
  checking for cc... no
  checking for cl.exe... no
  configure: error: no acceptable C compiler found in $PATH
  See `config.log' for more details.
  ERROR: configuration failed for package ‘XML’
  * removing
  ‘/Library/Frameworks/R.framework/Versions/2.13/Resources/library/XML’
  * installing *source* package ‘RCurl’ ...
  checking for curl-config... /usr/bin/curl-config
  checking for gcc... no
  checking for cc... no
  checking for cc... no
  checking for cl... no
  configure: error: no acceptable C compiler found in $PATH
  See `config.log' for more details.
  ERROR: configuration failed for package ‘RCurl’
  * removing
  ‘/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RCurl’
  * restoring previous
  ‘/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RCurl’
 
  The downloaded packages are in
 
 ‘/private/var/folders/a6/a60JdPfrHC0ZAizZWyNM-E+++TI/-Tmp-/RtmpVjBcvX/downloaded_packages’
 
 [[alternative HTML version deleted]]
 
 
  __
  

[R] Help with error: no acceptable C compiler found in $PATH

2011-11-15 Thread Hari Easwaran
Dear all,
I am trying to install a package from bioconductor (biomaRt) for which I
need the RCurl package. I get the following main error message when I try
to install RCurl (and its dependencies).

configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
ERROR: configuration failed for package ‘RCurl’

I searched for possible solutions and read in some online mailing list that
I might have to install Xcode to install the gcc compiler. I am not sure if
I should do this because I have installed RCurl in previous versions of R
without any problems (on this same computer). I upgraded to the latest R (R
version 2.14.0) and faced this problem. So I downgraded to R version 2.13.2
and still cannot install RCurl. I think my last successful installation of
RCurl was with R version 2.11.

Following is the complete error message and my R version details.
I really appreciate any help or suggestions.

Sincerely,
Hari

trying URL '
http://watson.nci.nih.gov/cran_mirror/src/contrib/XML_3.4-3.tar.gz'
Content type 'application/octet-stream' length 906364 bytes (885 Kb)
opened URL
==
downloaded 885 Kb

trying URL '
http://watson.nci.nih.gov/cran_mirror/src/contrib/RCurl_1.7-0.tar.gz'
Content type 'application/octet-stream' length 813252 bytes (794 Kb)
opened URL
==
downloaded 794 Kb

* installing *source* package ‘XML’ ...
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
ERROR: configuration failed for package ‘XML’
* removing
‘/Library/Frameworks/R.framework/Versions/2.13/Resources/library/XML’
* installing *source* package ‘RCurl’ ...
checking for curl-config... /usr/bin/curl-config
checking for gcc... no
checking for cc... no
checking for cc... no
checking for cl... no
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details.
ERROR: configuration failed for package ‘RCurl’
* removing
‘/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RCurl’
* restoring previous
‘/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RCurl’

The downloaded packages are in
‘/private/var/folders/a6/a60JdPfrHC0ZAizZWyNM-E+++TI/-Tmp-/RtmpVjBcvX/downloaded_packages’

[[alternative HTML version deleted]]

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


Re: [R] Help with error: no acceptable C compiler found in $PATH

2011-11-15 Thread R. Michael Weylandt
Yes, you probably need some sort of C compiler, but why can't you just
download the appropriate binary directly? I just did on OS X 10.5.8
(admittedly for R 2.13.2, not 2.14) with no problems. The output of

sessionInfo()
install.packages(RCurl)

if you don't mind please.

Thanks,

Michael

On Tue, Nov 15, 2011 at 2:12 PM, Hari Easwaran hariharan...@gmail.com wrote:
 Dear all,
 I am trying to install a package from bioconductor (biomaRt) for which I
 need the RCurl package. I get the following main error message when I try
 to install RCurl (and its dependencies).

 configure: error: no acceptable C compiler found in $PATH
 See `config.log' for more details.
 ERROR: configuration failed for package ‘RCurl’

 I searched for possible solutions and read in some online mailing list that
 I might have to install Xcode to install the gcc compiler. I am not sure if
 I should do this because I have installed RCurl in previous versions of R
 without any problems (on this same computer). I upgraded to the latest R (R
 version 2.14.0) and faced this problem. So I downgraded to R version 2.13.2
 and still cannot install RCurl. I think my last successful installation of
 RCurl was with R version 2.11.

 Following is the complete error message and my R version details.
 I really appreciate any help or suggestions.

 Sincerely,
 Hari

 trying URL '
 http://watson.nci.nih.gov/cran_mirror/src/contrib/XML_3.4-3.tar.gz'
 Content type 'application/octet-stream' length 906364 bytes (885 Kb)
 opened URL
 ==
 downloaded 885 Kb

 trying URL '
 http://watson.nci.nih.gov/cran_mirror/src/contrib/RCurl_1.7-0.tar.gz'
 Content type 'application/octet-stream' length 813252 bytes (794 Kb)
 opened URL
 ==
 downloaded 794 Kb

 * installing *source* package ‘XML’ ...
 checking for gcc... no
 checking for cc... no
 checking for cl.exe... no
 configure: error: no acceptable C compiler found in $PATH
 See `config.log' for more details.
 ERROR: configuration failed for package ‘XML’
 * removing
 ‘/Library/Frameworks/R.framework/Versions/2.13/Resources/library/XML’
 * installing *source* package ‘RCurl’ ...
 checking for curl-config... /usr/bin/curl-config
 checking for gcc... no
 checking for cc... no
 checking for cc... no
 checking for cl... no
 configure: error: no acceptable C compiler found in $PATH
 See `config.log' for more details.
 ERROR: configuration failed for package ‘RCurl’
 * removing
 ‘/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RCurl’
 * restoring previous
 ‘/Library/Frameworks/R.framework/Versions/2.13/Resources/library/RCurl’

 The downloaded packages are in
 ‘/private/var/folders/a6/a60JdPfrHC0ZAizZWyNM-E+++TI/-Tmp-/RtmpVjBcvX/downloaded_packages’

        [[alternative HTML version deleted]]


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



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


Re: [R] Help: sqlSave Error

2011-11-10 Thread Jeff Newmiller
The error seems clear enough to me... sqlSave is trying to create the table but 
it already exists.

Some possible directions you could take:

1) Do your work on a particular instance of the table within a single 
transaction and rollback at the end.
2) Delete the table before you run sqlSave.
3) Explicitly create the table once and keep it, deleting data before re-using 
it, and use the append option.
4) Include a column that distinguishes between different blocks of data and 
keep all of the data you add to it.
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

bruclee brouc...@gmail.com wrote:

I am using sqlSave to save my data into an existing table at MS SQL
Server
database. Previously my code ran smoothly but all of a sudden it
stopped
working. Here is my code:

sqlSave(con, highVol, dbo.futuresHighVol, append=TRUE,
rownames=FALSE)

Error: sqlSave(con, highVol, jrgchis.dbo.futuresHighVol, append =
TRUE,  : 
  42S01 2714 [Microsoft][ODBC SQL Server Driver][SQL Server]
'futuresHighVol' already exist
[RODBC] ERROR: Could not SQLExecDirect 'CREATE TABLE
jrgchis.dbo.futuresHighVol  (TradeTime varchar(255), vol float)'

Please Help!!!



--
View this message in context:
http://r.789695.n4.nabble.com/Help-sqlSave-Error-tp4022523p4022523.html
Sent from the R help mailing list archive at Nabble.com.

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

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


[R] Help: sqlSave Error

2011-11-09 Thread bruclee
I am using sqlSave to save my data into an existing table at MS SQL Server
database. Previously my code ran smoothly but all of a sudden it stopped
working. Here is my code:

sqlSave(con, highVol, dbo.futuresHighVol, append=TRUE, rownames=FALSE)

Error: sqlSave(con, highVol, jrgchis.dbo.futuresHighVol, append = TRUE,  : 
  42S01 2714 [Microsoft][ODBC SQL Server Driver][SQL Server]
'futuresHighVol' already exist
[RODBC] ERROR: Could not SQLExecDirect 'CREATE TABLE
jrgchis.dbo.futuresHighVol  (TradeTime varchar(255), vol float)'

Please Help!!!



--
View this message in context: 
http://r.789695.n4.nabble.com/Help-sqlSave-Error-tp4022523p4022523.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Help in error removal

2011-07-13 Thread Mitra, Sumona
Dear all,

Thank you so much for your help. I was able to get a script that ran and did 
what i wanted  it to do. It was as follows:-


 correlation - function(a)
+ {
+   r - matrix(nrow = dim(a)[1], ncol=dim(a)[1])
+   for(x in c(2:dim(a)[1]))
+   {
+ for(y in c(x:dim(a)[1]))
+ {
+   r[x,y] - (cor.test(as.vector(as.matrix(a)[x,], mode=double), 
as.vector(as.matrix(a)[y,], mode=double))$p.value)
+   r[y,x] - r[x,y]
+ }
+   }
+   return(r)
+ }

Now I want to extend this to include all the possible correlations that 
cor.test can do. One of the possible arguments of cor.test is method=method, 
where method can be pearson, spearman or kendall. To include this I modified my 
code in the following way:-

 correlation - function(a, b)
+ {
+   r - matrix(nrow = dim(a)[1], ncol=dim(a)[1])
+   for(x in c(2:dim(a)[1]))
+   {
+ for(y in c(x:dim(a)[1]))
+ {
+   r[x,y] - (cor.test(as.vector(as.matrix(a)[x,], mode=double), 
as.vector(as.matrix(a)[y,], mode=double), method=b)$p.value)
+   r[y,x] - r[x,y]
+ }
+   }
+   return(r)
+ }

This when executed though, gives the following error:-

 correlation(a, spearman)
Error in match.arg(method) : 
  'arg' should be one of “pearson”, “kendall”, “spearman”

Please help!

Sumona 

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


Re: [R] Help in error removal

2011-07-13 Thread David Winsemius


On Jul 13, 2011, at 6:09 AM, Mitra, Sumona wrote:


Dear all,

Thank you so much for your help. I was able to get a script that ran  
and did what i wanted  it to do. It was as follows:-




correlation - function(a)

+ {
+   r - matrix(nrow = dim(a)[1], ncol=dim(a)[1])
+   for(x in c(2:dim(a)[1]))
+   {
+ for(y in c(x:dim(a)[1]))
+ {
+   r[x,y] - (cor.test(as.vector(as.matrix(a)[x,],  
mode=double), as.vector(as.matrix(a)[y,], mode=double))$p.value)

+   r[y,x] - r[x,y]
+ }
+   }
+   return(r)
+ }

Now I want to extend this to include all the possible correlations  
that cor.test can do.


You are constructing a technique that in the wrong hands will do very  
bad statistics.


One of the possible arguments of cor.test is method=method, where  
method can be pearson, spearman or kendall. To include this I  
modified my code in the following way:-



correlation - function(a, b)

+ {
+   r - matrix(nrow = dim(a)[1], ncol=dim(a)[1])
+   for(x in c(2:dim(a)[1]))
+   {
+ for(y in c(x:dim(a)[1]))
+ {
+   r[x,y] - (cor.test(as.vector(as.matrix(a)[x,],  
mode=double), as.vector(as.matrix(a)[y,], mode=double),  
method=b)$p.value)


If you quote b, then the interpreter will not substitute the value  
of `b`.



+   r[y,x] - r[x,y]
+ }
+   }
+   return(r)
+ }

This when executed though, gives the following error:-


correlation(a, spearman)

Error in match.arg(method) :
 'arg' should be one of “pearson”, “kendall”, “spearman”

Please help!

Sumona


--

David Winsemius, MD
West Hartford, CT

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


Re: [R] Help in error removal

2011-07-12 Thread Mitra, Sumona
Dear all,

I am new to programming in R.
 I deal with microarray data,which is a data frame object type. I need to carry 
out a few statistical procedures on this, one of them being the pearson 
corelation. I need to do this between each row which is a gene. So the desired 
result is a square matrix with the pearson corelation value between each row. 
So the first column would be (1,1)=0,(1,2),(1,3) and so on.

I uploaded the data frame as a:-

a - read.csv(a.csv, header= TRUE, row.names=1)

and then I started the script:-

pearson - function(a){
 r - matrix[x,y]
 for(x in as.vector(a[,1], mode=double)){
 x++{
 for(y in as.vector(a[2,], mode=double)){
 y - x+1
 x++
 {
 r - (cor.test(as.vector(as.matrix(a)[x,], mode=double), 
as.vector(as.matrix(a)[y,], mode=double))$p.value)
 }
 }
 }
 r[x,y]==r[y,x]
 }
 return(r)
 }

However whenever I run it,I get the error:-

 pearson(a)
Error in matrix[x, y] : object of type 'closure' is not subsettable

Please help!

Best Regards
Sumona Mitra

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


Re: [R] Help in error removal

2011-07-12 Thread David Winsemius


On Jul 12, 2011, at 7:27 AM, Mitra, Sumona wrote:


Dear all,

I am new to programming in R.


You see to think there is a ++ operation in R. That is not so.

I deal with microarray data,which is a data frame object type. I  
need to carry out a few statistical procedures on this, one of them  
being the pearson corelation. I need to do this between each row  
which is a gene. So the desired result is a square matrix with the  
pearson corelation value between each row. So the first column would  
be (1,1)=0,(1,2),(1,3) and so on.


I do not understand what that means. You should offer either a minimal  
dataset or at the very least the results of str(a).




I uploaded the data frame as a:-


If by that you mean you made a failed effort at attaching the data in  
a file, then you need to read the Posting Guide for what the server  
will accept as a file type.




a - read.csv(a.csv, header= TRUE, row.names=1)

and then I started the script:-

pearson - function(a){
r - matrix[x,y]
for(x in as.vector(a[,1], mode=double)){


I do not see a need for as.vector here or at any point later.  a[,1]  
would already be a vector and if it is not numeric to begin with, then  
you are going to get junk.



x++{
for(y in as.vector(a[2,], mode=double)){
y - x+1
x++
{
r - (cor.test(as.vector(as.matrix(a)[x,], mode=double),  
as.vector(as.matrix(a)[y,], mode=double))$p.value)

}
}
}
r[x,y]==r[y,x]
}
return(r)
}

However whenever I run it,I get the error:-


pearson(a)

Error in matrix[x, y] : object of type 'closure' is not subsettable

Please help!

Best Regards
Sumona Mitra

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


David Winsemius, MD
West Hartford, CT

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


Re: [R] Help in error removal

2011-07-12 Thread David Hugh-Jones
On 12 July 2011 12:27, Mitra, Sumona sumona.mi...@kcl.ac.uk wrote:

 Dear all,

 I am new to programming in R.



You sure are ;-)

 I deal with microarray data,which is a data frame object type. I need to
 carry out a few statistical procedures on this, one of them being the
 pearson corelation. I need to do this between each row which is a gene. So
 the desired result is a square matrix with the pearson corelation value
 between each row. So the first column would be (1,1)=0,(1,2),(1,3) and so
 on.

 I uploaded the data frame as a:-

 a - read.csv(a.csv, header= TRUE, row.names=1)

 and then I started the script:-

 pearson - function(a){
  r - matrix[x,y]


I bet the problem you are getting is here. You want r to be a x by y matrix.
To do this, try r- matrix(nrow=x, ncol=y). But you haven't defined the x
and y, unless we are missing that part of your code.

As I understand it, you want the correlation matrix between all the rows of
your matrix. If so, then look at the help file for cor. (ie type ?cor.)
You will find that it automatically prints the correlatoins between all
columns of a matrix. So, once your data is correctly read in, you should be
able to just do:

cor(t(a))






  for(x in as.vector(a[,1], mode=double)){
  x++{
  for(y in as.vector(a[2,], mode=double)){
  y - x+1
  x++


This code looks like a horrible mess. It's almost never right to loop
through your vectors. In addition, there is no such thing as ++, as
somebody mentioned.



  {
  r - (cor.test(as.vector(as.matrix(a)[x,], mode=double),
 as.vector(as.matrix(a)[y,], mode=double))$p.value)
  }
  }
  }
  r[x,y]==r[y,x]
  }
  return(r)
  }

 However whenever I run it,I get the error:-

  pearson(a)
 Error in matrix[x, y] : object of type 'closure' is not subsettable

 Please help!

 Best Regards
 Sumona Mitra

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


[[alternative HTML version deleted]]

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


Re: [R] Help with error

2010-07-08 Thread cpen

Gretchen, 

I am getting the same error as you with my own data.
Have you been able to resolve it?

Claudia
-- 
View this message in context: 
http://r.789695.n4.nabble.com/Help-with-error-tp2256388p2282163.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] Help with error

2010-06-15 Thread Gretchen Heavner
Hi.  I am trying to do a nonlinear regression on a set of data with Monod
kinetics and Haldane inhibition.  I am using the following commands to do
the nonlinear regression:

dce-read.delim(data.txt, header = TRUE, sep = \t, quote=\, dec=.,
fill = TRUE, comment.char=)
dce.m1-nls(rate~kmax*conc/(Ks+conc+((conc^2)/Ki),data=dce
,start=list(Ks=1000,kmax=6000,Ki=1),trace=TRUE)

I get reasonable answers for Ks, kmax and Ki from this.
However, I want to find the 95% confidence intervals for each of these
values.  So I first use the command profile:

(pr - profile(dce.m1))

And then I ususally use the following command to get the confidence
intervals:

confint(pr, level=0.95)

However, when I run the profile command, I am getting the following error:

Error in prof$getProfile() : singular gradient

Do you have any idea what this means, or what I can do to fix it?
I have attached the corresponding file with the data I'm using in case that
helps.

Thanks!
Gretchen Heavner
concrate
1.642954108 4.460677577
1.96419336  5.369018741
2.411233484 303.4816161
2.083860628 406.5940798
3.237105618 332.5106627
1.541574251 310.1025388
0   2.746097252
0   3.236122145
0   5.387406642
2.613273505 544.3881261
1.674376521 535.2056647
1.272419565 688.773693
6506.124712 3193.54196
636.4890845 534.5243761
179.4848649 642.7148796
394.8780499 536.3999568
821.4336211 3018.968118
1985.399238 2880.47305
203.254026  1030.660214
11.6416869  446.6209406
1159.841416 2240.487362
179.1906363 1245.802977
25.32770902 562.8883166
278.1572449 709.1081229
24.3055219  249.1544286
187.6656906 678.752123
8.881946288 350.5795416
7554.586825 2724.21323
7430.314722 2745.073389
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Help with error on function: Error in .... attempt to apply non-function

2009-09-15 Thread Corrado
Dear R gurrus,

I wrote this function

http://scsys.co.uk:8002/33852?ln=onstore=onsubmit=Format+it!

for a small package I am preparing. 

Whenever I run the function I get the error

Error in Mspline(i = i, x = x, degree = kk, t = t) :  attempt to apply non-
function

Anyone could point me out what I am doing wrong?

kubuntu 904 64 bit, R 2.9.2

Regards
-- 
Corrado Topi

Global Climate Change  Biodiversity Indicators
Area 18,Department of Biology
University of York, York, YO10 5YW, UK
Phone: + 44 (0) 1904 328645, E-mail: ct...@york.ac.uk

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


Re: [R] Help with error on function: Error in .... attempt to apply non-function

2009-09-15 Thread Duncan Murdoch

Corrado wrote:

Dear R gurrus,

I wrote this function

http://scsys.co.uk:8002/33852?ln=onstore=onsubmit=Format+it!

for a small package I am preparing. 


Whenever I run the function I get the error

Error in Mspline(i = i, x = x, degree = kk, t = t) :  attempt to apply non-
function

Anyone could point me out what I am doing wrong?
  


It would be a lot easier to do so if you gave us a reproducible example. 
But the usual cause for that is using () instead of [], or forgetting an 
operator.  I think you've done the second:  you have (k-1)(t[i+k]-t[i]) 
where you should have (k-1)*(t[i+k]-t[i]).


Duncan Murdoch

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


Re: [R] Help with error on function: Error in .... attempt to apply non-function

2009-09-15 Thread Corrado
Dear Duncan,

this is a reproducible example: it is the function copied straight from my 
Eclipse.

I found the mistake (thanks to Peter) 

On Tuesday 15 September 2009 11:15:29 Duncan Murdoch wrote:
 Corrado wrote:
  Dear R gurrus,
 
  I wrote this function
 
  http://scsys.co.uk:8002/33852?ln=onstore=onsubmit=Format+it!
 
  for a small package I am preparing.
 
  Whenever I run the function I get the error
 
  Error in Mspline(i = i, x = x, degree = kk, t = t) :  attempt to apply
  non- function
 
  Anyone could point me out what I am doing wrong?

 It would be a lot easier to do so if you gave us a reproducible example.
 But the usual cause for that is using () instead of [], or forgetting an
 operator.  I think you've done the second:  you have (k-1)(t[i+k]-t[i])
 where you should have (k-1)*(t[i+k]-t[i]).

 Duncan Murdoch



-- 
Corrado Topi

Global Climate Change  Biodiversity Indicators
Area 18,Department of Biology
University of York, York, YO10 5YW, UK
Phone: + 44 (0) 1904 328645, E-mail: ct...@york.ac.uk

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


Re: [R] Help with error on function: Error in .... attempt to apply non-function

2009-09-15 Thread Duncan Murdoch

On 15/09/2009 6:32 AM, Corrado wrote:

Dear Duncan,

this is a reproducible example: it is the function copied straight from my 
Eclipse.


 - You posted it in a way that couldn't be cut and pasted into R:  you 
added line numbers.  (A similar problem is when people use print() to 
show a dataset; it's not easy to get one of those into a new session. 
Show us the source code to generate the example instead.)


 - You didn't give the calling sequence so I could just cut and paste 
the code into R and see the error.  So even if I took the time to turn 
off the line numbers, I would have to spend time figuring out what 
inputs you used.


  I found the mistake (thanks to Peter) 

But you didn't describe it so no one else can learn from it.

Duncan Murdoch




On Tuesday 15 September 2009 11:15:29 Duncan Murdoch wrote:

Corrado wrote:

Dear R gurrus,

I wrote this function

http://scsys.co.uk:8002/33852?ln=onstore=onsubmit=Format+it!

for a small package I am preparing.

Whenever I run the function I get the error

Error in Mspline(i = i, x = x, degree = kk, t = t) :  attempt to apply
non- function

Anyone could point me out what I am doing wrong?

It would be a lot easier to do so if you gave us a reproducible example.
But the usual cause for that is using () instead of [], or forgetting an
operator.  I think you've done the second:  you have (k-1)(t[i+k]-t[i])
where you should have (k-1)*(t[i+k]-t[i]).

Duncan Murdoch






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


Re: [R] Help with error on function: Error in .... attempt to apply non-function (Solution)

2009-09-15 Thread Corrado
Dear friends,

the problem with the error has been solved (thanks to Peter).

The line 41 in http://scsys.co.uk:8002/33852 should be rewritten as

M-k*((x-t[i])*m0+(t[i+k]-x)*m1)/((k-1)*(t[i+k]-t[i]))

On Tuesday 15 September 2009 11:32:53 Corrado wrote:
-- 
Corrado Topi

Global Climate Change  Biodiversity Indicators
Area 18,Department of Biology
University of York, York, YO10 5YW, UK
Phone: + 44 (0) 1904 328645, E-mail: ct...@york.ac.uk

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


[R] Help resolving error in quantcut

2009-07-08 Thread Chris Anderson
I am trying to use the quantcut function to create deciles, but I am getting 
the error below. I am new to using this function and do not know how to 
properly use the options or some other conversion that is necessary.
#initial summary using describe function in Hmisc library
DegreeBurn4th 
  n missing  uniqueMean .05 .10 .25 .50 .75 .90 
.95 
 76 133  16  0.0325  0.  0.  0.  0.  0.0225  0.0900 
 0.1725 
  0 0.01 0.02 0.03 0.04 0.05 0.06 0.08 0.09 0.12 0.16 0.17 0.18 
0.24 0.36 0.5
Frequency 486342211211111   
 1   1
% 63845331131111
11   1
 degree.quant = quantcut(DegreeBurn4th, q=seq(0, 1, 0.1), labels=F,na.rm=TRUE)
Error in if (sum(flag) == 0) return(cut) else return(min(x[flag], na.rm = 
na.rm)) : 
  missing value where TRUE/FALSE needed

#orignal data
print(DegreeBurn4th)
  [1] 0.09 0.00 0.00   NA   NA 0.03   NA 0.02   NA 0.00 0.01 0.00   NA   NA   
NA   NA   NA 0.00   NA 0.05 0.03 0.00   NA 0.02 0.00   NA 0.00   NA   NA 0.16   
NA   NA 0.24
 [34]   NA   NA 0.00   NA 0.00 0.08   NA   NA   NA 0.00 0.00   NA   NA 0.01   
NA 0.09   NA 0.00 0.00 0.00 0.06   NA 0.00   NA   NA 0.00   NA   NA 0.00 0.01   
NA   NA 0.00
 [67]   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA 
0.00 0.00   NA   NA 0.00   NA 0.05 0.00   NA   NA   NA 0.00 0.02 0.18   NA   NA 
  NA 0.03   NA
[100]   NA 0.00   NA   NA   NA 0.36   NA   NA   NA   NA 0.00 0.00 0.00   NA 
0.00   NA 0.17   NA 0.00   NA   NA   NA 0.00   NA 0.00 0.00 0.00   NA   NA 0.12 
0.00   NA 0.01
[133] 0.00   NA   NA   NA   NA 0.00 0.00   NA 0.01 0.00 0.00   NA   NA 0.00 
0.04   NA   NA   NA 0.00 0.00   NA 0.03   NA 0.00   NA 0.00   NA   NA 0.01 0.00 
0.00   NA   NA
[166]   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA 0.00   NA   
NA   NA   NA   NA   NA   NA   NA   NA   NA 0.50   NA   NA   NA   NA   NA   NA   
NA   NA 0.04
[199]   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA   NA
#convert missing to zero
 DegreeBurn4th[is.na(DegreeBurn4th)]-0.00
 print(DegreeBurn4th)
  [1] 0.09 0.00 0.00 0.00 0.00 0.03 0.00 0.02 0.00 0.00 0.01 0.00 0.00 0.00 
0.00 0.00 0.00 0.00 0.00 0.05 0.03 0.00 0.00 0.02 0.00 0.00 0.00 0.00 0.00 0.16 
0.00 0.00 0.24
 [34] 0.00 0.00 0.00 0.00 0.00 0.08 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01 
0.00 0.09 0.00 0.00 0.00 0.00 0.06 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01 
0.00 0.00 0.00
 [67] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 
0.00 0.00 0.00 0.00 0.00 0.00 0.05 0.00 0.00 0.00 0.00 0.00 0.02 0.18 0.00 0.00 
0.00 0.03 0.00
[100] 0.00 0.00 0.00 0.00 0.00 0.36 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 
0.00 0.00 0.17 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.12 
0.00 0.00 0.01
[133] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 0.00 0.00 0.00 0.00 
0.04 0.00 0.00 0.00 0.00 0.00 0.00 0.03 0.00 0.00 0.00 0.00 0.00 0.00 0.01 0.00 
0.00 0.00 0.00
[166] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 
0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.50 0.00 0.00 0.00 0.00 0.00 0.00 
0.00 0.00 0.04
[199] 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00 0.00
 degree.quant = quantcut(DegreeBurn4th, q=seq(0, 1, 0.1), labels=F,na.rm=TRUE)
Error in if (pairs[1, i] == pairs[1, i - 1]  pairs[1, i] == pairs[2,  : 
  missing value where TRUE/FALSE needed
 degree.quant = quantcut(DegreeBurn4th, q=seq(0, 1, 0.1), 
 labels=F,include.lowest=TRUE)
Error in cut.default(x[!flag], breaks = newquant, include.lowest = TRUE,  : 
  formal argument include.lowest matched by multiple actual arguments
 degree.quant = quantcut(DegreeBurn4th, q=seq(0, 1, 0.1), 
 labels=F,include.lowest=F)
Error in cut.default(x[!flag], breaks = newquant, include.lowest = TRUE,  : 
  formal argument include.lowest matched by multiple actual arguments
 degree.quant = quantcut(DegreeBurn4th, q=seq(0, 1, 0.1), 
 labels=F,include.lowest=T)
Error in cut.default(x[!flag], breaks = newquant, include.lowest = TRUE,  : 
  formal argument include.lowest matched by multiple actual arguments
 



Chris Anderson

http://www.seocodebreaker.com/?thankyou-page=429

Criminal Lawyers - Click here.
http://thirdpartyoffers.netzero.net/TGL2241/fc/BLSrjpYbd6xeB8PyC2qYcdt9oup93MpUqzGGHKa4mySkwS9XNfuLPlvlNq4/
[[alternative HTML version deleted]]

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


[R] help with error

2009-05-19 Thread deanj2k

while (theta1!=theta) {...}

gives the error message:
Error in while (theta1 != theta) { : 
  missing value where TRUE/FALSE needed

but when i extract theta1!=theta and paste it into the console it comes up
with the output TRUE which contradicts the error message- im not sure what I
am doing wrong
-- 
View this message in context: 
http://www.nabble.com/help-with-error-tp23623932p23623932.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] [R-help]Remove error data and clustering analysis

2009-04-24 Thread guodong wang
Hi, all,
I’d like to do the clustering analysis in my dataset. The example data
are as follows:

Dataset 1:
500, 490, 486, 490, 491, 493, 480, 461, 504, 476, 434, 500, 470, 495,
3116, 3142, 12836, 3062, 3091, 3141, 3177, 3150, 3114, 3149;
Dataset 2:
506, 473, 495, 494, 434, 459, 445, 475, 476, 128367, 470, 513, 466,
476,482, 1201, 469, 502;

I had so many datasets like that. Basically, every dataset can
classify one or two clusters (no more than 2), meanwhile, there have
error data points, for example, 12836 is error data point in Dataset
1; and 128367, 1201 is error data points in dataset2.

The clustered data is following the normal distribution, the standard
deviation was known. That’s mean the one cluster is following the
normal distribution when the dataset classified one cluster like
dataset2; the two clusters are following the normal distribution
respectively when the dataset classified two clusters like dataset1.
Error data are far away of the mean.

I am wondering is there any mathematic pipeline/function can do
the analysis that removing error data, and clustering the dataset in 1
or 2 clusters?

Thank you for your reply.

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


Re: [R] Help with error in if then statement

2008-07-12 Thread John Kane
As the note at the bottom says provide commented, minimal, self-contained, 
reproducible code. 

It is difficult to comment on a loop when we have no code to read.


--- On Fri, 7/11/08, Andrew Rominger [EMAIL PROTECTED] wrote:

 From: Andrew Rominger [EMAIL PROTECTED]
 Subject: [R] Help with error in if then statement
 To: r-help@r-project.org
 Received: Friday, July 11, 2008, 12:48 PM
 Dear list,
 
 I'm afraid this is a mundane question.  Here's the
 background: I've  
 produced a function which allows me to sequentially measure
 angles and  
 distances from a specified reference point to a curve
 defined by  
 empirical data points while (i.e. using a while loop) the
 angle being  
 measured is within certain bounds.  Because the curve is
 circular I  
 need to pars the data into basically an upper
 curve and lower  
 curve.  I tried to do this with an if statement,
 specifically:
 
 ycrit-subset(data,subset=data$x==min(data$x)
 y.max-length*sin(angle)+y.ref #length, angle and y.ref
 are given
 if(y.maxycrit){
 
 }
 
 Now the problem:  The while loop works for 4 iterations,
 until I get  
 the error message:
 
 Error in if (y.max  ycrit) { : missing value
 where TRUE/FALSE needed
 
 When I forced the function to print y.max and ycrit for
 each iteration  
 of the while loop, it returns finite real numbers,
 including ycrit =  
 153.5 and y.max = 245.16 for the step which returns the
 error message.
 
 Any ideas about what's going on here--why does R
 think that  
 245.16153.5 is missing, or is anything
 other than TRUE/FALSE?  Am I  
 using if incorrectly?  In which case would it
 be more appropriate to  
 perhaps create subsets of the data points based on  or
  ycrit?
 
 Thanks in advance for any guidance--
 Andy
 
 -- 
 Andrew J. Rominger
 Department of Biological Sciences
 Stanford University
 [EMAIL PROTECTED]
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained,
 reproducible code.


  __
[[elided Yahoo spam]]

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


[R] Help with error in if then statement

2008-07-11 Thread Andrew Rominger

Dear list,

I'm afraid this is a mundane question.  Here's the background: I've  
produced a function which allows me to sequentially measure angles and  
distances from a specified reference point to a curve defined by  
empirical data points while (i.e. using a while loop) the angle being  
measured is within certain bounds.  Because the curve is circular I  
need to pars the data into basically an upper curve and lower  
curve.  I tried to do this with an if statement, specifically:


ycrit-subset(data,subset=data$x==min(data$x)
y.max-length*sin(angle)+y.ref #length, angle and y.ref are given
if(y.maxycrit){

}

Now the problem:  The while loop works for 4 iterations, until I get  
the error message:


Error in if (y.max  ycrit) { : missing value where TRUE/FALSE needed

When I forced the function to print y.max and ycrit for each iteration  
of the while loop, it returns finite real numbers, including ycrit =  
153.5 and y.max = 245.16 for the step which returns the error message.


Any ideas about what's going on here--why does R think that  
245.16153.5 is missing, or is anything other than TRUE/FALSE?  Am I  
using if incorrectly?  In which case would it be more appropriate to  
perhaps create subsets of the data points based on  or  ycrit?


Thanks in advance for any guidance--
Andy

--
Andrew J. Rominger
Department of Biological Sciences
Stanford University
[EMAIL PROTECTED]

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


Re: [R] Help with error in if then statement

2008-07-11 Thread Erik Iverson

Hello -

Andrew Rominger wrote:

Dear list,

I'm afraid this is a mundane question.  Here's the background: I've 
produced a function which allows me to sequentially measure angles and 
distances from a specified reference point to a curve defined by 
empirical data points while (i.e. using a while loop) the angle being 
measured is within certain bounds.  Because the curve is circular I need 
to pars the data into basically an upper curve and lower curve.  I 
tried to do this with an if statement, specifically:


ycrit-subset(data,subset=data$x==min(data$x)


You might consider not using 'data' as a variable name (it is the name 
of a function in the utils package) , and clearer code might be


ycrit - subset(data, x == min(x))

But what does this return?  It can definitely return a data.frame as in 
the following example:


t1 - data.frame(a = rep(2,2))
t1
class(subset(t1, a == min(a)))

You probably do not want to them subsequently use this returned subset 
in an 'if' clause.  Also, consider cases where there are NAs in the data:


t2 - data.frame(a = c(NA,rep(2,2)))
t2
subset(t2, a == min(a))

This code returns a data.frame with 0 rows.

I don't know what your specific problem is, but hopefully this might 
lead you in the right direction.




y.max-length*sin(angle)+y.ref #length, angle and y.ref are given
if(y.maxycrit){

}

Now the problem:  The while loop works for 4 iterations, until I get the 
error message:


Error in if (y.max  ycrit) { : missing value where TRUE/FALSE needed

When I forced the function to print y.max and ycrit for each iteration 
of the while loop, it returns finite real numbers, including ycrit = 
153.5 and y.max = 245.16 for the step which returns the error message.


Any ideas about what's going on here--why does R think that 
245.16153.5 is missing, or is anything other than TRUE/FALSE?  Am I 
using if incorrectly?  In which case would it be more appropriate to 
perhaps create subsets of the data points based on  or  ycrit?


Thanks in advance for any guidance--
Andy



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


[R] Help with Error!

2008-03-07 Thread hoogeebear

Hi,

Can anyone explain the following error??

Error in FUN(newX[, i], ...) : missing observations in cov/cor
In addition: Warning message:
In FUN(newX[, i], ...) : NAs introduced by coercion

svm_modelSAheart1 - svm(x_training, y_training) is the command i am
using.my x/y training are working fine.

If anyone needs more information just let me know!

Hope to hear from someone soon.

Regards. 

-- 
View this message in context: 
http://www.nabble.com/Help-with-Error%21-tp15900037p15900037.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Help with Error

2008-01-17 Thread Richard . Cotton
 d - read.table(C:\\rep.csv, head=TRUE, sep=,)
  pie(d$Votes,
 + labels=d$Name,
 + main=Class Rep Results\n(Final Results))
 
 Error:
 Error in pie(d$votes, labels = d$name, main = Class Rep Results\n(Final
 Results)) : 
   'x' values must be positive.

The first input to the pie function represents the size of the pie slice, 
so it's values must be non-negative.

Take a look at what you have stored in the data frame d; it is possible 
that the data has been read into R incorrectly.
Type d and str(d) at the command line to see this.

Also, you might want to use read.csv to read in your data if it is comma 
separated value format.


Regards,
Richie.

Mathematical Sciences Unit
HSL



ATTENTION:

This message contains privileged and confidential inform...{{dropped:20}}

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


[R] Help with Error

2008-01-17 Thread hoogeebear

Hi,

I am having trouble with an error I keep getting. I am just trying to create
a simple pic chart from a small table. Hope someone can help. I am new to R.

Table:
 Name Votes
John   300
   Sean222
Andy   467
  Sinead   740
   David   124
   James   641
 William   380

Commands:
d - read.table(C:\\rep.csv, head=TRUE, sep=,)
 pie(d$Votes,
+ labels=d$Name,
+ main=Class Rep Results\n(Final Results))

Error:
Error in pie(d$votes, labels = d$name, main = Class Rep Results\n(Final
Results)) : 
  'x' values must be positive.

Hope to hear from someone soon

Best Regards,

John.
-- 
View this message in context: 
http://www.nabble.com/Help-with-Error-tp14923519p14923519.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Help with Error

2008-01-17 Thread hoogeebear

Thnk you very much! It now works correctly!

Much Appreciated,

John.


hoogeebear wrote:
 
 Hi,
 
 I am having trouble with an error I keep getting. I am just trying to
 create a simple pic chart from a small table. Hope someone can help. I am
 new to R.
 
 Table:
  Name Votes
 John   300
Sean222
 Andy   467
   Sinead   740
David   124
James   641
  William   380
 
 Commands:
 d - read.table(C:\\rep.csv, head=TRUE, sep=,)
 pie(d$Votes,
 + labels=d$Name,
 + main=Class Rep Results\n(Final Results))
 
 Error:
 Error in pie(d$votes, labels = d$name, main = Class Rep Results\n(Final
 Results)) : 
   'x' values must be positive.
 
 Hope to hear from someone soon
 
 Best Regards,
 
 John.
 

-- 
View this message in context: 
http://www.nabble.com/Help-with-Error-tp14923519p14925064.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Help with Error

2008-01-17 Thread John Kane
It looks fine to me.  Try str(d) and check to be sure
that Votes is a numeric value or integer value. 

I ran this code with no problem.

 x -  Name Votes
John   300
   Sean222
Andy   467
  Sinead   740
   David   124
   James   641
 William   380 
d - read.table(textConnection(x), header=TRUE,
as.is=TRUE); d

pie(d$Votes, labels=d$Name, main=Class Rep
Results\n(Final Results))

--- hoogeebear [EMAIL PROTECTED] wrote:
 Hi,
 
 I am having trouble with an error I keep getting. I
 am just trying to create
 a simple pic chart from a small table. Hope someone
 can help. I am new to R.
 
 Table:
  Name Votes
 John   300
Sean222
 Andy   467
   Sinead   740
David   124
James   641
  William   380
 
 Commands:
 d - read.table(C:\\rep.csv, head=TRUE, sep=,)
  pie(d$Votes,
 + labels=d$Name,
 + main=Class Rep Results\n(Final Results))
 
 Error:
 Error in pie(d$votes, labels = d$name, main = Class
 Rep Results\n(Final
 Results)) : 
   'x' values must be positive.
 
 Hope to hear from someone soon
 
 Best Regards,
 
 John.
 -- 
 View this message in context:

http://www.nabble.com/Help-with-Error-tp14923519p14923519.html
 Sent from the R help mailing list archive at
 Nabble.com.
 
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained,
 reproducible code.
 



  Instant Messaging, free SMS, sharing photos and more... Try the new 
Yahoo! Canada Messenger at http://ca.beta.messenger.yahoo.com/

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


[R] Help with Error Message

2007-11-05 Thread Patrick Richardson
Hoping someone can offer me some assistance.  I'm trying to execute a script
and I keep getting this error message about Error: element 12 is empty.
I'm wondering if my syntax is incorrect within legend.list.  If anyone has
any suggestions to sees something obvious that I am missing, I would greatly
appreciate any help.

Many Thanks,

Patrick

 # These are the symbols and colors to use for each phenotype in the model
and test sets 
 #  model samples:   square symbols
 #  color symbol  phenotype
 legend.list - c(green, 22,# ALL-B 
+  steelblue, 22,# ALL-T 
+  red,   22,# AML   
+ #  test samples:cicle symbols
+ #  color symbol  phenotype 
+  lightgreen,21,# ALL-B 
+  lightblue, 21,# ALL T 
+  orange,21,# AML 
+ )
Error: element 12 is empty;
   the part of the args list of 'c' being evaluated was:
   (22, steelblue, 22, red, 22, lightgreen, 21, lightblue, 21,
orange, 21, )
 
 col - legend.list[seq(1, length(legend.list), 2)]
Error: object legend.list not found
 symbs - as.numeric(legend.list[seq(2, length(legend.list), 2)])
Error: object legend.list not found

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


Re: [R] Help with Error Message

2007-11-05 Thread Matthew Keller
Not having run your script, it looks to me like you have an extra
comma after the final element of legend.list...

On 11/5/07, Patrick Richardson [EMAIL PROTECTED] wrote:
 Hoping someone can offer me some assistance.  I'm trying to execute a script
 and I keep getting this error message about Error: element 12 is empty.
 I'm wondering if my syntax is incorrect within legend.list.  If anyone has
 any suggestions to sees something obvious that I am missing, I would greatly
 appreciate any help.

 Many Thanks,

 Patrick

  # These are the symbols and colors to use for each phenotype in the model
 and test sets
  #  model samples:   square symbols
  #  color symbol  phenotype
  legend.list - c(green, 22,# ALL-B
 +  steelblue, 22,# ALL-T
 +  red,   22,# AML
 + #  test samples:cicle symbols
 + #  color symbol  phenotype
 +  lightgreen,21,# ALL-B
 +  lightblue, 21,# ALL T
 +  orange,21,# AML
 + )
 Error: element 12 is empty;
the part of the args list of 'c' being evaluated was:
(22, steelblue, 22, red, 22, lightgreen, 21, lightblue, 21,
 orange, 21, )
 
  col - legend.list[seq(1, length(legend.list), 2)]
 Error: object legend.list not found
  symbs - as.numeric(legend.list[seq(2, length(legend.list), 2)])
 Error: object legend.list not found

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



-- 
Matthew C Keller
Asst. Professor of Psychology
University of Colorado at Boulder
www.matthewckeller.com

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


[R] Help in error of mixed models

2007-11-04 Thread Bernardo Rangel Tura

Hi R-masters

I read the article: Bivariate analysis of sensitivity and specificity
produces informative summary measures in diagnostic reviews.

In this paper i proposed a bivariate mixed model and use SAS proc mixed
to adjust the estimates.


I thinks use R to make the same and try with this code:

base-read.csv(base.csv)
adj-.5
attach(base)

sens-(VP+adj)/(VP+FN+2*adj)
log.S-log(sens/(1-sens))
var.log.S-1/(sens*(1-sens)*(VP+FN))
dis-rep(1,length(log.S))
non.dis-rep(0,length(log.S))
data.S-data.frame(id,Modality,log.S,var.log.S,dis,non.dis)
names(data.S)-c(id,Modality,logit,var.logit,dis,non.dis)

esp-(VN+adj)/(VN+FP+2*adj)
log.E-log((1-esp)/esp)
var.log.E-1/(esp*(1-esp)*(VN+FP))
dis-rep(0,length(log.E))
non.dis-rep(1,length(log.E))
data.E-data.frame(id,Modality,log.E,var.log.E,dis,non.dis)
names(data.E)-c(id,Modality,logit,var.logit,dis,non.dis)

data.bi-rbind(data.S,data.E)
require(nlme) 
lme(logit~dis*Modality+non.dis*Modality, random=~dis|id+non.dis|
id,data=data.bi)

but i recive a erro msg :

Error in MEEM(object, conLin, control$niterEM) : 
  Singularity in backsolve at level 0, block 1


How in solve this problem? Whats is wrong?

Thanks in advance
-- 
Bernardo Rangel Tura, M.D,Ph.D
National Institute of Cardiology
Brazil
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] help on error message!!!

2007-11-04 Thread david csongor
Could anyone please  help me with this one!!!
I am looping some simple stuff but when I enter an if - function I get this
error message:


Error in if (y  (2/(1 * pi) * sqrt(1 - ((x - 2)/1)^2))) c[i] = x else c[i]
= 0 :
missing value where TRUE/FALSE needed


WHAT does it mean, what should I do

[[alternative HTML version deleted]]

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


Re: [R] help on error message!!!

2007-11-04 Thread Bernardo Rangel Tura

On Sun, 2007-11-04 at 15:06 +0100, david csongor wrote:
 Could anyone please  help me with this one!!!
 I am looping some simple stuff but when I enter an if - function I get this
 error message:
 
 
 Error in if (y  (2/(1 * pi) * sqrt(1 - ((x - 2)/1)^2))) c[i] = x else c[i]
 = 0 :
 missing value where TRUE/FALSE needed
 
 
 WHAT does it mean, what should I do

Try ifelse:

c-ifelse(y  (2/(1 * pi)*sqrt(1 -(x - 2)^2)),x,c[i])
-- 
Bernardo Rangel Tura, M.D,Ph.D
National Institute of Cardiology
Brazil

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


Re: [R] Help in error of mixed models

2007-11-04 Thread Andrew Robinson
Hi Bernardo,

it may sound simple-minded, but it looks to me as though you have a
problem with the model.  Unfortunately it's difficult for us to
diagnose the problem because you didn't send an example that we can
reproduce.  We don't have the base data.

Based on my understanding of your code, you might try

lme(logit ~ dis*Modality + non.dis*Modality, 
  random = ~ dis+non.dis | id, 
  data = data.bi)

If this doesn't work, try fitting a simpler model, eg 

lme(logit ~ dis*Modality + non.dis*Modality,
  random = ~ | id,
  data = data.bi)

and then using update() to increment towards the full model of
interest.  You can also change the model-fitting engine, I have
sometimes had success using Nelder-Mead where nlminb failed.  For more
information about this see 

?lmeControl

Can I also recommend that you use more spaces in your code?

Good luck

Andrew

On Sun, Nov 04, 2007 at 09:18:09AM -0200, Bernardo Rangel Tura wrote:
 
 Hi R-masters
 
 I read the article: Bivariate analysis of sensitivity and specificity
 produces informative summary measures in diagnostic reviews.
 
 In this paper i proposed a bivariate mixed model and use SAS proc mixed
 to adjust the estimates.
 
 
 I thinks use R to make the same and try with this code:
 
 base-read.csv(base.csv)
 adj-.5
 attach(base)
 
 sens-(VP+adj)/(VP+FN+2*adj)
 log.S-log(sens/(1-sens))
 var.log.S-1/(sens*(1-sens)*(VP+FN))
 dis-rep(1,length(log.S))
 non.dis-rep(0,length(log.S))
 data.S-data.frame(id,Modality,log.S,var.log.S,dis,non.dis)
 names(data.S)-c(id,Modality,logit,var.logit,dis,non.dis)
 
 esp-(VN+adj)/(VN+FP+2*adj)
 log.E-log((1-esp)/esp)
 var.log.E-1/(esp*(1-esp)*(VN+FP))
 dis-rep(0,length(log.E))
 non.dis-rep(1,length(log.E))
 data.E-data.frame(id,Modality,log.E,var.log.E,dis,non.dis)
 names(data.E)-c(id,Modality,logit,var.logit,dis,non.dis)
 
 data.bi-rbind(data.S,data.E)
 require(nlme) 
 lme(logit~dis*Modality+non.dis*Modality, random=~dis|id+non.dis|
 id,data=data.bi)
 
 but i recive a erro msg :
 
 Error in MEEM(object, conLin, control$niterEM) : 
   Singularity in backsolve at level 0, block 1
 
 
 How in solve this problem? Whats is wrong?
 
 Thanks in advance
 -- 
 Bernardo Rangel Tura, M.D,Ph.D
 National Institute of Cardiology
 Brazil

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


-- 
Andrew Robinson  
Department of Mathematics and StatisticsTel: +61-3-8344-9763
University of Melbourne, VIC 3010 Australia Fax: +61-3-8344-4599
http://www.ms.unimelb.edu.au/~andrewpr
http://blogs.mbs.edu/fishing-in-the-bay/

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