[R] Base package being deleted recurrently

2020-08-29 Thread Rene J Suarez-Soto
Hi,

I have a very strange issue. I am currently running R 4.0.2. The files in
my library/base/ are being deleted by some unknown reason. I have had to
install R over 20 times in the last 2 month. I have installed using user
privileges and admin. I have installed it to different directories but the
same issue repeats. I have checked the history of the antivirus program and
it does not seem to be a problem. This is in an enterprise environment but
IT checked an it does not seem to be related to any security processes. Any
ideas? Thanks.

[[alternative HTML version deleted]]

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


[R] R base packages

2017-10-23 Thread Rene J Suarez-Soto
I installed R 3.4.2 (Windows) and noticed that 30 folders are under my
R_HOME/library folder. I assume all of these are R base packages. Is this
correct? Where can I see a list of current R base packages? Also; are R
base packages also in CRAN? and are these packages updated only when a new
version of R is released or can the be updated at a different time? Thanks

[[alternative HTML version deleted]]

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


Re: [R] R_LIBS_USER not in libPaths

2017-09-16 Thread Rene J Suarez-Soto
I have not intentionally set R_LIBS_USER. I looked for an Renviron.site
file but did not see it in R/etc or my home directory. The strange part is
that if I print Sud.getenv I see a value for R_LIBS_USER. However, this
directory is not showing under libPaths.

I though .libPaths should contain R_LIBS_USER.

I also noticed that R related variables are not in the system or user
variables because I dont see them when I type SET from the Windows Command
line. So a related question is where does R get the system variables
(e.g., R_LIBS_USER,
R_HOME) if I dont see a Renviron.site file. Thanks

On Sep 16, 2017 10:45 AM, "Henrik Bengtsson" <henrik.bengts...@gmail.com>
wrote:

I'm not sure I follow what.the problem is. Are you trying to
set R_LIBS_USER but R does not acknowledge it, or do you observe something
in R that you didn't expect to be there and you are trying to figure out
why that is / where that happens?

Henrik

On Sep 16, 2017 07:10, "Rene J Suarez-Soto" <rene.j.sua...@gmail.com> wrote:

> I have a computer where R_LIBS_USER is not found in libPaths. This is for
> Windows (x64). I ran R from the command line, RGui and RStudio and I get
> the same results. I also ran R --vanilla and I still get the discrepancy.
>
> The only thing I found interesting was that I also ran SET from the command
> line and the "R related variables" (e.g.,  R_HOME; R_LIBS_USER) are not
> there. Therefore these variables are being set when I start R. I have not
> been able to track where does R obtain the value for these.
>
> Aside from looking at
> http://stat.ethz.ch/R-manual/R-patched/library/base/html/Startup.html I am
> not sure I have much more information that I have found useful.
>
> Thanks
>
> R
>
> [[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/posti
> ng-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

[[alternative HTML version deleted]]

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


[R] R_LIBS_USER not in libPaths

2017-09-16 Thread Rene J Suarez-Soto
I have a computer where R_LIBS_USER is not found in libPaths. This is for
Windows (x64). I ran R from the command line, RGui and RStudio and I get
the same results. I also ran R --vanilla and I still get the discrepancy.

The only thing I found interesting was that I also ran SET from the command
line and the "R related variables" (e.g.,  R_HOME; R_LIBS_USER) are not
there. Therefore these variables are being set when I start R. I have not
been able to track where does R obtain the value for these.

Aside from looking at
http://stat.ethz.ch/R-manual/R-patched/library/base/html/Startup.html I am
not sure I have much more information that I have found useful.

Thanks

R

[[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] question about windows Rgui.exe startup

2012-08-10 Thread Ryan Rene

Hi all,

I had a specific question about the loading of objects 
into R. I apologize in advance if I have overlooked anything in the 
manual but as far as I can tell I have yet to find a solution to my 
problem.

I am on a Windows platform.

So what I am trying 
to do is have R read in a binary file on startup from the Windows system
 command line and startup Rgui.exe with these options without having to 
change Rprofile.site.
I have written a script called myscript.r which allows R to read in the binary 
files and load my objects.

I would like to load up those object from binary format on startup into 
R(interactive)

like so:


windows key + r
C:\Program Files\R\R-2.15.0\bin\x64\Rgui.exe  
C:\Users\Ryan\Desktop\myscript.r
but this does not work.

I can do it in R batch mode like this:
C:\Program Files\R\R-2.15.0\bin\x64\R.exe CMD BATCH --vanilla --slave 
C:\Users\Ryan\Desktop\myscript.r

So
 what I am interested in is if there are any options Rgui that allow me 
to load a script on startup (before opening rgui.exe)

If not I 
am wondering if there is any way of transferring the input I get from R 
batch mode to another instance of Rgui.exe or where Rgui.exe reads in 
its objects.

Or maybe there is a way to point Rgui.exe to another startup file of my 
choosing without having to alter Rprofile.site.

Any help on this would be greatly appreciated.
Thank you very much and have a wonderful day!

Ryan Rene

Epicenter Software
80 S. Lake ave,
Pasadena CA
91101
suite 550
  
[[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] Quadprog help

2010-02-19 Thread Araujo-Enciso, Sergio Rene
I am having some problems using Quadprog in R. I want to minimize the
objective function :

 

200*P1-1/2*10*P1^2+100*P2-1/2*5*P2^2+160*P3-1/2*8*P3^2+50*P4-1/2*10*P4^2+50*P
5-1/2*20*P5^2+50*P6-1/2*10*P6^2, 

 

Subject to a set of constrains including not only the variables P1, P2, P3,
P4, P5, P6, but also the variables X1, X2,X3,X4,X5,X6,X7,X8,X9.

 

 As the set of variables X's are not affecting the objective function, I
assume that I have to enter them as zero's in the vector dvec and the
matrix Dmat. 

 

My program states as: 

 

mat-matrix(0,15,15)

diag(Dmat)-c(10,5,8,10,20,10,0,0,0,0,0,0,0,0,0)

dvec- c(-200,-100,-160,-50,-50,-50,0,0,0,0,0,0,0,0,0)

Amat- matrix(c(-1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,-1,0,1,

 0,0,0,0,0,0,0,0,0,0,0,0,0,-1,1,0,0,0,0,

 0,0,0,0,0,0,0,-1,0,0,0,1,0,0,0,0,0,0,0,

 0,0,0,0,-1,0,0,1,0,0,0,0,0,0,0,0,0,0,0,

 0,-1,0,1,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,0,

 1,0,0,0,0,0,0,0,0,0,0,-1,0,0,0,1,0,0,0,0,

 0,0,0,0,0,0,0,-1,0,0,1,0,0,0,0,0,0,0,0,0,

 -10,0,0,0,0,0,-1,0,0,-1,0,0,-1,0,0,0,-5,0,

 0,0,0,0,-1,0,0,-1,0,0,-1,0,0,0,-8,0,0,0,0,

 0,-1,0,0,-1,0,0,-1,0,0,0,-10,0,0,1,1,1,0,0,

 0,0,0,0,0,0,0,0,-20,0,0,0,0,1,1,1,0,0,0,0,0,

 0,0,0,-10,0,0,0,0,0,0,1,1,1),15,15)

bvec -c(0,-2,-2,-2,0,-1,-2,-1,0,-200,-100,-160,-50,-50,-50)

solve.QP(Dmat,dvec,Amat,bvec=bvec)

 

Nonetheless I get the message: Error en solve.QP(Dmat, dvec, Amat, bvec =
bvec) : matrix D in quadratic function is not positive definite!.

 

I think it has to do with the fact that in the Dmat matrix I end up with
several columns with zeros. Do anyone have an idea of how to solve such a
problem? 

 

Bests, 

 

Sergio René


[[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] loop and plot

2009-10-19 Thread Rene
Dear all,

I am stuck at applying loop function for creating separated plots.

I have coding like below:

dataset.table -
table(data.frame(var1=c(1,2,3,1,2,3,1),colour=c(a,b,c,c,a,b,b)
))
kk = function(f)
 {
  ls=as.character(f)
  pie(dataset.table[ls,],main=ls)
  box()
 }

kk(1)
kk(2)
kk(3)

By using above code, I can create 3 single plot respectively, but when I
type kk(1:3), obviously it will not work. 

I know I have to vectorise the coding, then I can use command kk(1:3). I try
to use loop:

kk = function(f)
 {
  ls=as.character(f)
  for (i in length(f))
  {
  pie(dataset.table[ls[i],],main=ls[i])
  box()
  }
  }
kk(1:3)

the above code only gives me the last pie plot (ie. kk(3) plot) instead of 3
plots respectively. 

Can someone please guide me how to revise the loop coding, and produce 3
separated plots one after another on the screen by typing kk(1:3)?

Thanks a lot.

Rene.

__
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] rect function

2009-10-14 Thread Rene
Dear all,

 

I have a question about how to load data or (entering data )to each cell of
a rectangle created by rect . 

 

e.g.

I have a matrix 

rbind(1:2,1:2)

 

I have created a 2x2 rectangle by using:

 

a-0:1/10

b-0:1/10

kk-expand.grid(a,b)

plot.new()

rect(kk[, 1], kk[, 2], kk[, 1] + .1,kk[, 2] + .1)

 

 

so how do we put the value of rbind(1:2,1:2) into the relevant cell of this
rectangle created above? If it is not possible to do so, is there any way to
plot the matrix table with grid.

 

Thanks million times!

 

Rene

 


[[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] auto.key legend color different from actual plot

2009-10-10 Thread Rene
Dear All,

 

I have created a barchart, but the legend created by auto.key does not match
the actual graph. Can someone give me some hint here?

 

For example, my coding are:

 

Library(lattice)

dataset.table -
table(data.frame(id=c(a,b,c,a,c,b,a),colour=c(blue,green,
red,red,red,green,green)))

blue-hcl(238,60,100)

green-hcl(120,70,100)

violet-hcl(350,100,100)

barchart(rbind(dataset.table),horizontal =
FALSE,col=c(blue,green,violet),stack=FALSE, auto.key=TRUE)

 

 

As you can see, the actual plot, the color is blue, green then violet, but
in the legend, it is blue, violet and green. Can someone help me correct the
legend colour?

 

 

Thanks a lot.

 

Rene.

 

 

 

 


[[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] About finding NA values sources

2009-10-09 Thread Rene
Dear All,

 

In R, is there a way (or a function) I can quickly check whether all the NA
values in one new created numerical variable happened are because of  nbsp;
or something else in the original dataset? And how can we easily group these
NAs separately based on different  reason (e.g. some NA are because of
nbsp; ,  some are because of there are extra text inside, etc).

 

Thanks heaps. 

 

Rene.


[[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] Numerical.summary Error

2009-10-03 Thread Rene
Dear all,

 

Have you experienced problem of using numerical.summary() function?  I used
to be able to run this function in R, but not any more.  Now I try to use
this function, it gives me error like this:

 

Error: could not find function numerical.summary

 

I used to be able to run this function under library(s20x).

 

Can someone please guide me on this ?

 

Thanks. 

Rene

 


[[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] retrieve certain part from html

2009-09-23 Thread Rene
Dear All,

 

Can someone please guide me how to get the certain part from a long html
language?

 

e.g. 

 

tda href='2005-01.html'2005-01/a/tdtda
href='2006-01.html'2006-01/a/tdtda
href='2007-01.html'2007-01/a/tdtda
href='2008-01.html'2008-01/a/tdtda
href='2009-01.html'2009-01/a/td

 

How to get only the wording of  2005-01.html, 2006-01.html,
2007-01.html, 2008-01.html, 2009-01.html from the above html code? I
have tried to use gsub function, but not working.

 

Please guide me on this.

 

Thanks a lot.

Rene.

 


[[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] function of probability for normal distribution

2009-08-20 Thread Rene
Dear all,

Because my last email was in html format, so it was a disaster to read. I
have second thought of my question asked in my last email, and came up some
solution to myself, but I found the result was a bit weird, can someone
please help look at my coding and advise where I have done wrong?

I need to write a function which compute the probability for standard normal
distribution. The formula is

P(z)= 1/2 + 1/(sqrt(2*pi)) * sum ((-1)^k*z^(2*k+1) /(2^k*k!*(2*k+1)) 


From series expansion for the exponential function, we know e^x= sum
(x^n/n!), we can substitute x = -t^2/2, so e^(-t^2/2) = sum
((-1)^k*t^(2*k)/(2^k*k!)). Comparing with the formula above, the sum
((-1)^k*z^(2*k+1) /(2^k*k!*(2*k+1)) is very similar to e^(-t^2/2), except
there is z/(2*k+1) in the formula. 

So I create a function for the sum ((-1)^k*z^(2*k+1) /(2^k*k!*(2*k+1)),
which is

expf = function (t)
   {
   neg=(t0)
   t = ifelse(neg,-t,t)
   k=0;term=1;sum=1
   oldsum=0
   while(any(sum!=oldsum)){
   oldsum = sum
   k = k+1
   term = term*(((-1)^1*t^2) / (2*k))
   sum = sum + (t/(2*k+1))*term
   }
   ifelse(neg,1/sum,sum)
   }

Now the sum part of the probability can be replaced by expf function, then I
create the function for the probability p(z), which is

prob = function(z)
   {
   1/2+(1/sqrt(2*pi))*expf(z)
   }

Am I doing the right thing here? However, when I test the probability
function, e.g. prob(1:10), the result appear some negative value and some
very large value which do not seem right to me as probability values. Can
someone please guide me where I have done wrong here?


Thanks a lot.

Rene.

__
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 function for Probabilities for the (standard) normal distribution

2009-08-19 Thread Rene
Dear All,

I need to write an R function which computes values of  Probabilities for
the (standard) normal distribution, ¦µ(z) for z  0 by summing this power
series. (We should accumulate terms until the sum doesn't change). I also
need to make the function work for vector of values z.

The initial fomular is

 

¦µ(z) = ( 1/ sqrt(2¦Ð) )* ¡Ò e^(-t^2/2)dt   (¡Ò is from -¡Þ, z)

 = 1/ 2 + ( 1/ sqrt(2¦Ð) )* ¡Ò e^(-t^2/2)dt (¡Ò is from 0 to z)

 

I can substituting x = -t^2/2 into the series expansion for the exponential
function

 

 

e^x = ¡Æ x^n/n! (¡Æ is from n=0 to ¡Þ)

 

I can obtain the series

 

e^(-t^2/2) = ¡Æ (-1)^k*t^2k / 2^k*k!   (¡Æ is from n=0 to ¡Þ)

 

 

 

This series can be integrated term by term to obtain the formula

 

¦µ(z) = 1/ 2 + ( 1/ sqrt(2¦Ð) ) * ¡Æ (-1)^k*z^(2k+1) / (2^k*k! *(2k+1))
(¡Æ is from n=0 to ¡Þ)

 

 

I know how to write the R function for exponential function e^x 

 

 expf  = function (x)

{

x=ifelse((neg=(x0)),-x,x)

n=0;term=1

 oldsum=0; newsum=1

while(any(newsum != oldsum)) {

oldsum=newsum

n=n+1

term = term*x/n

newsum = newsum+term}

ifelse(neg, 1/newsum, newsum)

}

 

 

I know it will be similar to the above coding, but I don¡¯t know exactly how
should we  modify the above coding in order to get Probabilities for the
(standard) normal distribution, ¦µ(z) for z  0.  

 

Can anybody advise me on this??

 

 

Thanks a lot.

 

Rene.

 

 

 

 

 


[[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] wordStem problems in R 2.9, Fedora 11; Linux Kernel 2.6.29.5-191.fc11.i586

2009-07-09 Thread Reitsma, Rene - COB
Duncan,

Thanks for helping. I reinstalled Rstem from source (using the omegahat
URL) and this time things are working. :-)

RR

 

-Original Message-
From: Duncan Temple Lang [mailto:dun...@wald.ucdavis.edu] 
Sent: Tuesday, July 07, 2009 5:33 PM
To: Reitsma, Rene - COB
Cc: r-help@r-project.org
Subject: Re: [R] wordStem problems in R 2.9, Fedora 11; Linux Kernel
2.6.29.5-191.fc11.i586

Hi Rene

   Can you tell us the version of the Rstem package you installed.
Rstem_0.3-1 from
  http://www.omegahat.org/Rstem/

or

 install.packages(Rstem, repos = http://www.omegahat.org/R;)

work fine for me.

I seem to recall this being a problem with an older version of Rstem.

   D.

Reitsma, Rene - COB wrote:
 Dear All,
 
 I just updated from Fedora 9 to Fedora 11, kernel version
 2.6.29.5-191.fc11.i586. I'm running R 2.9.
 
 I successfully installed package Rstem from source (it always ran fine
 for me in F9). However:
 
 wordStem(c(This,is,a,test))
 Error in wordStem(c(This, is, a, test)) : 
   VECTOR_ELT() can only be applied to a 'list', not a 'character'
 
 Any idea what causes this / how I can fix this?
 
 RR
 
 __
 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] wordStem problems in R 2.9, Fedora 11; Linux Kernel 2.6.29.5-191.fc11.i586

2009-07-07 Thread Reitsma, Rene - COB
Dear All,

I just updated from Fedora 9 to Fedora 11, kernel version
2.6.29.5-191.fc11.i586. I'm running R 2.9.

I successfully installed package Rstem from source (it always ran fine
for me in F9). However:

 wordStem(c(This,is,a,test))
Error in wordStem(c(This, is, a, test)) : 
  VECTOR_ELT() can only be applied to a 'list', not a 'character'

Any idea what causes this / how I can fix this?

RR

__
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] filtering number of values in a data frame

2009-06-18 Thread Schönemann , Rene
Dear list,

given is the following data frame df():

Number   Place   Start End
1 218024740787 HHO 5   263 2008-01-02 00:21:14 2008-01-03 15:25:16
2 218024740787 HHO 5   263 2008-01-02 00:21:14 2008-01-02 00:21:14
3 318039091794 HHO 5   263 2008-01-02 00:21:14 2008-01-02 13:22:54
4 318039091794 HHO 5   263 2008-01-02 00:21:14 2008-01-02 00:21:14
5 318039379900 HHO 1   104 2008-01-02 06:45:01 2008-01-02 09:15:23

Now, I want to count the number of equal values of column Start but I also 
want the other columns to be preserved.

Using:

rle(as.character(df$Start)) - m
n - data.frame(m$values, m$lengths)

produces a list of items according to their frequency of the Start point:

 m.values m.lengths
1 2008-01-02 00:21:14 4
2 2008-01-02 06:45:01 1


I want now also other columns to be in this new data frame. It should look like 
that:

 Number   Place   m.values  m.lengths
1 218024740787 HHO 5   263 2008-01-02 00:21:14 4
2 318039379900 HHO 1   104 2008-01-02 06:45:01 1


Does anybody can help me with this?

Thanking you in advance!

René Schönemann

-- 
__

Technische Universität Berlin
Institut für Land- und Seeverkehr
Fachgebiet Schienenfahrwege und Bahnbetrieb 
Prof. Dr.-Ing. habil. Jürgen Siegmann

PostSekretariat SG 18
Salzufer 17-19
D-10587 Berlin

Telefon +49 (0)30 314 - 23 314 

Internethttp://www.railways.tu-berlin.de
__

Dipl.-Verk.wirtsch. René Schönemann
- Wissenschaftlicher Mitarbeiter -

Telefon +49 (0)30 314 - 22 710
Telefax +49 (0)30 314 - 25 530

E-Mail  rschoenem...@railways.tu-berlin.de
__

Technische Universität Berlin
Körperschaft öffentlichen Rechts

Präsident   Prof. Dr. Kurt Kutzler 

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


[R] How to refer to a list member by variable

2008-12-01 Thread Reitsma, Rene - COB
Dear All,

I'm hoping one of you can help me with the following R problem. I'm
trying to refer to a member of a list by variable. However, this seems
not to work:

foo=list(first=c(1:10),second=c(11:20))

 foo$first
 [1]  1  2  3  4  5  6  7  8  9 10

 foo$first
 [1]  1  2  3  4  5  6  7  8  9 10

 goo=c(first)

 foo$goo
NULL

 foo$goo[1]
NULL

I'm sure I'm missing something quite elementary. Perhaps you can help?

RR

__
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] logical operators in 'subset'

2008-11-13 Thread Reitsma, Rene - COB
Dear All, 

Am I correct in believing that logical operators such as  and ||
cannot be used as part of 
a 'subset' logical expression?

Example:

foo = as.data.frame(matrix(c(1:9), nrow=3, ncol=3,
dimnames=list(c(r1,r2,r3),c(c1,c2,c3

foo
   c1 c2 c3
r1  1  4  7
r2  2  5  8
r3  3  6  9

subset(foo, c1  1)
   c1 c2 c3
r2  2  5  8
r3  3  6  9

subset(foo, c2  5)
   c1 c2 c3
r3  3  6  9

However,

subset(foo, c1  1  c2  5)
[1] c1 c2 c3
0 rows (or 0-length row.names)

RR

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