[R] R Installation Options

2014-01-23 Thread Mark Lyman
Can I build a version of R for Windows without some functionality like ftp
and sockets? And without some of the recommended packages? It doesn't look
like this can be done from the Windows install file, but if it can that
would nice to know too.

Thanks,
Mark

[[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] R Installation Options

2014-01-23 Thread Mark Lyman
Thank you. I ask because our IT people have security concerns with that
functionality


On Thu, Jan 23, 2014 at 10:25 AM, Prof Brian Ripley
rip...@stats.ox.ac.ukwrote:

 On 23/01/2014 16:15, Mark Lyman wrote:

 Can I build a version of R for Windows without some functionality like ftp
 and sockets? And without some of the recommended packages? It doesn't look
 like this can be done from the Windows install file, but if it can that
 would nice to know too.


 Installing the recommended packages is a documented step you can omit.

 Not building the Internet support means modifying Makefiles, but it would
 seem as easy to remove the internet[2].dll if you want to hobble the
 feature.

 OTOH, in 15 years no one has ever asked to build R without internet
 support, on any platform.

 --
 Brian D. Ripley,  rip...@stats.ox.ac.uk
 Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
 University of Oxford, Tel:  +44 1865 272861 (self)
 1 South Parks Road, +44 1865 272866 (PA)
 Oxford OX1 3TG, UKFax:  +44 1865 272595


[[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] odbcConnectExcel2007 creates corrupted files

2011-03-01 Thread Mark Lyman
I tried creating a .xlsx file using odbcConnectExcel2007 and adding a 
worksheet with sqlSave. This seems to work, I am even able to query the 
worksheet, but when I try opening the file in Excel I get the following 
message: Excel cannot open the file 'test.xlx' because the file format or 
file extension is not valid. Verify that the file has not been corrupted and 
that the file extension matches the format of the file. Is this a known 
issue? Or just user error? The RODBC manual seemed to indicate that sqlSave 
worked fine with Excel, however it did not mention Excel 2007.

I am running Excel 2007 and R 2.12.1 on Windows XP. Below is my example code. 

$ library(RODBC)
$ 
$ # This doesn't work
$ # Connect to an previously non-existent Excel file
$ out - odbcConnectExcel2007(test.xlsx, readOnly=FALSE)
$ test - data.frame(x=1:10, y=rnorm(10))
$ sqlSave(out, test)
$ sqlTables(out)
TABLE_CAT TABLE_SCHEM 
TABLE_NAME   TABLE_TYPE REMARKS
1 C:\\Documents and Settings\\G69974\\My Documents\\test.xlsxNA  
test$ SYSTEM TABLENA
2 C:\\Documents and Settings\\G69974\\My Documents\\test.xlsx
NA   testTABLENA
$ sqlFetch(out, test)
x  y
1   1  0.5832882
2   2  0.4387569
3   3 -0.6444048
4   4 -1.0013450
5   5  1.0324718
6   6 -0.7844128
7   7 -1.6789266
8   8  0.1402672
9   9  0.8650061
10 10 -0.0420201
$ close(out)
$ # Opening test.xlsx now fails
$ 
$ # This works
$ out - odbcConnectExcel(test.xls, readOnly=FALSE)
$ test - data.frame(x=1:10, y=rnorm(10))
$ sqlSave(out, test)
$ sqlTables(out)
   TABLE_CAT TABLE_SCHEM 
TABLE_NAME   TABLE_TYPE REMARKS
1 C:\\Documents and Settings\\G69974\\My Documents\\testNA  
test$ SYSTEM TABLENA
2 C:\\Documents and Settings\\G69974\\My Documents\\testNA   
testTABLENA
$ sqlFetch(out, test)
x  y
1   1  0.5955787
2   2  1.0517528
3   3  0.3884892
4   4 -2.1408813
5   5 -0.7081686
6   6  0.1511828
7   7  2.0560555
8   8 -0.5801912
9   9 -0.6988058
10 10 -0.1237739
$ close(out)
$ # Opening test.xls now works

__
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] Weighting data with normal distribution

2009-03-27 Thread Mark Lyman
Alice Lin alice.ly at gmail.com writes:

 
 
 I have a vector of binary data – a string of 0’s and 1’s. 
 I want to weight these inputs with a normal kernel centered around entry x
 so it is transformed into a new vector of data that takes into account the
 values of the entries around it (weighting them more heavily if they are
 near).
 
 Example:
   -
- -
 -  -
 0 1 0 0 1 0 0 1 1 1 1 
 If x = 3, it’s current value is 0 but it’s new value with the Gaussian
 weighting around would be something like .1*0+.5*1+1*0+0.5*0+.1*1= 0.6
 
 I want to be able to play with adjusting the variance to different values as
 well.
 I’ve found wkde in the mixtools library and think it may be useful but I
 have not figured out how to use it yet.
 
 Any tips would be appreciated.
 
 Thanks!
 

I don't know anything about wkde. But the filter function in stats package 
should do what you want.

 x - c(0, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1)
 filter(x, c(.1, .5, 1, .5, .1))
Time Series:
Start = 1 
End = 11 
Frequency = 1 
 [1]  NA  NA 0.6 0.6 1.0 0.6 0.7 1.6 2.1  NA  NA

In the signal package, there is also a variety of windows, including the 
gausswin function. However, the filter function in the signal package masks the 
filter function from the stats package

 stats::filter(x, gausswin(5, 2.68))

Mark Lyman
Statistician, ATK Launch Systems

__
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] scatter plot question

2009-03-03 Thread Mark Lyman
Dipankar Basu basu.15 at gmail.com writes:

 
 Hi R Users,
 
 I have a dataframe like this:
 
 id  x   rho
 A  1   0.1
 B  20  0.5
 C  2   0.9
 ...
 
 I want to do a scatter plot of x versus rho but for each point on the
 scatter plot I want the corresponding entry for id instead of points.

test - data.frame(id=c(A, B, C), x=c(1, 20, 2), rho=c(0.1, 0.5, 0.9))
plot(rho~x, test, pch=as.character(id))

Mark Lyman

__
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] How to convert S4 class slots into data.frame or how to assign variables of type 'Date'

2008-11-21 Thread Mark Lyman
  Hi,
 
  I created a class (S4) with some slots like value, date, description  
  (it's actually a financial transaction class). Now  I need a method  
  to convert this class forth and back into a single row data.frame,  
  where every slots represents a column. This method looks at the  
  moment like this:
 
   setMethod(as.data.frame, Transaction,
 function(x, row.names = NULL,  optional = FALSE, ...){
 slotnames - slotNames(x)
 slotlist -  
  data.frame(rbind(1:length(slotnames)))
 names(slotlist) - slotnames
 for(i in slotnames) {
 slotlist[1, i] - slot(x,  i)
 }
 return(slotlist)
 }
  )
 
  This method doesn't require predetermined slotnames or types, which  
  is important to me. The method works quite good but the problem is  
  that I have slots of type 'Date' and this method doesn't preserve  
  the type but converts it to numeric.
 


You would probably have gotten a quicker response if you had made a 
reproducible example as requested in the posting guide. However, the following 
example should give you a solution.

tmp - new(numWithId, 1, id = Sys.Date())
slotnames - slotNames(tmp)
slotlist - vector(list, length(slotnames))
names(slotlist) - slotnames
for(i in slotnames) slotlist[[i]] - slot(tmp, i)
as.data.frame(slotlist)

Take a look at the coercion section of ?[.data.frame. I belive your Date is 
being converted to numeric to match the class of what it is replacing.

Mark Lyman
Statistician, ATK

__
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] apply() just loops ?

2008-11-12 Thread Mark Lyman
Markus Loecher mao.loecher at gmail.com writes:

 
 Dear R users,
 I have been diligently using the apply() family in order to avoid explicit
 for loops and speed up computation.
 However, when I finally inspected the source code for apply, it appears that
 the core computation is a simple loop as well.
 What am I missing ? Why the often found advice to use apply() instead of
 loops and the actually observed empirical  speedups on many tasks ?
 
 Thanks in advance for demystifying,
 
 Markus
 

Professor Ripley gave the following response to a similar question, that I 
believe will answer your question.

http://finzi.psych.upenn.edu/R/Rhelp02a/archive/76330.html

Mark Lyman

__
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] Remove warnings.

2008-10-14 Thread Mark Lyman
 rkevinburton at charter.net writes:

 
 The problem is that I am interested in all the warnings but after they have 
been reported using the
 'warnings()' command I am no longer interested in those warnings but similar 
warnings (of the same type)
 may occur with subsequent invocations and I am interested in these new 
warnings not the ones that have
 been reported already. If 'warnings()' cleared out the warnings then it would 
be ideal for me.
 
 Thank you.
 
 Kevin
  hadley wickham h.wickham at gmail.com wrote: 
  Why don't you just suppress the warning messages you are not interested in?
  
  ?suppressWarnings
  
  Hadley
  
  
  On Tue, Oct 14, 2008 at 7:59 AM,  rkevinburton at charter.net wrote:
   I have a function that could possibly generate warnings in a loop. What I 
want is to report the warnings
 (warnings()) then clear out the last.warning object so that if there is a 
call without warnings I will not
 see the previous warning.
   Some example code:
  
   generatewarning - function(s)
   {
  warning(s)
   }
  
   loop - function(f=TRUE)
   {
  if(f)
  {
  for(.index in 1:10)
  {
  if(.index %% 2)
  {
  generatewarning(sprintf(%d warning, .index))
  }
  }
   }
   }
  
   loop()
   warnings(TRUE)
   loop(FALSE)
   warnings(FALSE)
   loop()
   warnings(TRUE)
  
   Notice that the call to warnings(FALSE) still reports the warnings 
from the previousely generated
 warnings. I want to clear this set since it has already been reported. Is 
there a way to do this?
  
   Thank you.
  
   Kevin
  

Does setting the warn option to 1 do what you want?

 options(warn=1)
 generatewarning - function(s)
+ {
+ warning(s)
+ }
 
 loop - function(f=TRUE)
+ {
+ if(f)
+ {
+ for(.index in 1:10)
+ {
+  if(.index %% 2)
+  {
+   generatewarning(sprintf(%d warning, .index))
+  }
+ }
+  }
+ }
 
 loop()
Warning in generatewarning(sprintf(%d warning, .index)) : 1 warning
Warning in generatewarning(sprintf(%d warning, .index)) : 3 warning
Warning in generatewarning(sprintf(%d warning, .index)) : 5 warning
Warning in generatewarning(sprintf(%d warning, .index)) : 7 warning
Warning in generatewarning(sprintf(%d warning, .index)) : 9 warning
 warnings(TRUE)
NULL
 loop(FALSE)
 warnings(FALSE)
NULL
 loop()
Warning in generatewarning(sprintf(%d warning, .index)) : 1 warning
Warning in generatewarning(sprintf(%d warning, .index)) : 3 warning
Warning in generatewarning(sprintf(%d warning, .index)) : 5 warning
Warning in generatewarning(sprintf(%d warning, .index)) : 7 warning
Warning in generatewarning(sprintf(%d warning, .index)) : 9 warning
 warnings(TRUE)
NULL

__
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] Two math expressions in plot

2008-10-09 Thread Mark Lyman
Giovanni Petris GPetris at uark.edu writes:

 
 
 Hello!
 
 I am trying to put two math expressions in the title of a plot.  As
 you can see below, I can place correctly one expression at a time, but
 not both. Ideally I would like to have them separated by a comma. Any
 suggestions? 
 
  k - 1
  n.eff - c(20, 30)
  ### this works
  plot(0,0, main = substitute(n == k, list(k = k)))
  ### this works
  plot(0,0, main = substitute(N[eff] == neff, list(neff = n.eff[k])))
  ### this doesn't work
  plot(0,0, main = substitute(n == k * N[eff] == neff, list(k = k, neff = 
n.eff[k])))
 

This should do it for you:

plot(0,0, main = substitute(paste(n == k*, , N[eff] == neff), list(k = k, 
neff = n.eff[k])))

__
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] merging a list and data frame

2008-10-01 Thread Mark Lyman
eric lee ericlee100 at gmail.com writes:

 
 Hi,
 
 I'd like to merge the following list and data frame by matching the first
 column in the data frame to the first number in each object of the list.
 I'd also like the merged object to be a list.  Any suggestions?  Thanks.
 
 eric
 
 a - list(c(1,11), c(2,12), c(3,13), c(4,14), c(5,16))
 
 b - data.frame(1:5, 51:55)


Here is one idea:

 a - list(c(1,11), c(2,12), c(3,13), c(4,14), c(5,16))
 b - data.frame(1:5, 51:55)
 tmp - merge(do.call(rbind, a), b, by=1)
 split(as.matrix(tmp), row(tmp))
$`1`
[1]  1 11 51

$`2`
[1]  2 12 52

$`3`
[1]  3 13 53

$`4`
[1]  4 14 54

$`5`
[1]  5 16 55

__
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] question about working with workspaces

2008-10-01 Thread Mark Lyman
Daniel Rabczenko d.rabczenko at iestat.pl writes:

 
 Hello everybody,
 
 Two - I hope Simple questions about working with workspaces.
 
 Is there a way to force R to start in clean workspace / avoid previously
 saved workspace restored?

When you start R, use the option --no-restore. If you are working in windows 
you can add this to the target field of the the shortcut that you use to start 
R.
 When I load workspace2 working in workspace1 everything from 1 is
 written into 2 is there a way to avoid it?

Take a look at ?save.

Mark Lyman

 Best regards,
 
 Daniel Rabczenko


__
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] plot order in multi-panel figure

2008-09-19 Thread Mark Lyman
Stephen Tucker brown_emu at yahoo.com writes:

 Hi, 
 
 Does anyone know if there is a way to 'reset the plot number' on a 
traditional graphics device?
 
 For instance, I want to have two plots on stacked top of each other (mfrow=c
(2,1)) but with underlying grid
 lines spanning both figures vertically.


Below is one approach using split.screen. See ?split.screen for details.

 split.screen(c(1,1))
[1] 1
 screen(1)
 plot.window(c(0,1),c(0,1))
 abline(v=seq(0,1,by=0.2),lty=3)
 split.screen(c(2,1))
[1] 2 3
 screen(2)
 plot.new()
 plot.window(c(0,1),c(0,1))
 for(i in 1:2) axis(i)
 box(bty=L)
 rect(0.2,0.2,0.5,0.5,col=8)
 screen(3)
 plot.new()
 plot.window(c(0,1),c(0,1))
 for( i in 1:2) axis(i)
 box(bty=L)
 close.screen()
[1] 1 2 3

Mark Lyman

__
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] extract variance components

2008-08-29 Thread Mark Lyman
huang min minhuangr at gmail.com writes:

 
 HI,
 
 I would like to extract the variance components estimation in lme function
 like
 
 a.fit-lme(distance~age, data=aaa, random=~day/subject)
 
 There should be three variances \sigma_day, \sigma_{day %in% subject } and
 \sigma_e.
 
 I can extract the \sigma_e using something like a.fit$var. However, I cannot
 manage to extract the first two variance components. I can only see the
 results in summary(a.fit).
 
 I have some problem in the lme4 package and hence use the nlme package. The
 example data also has some problem so I just list the function here using
 some imaginary data set. Thank you.
 


You probably want to try one of these

 fm1 - lme(distance ~ age, data = Orthodont, subset = Sex == Female)
 getVarCov(fm1)
Random effects variance covariance matrix
(Intercept)   age
(Intercept) 3.55020 -0.107490
age-0.10749  0.025898
  Standard Deviations: 1.8842 0.16093 
 diag(getVarCov(fm1))
(Intercept) age 
 3.55015248  0.02589773 
 VarCorr(fm1)
Subject = pdSymm(age) 
Variance   StdDevCorr  
(Intercept) 3.55015248 1.8841848 (Intr)
age 0.02589773 0.1609277 -0.354
Residual0.44659098 0.6682746   
 VarCorr(fm1)[,1]
 (Intercept)  age Residual 
3.55015248 0.02589773 0.44659098 
 as.numeric(VarCorr(fm1)[,1])
[1] 3.55015248 0.02589773 0.44659098

Mark

__
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] Function not returning a vector?

2008-08-28 Thread Mark Lyman
 rkevinburton at charter.net writes:

 
 Why does:
 
 (shape/scale) * (1:365/scale)^(shape - 1)
 
 return a vector of numbers but calling a function
 
 hasard(1:365,shape,scale)
 
 defined like:
 
 hazard - function(x,shape,scale)
 {
return (shape/scale) * (x/scale)^(shape - 1)
 }
 
 Only return a single value? It is like x becomes a single value passed as an 
argument.
 

I believe you have a couple of typos. Your function is returning shape/scale 
only. Try:

hazard - function(x,shape,scale)
{
 return ((shape/scale) * (x/scale)^(shape - 1))
}

__
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] Very confused with class

2008-08-21 Thread Mark Lyman
Williams, Robin robin.williams at metoffice.gov.uk writes:

 
 Hi all,
   I am very confused with class.
   I am looking at some weather data which I want to use as explanatory
 variables in an lm. R has treated these variables as factors (i.e. with
 different levels), whereas I want them treated as discretely measured
 continuous variables.
 

The short answer to your problem can be found in the documentation for factor, 
particularly in the Warning section.

?factor

Mark

__
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] New to R. Question about very large files

2008-08-14 Thread Mark Lyman
Richard Palmer rhpalmer at gmail.com writes:

 
 .. I am new to R but experienced in SAS.  SAS has the capability to let me
 develop a model from a sample and use the results to score the records of
 another file which won't fit in memory.  Is this straightforward in R or
 does it require coding to do the scoring in segments?  Can someone point me
 to sample code that I can copy or modify to do this quickly?
 

I don't know what you mean by score the records, but the package biglm might 
be able help.

Mark

__
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] The standard deviation of measurement 1 with respec t to measurement 2

2008-08-13 Thread Mark Lyman
Firas Swidan frsswdn at gmail.com writes:

 
 Hi,
 
 I have two (different types of) measurements, say X and Y, resulting from
 the same set of experiments. So X and Y are paired: (x_1, y_1), (x_2, y_2),
 ...
 
 I am trying to calculate the standard deviation of Y with respect to X. In
 other words, in terms of the scatter plot of X and Y, I would like to divide
 it into bins along the X-axis and for each bin calculate the standard
 deviation along the Y results in that bin. (Though I am not totally sure,
 this seems to remind me of the conditional expectation of Y given X - maybe
 it is called the conditional deviation?)
 
 Is their a built in procedure in R for calculating the above? Otherwise,
 what would be the easiest way to achieve it? (factors maybe?)
 
 Thankful for the help,
 Firas.
 

Something like the following should give you what you want:

 x - rnorm(50)
 y - rnorm(50)
 tapply(y, cut(x, 10, include.lowest=TRUE), sd)
 [-2.19,-1.75]   (-1.75,-1.3]   (-1.3,-0.86] (-0.86,-0.415] (-0.415,0.029] 
 0.7569111  0.1671267  0.5620591  1.1280510  0.7772356 
 (0.029,0.473]  (0.473,0.918]   (0.918,1.36](1.36,1.81](1.81,2.25] 
 0.5600363  0.7681090  0.9754286  0.3184307  0.2410181

__
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] Simulate from a GAM model

2008-07-01 Thread Mark Lyman
Does anybody have any suggestions on how I might simulate from fitted GAM 
model? I am using the gam function in the mgcv package to fit a variable 
coefficient model like the following from the examples. I would like simulate 
based on the fitted model like the simulate function in the stats package does 
for lm models.

library(mgcv)
set.seed(10)
## simulate date from y = f(x2)*x1 + error
dat - gamSim(3,n=400)
b-gam(y ~ s(x2,by=x1),data=dat)


Thanks for any help you can give,
Mark Lyman

__
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] WIERD: Basic computing in R

2008-07-01 Thread Mark Lyman
poolloopus at yahoo.com poolloopus at yahoo.com writes:

 
 Can someone please enlighten me as to why the following happens?
  -2.7^8.6
 [1] -5125.407
 
  p- -2.7
  q- 8.6
  p^q
 [1] NaN
 R seems perfectly able to calculate -2.7^8.6, but fails when the exact same 
values are assigned to
 variables and then the computation is repeated. 
 Thanks in advance for any suggetsions.
 Kris.


The problem is the grouping is not what you are expecting it is. Try

(-2.7)^8.6

and

p - 2.7
q - 8.6
p^q

Mark

__
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-ex folder in user-created package

2008-04-02 Thread Mark Lyman
When I run R CMD check pkg the R-ex folder containing examples is created in 
pkg.Rcheck/pkg, however, when I run R CMD build pkg or R CMD INSTALL --build 
pkg, it is not created. Should the folder and its examples be created 
manually? I am running R 2.6.2 on Windows XP.

__
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] R-ex folder in user-created package

2008-04-02 Thread Mark Lyman
Mark Lyman mark.lyman at gmail.com writes:

 
 When I run R CMD check pkg the R-ex folder containing examples is created in 
 pkg.Rcheck/pkg, however, when I run R CMD build pkg or R CMD INSTALL --build 
 pkg, it is not created. Should the folder and its examples be created 
 manually? I am running R 2.6.2 on Windows XP.
 
 __
 R-help at 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.
 
 


I have discovered my error. I over-looked the fact that examples are a type of 
documentation. I didn't realize that the command R CMD INSTALL --build --
docs=txt,html would not create the examples.

__
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] Using subset in correlation analysis

2008-03-19 Thread Mark Lyman
James J. Roper jjroper at gmail.com writes:

 
 The correlation test function says that it can do a subset where one 
 specifies the subsete vector.  I cannot seem to get it to work.
 
 For example, the command line is:
 
 cor.test(adults$Alt, adults$Cab, alternative=greater, method=pearson)
 
 So, let´s say my subset vector is Sex.  How would I state the command 
 to get the test of that subset?
 
 Thanks in advance.
 
 Jim

The subset argument only applies to the formula method. It should be a boolean 
vector something like the following (assuming adults is a data frame):

cor.test(~ Alt + Cab, adults, Sex==MALE, alternative=greater, 
method=pearson)

__
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] Dealing with schema in RODBC

2007-11-09 Thread Mark Lyman
Thanks for your suggestion Marc. I saw that on some Oracle-related
web-sites, but something in the way RODBC functions verify the existance of
a table does not accept that naming structure. For example:

 sqlColumns(eids, EIDS.TEST_ARTCL_INST)
Error in sqlColumns(eids, EIDS.TEST_ARTCL_INST) :
'EIDS.TEST_ARTCL_INST': table not found on channel


On 11/7/07, Marc Schwartz [EMAIL PROTECTED] wrote:

 On Wed, 2007-11-07 at 22:15 +, Mark Lyman wrote:
  Is there a way to get a table in a certain schema? The Oracle database I
 am
  using has a table by the same name in two different schemas. This
 creates
  problems in sqlUpdate because to sqlUpdate there are duplicate columns.
 The
  following is part of the output of sqlColumns:
 
  sqlColumns(eids, TEST_ARTCL_INST)[,1:4]
 TABLE_CAT TABLE_SCHEM  TABLE_NAMECOLUMN_NAME
  1   EIDS TEST_ARTCL_INST CHANNEL_ID
  2   EIDS TEST_ARTCL_INSTARTICLE_TEST_ID
  3   EIDS TEST_ARTCL_INST CHANNEL_OLD_ID
  4   EIDS TEST_ARTCL_INSTFREQ_FM_CNT
  5   EIDS TEST_ARTCL_INST  RANGE_MAX_CNT
  6   EIDS TEST_ARTCL_INST  RANGE_MIN_CNT
  7   EIDS TEST_ARTCL_INST   TYPE_GAGE_ID
  8   EIDS TEST_ARTCL_INSTDRAWING_TYPE_ID
  9   EIDS TEST_ARTCL_INST DRAWING_ID
  10  EIDS TEST_ARTCL_INST RATE_SPECIFIED_CNT
  11  EIDS TEST_ARTCL_INST  ACCURACY_RQRD_CNT
  12  EIDS TEST_ARTCL_INSTUNIT_MSR_ID
  13  EIDS_APP TEST_ARTCL_INST CHANNEL_ID
  14  EIDS_APP TEST_ARTCL_INSTARTICLE_TEST_ID
  15  EIDS_APP TEST_ARTCL_INST CHANNEL_OLD_ID
  16  EIDS_APP TEST_ARTCL_INSTFREQ_FM_CNT
  17  EIDS_APP TEST_ARTCL_INST  RANGE_MAX_CNT
  18  EIDS_APP TEST_ARTCL_INST  RANGE_MIN_CNT
  19  EIDS_APP TEST_ARTCL_INST   TYPE_GAGE_ID
  20  EIDS_APP TEST_ARTCL_INSTDRAWING_TYPE_ID
  21  EIDS_APP TEST_ARTCL_INST DRAWING_ID
  22  EIDS_APP TEST_ARTCL_INST RATE_SPECIFIED_CNT
  23  EIDS_APP TEST_ARTCL_INST  ACCURACY_RQRD_CNT
  24  EIDS_APP TEST_ARTCL_INSTUNIT_MSR_ID
 
  Mark Lyman

 Typically, with a schema in Oracle, you use:

 schema.object

 syntax. So something like (in SQL):

 select * from EIDS.TEST_ARTCL_INST;

 would be different than:

 select * from EIDS_APP.TEST_ARTCL_INST;


 So in RODBC, prefix any occurrence of a table name with 'SchemaName.' as
 may be appropriate. The same syntax is used for views.

 The nuance is that in Oracle, all users typically have a schema that is
 their UserID. When you login to Oracle and just use the table name, your
 current UserID schema prefix is 'implied'.

 However, if you want to access other objects within schema created by
 other users, you need to explicitly use the schema prefix. You of course
 also need appropriate access privileges for other schema that you have
 not created.

 HTH,

 Marc Schwartz




[[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] Dealing with schema in RODBC

2007-11-07 Thread Mark Lyman
Is there a way to get a table in a certain schema? The Oracle database I am 
using has a table by the same name in two different schemas. This creates 
problems in sqlUpdate because to sqlUpdate there are duplicate columns. The 
following is part of the output of sqlColumns:

sqlColumns(eids, TEST_ARTCL_INST)[,1:4]
   TABLE_CAT TABLE_SCHEM  TABLE_NAMECOLUMN_NAME
1   EIDS TEST_ARTCL_INST CHANNEL_ID
2   EIDS TEST_ARTCL_INSTARTICLE_TEST_ID
3   EIDS TEST_ARTCL_INST CHANNEL_OLD_ID
4   EIDS TEST_ARTCL_INSTFREQ_FM_CNT
5   EIDS TEST_ARTCL_INST  RANGE_MAX_CNT
6   EIDS TEST_ARTCL_INST  RANGE_MIN_CNT
7   EIDS TEST_ARTCL_INST   TYPE_GAGE_ID
8   EIDS TEST_ARTCL_INSTDRAWING_TYPE_ID
9   EIDS TEST_ARTCL_INST DRAWING_ID
10  EIDS TEST_ARTCL_INST RATE_SPECIFIED_CNT
11  EIDS TEST_ARTCL_INST  ACCURACY_RQRD_CNT
12  EIDS TEST_ARTCL_INSTUNIT_MSR_ID
13  EIDS_APP TEST_ARTCL_INST CHANNEL_ID
14  EIDS_APP TEST_ARTCL_INSTARTICLE_TEST_ID
15  EIDS_APP TEST_ARTCL_INST CHANNEL_OLD_ID
16  EIDS_APP TEST_ARTCL_INSTFREQ_FM_CNT
17  EIDS_APP TEST_ARTCL_INST  RANGE_MAX_CNT
18  EIDS_APP TEST_ARTCL_INST  RANGE_MIN_CNT
19  EIDS_APP TEST_ARTCL_INST   TYPE_GAGE_ID
20  EIDS_APP TEST_ARTCL_INSTDRAWING_TYPE_ID
21  EIDS_APP TEST_ARTCL_INST DRAWING_ID
22  EIDS_APP TEST_ARTCL_INST RATE_SPECIFIED_CNT
23  EIDS_APP TEST_ARTCL_INST  ACCURACY_RQRD_CNT
24  EIDS_APP TEST_ARTCL_INSTUNIT_MSR_ID

Mark Lyman

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