Re: [R] Difference between times

2014-04-20 Thread Prof Brian Ripley

On 18/04/2014 21:46, David Winsemius wrote:


On Apr 18, 2014, at 12:59 PM, Prof Brian Ripley wrote:


On 18/04/2014 19:46, Rui Barradas wrote:

Hello,

The reason why is that you've misspelled CET (not CEST)


Neither CET nor CEST are portable time-zone names.  We have not been given the 
'at a minimum' information required by the posting guide, so please read 
?Sys.timezone on your system.


Dear Prof;

Thanks for the impetus to yet again read that page. Despite frequently reading help pages and in 
particular reading that one many times, I still was not getting the 'tz' arguments correct on a 
Mac. I do now see that I was spelling my TZ incorrectly (as Americas/Los_Angeles rather 
than America/Los_Angeles.

Fellow Mac users may face a problem when using the Finder unless they set it up to 
display hidden ('dot') files. The /usr/ folder is greyed out but it still 
does open. If I restore my Finder defaults to not show system files and folders, I no 
longer see that directory and would not have been able to resolve my spelling error on my 
own:



dt2 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = 
America/New_York)
  dt1 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = 
America/Los_Angeles)
  dt1-dt2

Time difference of 3 hours

I don't suppose a warning could be issued by the as.POSIXct code when a tz 
argument is not found in the database to let people know that 'UTC' will be the default?


No, as the underlying POSIX function does not report this.  We could 
perhaps do this on platforms which use --with-internal-tzcode but not 
e.g. on Linux.


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

__
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] Difference between times

2014-04-20 Thread Prof Brian Ripley

On 20/04/2014 08:50, Prof Brian Ripley wrote:

On 18/04/2014 21:46, David Winsemius wrote:


On Apr 18, 2014, at 12:59 PM, Prof Brian Ripley wrote:


On 18/04/2014 19:46, Rui Barradas wrote:

Hello,

The reason why is that you've misspelled CET (not CEST)


Neither CET nor CEST are portable time-zone names.  We have not been
given the 'at a minimum' information required by the posting guide,
so please read ?Sys.timezone on your system.


Dear Prof;

Thanks for the impetus to yet again read that page. Despite frequently
reading help pages and in particular reading that one many times, I
still was not getting the 'tz' arguments correct on a Mac. I do now
see that I was spelling my TZ incorrectly (as Americas/Los_Angeles
rather than America/Los_Angeles.

Fellow Mac users may face a problem when using the Finder unless they
set it up to display hidden ('dot') files. The /usr/ folder is greyed
out but it still does open. If I restore my Finder defaults to not
show system files and folders, I no longer see that directory and
would not have been able to resolve my spelling error on my own:


You can always use the command-line or OlsonNames() in R.



dt2 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz =
America/New_York)
  dt1 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz =
America/Los_Angeles)
  dt1-dt2

Time difference of 3 hours

I don't suppose a warning could be issued by the as.POSIXct code when
a tz argument is not found in the database to let people know that
'UTC' will be the default?


No, as the underlying POSIX function does not report this.  We could
perhaps do this on platforms which use --with-internal-tzcode but not
e.g. on Linux.


In fact we already do: R 3.1.0 on a Mac shows

 as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = 
Americas/New_York)

[1] 2014-04-18 09:00:00 GMT
Warning messages:
1: In strptime(x, format, tz = tz) : unknown timezone 'Americas/New_York'
2: In as.POSIXct.POSIXlt(as.POSIXlt(x, tz, ...), tz, ...) :
  unknown timezone 'Americas/New_York'
3: In as.POSIXlt.POSIXct(x, tz) : unknown timezone 'Americas/New_York'


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

__
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] to divide column cells by the mean of another column

2014-04-20 Thread Andre Zacharia
Dear all,

I am getting data columnwise that I need to divide by the mean of another
column

If the column is the previous one this code works perfectly well:

fun1 - function(beginColumn, by, data) { indx - seq(beginColumn,
ncol(data), by = by) as.data.frame(t(100 - (t(data[, indx])/colMeans(data[,
indx - 1], na.rm = TRUE)) *  100))
}
(Arun helped me with this code, thank you again!...)

But, the things is now more complicated...

I need to program a function that allow me to divide for example cells from
column 3 on mean from column 2 and cells from column 4 on mean of column 2
and the 5 etc. Then column 6 is another column from whch I  need to extract
the mean and to do the same with column 7 and 8, etc...

so if  I have:

1  2  3 4  1  5
2  5  4 7  2  8
3  4  5 9  3  7
4  7  7 9  4  3

The serie 1,2,3,4 ar just enumerating so not useful at this timepoint.

the results should be (from excel...):
 4,5 33,333 11,111 -11,111   11,111 -55,556 -77,778
-11,111 -100 -55,556   -55,556 -100
33,333
I tried to work on modyfying indx-1 by 2*indx-2, but this is not doing the
job... I tried many other things so that I am now stucked.

Does Anyone has a brilliant idea?

Many many thanks

André ZACHARIA

[[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] Extracting the names of coefficients of random effects

2014-04-20 Thread Ben Bolker
Brian Willis b.h.willis at bham.ac.uk writes:

 
 Hi All,
 I need to be able to manipulate the names of the coefficients from
 *ranef()*.
 
 If there is any missing data when fitting a mixed model using lmer, no
 estimate is returned for the associated level for that random effect. Thus
 if the data input for regions had levels 
   *Region*
 Bolton
   Bradford
 Cambridge
 Durham 
 and there was missing data on Bradford then 
 * ranef(model)*   gives 
(Intercept)
 Bolton: -0.0981763413
 Cambridge0.0151102347
 Durham   0.1837142259


  I think you want to use rownames():

library(lme4)
d - expand.grid(f=factor(LETTERS[1:10]),rep=1:10)
d$y - rnorm(100)
m - lmer(y~(1|f),data=d)

rownames(ranef(m)[[1]])

 This becomes a problem if I want to use *predict( )* on new data where there
 is no missing data on Bradford. In such an instance
 
   *predict (model, newdata = newInput) *
 gives the following error message 
 
  ‘Error in (function (x, n)  : new levels detected in newdata’
 
 I could get round this by checking the Region field of the new data
 ‘newInput’ against the names of the levels of the intercept coefficients
 from* ranef().*
 However, I’m not sure how to access these since if 
 *x- ranef(model)
 x *

  You should also check the allow.new.levels argument in
?predict.merMod, and send followups to r-sig-mixed-mod...@r-project.org.

__
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 use rainbow function without the gamma argument

2014-04-20 Thread Francesco Brundu
Hi Boris,
yes I tried this way and it worked. The fact is that I wanted to be
compliant with the old code, I did not want to change anything. So I wanted
to find a new way to rewrite the code.
Thanks

~ Francesco Brundu


On 19 April 2014 23:18, Boris Steipe boris.ste...@utoronto.ca wrote:

 Have you looked at ?rainbow ?
 Is there a reason why you don't simply leave the gamma parameter away?

 Try:
 pie(rep(1,100), col=rainbow(100, s = 1.0, v = 0.75, start = 0.0, end =
 0.75))

 Cheers,
 B.


 On 2014-04-19, at 6:05 AM, Francesco Brundu wrote:

  Hi all,
  I am using an old code (probably written for R 2.5) and it stops when
  calling rainbow() with gamma argument. I saw that gamma argument is not
  present in newer version of R rainbow function. How can I translate this
  line of code:
 
  rainbow(100, s = 1.0, v = 0.75, start = 0.0, end = 0.75, gamma = 1.5)
 
  ?
 
  It fails with:
 
  Error in rainbow(100, s = 1, v = 0.75, start = 0, end = 0.75, gamma =
 1.5)
  :
   unused argument (gamma = 1.5)
  Calls: nmfconsensus ... matrix.abs.plot - image - image.default -
 rainbow
  Execution halted
 
  Thanks
 
  ~ Francesco Brundu
 
[[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.



[[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] How to use rainbow function without the gamma argument

2014-04-20 Thread Francesco Brundu
Thanks Boris for the detailed answer. I thought to make it backward
compatible because I did not know if gamma parameter would change the
result if absent. As far as I can see changes in my results are not
relevant, so I think to follow your advice to update the old code.

Thanks

~ Francesco Brundu


On 20 April 2014 02:16, Boris Steipe boris.ste...@utoronto.ca wrote:

 If it MUST be parameter-compatible with the old call, you could just add
 ... to your local version of rainbow. The unused parameter will then be
 dropped.

 Here's how:

 # The original creates an error ...
 rainbow(100, s = 1.0, v = 0.75, start = 0.0, end = 0.75, gamma = 1.5)

 Error in rainbow(100, s = 1, v = 0.75, start = 0, end = 0.75, gamma = 1.5)
 :
   unused argument (gamma = 1.5)

 # The code of the function is here:
  rainbow
 function (n, s = 1, v = 1, start = 0, end = max(1, n - 1)/n,
 alpha = 1)
 {
 if ((n - as.integer(n[1L]))  0) {
 if (start == end || any(c(start, end)  0) || any(c(start,
 end)  1))
 stop('start' and 'end' must be distinct and in [0, 1].)
 hsv(h = seq.int(start, ifelse(start  end, 1, 0) + end,
 length.out = n)%%1, s, v, alpha)
 }
 else character()
 }
 bytecode: 0x101968950
 environment: namespace:grDevices

 # I add ... to the parameters and define a local version of rainbow

 rainbow = function (n, s = 1, v = 1, start = 0, end = max(1, n - 1)/n,
  alpha = 1, ...)
  {
  if ((n - as.integer(n[1L]))  0) {
  if (start == end || any(c(start, end)  0) || any(c(start,
  end)  1))
  stop('start' and 'end' must be distinct and in [0, 1].)
  hsv(h = seq.int(start, ifelse(start  end, 1, 0) + end,
  length.out = n)%%1, s, v, alpha)
  }
  else character()
  }

 # same code except for the dots...
 # Now it accepts and discards unused arguments
  rainbow(100, s = 1.0, v = 0.75, start = 0.0, end = 0.75, gamma = 1.5,
 gefingerpoken = TRUE)
   [1] #BFFF #BF0900FF #BF1100FF #BF1A00FF #BF2300FF
 #BF2B00FF #BF3400FF
 [...]
  [99] #5700BFFF #6000BFFF

 # and if I want the original back, I just delete my local version ...
  rm(rainbow)
  rainbow(100, s = 1.0, v = 0.75, start = 0.0, end = 0.75, gamma = 1.5)
 Error in rainbow(100, s = 1, v = 0.75, start = 0, end = 0.75, gamma = 1.5)
 :
   unused argument (gamma = 1.5)

  rainbow(100, s = 1.0, v = 0.75, start = 0.0, end = 0.75)
   [1] #BFFF #BF0900FF #BF1100FF #BF1A00FF #BF2300FF
 #BF2B00FF #BF3400FF
 [...]
  [99] #5700BFFF #6000BFFF

 You can read about the '...' argument in the Introduction to R. Here we
 use it not to pass variables on, but to have them not cause an error when
 present.

 HOWEVER: I personally would consider this poor style. It's probably better
 to review and update your old code. There may be other less obvious
 problems.

 YMMV
 B.





 On 2014-04-19, at 7:19 PM, Francesco Brundu wrote:

  Hi Boris,
  yes I tried this way and it worked. The fact is that I wanted to be
 compliant with the old code, I did not want to change anything. So I wanted
 to find a new way to rewrite the code.
  Thanks
 
  ~ Francesco Brundu
 
 
  On 19 April 2014 23:18, Boris Steipe boris.ste...@utoronto.ca wrote:
  Have you looked at ?rainbow ?
  Is there a reason why you don't simply leave the gamma parameter away?
 
  Try:
  pie(rep(1,100), col=rainbow(100, s = 1.0, v = 0.75, start = 0.0, end =
 0.75))
 
  Cheers,
  B.
 
 
  On 2014-04-19, at 6:05 AM, Francesco Brundu wrote:
 
   Hi all,
   I am using an old code (probably written for R 2.5) and it stops when
   calling rainbow() with gamma argument. I saw that gamma argument is not
   present in newer version of R rainbow function. How can I translate
 this
   line of code:
  
   rainbow(100, s = 1.0, v = 0.75, start = 0.0, end = 0.75, gamma = 1.5)
  
   ?
  
   It fails with:
  
   Error in rainbow(100, s = 1, v = 0.75, start = 0, end = 0.75, gamma =
 1.5)
   :
unused argument (gamma = 1.5)
   Calls: nmfconsensus ... matrix.abs.plot - image - image.default -
 rainbow
   Execution halted
  
   Thanks
  
   ~ Francesco Brundu
  
 [[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.
 
 



[[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] Need help to convert data frame to transaction set.

2014-04-20 Thread Sathish Kumar
Hi Arul,

Thanks for your reply.  I am trying your approach now.  I will reply once
again with my result.

Regards,
Sathish


On Sat, Apr 19, 2014 at 6:43 PM, arun smartpink...@yahoo.com wrote:



 Hi,

 Without a reproducible example using ?dput() or the package name, it is a
 bit difficult to comment.

 Assuming that you used:
 library(arules)
  data(AdultUCI)
 AdultUCI$ID - 1:nrow(AdultUCI)

 lst1 - split(AdultUCI[,ID], AdultUCI[,marital-status])
  as(lst1, transactions)
 #transactions in sparse format with
 # 7 transactions (rows) and
 # 48842 items (columns)



 A.K.


 On Saturday, April 19, 2014 5:01 PM, Sathish Kumar tellsath...@gmail.com
 wrote:
 Hi,

 To convert coerce the data set to transaction data set I used the code

 trans4 - as(split(a[,Cust_ID], a[,Parts]), transactions)

 but I am getting the following error-

 Error in as(split(a[, Cust_ID], a[, Parts]), transactions) : nomethod
 or default for coercing “list” to “transactions”



 Then I tried first converting the data set to matrix structure using the
 code

 c_m-as.matrix(c_df)
 c_m



 then entered the following code


 trans2 - as(c_m, transactions)

 but got the following error

 Error in as(c_m, transactions) : no method or default for coercing
 “matrix” to “transactions”
 Please let me know how to correct the problem.

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


[[alternative HTML version deleted]]

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


Re: [R] Need help to convert data frame to transaction set.

2014-04-20 Thread Sathish Kumar
Hi AK,

First, your timely response is greatly appreciated.

Contrary to what you are getting, I am getting the below when I enter the
same code

  lines1 - readLines(spares.csv)
 head(lines1)
[1] Cust_ID,Parts1,FENDERS2,FENDERS
[4] 3,OIL FILTERS4,BMW SERVICE FLUIDS 4,OIL FILTER

Why is that ?


similarly, I get a different output when I have the same code you have
given.

part-read.csv(spares.csv,header=TRUE,sep=\t)
   str(part)
'data.frame':   838 obs. of  1 variable:
 $ Cust_ID.Parts: Factor w/ 838 levels 1,FENDERS,10,BUMPERS,..: 1 162
334 496 497 729 730 731 771 772 ...


What is the mistake I am doing?


Also, can you please explain below code?

part$Parts - interaction(part[,2:5],sep= ,drop=TRUE)
 part - part[,1:2]


Aru,

I need to submit my class assignment tomorrow.  I have to waiting for
answers for last one week in different forums, you are the only person to
reply. many thanks for that.


Thanks
Sathish



On Sat, Apr 19, 2014 at 10:36 PM, arun smartpink...@yahoo.com wrote:



 Hi Satish,

 Using your code:
 part-read.csv(spares.csv)
 str(part)
 #'data.frame':838 obs. of  1 variable:
 # $ Cust_ID.Parts: Factor w/ 838 levels 100\tAIR\tFILTER\tHOUSING\t,..:
 161 333 495 727 728 768 769 770 784 785 ...

 #I guess you have only two columns in the dataset

  lines1 - readLines(spares.csv)
  head(lines1)
 #[1] Cust_ID\tParts\t\t\t  1\tFENDERS\t\t\t
 #[3] 2\tFENDERS\t\t\t  3\tOIL\tFILTERS\t\t
 #[5] 4\tBMW\tSERVICE\tFLUIDS\t 4\tOIL\tFILTER\t\t


 part-read.csv(spares.csv,header=TRUE,sep=\t)
  str(part)
 #'data.frame':838 obs. of  5 variables:
 # $ Cust_ID: int  1 2 3 4 4 5 5 5 6 6 ...
 # $ Parts  : Factor w/ 26 levels AIR,ALTERNATOR,..: 9 9 16 4 16 6 9 12
 6 9 ...
 # $ X  : Factor w/ 14 levels ,BLADES,CAR,..: 1 1 6 14 5 1 1 1 1
 1 ...
 # $ X.1: Factor w/ 6 levels ,(AXLE,CARE,..: 1 1 1 4 1 1 1 1 1 1
 ...
 # $ X.2: Factor w/ 2 levels ,BOOT): 1 1 1 1 1 1 1 1 1 1 ...


 part$Parts - interaction(part[,2:5],sep= ,drop=TRUE)
  part - part[,1:2]
  str(part)
 #'data.frame':838 obs. of  2 variables:
 # $ Cust_ID: int  1 2 3 4 4 5 5 5 6 6 ...
 # $ Parts  : Factor w/ 31 levels ALTERNATOR   ,..: 6 6 21 28 20 3 6 8 3
 6 ...
 as(split(part[,Cust_ID],part[,Parts]),transactions)
 #transactions in sparse format with
 # 31 transactions (rows) and
 # 502 items (columns)
 A.K.



 On Saturday, April 19, 2014 11:08 PM, Sathish Kumar tellsath...@gmail.com
 wrote:

 Hi AK,

 I have attached  the data set.

 And as you suggested, I coded as follows but still I am getting an error

  part-read.csv(spares.csv)
  part
 lst1-split(part[,Cust_ID],part[,Parts])
  as(lst1, transactions)

 Error in as(lst1, transactions) :
   no method or default for coercing “list” to “transactions”



 On Sat, Apr 19, 2014 at 6:43 PM, arun smartpink...@yahoo.com wrote:


 
 Hi,
 
 Without a reproducible example using ?dput() or the package name, it is a
 bit difficult to comment.
 
 Assuming that you used:
 library(arules)
  data(AdultUCI)
 AdultUCI$ID - 1:nrow(AdultUCI)
 
 lst1 - split(AdultUCI[,ID], AdultUCI[,marital-status])
  as(lst1, transactions)
 #transactions in sparse format with
 # 7 transactions (rows) and
 # 48842 items (columns)
 
 
 
 A.K.
 
 
 
 On Saturday, April 19, 2014 5:01 PM, Sathish Kumar tellsath...@gmail.com
 wrote:
 Hi,
 
 To convert coerce the data set to transaction data set I used the code
 
 trans4 - as(split(a[,Cust_ID], a[,Parts]), transactions)
 
 but I am getting the following error-
 
 Error in as(split(a[, Cust_ID], a[, Parts]), transactions) :
 nomethod
 or default for coercing “list” to “transactions”
 
 
 
 Then I tried first converting the data set to matrix structure using the
 code
 
 c_m-as.matrix(c_df)
 c_m
 
 
 
 then entered the following code
 
 
 trans2 - as(c_m, transactions)
 
 but got the following error
 
 Error in as(c_m, transactions) : no method or default for coercing
 “matrix” to “transactions”
 Please let me know how to correct the problem.
 
 Thanks
 Sathish
 __
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide
 http://www.R-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 


[[alternative HTML version deleted]]

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


Re: [R] to divide column cells by the mean of another column

2014-04-20 Thread Bert Gunter
R has no cells.

You need to do your homework by reading An Introduction to R , which
ships with R, or one of the many R web tutorials of your choice. What
you describe is trivial once you have made a minimal effort to learn
R. In particular, ?[  explains how to index data frames; but a
tutorial is a better option for a learner.

-- Bert

Bert Gunter
Genentech Nonclinical Biostatistics
(650) 467-7374

Data is not information. Information is not knowledge. And knowledge
is certainly not wisdom.
H. Gilbert Welch




On Sun, Apr 20, 2014 at 2:52 AM, Andre Zacharia
andre.zacha...@gmail.com wrote:
 Dear all,

 I am getting data columnwise that I need to divide by the mean of another
 column

 If the column is the previous one this code works perfectly well:

 fun1 - function(beginColumn, by, data) { indx - seq(beginColumn,
 ncol(data), by = by) as.data.frame(t(100 - (t(data[, indx])/colMeans(data[,
 indx - 1], na.rm = TRUE)) *  100))
 }
 (Arun helped me with this code, thank you again!...)

 But, the things is now more complicated...

 I need to program a function that allow me to divide for example cells from
 column 3 on mean from column 2 and cells from column 4 on mean of column 2
 and the 5 etc. Then column 6 is another column from whch I  need to extract
 the mean and to do the same with column 7 and 8, etc...

 so if  I have:

 1  2  3 4  1  5
 2  5  4 7  2  8
 3  4  5 9  3  7
 4  7  7 9  4  3

 The serie 1,2,3,4 ar just enumerating so not useful at this timepoint.

 the results should be (from excel...):
  4,5 33,333 11,111 -11,111   11,111 -55,556 -77,778
 -11,111 -100 -55,556   -55,556 -100
 33,333
 I tried to work on modyfying indx-1 by 2*indx-2, but this is not doing the
 job... I tried many other things so that I am now stucked.

 Does Anyone has a brilliant idea?

 Many many thanks

 André ZACHARIA

 [[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] to divide column cells by the mean of another column

2014-04-20 Thread arun
Hi,

May be this helps:
fun1 - function(beginColumn, by, data) {
    indx - seq(beginColumn, ncol(data), by = by)
    dataNew - data[, indx[1]:ncol(data)]
    indx1 - cumsum(seq(ncol(data)) %in% indx)
    indx2 - indx1[indx1 != 0]
    lst1 - lapply(split(seq_along(indx2), indx2), function(i) {
    x1 - dataNew[, i, drop = FALSE]
    if (ncol(x1)  1) {
    x1[, -1]/mean(x1[, 1])
    }
    })
    res - data.frame(lst1[sapply(lst1, length)  0])
    colnames(res) - gsub(.*\\., , colnames(res))
    res
}

set.seed(458)
dat1 - as.data.frame(matrix(sample(5,10*5,replace=TRUE),ncol=10))

set.seed(34)
dat2 - as.data.frame(matrix(sample(20,21*5,replace=TRUE),ncol=21))
 fun1(2,4,dat1)
fun1(2,5,dat2)

A.K.





On Sunday, April 20, 2014 5:55 AM, Andre Zacharia andre.zacha...@gmail.com 
wrote:
Dear all,

I am getting data columnwise that I need to divide by the mean of another
column

If the column is the previous one this code works perfectly well:

fun1 - function(beginColumn, by, data) { indx - seq(beginColumn,
ncol(data), by = by) as.data.frame(t(100 - (t(data[, indx])/colMeans(data[,
indx - 1], na.rm = TRUE)) *  100))
}
(Arun helped me with this code, thank you again!...)

But, the things is now more complicated...

I need to program a function that allow me to divide for example cells from
column 3 on mean from column 2 and cells from column 4 on mean of column 2
and the 5 etc. Then column 6 is another column from whch I  need to extract
the mean and to do the same with column 7 and 8, etc...

so if  I have:

1  2  3 4  1  5
2  5  4 7  2  8
3  4  5 9  3  7
4  7  7 9  4  3

The serie 1,2,3,4 ar just enumerating so not useful at this timepoint.

the results should be (from excel...):
4,5 33,333 11,111 -11,111   11,111 -55,556 -77,778
-11,111 -100 -55,556   -55,556 -100
33,333
I tried to work on modyfying indx-1 by 2*indx-2, but this is not doing the
job... I tried many other things so that I am now stucked.

Does Anyone has a brilliant idea?

Many many thanks

André ZACHARIA

    [[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] to divide column cells by the mean of another column

2014-04-20 Thread arun
Hi Andre,


A slight correction:
fun1 - function(beginColumn, by, data) {
    indx - seq(beginColumn, ncol(data), by = by)
    dataNew - data[, indx[1]:ncol(data)]
    indx1 - cumsum(seq(ncol(data)) %in% indx)
    indx2 - indx1[indx1 != 0]
    lst1 - lapply(split(seq_along(indx2), indx2), function(i) {
    x1 - dataNew[, i, drop = FALSE]
    if (ncol(x1)  1) {
    x1[, -1, drop = FALSE]/mean(x1[, 1]) ###changed
    }
    })
    
    res - data.frame(lst1[sapply(lst1, length)  0])
    colnames(res) - gsub(.*\\., , colnames(res))
    res
}



Also, you can try:
fun2 - function(beginColumn, by, data) {
    indx - seq(beginColumn, ncol(data), by = by)
    indx1 - head(indx + 1, -1)
    indx2 - tail(indx - 1, -1)
    vec1 - as.vector(sapply(seq_along(indx1), function(i) indx1[i]:indx2[i]))
    if (ncol(data)  tail(indx, 1)) {
    vec2 - c(vec1, (tail(indx, 1) + 1):ncol(dat1))
    } else {
    vec2 - vec1
    }
    means1 - rep(colMeans(data[, indx]), each = by - 1, length.out = 
length(vec2))
    res - as.data.frame(t(t(data[, vec2])/means1))
    res
}

set.seed(458)
dat1 - as.data.frame(matrix(sample(5,10*5,replace=TRUE),ncol=10))

identical(fun1(2,4,dat1),fun2(2,4,dat1))
#[1] TRUE
A.K.



Hi,

May be this helps:
fun1 - function(beginColumn, by, data) {
    indx - seq(beginColumn, ncol(data), by = by)
    dataNew - data[, indx[1]:ncol(data)]
    indx1 - cumsum(seq(ncol(data)) %in% indx)
    indx2 - indx1[indx1 != 0]
    lst1 - lapply(split(seq_along(indx2), indx2), function(i) {
    x1 - dataNew[, i, drop = FALSE]
    if (ncol(x1)  1) {
    x1[, -1]/mean(x1[, 1])
    }
    })
    res - data.frame(lst1[sapply(lst1, length)  0])
    colnames(res) - gsub(.*\\., , colnames(res))
    res
}

set.seed(458)
dat1 - as.data.frame(matrix(sample(5,10*5,replace=TRUE),ncol=10))

set.seed(34)
dat2 - as.data.frame(matrix(sample(20,21*5,replace=TRUE),ncol=21))
 fun1(2,4,dat1)
fun1(2,5,dat2)

A.K.






On Sunday, April 20, 2014 5:55 AM, Andre Zacharia andre.zacha...@gmail.com 
wrote:
Dear all,

I am getting data columnwise that I need to divide by the mean of another
column

If the column is the previous one this code works perfectly well:

fun1 - function(beginColumn, by, data) { indx - seq(beginColumn,
ncol(data), by = by) as.data.frame(t(100 - (t(data[, indx])/colMeans(data[,
indx - 1], na.rm = TRUE)) *  100))
}
(Arun helped me with this code, thank you again!...)

But, the things is now more complicated...

I need to program a function that allow me to divide for example cells from
column 3 on mean from column 2 and cells from column 4 on mean of column 2
and the 5 etc. Then column 6 is another column from whch I  need to extract
the mean and to do the same with column 7 and 8, etc...

so if  I have:

1  2  3 4  1  5
2  5  4 7  2  8
3  4  5 9  3  7
4  7  7 9  4  3

The serie 1,2,3,4 ar just enumerating so not useful at this timepoint.

the results should be (from excel...):
4,5 33,333 11,111 -11,111   11,111 -55,556 -77,778
-11,111 -100 -55,556   -55,556 -100
33,333
I tried to work on modyfying indx-1 by 2*indx-2, but this is not doing the
job... I tried many other things so that I am now stucked.

Does Anyone has a brilliant idea?

Many many thanks

André ZACHARIA

    [[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] What do the colours of the scatterplot3d actually show?

2014-04-20 Thread mfbx9jhy
Hello, 

Please could anyone tell me the significance of the graded red-black color
when using scatterplot3d? 

At first I thought it was just going from the very 'near' to the back of the
chart area, but as you can see from the pictures some of the points in the
back are bright red. The description from ?scatterplot mentions that
hightlight3d points will be drawn in different colors related to y
coordinates... but as you can tell from the plot is isn't true either; with
come short points being black as well as red...


http://r.789695.n4.nabble.com/file/n4689148/Rplot.png 


any help would be fantastic, I'm very very new to R

Cheers, 

Jo




--
View this message in context: 
http://r.789695.n4.nabble.com/What-do-the-colours-of-the-scatterplot3d-actually-show-tp4689148.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] What do the colours of the scatterplot3d actually show?

2014-04-20 Thread Uwe Ligges



On 20.04.2014 17:51, mfbx9jhy wrote:

Hello,

Please could anyone tell me the significance of the graded red-black color
when using scatterplot3d?

At first I thought it was just going from the very 'near' to the back of the
chart area, but as you can see from the pictures some of the points in the
back are bright red. The description from ?scatterplot mentions that
hightlight3d points will be drawn in different colors related to y
coordinates... but as you can tell from the plot is isn't true either; with
come short points being black as well as red...


http://r.789695.n4.nabble.com/file/n4689148/Rplot.png


any help would be fantastic, I'm very very new to R



All points in bright red appear to be within [0,5] on the elong 
labelled  axis. If you find a point that is not, please tell me which 
one and send me the data and the code so that I could check what happens.


Best,
Uwe Ligges





Cheers,

Jo




--
View this message in context: 
http://r.789695.n4.nabble.com/What-do-the-colours-of-the-scatterplot3d-actually-show-tp4689148.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] Difference between times

2014-04-20 Thread David Winsemius

On Apr 20, 2014, at 2:16 AM, Prof Brian Ripley wrote:

 On 20/04/2014 08:50, Prof Brian Ripley wrote:
 On 18/04/2014 21:46, David Winsemius wrote:
 
 On Apr 18, 2014, at 12:59 PM, Prof Brian Ripley wrote:
 
 On 18/04/2014 19:46, Rui Barradas wrote:
 Hello,
 
 The reason why is that you've misspelled CET (not CEST)
 
 Neither CET nor CEST are portable time-zone names.  We have not been
 given the 'at a minimum' information required by the posting guide,
 so please read ?Sys.timezone on your system.
 
 Dear Prof;
 
 Thanks for the impetus to yet again read that page. Despite frequently
 reading help pages and in particular reading that one many times, I
 still was not getting the 'tz' arguments correct on a Mac. I do now
 see that I was spelling my TZ incorrectly (as Americas/Los_Angeles
 rather than America/Los_Angeles.
 
 Fellow Mac users may face a problem when using the Finder unless they
 set it up to display hidden ('dot') files. The /usr/ folder is greyed
 out but it still does open. If I restore my Finder defaults to not
 show system files and folders, I no longer see that directory and
 would not have been able to resolve my spelling error on my own:
 
 You can always use the command-line or OlsonNames() in R.

I'm not finding an OlsonNames function on a Mac (but is that because I haven't 
updated?). Before seeing that the zone-checking feature had been added as a 
feature, I was building an OlsonNames function that extracts the 
sub-directories of the zoneinfo directory and appends the file names to them as 
well as extracting the non-OlsonNames entries in zoneinfo. My plan had been to 
make my own warnings in strptime, but that appears to be unnecessary.

OlsonNames - function(onlyOlson=FALSE) { 
  MacOlsonDirs - system('ls -p /usr/share/zoneinfo ', intern=TRUE)
  OlsonNames - unlist( lapply( MacOlsonDirs[grep(/$, MacOlsonDirs)], 
function(dir) paste0( dir, 
   system( paste0('ls -p 
/usr/share/zoneinfo/', dir) , 
   intern=TRUE) ) ) )
  nonOlsonNames - MacOlsonDirs[grepl(^[A-Z], MacOlsonDirs)  ! grepl(/$, 
MacOlsonDirs) ]
  if ( !onlyOlson){ c(OlsonNames, nonOlsonNames)} else {OlsonNames}
   }

Yes. It is because I haven't updated. I now see this in the NEWS that was 
posted in this list 10 days ago.

There is more support to explore the system's idea of time-zone
names.  Sys.timezone() tries to give the current system setting
by name (and succeeds at least on Linux, OS X, Solaris and
Windows), and OlsonNames() lists the names in the system's Olson
database. Sys.timezone(location = FALSE) gives the previous
behaviour.
 
I guess I will have fun comparing my efforts with those of the masters.

 
 dt2 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz =
 America/New_York)
  dt1 = as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz =
 America/Los_Angeles)
  dt1-dt2
 Time difference of 3 hours
 
 I don't suppose a warning could be issued by the as.POSIXct code when
 a tz argument is not found in the database to let people know that
 'UTC' will be the default?
 
 No, as the underlying POSIX function does not report this.  We could
 perhaps do this on platforms which use --with-internal-tzcode but not
 e.g. on Linux.
 
 In fact we already do: R 3.1.0 on a Mac shows

My apologies. And thank you to whomever added the feature and to you, Prof, for 
checking and letting us know. I was going to offer the code above as a patch 
but that seems not needed now. I have not yet updated to 3.1.0. The 
Mavericks/3.1.0 incompatibilities have been scaring me off from updating. Still 
on Lion/3.0.2.

 
  as.POSIXct(2014-04-18 09.00, format=%Y-%m-%d %H.%M, tz = 
  Americas/New_York)
 [1] 2014-04-18 09:00:00 GMT
 Warning messages:
 1: In strptime(x, format, tz = tz) : unknown timezone 'Americas/New_York'
 2: In as.POSIXct.POSIXlt(as.POSIXlt(x, tz, ...), tz, ...) :
  unknown timezone 'Americas/New_York'
 3: In as.POSIXlt.POSIXct(x, tz) : unknown timezone 'Americas/New_York'

Thank you, all of R-Core.


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

David Winsemius
Alameda, CA, USA

__
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 3.0.3, Windows 7: Problem installing XML package

2014-04-20 Thread Alpesh Pandya
I keep on trying from various networks but I still get the same error. I
don't this this has anything to do with network or ability to download the
package (as I can install other packages fine). This must be something in
base R or dependencies issues (that R is not spelling out).

I know R is geared for Mac and Windows is kind of looked down upon but I
have no option but use windows and need this XML package running to
complete my education. Any help on this would be appreciated.


On Mon, Apr 14, 2014 at 2:24 PM, Alpesh Pandya alpeshpan...@gmail.comwrote:

 Thank you for response Rui.

 I still get the same error with this repository.

 Installing package into ‘C:/Users/APandya/Documents/R/win-library/3.0’
 (as ‘lib’ is unspecified)
 trying URL '
 http://cran.dcc.fc.up.pt/bin/windows/contrib/3.0/XML_3.98-1.1.zip'
 Content type 'application/zip' length 4288136 bytes (4.1 Mb)
 opened URL
 downloaded 4.1 Mb

 Error in read.dcf(file.path(pkgname, DESCRIPTION), c(Package, Type))
 :
   cannot open the connection
 In addition: Warning messages:
 1: In download.file(url, destfile, method, mode = wb, ...) :
   downloaded length 4276224 != reported length 4288136
 2: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
 3: In read.dcf(file.path(pkgname, DESCRIPTION), c(Package, Type)) :
   cannot open compressed file 'XML/DESCRIPTION', probable reason 'No such
 file or directory'



 On Mon, Apr 14, 2014 at 2:17 PM, Rui Barradas ruipbarra...@sapo.ptwrote:

 Hello,
 I have package XML installed on Windows 7, R 3.0.3 and I had no problem
 at all. Can't you try (it worked with me)

 install.packages(XML, repos = http://cran.dcc.fc.up.pt;)

 Hope this helps,

 Rui Barradas

 Em 14-04-2014 16:24, Alpesh Pandya escreveu:

  I have tried these sources (almost all US mirrors):

 http://cran.cnr.Berkeley.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip
 http://cran.stat.ucla.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip
 http://streaming.stat.iastate.edu/CRAN/bin/windows/contrib/
 3.0/XML_3.98-1.1.zip
 http://ftp.ussg.iu.edu/CRAN/bin/windows/contrib/3.0/XML_3.98-1.1.zip
 http://rweb.quant.ku.edu/cran/bin/windows/contrib/3.0/XML_3.98-1.1.zip
 http://watson.nci.nih.gov/cran_mirror/bin/windows/
 contrib/3.0/XML_3.98-1.1.zip
 http://cran.mtu.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip
 http://cran.wustl.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip
 http://cran.case.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip
 http://ftp.osuosl.org/pub/cran/bin/windows/contrib/3.0/XML_3.98-1.1.zip
 http://lib.stat.cmu.edu/R/CRAN/bin/windows/contrib/3.0/XML_3.98-1.1.zip

 I have confirmed with IT that there is no restriction on downloading this
 zip file from any of these sources. Also I am getting same error when I
 try
 from my home network as well.


 On Sun, Apr 13, 2014 at 9:46 AM, Uwe Ligges 
 lig...@statistik.tu-dortmund.de

 wrote:




 On 13.04.2014 01:30, Alpesh Pandya wrote:

  @Uwe I tried the same steps from office as well as home network with
 same
 results. Are you using windows 7 with R 3.0.3?

 I have seen same question being asked by others without any
 resolution. Is
 anything special about XML package? I am OK use older version of
 package
 but in archives there are no zip files (only gz files). Is windows
 platform
 not recommended for R?


 Right, and you can try to install these from sources.
 But I doubt you need it. You still have not told us if you tried another
 mirror to download the XML file from and what you local IT support tells
 you while your downloads are incomplete.

 Best,
 Uwe Ligges







 On Sat, Apr 12, 2014 at 7:22 PM, Uwe Ligges 
 lig...@statistik.tu-dortmund.de

  wrote:




 On 12.04.2014 22:39, Alpesh Pandya wrote:

   Thank you for response Uwe. I tried multiple times by downloading
 the

 zip
 file from many sources but still the same error. This is a major road
 block
 for me in using R. Appreciate any help on this.


  Please ask your local IT staff.

 I get, using the same mirror:

   options(repos=c(CRAN=http://watson.nci.nih.gov/cran_mirror;))

 install.packages(XML, lib=d:/temp)


 trying URL 'http://watson.nci.nih.gov/cran_mirror/bin/windows/

 contrib/3.0/XML_3.98-1.1.zip'
 Content type 'application/zip' length 4288136 bytes (4.1 Mb)
 opened URL
 downloaded 4.1 Mb

 package 'XML' successfully unpacked and MD5 sums checked

 The downloaded binary packages are in
   d:\temp\RtmpqMqL8L\downloaded_packages



 Best,
 Uwe Ligges








  On Fri, Apr 11, 2014 at 6:53 PM, Uwe Ligges 
 lig...@statistik.tu-dortmund.de

   wrote:



 Works for me.


 Best,
 Uwe Ligges




 On 11.04.2014 17:10, Alpesh Pandya wrote:

Using install.package('XML') command produces this error:


 trying URL
 '
 http://watson.nci.nih.gov/cran_mirror/bin/windows/
 contrib/3.0/XML_3.98-1.1.zip
 '
 Content type 'application/zip' length 4288136 bytes (4.1 Mb)
 opened URL
 downloaded 4.1 Mb

 Error in read.dcf(file.path(pkgname, DESCRIPTION), c(Package,
 Type)) :
   cannot open the 

Re: [R] R 3.0.3, Windows 7: Problem installing XML package

2014-04-20 Thread Duncan Murdoch

On 20/04/2014, 2:45 PM, Alpesh Pandya wrote:

I keep on trying from various networks but I still get the same error. I
don't this this has anything to do with network or ability to download the
package (as I can install other packages fine). This must be something in
base R or dependencies issues (that R is not spelling out).


This is very clearly a problem with your setup, not with R:  nobody else 
is reporting it.


What you should do is download the .zip file using some other means 
(e.g. Firefox, etc.) and check whether the size comes out properly 
(4,288,694 bytes; not sure why you saw the numbers you saw).  If it 
does, then install the package from the .zip file.  If it doesn't, then 
tell your IT people to fix your system.


Duncan Murdoch



I know R is geared for Mac and Windows is kind of looked down upon but I
have no option but use windows and need this XML package running to
complete my education. Any help on this would be appreciated.


On Mon, Apr 14, 2014 at 2:24 PM, Alpesh Pandya alpeshpan...@gmail.comwrote:


Thank you for response Rui.

I still get the same error with this repository.

Installing package into ‘C:/Users/APandya/Documents/R/win-library/3.0’
(as ‘lib’ is unspecified)
trying URL '
http://cran.dcc.fc.up.pt/bin/windows/contrib/3.0/XML_3.98-1.1.zip'
Content type 'application/zip' length 4288136 bytes (4.1 Mb)
opened URL
downloaded 4.1 Mb

Error in read.dcf(file.path(pkgname, DESCRIPTION), c(Package, Type))
:
   cannot open the connection
In addition: Warning messages:
1: In download.file(url, destfile, method, mode = wb, ...) :
   downloaded length 4276224 != reported length 4288136
2: In unzip(zipname, exdir = dest) : error 1 in extracting from zip file
3: In read.dcf(file.path(pkgname, DESCRIPTION), c(Package, Type)) :
   cannot open compressed file 'XML/DESCRIPTION', probable reason 'No such
file or directory'



On Mon, Apr 14, 2014 at 2:17 PM, Rui Barradas ruipbarra...@sapo.ptwrote:


Hello,
I have package XML installed on Windows 7, R 3.0.3 and I had no problem
at all. Can't you try (it worked with me)

install.packages(XML, repos = http://cran.dcc.fc.up.pt;)

Hope this helps,

Rui Barradas

Em 14-04-2014 16:24, Alpesh Pandya escreveu:

  I have tried these sources (almost all US mirrors):


http://cran.cnr.Berkeley.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip
http://cran.stat.ucla.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip
http://streaming.stat.iastate.edu/CRAN/bin/windows/contrib/
3.0/XML_3.98-1.1.zip
http://ftp.ussg.iu.edu/CRAN/bin/windows/contrib/3.0/XML_3.98-1.1.zip
http://rweb.quant.ku.edu/cran/bin/windows/contrib/3.0/XML_3.98-1.1.zip
http://watson.nci.nih.gov/cran_mirror/bin/windows/
contrib/3.0/XML_3.98-1.1.zip
http://cran.mtu.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip
http://cran.wustl.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip
http://cran.case.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip
http://ftp.osuosl.org/pub/cran/bin/windows/contrib/3.0/XML_3.98-1.1.zip
http://lib.stat.cmu.edu/R/CRAN/bin/windows/contrib/3.0/XML_3.98-1.1.zip

I have confirmed with IT that there is no restriction on downloading this
zip file from any of these sources. Also I am getting same error when I
try
from my home network as well.


On Sun, Apr 13, 2014 at 9:46 AM, Uwe Ligges 
lig...@statistik.tu-dortmund.de


wrote:






On 13.04.2014 01:30, Alpesh Pandya wrote:

  @Uwe I tried the same steps from office as well as home network with

same
results. Are you using windows 7 with R 3.0.3?

I have seen same question being asked by others without any
resolution. Is
anything special about XML package? I am OK use older version of
package
but in archives there are no zip files (only gz files). Is windows
platform
not recommended for R?



Right, and you can try to install these from sources.
But I doubt you need it. You still have not told us if you tried another
mirror to download the XML file from and what you local IT support tells
you while your downloads are incomplete.

Best,
Uwe Ligges








On Sat, Apr 12, 2014 at 7:22 PM, Uwe Ligges 
lig...@statistik.tu-dortmund.de

  wrote:







On 12.04.2014 22:39, Alpesh Pandya wrote:

   Thank you for response Uwe. I tried multiple times by downloading
the


zip
file from many sources but still the same error. This is a major road
block
for me in using R. Appreciate any help on this.


  Please ask your local IT staff.


I get, using the same mirror:

   options(repos=c(CRAN=http://watson.nci.nih.gov/cran_mirror;))


install.packages(XML, lib=d:/temp)



trying URL 'http://watson.nci.nih.gov/cran_mirror/bin/windows/

contrib/3.0/XML_3.98-1.1.zip'
Content type 'application/zip' length 4288136 bytes (4.1 Mb)
opened URL
downloaded 4.1 Mb

package 'XML' successfully unpacked and MD5 sums checked

The downloaded binary packages are in
   d:\temp\RtmpqMqL8L\downloaded_packages



Best,
Uwe Ligges








  On Fri, Apr 11, 2014 at 6:53 PM, Uwe Ligges 

lig...@statistik.tu-dortmund.de

   wrote:




 Works for me.





Re: [R] R 3.0.3, Windows 7: Problem installing XML package

2014-04-20 Thread Jeff Newmiller
Hard to help you when the problem simply does not happen for others.

As for Windows being not a focus, that is not at all true. I use it regularly 
on Windows at work. That being said, there are thousands of packages and those 
each involve their own subset of R users. There are also many operating system 
configurations that may not all be fully tested. Blaming R or Windows, or 
blaming us for preventing you from getting your education (isn't that 
something between you and your educational institution?) are not going to be 
effective strategies for problem solving.

Are you able to use other aspects of R beyond the XML package? Have you tried 
communicating with the maintainers of that package?
---
Jeff NewmillerThe .   .  Go Live...
DCN:jdnew...@dcn.davis.ca.usBasics: ##.#.   ##.#.  Live Go...
  Live:   OO#.. Dead: OO#..  Playing
Research Engineer (Solar/BatteriesO.O#.   #.O#.  with
/Software/Embedded Controllers)   .OO#.   .OO#.  rocks...1k
--- 
Sent from my phone. Please excuse my brevity.

On April 20, 2014 11:45:44 AM PDT, Alpesh Pandya alpeshpan...@gmail.com wrote:
I keep on trying from various networks but I still get the same error.
I
don't this this has anything to do with network or ability to download
the
package (as I can install other packages fine). This must be something
in
base R or dependencies issues (that R is not spelling out).

I know R is geared for Mac and Windows is kind of looked down upon but
I
have no option but use windows and need this XML package running to
complete my education. Any help on this would be appreciated.


On Mon, Apr 14, 2014 at 2:24 PM, Alpesh Pandya
alpeshpan...@gmail.comwrote:

 Thank you for response Rui.

 I still get the same error with this repository.

 Installing package into
���C:/Users/APandya/Documents/R/win-library/3.0���
 (as ���lib��� is unspecified)
 trying URL '
 http://cran.dcc.fc.up.pt/bin/windows/contrib/3.0/XML_3.98-1.1.zip'
 Content type 'application/zip' length 4288136 bytes (4.1 Mb)
 opened URL
 downloaded 4.1 Mb

 Error in read.dcf(file.path(pkgname, DESCRIPTION), c(Package,
Type))
 :
   cannot open the connection
 In addition: Warning messages:
 1: In download.file(url, destfile, method, mode = wb, ...) :
   downloaded length 4276224 != reported length 4288136
 2: In unzip(zipname, exdir = dest) : error 1 in extracting from zip
file
 3: In read.dcf(file.path(pkgname, DESCRIPTION), c(Package,
Type)) :
   cannot open compressed file 'XML/DESCRIPTION', probable reason 'No
such
 file or directory'



 On Mon, Apr 14, 2014 at 2:17 PM, Rui Barradas
ruipbarra...@sapo.ptwrote:

 Hello,
 I have package XML installed on Windows 7, R 3.0.3 and I had no
problem
 at all. Can't you try (it worked with me)

 install.packages(XML, repos = http://cran.dcc.fc.up.pt;)

 Hope this helps,

 Rui Barradas

 Em 14-04-2014 16:24, Alpesh Pandya escreveu:

  I have tried these sources (almost all US mirrors):


http://cran.cnr.Berkeley.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip
 http://cran.stat.ucla.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip
 http://streaming.stat.iastate.edu/CRAN/bin/windows/contrib/
 3.0/XML_3.98-1.1.zip

http://ftp.ussg.iu.edu/CRAN/bin/windows/contrib/3.0/XML_3.98-1.1.zip

http://rweb.quant.ku.edu/cran/bin/windows/contrib/3.0/XML_3.98-1.1.zip
 http://watson.nci.nih.gov/cran_mirror/bin/windows/
 contrib/3.0/XML_3.98-1.1.zip
 http://cran.mtu.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip
 http://cran.wustl.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip
 http://cran.case.edu/bin/windows/contrib/3.0/XML_3.98-1.1.zip

http://ftp.osuosl.org/pub/cran/bin/windows/contrib/3.0/XML_3.98-1.1.zip

http://lib.stat.cmu.edu/R/CRAN/bin/windows/contrib/3.0/XML_3.98-1.1.zip

 I have confirmed with IT that there is no restriction on
downloading this
 zip file from any of these sources. Also I am getting same error
when I
 try
 from my home network as well.


 On Sun, Apr 13, 2014 at 9:46 AM, Uwe Ligges 
 lig...@statistik.tu-dortmund.de

 wrote:




 On 13.04.2014 01:30, Alpesh Pandya wrote:

  @Uwe I tried the same steps from office as well as home network
with
 same
 results. Are you using windows 7 with R 3.0.3?

 I have seen same question being asked by others without any
 resolution. Is
 anything special about XML package? I am OK use older version of
 package
 but in archives there are no zip files (only gz files). Is
windows
 platform
 not recommended for R?


 Right, and you can try to install these from sources.
 But I doubt you need it. You still have not told us if you tried
another
 mirror to download the XML file from and what you local IT support
tells
 you while your downloads are incomplete.

 Best,
 Uwe Ligges







 On Sat, Apr 12, 2014 at 7:22 PM, Uwe Ligges