Re: [R] Chemical Names in Data Frames

2011-09-02 Thread Gustavo Carvalho
?make.names perhaps.

On Fri, Sep 2, 2011 at 4:13 PM, Durant, James T. (ATSDR/DTEM/PRMSB)
h...@cdc.gov wrote:
 Greetings -

 I am working on some data that contain chemical names with air 
 concentrations, and I am creating a data frame with date/time and each 
 chemical having its own column. However, these are organic chemicals (e.g. 
 1-butene, 2,3,4-trimethylbenzene etc). The package I am going to be using the 
 data with is openair, and many of the great functions require you to specify 
 a column name which does not seem to work with improper column names- e.g. 
 smoothTrend(mydata, pollutant=1-Butene and smoothTrend(mydata, 
 pollutant=mydata[,1-Butene])

 I was wondering if there was a function to automatically convert these 
 chemical names (with all sorts of numbers and minuses in the beginning) to 
 something openair can handle?  Or am I going to be stuck recoding several 
 hundred chemical names in my database?

 VR

 Jim

 James T. Durant, MSPH CIH
 Emergency Response Coordinator
 US Agency for Toxic Substances and Disease Registry
 Atlanta, GA 30341
 770-378-1695





        [[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: extrac the first entry for each component of a list

2011-08-23 Thread Gustavo Carvalho
sapply(a, `[`, 1)

On Wed, Aug 24, 2011 at 12:18 AM, Chee Chen chee.c...@yahoo.com wrote:
 Dear All,
 I would like to know, beside writing a function and then apply it to a list, 
 or using a for loop, whether there is a one-line command to do the following.
 Suppose we have a list, each of whose components are numeric:
 a - vector(list,3)
 a[[1]] -c(1,2)
 a[[2]] -c(3,4)
 a[[3]] - c(5,6)
 a
 [[1]]
 [1] 1 2

 [[2]]
 [1] 3 4

 [[3]]
 [1] 5 6

 Target: I would like to extract from each of its components the first entry 
 and store them into a vector, ie, to extract 1 from a[[1]], 3 from a[[2]], 5 
 from a[[3]], and store 1,3,5 into a vector without using for loops.
 Thank you,
 Chee
        [[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] How to call an external program/web page under R for Mac OS?

2011-05-24 Thread Gustavo Carvalho
To open a website on the default browser:

system(open http://www.google.com;)

Gustavo.

On Tue, May 24, 2011 at 7:56 PM, jbrezmes jesus.brez...@gmail.com wrote:
 I would like to be able to call external programs such as Java scripts (*.jar
 files) or bring up the browser to a given direction. Can that be done from
 R?

 I am running R on a mac OS X system.

 Thanks again for any suggestions or solutions.

 Best regards,

 Jesus Brezmes

 --
 View this message in context: 
 http://r.789695.n4.nabble.com/How-to-call-an-external-program-web-page-under-R-for-Mac-OS-tp3548479p3548479.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.


Re: [R] Find number of elements less than some number: Elegant/fast solution needed

2011-04-14 Thread Gustavo Carvalho
This might be a bit quicker with larger vectors:

f - function(x, y) sum(x  y)
vf - Vectorize(f, x)
vf(x, y)

On Thu, Apr 14, 2011 at 5:37 PM, Marc Schwartz marc_schwa...@me.com wrote:
 On Apr 14, 2011, at 2:34 PM, Kevin Ummel wrote:

 Take vector x and a subset y:

 x=1:10

 y=c(4,5,7,9)

 For each value in 'x', I want to know how many elements in 'y' are less than 
 'x'.

 An example would be:

 sapply(x,FUN=function(i) {length(which(yi))})
 [1] 0 0 0 0 1 2 2 3 3 4

 But this solution is far too slow when x and y have lengths in the millions.

 I'm certain an elegant (and computationally efficient) solution exists, but 
 I'm in the weeds at this point.

 Any help is much appreciated.

 Kevin

 University of Manchester



 I started working on a solution to your problem above and then noted the one 
 below.

 Here is one approach to the above:

 colSums(outer(y, x, ))
  [1] 0 0 0 0 1 2 2 3 3 4




 Take two vectors x and y, where y is a subset of x:

 x=1:10

 y=c(2,5,6,9)

 If y is removed from x, the original x values now have a new placement 
 (index) in the resulting vector (new):

 new=x[-y]

 index=1:length(new)

 The challenge is: How can I *quickly* and *efficiently* deduce the new 
 'index' value directly from the original 'x' value -- using only 'y' as an 
 input?

 In practice, I have very large matrices containing the 'x' values, and I 
 need to convert them to the corresponding 'index' if the 'y' values are 
 removed.


 Something like the following might work, if I correctly understand the 
 problem:

 match(x, x[-y])
  [1]  1 NA  2  3 NA NA  4  5 NA  6


 HTH,

 Marc Schwartz

 __
 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] confirmatory factor analysis program in R

2011-03-20 Thread Gustavo Carvalho
Search for lavaan, sem, and OpenMx.

On Mon, Mar 21, 2011 at 12:34 AM, rvohen bingbingzhan...@126.com wrote:
 thank you !  I will try it !

 --
 View this message in context: 
 http://r.789695.n4.nabble.com/confirmatory-factor-analysis-program-in-R-tp3386133p3392279.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.


Re: [R] Incorrect degrees of freedom in SEM model using lavaan

2011-03-17 Thread Gustavo Carvalho
Your model is saturated.

I think lavaan calculates the number of degrees of freedom this way:

DF = n*(n + 1)/2 - t - n.fix*(n.fix + 1)/2

n = number of variables
t = number of free parameters
n.fix = number of fixed exogenous variables

So, if you fix the exogenous variables, as in mimic = Mplus:

DF = 28 - 13 - 15 = 0

If you don't, as in mimic = EQS:

DF = 28 - 28 - 0 = 0

You are probably not considering the variances and covariances of the
exogenous variables to arrive at 15 degrees of freedom:

model = '

Internet + Stress3 ~ HHincome + Race + Age + Gender + Stress1

Stress3 ~ Internet

HHincome ~~ 0*Race + 0*Age + 0*Gender + 0*Stress1
Race ~~  0*Age + 0*Gender + 0*Stress1
Age ~~ 0*Gender + 0*Stress1
Gender ~~  0*Stress1

HHincome ~~ 1*HHincome
Race ~~ 1*Race
Age ~~ 1*Age
Gender ~~ 1*Gender
Stress1 ~~ 1*Stress1
'

fit = lavaan(model, sample.nobs=161, sample.cov=myCov, int.ov.free =
T, int.lv.free = F, auto.fix.first = T, auto.fix.single = T,
auto.resid.var = T, auto.cov.lv.x = T, auto.cov.y = T,
mimic = EQS)
summary(fit)

Cheers,

Gustavo.



On Thu, Mar 17, 2011 at 9:50 AM, Andrew Miles rstuff.mi...@gmail.com wrote:
 I have been trying to use lavaan (version 0.4-7) for a simple path model,
 but the program seems to be computing far less degrees of freedom for my
 model then it should have.  I have 7 variables, which should give (7)(8)/2 =
 28 covariances, and hence 28 DF.  The model seems to only think I have 13
 DF.  The code to reproduce the problem is below.  Have I done something
 wrong, or is this something I should take to the developer?


 library(lavaan)

 myCov = matrix(c(24.40, 0, 0, 0, 0, 0, 0, .03, .03, 0, 0, 0, 0, 0, 6.75, -
 .08, 519.38, 0, 0, 0, 0, .36, .01, 2.74, .18, 0, 0, 0, .51, .0, -.31, .02,
 .2, .0, 0, -.17, .0, -1.6, -.04, .01, .25, 0, -.1, .02, -.03, .0, -.01, .01
 , .02), nrow=7, byrow=TRUE, dimnames=list(c(Internet, Stress3,
 HHincome, Race, Age, Gender, Stress1), c(Internet, Stress3,
 HHincome, Race, Age, Gender, Stress1)))


 model = '

 Internet ~ HHincome + Race + Age + Gender + Stress1

 Stress3 ~ Internet + HHincome + Race + Age + Gender + Stress1

 '


 fit=sem(model, sample.nobs=161, sample.cov=myCov, mimic.Mplus=FALSE)


 #check the number of parameters being estimated

 inspect(fit, what=free)


 #Note the DF for the Chi-square is 0, when it should be 28-13 = 15

 summary(fit)


 Andrew Miles

        [[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] Is there an implementation for URL Encoding (/format) in R?

2010-11-25 Thread Gustavo Carvalho
?URLencode

On Thu, Nov 25, 2010 at 3:53 PM, Tal Galili tal.gal...@gmail.com wrote:
 Hello all,

 I would like some R function that can translate a string to a URL encoding
 (see here: http://www.w3schools.com/tags/ref_urlencode.asp)

 Is it implemented? (I wasn't able to find any reference to it)

 Thanks,
 Tal





 Contact
 Details:---
 Contact me: tal.gal...@gmail.com |  972-52-7275845
 Read me: www.talgalili.com (Hebrew) | www.biostatistics.co.il (Hebrew) |
 www.r-statistics.com (English)
 --

        [[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] the first. from SAS in R

2010-11-23 Thread Gustavo Carvalho
Perhaps something like this:

a$d - ifelse(duplicated(a$a), 0, 1)

On Tue, Nov 23, 2010 at 1:33 PM, Joel joda2...@student.uu.se wrote:

 Is there any similar function in R to the first. in SAS?

 What it dose is:

 Lets say we have this table:

  a b  c
  1 1  5
  1 0  2
  2 0  2
  2 0 NA
  2 9  2
  3 1  3


 and then I want do to do one thing the first time the number 1 appers in a
 and something else the secund time 1 appers in a and so on.

 so

 something similar to:

 if first.a {
  a$d-1
 }else{
  a$d-0
 }

 This would give me

  a b  c b
  1 1  5 1
  1 0  2 0
  2 0  2 1
  2 0 NA 0
  2 9  2 0
  3 1  3 1

 Is there such a function in R or anything similar?


 thx

 //Joel

 --
 View this message in context: 
 http://r.789695.n4.nabble.com/the-first-from-SAS-in-R-tp3055417p3055417.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] looking for a faster way to compare two columns of a matrix

2010-09-23 Thread Gustavo Carvalho
Please consider this matrix:

x - structure(c(5, 4, 3, 2, 1, 6, 3, 2, 1, 0, 3, 2, 1, 0, 0, 2, 1,
1, 0, 0, 2, 0, 0, 0, 0), .Dim = c(5L, 5L))

For each pair of columns, I want to calculate the proportion of entries
different than 0 in column j (i  j) that have lower values than the entries
in the same row in column i:

x[, 1:2]
sum((x[,1]  x[,2])  (x[,2]  0))/sum(x[,2]  0)

Thus, for this pair, 3 of the 4 entries in the second column are
lower than the entries in the same row in the first column.

When both columns of a given pair have the same number of cells different than
0, the value of the metric is 0.

x[, 3:4]
colSums(x[, 3:4]  0)

The same if column j has more valid ( 0) entries.

I've been doing this using this idea:

combinations - combn(1:ncol(x), 2)
values - numeric(ncol(combinations))

for (i in 1:ncol(combinations)) {
  pair - combinations[,i]
  first - x[, pair[1]]
  second - x[, pair[2]]
  if (sum(first  0) = sum(second  0)) next
  values[i] - sum(first - second  0  second  0) / sum(second  0)
}
values

Anyway, I was wondering if there is a faster/better way. I've tried
putting the code from
the for loop into a function and passing it to combn but, as expected, it didn't
help much. Any pointers to functions that I should be looking into will be
greatly appreciated.

Thank you very much,

Gustavo.

__
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] Finding (Ordered Subvectors)

2010-09-21 Thread Gustavo Carvalho
This function might be helpful:

bleh - function(a, b) {
  where - list()
  matches - 0
  first - which(a == b[1])
  for (i in first) {
seq.to.match - seq(i, length = length(b))
if (identical(a[seq.to.match], b)) {
  matches - matches + 1
  where[[matches]] - seq.to.match
}
  }
  return(where)
}

a-c(3,4,3,0,4,5,6,9,3,4)
b-c(0,4,5)
c-c(5,4,0)
d-c(3,4)
bleh(a, b)
bleh(a, c)
bleh(a, d)

Cheers,

Gustavo.

On Tue, Sep 21, 2010 at 11:31 AM, Lorenzo Isella
lorenzo.ise...@gmail.com wrote:
 Dear All,
 Consider a simple example

 a-c(1,4,3,0,4,5,6,9,3,4)
 b-c(0,4,5)
 c-c(5,4,0)

 I would like to be able to tell whether a sequence is contained (the order
 of the elements does matter) in another one e.g. in the example above, b is
 a subsequence of a, whereas c is not. Since the order matters, I cannot
 treat the sequences above as sets (also, elements are repeated).
 Does anyone know a smart way of achieving that?
 Many thanks

 Lorenzo

 __
 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] problems trying to reproduce structural equation model using the sem package

2010-09-16 Thread Gustavo Carvalho
Hello,

I've been unsuccessfully trying to reproduce a sem from Grace et al.
(2010) published in Ecological Monographs:

http://www.esajournals.org/doi/pdf/10.1890/09-0464.1

The model in question is presented in Figure 8, page 81. The errors
that I've been getting are:

1. Using a correlation matrix:

res.grace - sem(grace.model, S = grace, N = 190)
Warning message:
In sem.default(ram = ram, S = S, N = N, param.names = pars, var.names = vars,  :
 Could not compute QR decomposition of Hessian.
Optimization probably did not converge.

2. Using a variances/covariances matrix:

res.grace - sem(grace.model, S = grace.cov, N = 190)
Error in solve.default(C) :
 Lapack routine dgesv: system is exactly singular
In addition: Warning messages:
1: In log(det(C)) : NaNs produced
2: In sem.default(ram = ram, S = S, N = N, param.names = pars,
var.names = vars,  :
  singular Hessian: model is probably underidentified.
(...)

So far I've tried:

1. Fixing the variances of the latent variables
2. Allowing the exogenous indicators to covary (fixed.x parameter in sem())
3. Manually inserting the published parameter estimates during model
specification (specify.model()) to see if the starting parameters
passed to nlm were the problem
4. Extensively looking for typing mistakes

Anyway, there seems to be a problem either with the way I specified
the model or with the model itself as it has been published. I can see
that the number of degrees of freedom in  the model that I've
specified is 21, as in the published model.

Any light you could shed on this would be greatly appreciated. The
code to reproduce all steps is presented below.

Thank you very much,

Gustavo.

##

library(sem)

grace - matrix(ncol = 10, nrow = 10)

variables - c(lightlog, light, dstb, species_count, masslog,
              soil_carbon, soil_organic, soil_low_flooding,
              soil_high_flooding, soil_salinity)

rownames(grace) - colnames(grace) - variables

diag(grace) - 1

## Coefficients from the paper.

grace.coefficients - c(0.858, 0.667, -0.251, -0.699, 0.06, 0.012, 0.552, 0.547,
                       0.327, 0.776, -0.404, -0.794, 0.157, 0.120,
0.439, 0.462,
                       0.321, -0.228, -0.686, 0.218, 0.186, 0.249,
0.290, 0.216,
                       0.291, 0.119, 0.132, -0.374, -0.406, -0.292,
-0.096, -0.071,
                       -0.426, -0.466, -0.138, 0.973, -0.170, -0.150,
0.249, -0.211,
                       -0.188, 0.244, 0.959, 0.073, 0.052)

grace.sds - c(1.11, 0.285, 3.29, 3.33, 1.44, 0.605, 1.23, 1.33, 1.27, 1.68)

grace[lower.tri(grace, diag = F)] - grace.coefficients
grace[upper.tri(grace, diag = F)] - t(grace)[upper.tri(grace, diag = F)]

## Covariances matrix

grace.cov - outer(grace.sds, grace.sds) * grace

## Specifying the model

grace.model - specify.model()
salinity - soil_salinity, NA, 1
flooding - soil_high_flooding, NA, 1
flooding - soil_low_flooding, flooding_low_flooding, NA
infertility - soil_organic, NA, -1
infertility - soil_carbon, inf_carbon, NA
disturbance - dstb, NA, 1
biomass - masslog, NA, 1
light - light_effect, NA, 1
lightlog - light_effect, lightlog_light_effect, NA
richness - species_count, NA, 1
salinity - richness, salinity_richness, NA
salinity - light, salinity_light, NA
flooding - richness, flooding_richness, NA
flooding - biomass, flooding_biomass, NA
infertility - richness, infertility_richness, NA
disturbance - biomass, disturbance_biomass, NA
disturbance - light, disturbance_light, NA
biomass - light, biomass_light, NA
light_effect - richness, light_effect_richness, NA
salinity - flooding, salinity_flooding, NA
salinity - infertility, salinity_infertility, NA
salinity - disturbance, salinity_disturbance, NA
flooding - infertility, flooding_infertility, NA
flooding - disturbance, flooding_disturbance, NA
infertility - disturbance, infertility_disturbance, NA
biomass - biomass, biomass, NA
masslog - masslog, masslog, NA
light - lightlog, light_lightlog, NA
light_effect - light_effect, NA, 0
richness - richness, richness, NA
species_count - species_count, species_count, NA
light - light, light, NA
lightlog - lightlog, NA, 1
salinity - salinity, salinity, NA
disturbance - disturbance, disturbance, NA
flooding - flooding, flooding, NA
infertility - infertility, infertiliy, NA
soil_salinity - soil_salinity, soil_salinity, NA
soil_high_flooding - soil_high_flooding, soil_high, NA
soil_low_flooding - soil_low_flooding, soil_low, NA
soil_organic - soil_organic, soil_organic, NA
soil_carbon - soil_carbon, soil_carbon, NA
dstb - dstb, dstb, NA

res.grace - sem(grace.model, S = grace.cov, N = 190)

__
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 columns containing all zeros (or other value)

2009-01-14 Thread Gustavo Carvalho
You can also try this:

x[,-(which(colSums(x) == 0))]

Cheers,

Gustavo.

On Wed, Jan 14, 2009 at 8:01 PM, Anthony Dick ad...@uchicago.edu wrote:
 Hello-

 I would like to remove the columns of a matrix that contain all zeros. For
 example, from
 x-matrix(c(1,5,3,2,1,4,0,0,0), ncol=3,nrow=3)

 I would like to remove the third column. However, because this is in a loop
 I need a way to first determine which columns are all zeros, and only then
 remove them. I.e., I don't know which column of x contains all zeros until
 after x is created.

 Thanks!

 Anthony

 --
 Anthony Steven Dick, Ph.D.
 Post-Doctoral Fellow
 Human Neuroscience Laboratory
 Department of Neurology
 The University of Chicago
 5841 S. Maryland Ave. MC-2030
 Chicago, IL 60637
 Phone: (773)-834-7770
 Email: ad...@uchicago.edu
 Web: http://home.uchicago.edu/~adick/

 __
 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] remove columns containing all zeros (or other value)

2009-01-14 Thread Gustavo Carvalho
Sorry for the double post, but this is probably faster:

x[, colSums(x) != 0]

On Wed, Jan 14, 2009 at 8:22 PM, Gustavo Carvalho
gustavo.bi...@gmail.com wrote:
 You can also try this:

 x[,-(which(colSums(x) == 0))]

 Cheers,

 Gustavo.

 On Wed, Jan 14, 2009 at 8:01 PM, Anthony Dick ad...@uchicago.edu wrote:
 Hello-

 I would like to remove the columns of a matrix that contain all zeros. For
 example, from
 x-matrix(c(1,5,3,2,1,4,0,0,0), ncol=3,nrow=3)

 I would like to remove the third column. However, because this is in a loop
 I need a way to first determine which columns are all zeros, and only then
 remove them. I.e., I don't know which column of x contains all zeros until
 after x is created.

 Thanks!

 Anthony

 --
 Anthony Steven Dick, Ph.D.
 Post-Doctoral Fellow
 Human Neuroscience Laboratory
 Department of Neurology
 The University of Chicago
 5841 S. Maryland Ave. MC-2030
 Chicago, IL 60637
 Phone: (773)-834-7770
 Email: ad...@uchicago.edu
 Web: http://home.uchicago.edu/~adick/

 __
 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] Logical function to turn missing values to 0's

2009-01-14 Thread Gustavo Carvalho
Hello rafamoral,

Try this:

ifelse(is.na(x),0,x)

On Wed, Jan 14, 2009 at 8:32 PM, rafamoral rafa_moral2...@yahoo.com.br wrote:

 I have a dataset which contains some missing values, and I need to replace
 them with zeros. I tried using the following:

 x - matrix(data=rep(c(1,2,3,NA),6), ncol=6, nrow=6)

 y - matrix(data=0, ncol=ncol(x), nrow=nrow(x))

 for(i in 1:nrow(x)) {

 for(j in 1:ncol(x)) {

 y[i,j] - ifelse(x[i,j]==NA, 0, x[i,j])

 }}

 But y returns an NA matrix.
 I'd appreciate any help.
 --
 View this message in context: 
 http://www.nabble.com/Logical-function-to-turn-missing-values-to-0%27s-tp21466785p21466785.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.


Re: [R] Conditional Counting with Table

2008-12-23 Thread Gustavo Carvalho
Hello,

Something like this should work:

table(test$V1[!test$V2 %in% c(NM,QC)])

Cheers,

Gustavo.

On Wed, Dec 24, 2008 at 3:06 AM, Gundala Viswanath gunda...@gmail.com wrote:
 Dear all,

 I have the following data frame:

 V1 V2
 aaachr1
 aaachr2
 aaaNM
 aaaQC
 aaachr10
 att  NM
 att  chr7

 What I want to do is to count the string (V1).
 But the condition of counting is: if the V2 of the string
 is NM or QC  then the count is not increased.

 Hence the contigency table will look like this:

 #tag   count
 aaa  3
 att1

 Is there a compact way to achieve that in R?
 I am thinking of using table but can't see
 how to impose such condition into it.


 - Gundala Viswanath
 Jakarta - Indonesia

 __
 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] Reading from Google Docs

2008-12-15 Thread Gustavo Carvalho
Hello,

You can probably extract a .tar.gz using 7zip on Windows.

Regards,

Gustavo.

On Mon, Dec 15, 2008 at 8:07 PM, Farrel Buchinsky fjb...@gmail.com wrote:
 I saw a thread from September 24 in which Duncan Temple Lang told us:
 - The package currently has no Rd files, but there is a brief user's
 guide. The package is available from
 http://www.omegahat.org/RGoogleDocs

 I could not find it by using Tinn-R or RGui's package install tool.
 Then when I went to the website I saw that package is only available
 as
 http://www.omegahat.org/RGoogleDocs/RGoogleDocs_0.1-0.tar.gz

 To my knowledge tar.gz is only for Linux. Does this mean that I cannot
 run it on a windows machine. Please tell me that there is a way to run
 it on a Windows machine.

 Farrel Buchinsky
 GrandCentral Tel: (412) 567-7870

 __
 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] Logical in test

2008-12-11 Thread Gustavo Carvalho
Take a look at ?any.

On Thu, Dec 11, 2008 at 3:11 PM, David B. Thompson, Ph.D., P.E.,
D.WRE, CFM [EMAIL PROTECTED] wrote:
 OK, this should be trivial but I'm not finding it. I want to compress the
 test,

 if (i==7 | i==10 | i==30 | i==50) {}

 into something like

 if (i in c(7,10,30,50)) {}

 so I can build a excludes vector

 excludes - c(7,10,30,50)

 and test

 if (i in excludes) {}

 However, I'm not finding a clue on how to accomplish this, if it can be
 done. Would someone with more R experience lend a helping hand please? A
 reference (so I can continue learning) would also be appreciated.

 Thanks...

 -=d

 David Thompson, Ph.D., P.E., D.WRE, CFM
 Civil Engineer/Hydrologist

 __
 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] Logical inconsistency

2008-12-10 Thread Gustavo Carvalho
Hello,

An alternative to round():

isTRUE(all.equal((2.3-1.3),1))

Regards,

Gustavo.

On Wed, Dec 10, 2008 at 3:12 PM, Stephan Kolassa [EMAIL PROTECTED] wrote:
 Hi Emma,

 unfortunately, rounding variables before taking the difference will not
 solve your problem, because the *rounded* variables are subject to the same
 (effectively) random internal representation. Examples:

 round(8.3,20)-round(7.3,20)=1
 [1] TRUE
 round(2.3,20)-round(1.3,20)=1
 [1] FALSE
 round(8.3,1)-round(7.3,1)=1
 [1] TRUE
 round(2.3,1)-round(1.3,1)=1
 [1] FALSE

 I'm afraid you will need to think about what you really need your comparison
 for and whether this problem really affects your results. For example, if
 you are doing a large number of such comparisons, the effect may only affect
 a few of them and basically average out (sometimes going one way, sometimes
 the other), so the end results may be stable.

 Good luck!
 Stephan


 emma jane schrieb:

 Thanks Greg, that does make sense.  And I've solved the problem by
 rounding the variables before taking the difference between them.

 Thanks to all who replied.

 Emma JaneÂ



 
 From: Greg Snow [EMAIL PROTECTED]

 .com.br; Wacek Kusnierczyk [EMAIL PROTECTED]; Chuck
 Cleland [EMAIL PROTECTED]
 Cc: R help [EMAIL PROTECTED]
 Sent: Tuesday, 9 December, 2008 16:30:08
 Subject: RE: [R] Logical inconsistency

 Some (possibly all) of those numbers cannot be represented exactly, so
 there is a chance of round off error whenever you do some arithmetic,
 sometimes the errors cancel out, sometimes they don't.  Consider:

 print(8.3-7.3, digits=20)

 [1] 1.001

 print(11.3-10.3, digits=20)

 [1] 1

 So in the first case the rounding error gives a value that is slightly
 greater than 1, so the greater than test returns true (if you round the
 result before comparing to 1, then it will return false).  In the second
 case the uncertainties cancelled out so that you get exactly 1 which is not
 greater than 1 an so the comparison returns false.

 Hope this helps,

 --
 Gregory (Greg) L. Snow Ph.D.
 Statistical Data Center
 Intermountain Healthcare
 [EMAIL PROTECTED]
 801.408.8111


 -Original Message-
 From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]
 project.org] On Behalf Of emma jane
 Sent: Tuesday, December 09, 2008 7:02 AM
 To: Bernardo Rangel Tura; Wacek Kusnierczyk; Chuck Cleland
 Cc: R help
 Subject: Re: [R] Logical inconsistency

 Many thanks for your help, perhaps I should have set my query in
 context  !

 I'm simply calculating an indicator variable [0,1] based on the whether
 the difference between two measured variables is  1 or =1.

 I understand the FAQ about floating point arithmetic, but am still
 puzzled that it only apparently applies to certain elements, as
 follows:

 8.8 - 7.8  1

 TRUE

 8.3 - 7.3  1

 TRUE

 However,

 10.2 - 9.2  1

 FALSE

 11.3 - 10.31

 Â FALSE

 Emma Jane




 
 From: Bernardo Rangel Tura [EMAIL PROTECTED]
 To: Wacek Kusnierczyk [EMAIL PROTECTED]
 Cc: R help [EMAIL PROTECTED]
 Sent: Saturday, 6 December, 2008 10:00:48
 Subject: Re: [R] Logical inconsistency

 On Fri, 2008-12-05 at 14:18 +0100, Wacek Kusnierczyk wrote:

 Berwin A Turlach wrote:

 Dear Emma,

 On Fri, 5 Dec 2008 04:23:53 -0800 (PST)

 Please could someone kindly explain the following inconsistencies
 I've discovered__when performing logical calculations in R:

 8.8 - 7.8  1

 TRUE

 8.3 - 7.3  1

 TRUE

 Gladly:Â  FAQ 7.31
 http://cran.at.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-

 th

 ink-these-numbers-are-equal_003f


 well, this answer the question only partially.  this explains why a
 system with finite precision arithmetic, such as r, will fail to be
 logically correct in certain cases.  it does not explain why r, a
 language said to isolate a user from the underlying implementational
 choices, would have to fail this way.

 there is, in principle, no problem in having a high-level language
 perform the computation in a logically consistent way.  for example,
 bc is an arbitrary precision calculator language, and has no

 problem

 with examples as the above:

 bc  8.8 - 7.8  1
 # 0, meaning 'no'

 bc  8.3 - 7.3  1
 # 0, meaning 'no'

 bc  8.8 - 7.8 == 1
 # 1, meaning 'yes'


 the fact that r (and many others, including matlab and sage, perhaps
 not
 mathematica) does not perform logically here is a consequence of its
 implementation of floating point arithmetic.

 the faq you were pointed to, and its referring to the goldberg's
 article, show that r does not successfully isolate a user from

 details

 of the lower-level implementation.

 vQ

 Well, first of all for 8.-7.3 is not equal to 1 [for computers]

 8.3-7.3-1

 [1] 8.881784e-16

 But if you use only one digit precision

 round(8.3-7.3,1)-1

 [1] 0

 round(8.3-7.3,1)-10

 [1] FALSE

 round(8.3-7.3,1)==1

 [1] TRUE


 So the problem is the code write and no the software

 --
 Bernardo Rangel Tura, M.D,MPH,Ph.D
 

[R] extract the digits of a number

2008-12-09 Thread Gustavo Carvalho
Hello,

Anyone knows how can I do this in a cleaner way?

mynumber = 1001
as.numeric(unlist(strsplit(as.character(mynumber),)))
[1] 1 0 0 1

Thanks in advance,

Gustavo

__
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] == operand

2008-12-09 Thread Gustavo Carvalho
Hello,

You assigned 53 to c, not cc. Also, take a look at this:

http://cran.r-project.org/doc/FAQ/R-FAQ.html#Why-doesn_0027t-R-think-these-numbers-are-equal_003f


On Tue, Dec 9, 2008 at 9:36 PM, Renny Li [EMAIL PROTECTED] wrote:
 Hi,

 I am trying to compare two values using == operand, please take a look of 
 the following example (I copied ALL what I did here without deleting any line)

bb-1
 cc-50
 cc==abs(bb+52)
 [1] FALSE
 C-53
 C-53
 c-53
 cc==abs(bb+52)
 [1] FALSE

 I am expecting to see a TRUE here. Then I tried another way,

 abs(1+52)
 [1] 53
 cc==abs(1+52)
 [1] FALSE

 Why it is FALSE. Then I tried


 d-abs(b+52)
 Error: object b not found
 d-abs(bb+52)
 d
 [1] 53
 c==d
 [1] TRUE

 Now it is TRUE, but a wired thing is as following,
 c==abs(bb+52)
 [1] TRUE

 The coding c==abs(bb+52) is just the same from the 3line in the top, why 2 
 different results? HOWEVER, it is not repeatable, I am glad I did not close 
 the window.

 Also,
 c-0.5-0.1
 n-0.6-0.2
 n==c
 [1] FALSE

 So, is == comparing formula or result?

 Thanks,
 Renny



[[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] Running R Script on a Sequence of Files

2008-12-06 Thread Gustavo Carvalho
Thanks a lot!

On Fri, Dec 5, 2008 at 5:54 PM, Gabor Grothendieck
[EMAIL PROTECTED] wrote:
 Try this:

 dir()[!file.info(dir())$isdir]


 On Fri, Dec 5, 2008 at 2:30 PM, Gustavo Carvalho
 [EMAIL PROTECTED] wrote:
 Is there a way to list only the files in a given directory without
 passing pattern=... to list.files()?

 On Fri, Dec 5, 2008 at 5:10 PM, Kyle. [EMAIL PROTECTED] wrote:
 Thanks, Barry. I'll use that in the future.


 ---Kyle.

 On Fri, Dec 5, 2008 at 11:01 AM, Barry Rowlingson 
 [EMAIL PROTECTED] wrote:

 2008/12/5 Chris Poliquin [EMAIL PROTECTED]:
  Hi,
 
  I have about 900 files that I need to run the same R script on.  I looked
  over the R Data Import/Export Manual and  couldn't come up with a way to
  read in a sequence of files.
 
  The files all have unique names and are in the same directory.  What I
 want
  to do is:
  1) Create a list of the file names in the directory (this is really what
 I
  need help with)
  2) For each item in the list...
 a) open the file with read.table
 b) perform some analysis
 c) append some results to an array or save them to another file
  3) Next File
 
  My initial instinct is to use Python to rename all the files with numbers
  1:900 and then read them all, but the file names contain some information
  that I would like to keep intact and having to keep a separate database
 of
  original names and numbers seems inefficient.  Is there a way to have R
 read
  all the files in a directory one at a time?

  I can't believe the two 'solutions' already posted. It's easy:

  ?list.files

 Barry

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


 __
 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] Running R Script on a Sequence of Files

2008-12-05 Thread Gustavo Carvalho
Is there a way to list only the files in a given directory without
passing pattern=... to list.files()?

On Fri, Dec 5, 2008 at 5:10 PM, Kyle. [EMAIL PROTECTED] wrote:
 Thanks, Barry. I'll use that in the future.


 ---Kyle.

 On Fri, Dec 5, 2008 at 11:01 AM, Barry Rowlingson 
 [EMAIL PROTECTED] wrote:

 2008/12/5 Chris Poliquin [EMAIL PROTECTED]:
  Hi,
 
  I have about 900 files that I need to run the same R script on.  I looked
  over the R Data Import/Export Manual and  couldn't come up with a way to
  read in a sequence of files.
 
  The files all have unique names and are in the same directory.  What I
 want
  to do is:
  1) Create a list of the file names in the directory (this is really what
 I
  need help with)
  2) For each item in the list...
 a) open the file with read.table
 b) perform some analysis
 c) append some results to an array or save them to another file
  3) Next File
 
  My initial instinct is to use Python to rename all the files with numbers
  1:900 and then read them all, but the file names contain some information
  that I would like to keep intact and having to keep a separate database
 of
  original names and numbers seems inefficient.  Is there a way to have R
 read
  all the files in a directory one at a time?

  I can't believe the two 'solutions' already posted. It's easy:

  ?list.files

 Barry

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


__
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] if then statement problem

2008-11-27 Thread Gustavo Carvalho
If I understood your problem correctly, you are just missing a couple of things:

q = which(apply(p.unique,2,function(x)all(x==r)) == TRUE)

Also, you should probably change this line:

if(q0){c=p.unique[,q]};{c=c(0,0,0)}

To something like this:

if(length(q)0){c=p.unique[,q]};{c=c(0,0,0)}

Regards,

Gustavo

On Thu, Nov 27, 2008 at 3:02 PM, Salas, Andria Kay [EMAIL PROTECTED] wrote:
 I really need help with an if then statement I am having trouble with.  A 
 brief explanation of what I am trying to do: I have a p matrix of all 
 permutations of a vector of length 3 filled with either 1s or -1s (these make 
 up the columns).  The p.unique matrix is the unique columns of the p matrix; 
 here, they are identical but in my real script this will not always be the 
 case.  I want to be able to take a randomly generated vector and see which 
 column in the p.unique matrix, if any, match the random vector.  If there is 
 a match, I get an integer returned that tells me which column is the match.  
 If there is no match, I get the response integer (0).  I want to write an if 
 then statement that allows me to do different things based upon if there is a 
 match to one of the columns in the p.unique matrix or not.  Below is a sample 
 script plucked from bits of my master script that show this problem.  The 
 vector r was made to not match any columns in p.unique.  If it did, c w!
 ou!
  ld equal the integer representing the matching column, and since it does 
 not, I want c to equal the vector (0,0,0).  My if then statement is not 
 working (I keep getting the error that my argument is of length zero), so I 
 would really appreciate any help anyone can provide me.  Thanks for all of 
 your help previously and in advance for the help with this problem!!  Happy 
 Thanksgiving!

 p=as.matrix(do.call(expand.grid,rep(list(c(-1,1)),3)))
 p=t(p)
 p.unique=unique(p,MARGIN=2)

 r=c(2,2,2)
 q=which(apply(p.unique,2,function(x)all(x==r)))
 if(q0){c=p.unique[,q]};{c=c(0,0,0)}

 __
 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] R course in Scotland

2008-11-20 Thread Gustavo Carvalho
Hello,

Take a look at this course:

http://www.r4all.group.shef.ac.uk/index.html

I don't think they teach tools for working with the genome, but it
might be helpful anyway.

On Thu, Nov 20, 2008 at 11:16 AM, Peter Saffrey [EMAIL PROTECTED] wrote:
 (apologies if this is the wrong list)

 I'm a bioinformatician looking for a course in using R, in particular the
 tools for working with the genome - I've heard they're lightning fast. I'm
 in Glasgow, but I've tried the Robertson centre for biostatistics and they
 use minitab.

 If anybody knows of a course, I would be grateful. Glasgow or Edinburgh
 would be preferable, but anywhere in the UK will do if it's a good course.

 Thanks,

 Peter

 __
 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] Checking collinearity using lmer

2008-11-19 Thread Gustavo Carvalho
Take a look at vif in the package car.

On Wed, Nov 19, 2008 at 10:00 PM, Crystal McRae [EMAIL PROTECTED] wrote:


  I am running a logistic regression model with a random effect using lmer.  I 
 am uncertain how to check for collinearity between my parameters.  I have 
 already run cor() and linear regression for each combination of parameters, 
 and all Rsqr values were 0.8….but I am analyzing ecological data so a 0.8 
 cutoff may be unrealistic.

 -is there a way to check variance inflation factors or tolerance using 
 lmer?-Or is there a better way?
 _


[[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] Problem with the Linux R 2.8.0 rpm for 64 bit REL 4

2008-11-18 Thread Gustavo Carvalho
xdg utils is probably not being recognized because you compiled it
from source. The R rpm is looking for the xdg utils package. I'm not
familiar with yum, but I think you can try to force the installation:

rpm -ivh --force (or something like that) /data/R-2.8.0-1.rh4.x86_64.rpm

On Tue, Nov 18, 2008 at 2:21 PM, Peter Tait [EMAIL PROTECTED] wrote:
 Hi,

 I am trying to update my version of R on Centos 4.

  $uname -a

  Linux 2.6.9-78.0.5.ELsmp #1 SMP Wed Oct 8 07:06:30 EDT 2008 x86_64 x86_64
 x86_64 GNU/Linux

 I tried to update the current version of R (2.6.2) which was installed
 locally as an rpm
  $R --version
  R version 2.6.2 (2008-02-08)
  Copyright (C) 2008 The R Foundation for Statistical Computing
  ISBN 3-900051-07-0

 I used yum to try to do the update with the following error

 $su -c yum localupdate /data/R-2.8.0-1.rh4.x86_64.rpm
  Error: Missing Dependency: xdg-utils is needed by package R

 I have installed the xdg-utils manually from
 http://portland.freedesktop.org/download/xdg-utils-1.0.2.tgz

 $cd /data/xdg-utils-1.0.2 -- this is a directory
 $./configure --prefix=/usr
 $su -c  make install
 $cd /usr/bin
 $ ls -al | grep xdg -- shows the xdg utilities
 -rwxr-xr-x   1 root root  14806 Nov 18 10:43 xdg-desktop-icon
 -rwxr-xr-x   1 root root  39267 Nov 18 10:43 xdg-desktop-menu
 -rwxr-xr-x   1 root root  16177 Nov 18 10:43 xdg-email
 -rwxr-xr-x   1 root root  24129 Nov 18 10:43 xdg-icon-resource
 -rwxr-xr-x   1 root root  28015 Nov 18 10:43 xdg-mime
 -rwxr-xr-x   1 root root  10131 Nov 18 10:43 xdg-open
 -rwxr-xr-x   1 root root  19303 Nov 18 10:43 xdg-screensaver

 So the xdg-utils are installed but yum or the R rpm are not recognizing
 them? How do I solve this problem?

 Thanks
 Peter

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