Re: [R] To transform a vector

2013-12-08 Thread Arnaud Michel

Thank you
Michel
Le 09/12/2013 08:14, Berend Hasselman a écrit :

On 09-12-2013, at 08:04, Arnaud Michel  wrote:


Dear R Users

I have the vector
X <- c( 6 , 4 ,12 , 3)

I would like to build a new vector by to transform it into
Y <- c(rep(X[1], X[1]), rep(X[2], X[2]), rep(X[3], X[3]), rep(X[4], X[4]))

Have you a more elegant answer ?


Have a good read of ?rep.

Try this:

rep(X,times=X)

Berend





--
Michel ARNAUD
Chargé de mission auprès du DRH
DGDRD-Drh - TA 174/04
Av Agropolis 34398 Montpellier cedex 5
tel : 04.67.61.75.38
fax : 04.67.61.57.87
port: 06.47.43.55.31

__
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 transform a vector

2013-12-08 Thread Pascal Oettli
Hello,

Are you looking for Y <- rep(X, X) ?

Regards,
Pascal

On 9 December 2013 16:04, Arnaud Michel  wrote:
> Dear R Users
>
> I have the vector
> X <- c( 6 , 4 ,12 , 3)
>
> I would like to build a new vector by to transform it into
> Y <- c(rep(X[1], X[1]), rep(X[2], X[2]), rep(X[3], X[3]), rep(X[4], X[4]))
>
> Have you a more elegant answer ?
>
> PS : Sorry for this basic question
>
> --
> Michel ARNAUD
> Chargé de mission auprès du DRH
> DGDRD-Drh - TA 174/04
> Av Agropolis 34398 Montpellier cedex 5
> tel : 04.67.61.75.38
> fax : 04.67.61.57.87
> port: 06.47.43.55.31
>
> __
> 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.



-- 
Pascal Oettli
Project Scientist
JAMSTEC
Yokohama, Japan

__
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 transform a vector

2013-12-08 Thread Berend Hasselman

On 09-12-2013, at 08:04, Arnaud Michel  wrote:

> Dear R Users
> 
> I have the vector
> X <- c( 6 , 4 ,12 , 3)
> 
> I would like to build a new vector by to transform it into
> Y <- c(rep(X[1], X[1]), rep(X[2], X[2]), rep(X[3], X[3]), rep(X[4], X[4]))
> 
> Have you a more elegant answer ?


Have a good read of ?rep.

Try this:

rep(X,times=X)

Berend

__
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 transform a vector

2013-12-08 Thread Arnaud Michel

Dear R Users

I have the vector
X <- c( 6 , 4 ,12 , 3)

I would like to build a new vector by to transform it into
Y <- c(rep(X[1], X[1]), rep(X[2], X[2]), rep(X[3], X[3]), rep(X[4], X[4]))

Have you a more elegant answer ?

PS : Sorry for this basic question

--
Michel ARNAUD
Chargé de mission auprès du DRH
DGDRD-Drh - TA 174/04
Av Agropolis 34398 Montpellier cedex 5
tel : 04.67.61.75.38
fax : 04.67.61.57.87
port: 06.47.43.55.31

__
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] wmf screen resolution problem!!!

2013-12-08 Thread S Ellison


> From:Venkat Karthik [tvkarthi...@gmail.com]
> We are trying to generate a wmf image with fixed pixels, fixed height &
> fixed width. But the problem we are facing is that when the same code is
> run on a different screen resolution the dimensions of the image are no
> longer the same.

In what medium are you measuring the size of the image?

If you're reading on screen, try reading the help page for ?windows, where it 
says 
   "The size of a window is computed from information provided about
 the display: it depends on the system being configured accurately.
 By default a screen device asks Windows for the number of pixels
 per inch.  This can be overridden (it is often wrong) by
 specifying ‘xpinch’ and ‘ypinch’"
... and rather more.

Broadly, though, you are generating a vector image of defined size in some 
medium. There is no meaningful pixel count until you use a raster device to 
display it, and when you do, the size depends entirely on what the device 
thinks its pixel size is. And it seems that windows is not often right about it.

S






***
This email and any attachments are confidential. Any use...{{dropped:8}}

__
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] Problems updating packages

2013-12-08 Thread Jeff Newmiller
I recommend using a personal library directory unless you really are an 
administrator of a computer that multiple users of R use (very unusual for 
Windows). The install program offers you the opportunity to create an 
R/win-library/ directory. If you do this and make a habit of never updating "As 
Administrator" then you won't have to worry about permissions getting screwed 
up. This strategy actually works quite well on Linux as well, and I imagine 
would be a good strategy on any OS. The only thing you would need to elevate 
permissions for is to upgrade R, and Windows UAE will prompt you for that when 
you run the install.
---
Jeff NewmillerThe .   .  Go Live...
DCN:Basics: ##.#.   ##.#.  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.

Tolga Uzuner  wrote:
>OK thanks. The odd thing is, this just started happening. And I am an
>Admin on my machine.
>
>Or I think I am...hmm, let me check, maybe I did something to my own
>privileges recently by mistake.
>
>Sent from my iPhone
>
>> On 8 Dec 2013, at 01:07 pm, Uwe Ligges
> wrote:
>> 
>> 
>> 
>>> On 08.12.2013 16:37, Tolga Uzuner wrote:
>>> Dear R Users
>>> Ive just uninstalled R and reinstalled from scratch. I then hit
>Update
>>> Packages and get the following message:
>>> 
>>> > update.packages(ask='graphics',checkBuilt=TRUE)
>>> --- Please select a CRAN mirror for use in this session ---
>>> Warning: package 'foreign' in library 'C:/Program
>>> Files/R/R-3.0.2/library' will not be updated
>>> Warning: package 'lattice' in library 'C:/Program
>>> Files/R/R-3.0.2/library' will not be updated
>>> Warning: package 'Matrix' in library 'C:/Program
>>> Files/R/R-3.0.2/library' will not be updated
>>> Warning: package 'mgcv' in library 'C:/Program
>Files/R/R-3.0.2/library'
>>> will not be updated
>>> Warning: package 'nlme' in library 'C:/Program
>Files/R/R-3.0.2/library'
>>> will not be updated
>>> >
>>> 
>>> Why would this be the case ?
>> 
>> You do not have permissions to update packages in that library.
>> 
>> Best,
>> Uwe Ligges
>> 
>> 
>> 
>> 
>>> 
>>> Thanks in advance
>>> 
>>> __
>>> 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] rJava problems

2013-12-08 Thread Xiaogang Su
I encountered the same problem a couple of days ago. I found simply
re-installing JASA (the 64bit one) would straighten out the Registry
entries:
http://java.com/en/download/manual.jsp


=
Xiaogang Su, Ph.D.
Associate Professor
Department of Mathematical Sciences
University of Texas at El Paso
500 W. University Ave.
El Paso, Texas 79968-0514
x...@utep.edu
xiaogan...@gmail.com
https://sites.google.com/site/xgsu00/


On Sun, Dec 8, 2013 at 11:15 AM, Tolga Uzuner wrote:

> Thank you Rob. I used to have the 64-bit R also installed, but removed it
> and did not reinstall it. I also cleared out all rJava.dll files on my
> computer before reinstalling R fresh. I am running R through Rgui,  not
> Rstudio. I will post RVersion data later once I return to my PC, apologies.
>
> Sent from my iPhone
>
> > On 8 Dec 2013, at 12:50 pm, Robert Baer  wrote:
> >
> > You don't really provide enough information like
> > R.Version()
> >
> > but my guess is that you are running 64-bit R either directly or through
> R Studio but that you have only 32-bit Java installed.   I am doing fine on
> Windows with Java 7 update 45 but had some 64-bit run issues with only Java
> 7 update 40 64-bit JDK.
> >
> > HTH,
> > Rob
> >
> >
> >> On 12/8/2013 8:03 AM, Tolga Uzuner wrote:
> >> Dear R Users
> >> Have run into a problem with the rJava package recently. I do not seem
> to be able to load the package. I am on R 3.0.2 and updated the rJava
> package this morning from the Pennsylvania mirrors. I get the following
> error:
> >>
> >> 
> >> package ‘mnormt’ successfully unpacked and MD5 sums checked
> >> package ‘rJava’ successfully unpacked and MD5 sums checked
> >>
> >> The downloaded binary packages are in
> >> C:\Users\t_uzu_000\AppData\Local\Temp\RtmpOC9zec\downloaded_packages
> >> > library(rJava)
> >> Error in get(Info[i, 1], envir = env) :
> >> cannot allocate memory block of size 2.8 Gb
> >> Error: package or namespace load failed for ‘rJava’
> >> >
> >> 
> >>
> >> Any pointers ?
> >>
> >> Thanks in advance
> >>
> >> __
> >> 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.
>

[[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 evaluate sequence of strings like this

2013-12-08 Thread kingsly
Thank you.  It is working well.



On Sunday, 8 December 2013 11:13 PM, arun kirshna [via R] 
 wrote:
  
Hi, 
You could do without "eval(parse(.." 

mydat <- 
data.frame(Centercode=letters[1:5],FSUSN=letters[6:10],Round=letters[11:15],stringsAsFactors=FALSE)
 
mydat1 <- paste(mydat$Centercode, mydat$FSUSN,mydat$Round,sep="") 
 mydat2 <- as.character(interaction(mydat,sep="")) 
 identical(mydat1,mydat2) 
#[1] TRUE 
#or 
mydat3 <- do.call(paste0,mydat) 
identical(mydat1,mydat2) 
#[1] TRUE 
A.K. 



On Sunday, December 8, 2013 8:58 AM, kingsly <[hidden email]> wrote: 
Hello Dear R community, 
 This is my problem.  I have a data set (dataframe) called "mydat". It 
consist of 3 numerical variable.  They are Centrecode, FSUSN and Round. I 
want to create unique ID by combining these 3 variables. 
Follwing commands gives me what I need. 

mydat1 <- paste(mydat$Centrecode, mydat$FSUSN,mydat$Round,sep="") 
newds <- data.frame(mydat1) 
  
 For a large data set, I don't want to write like this ...    
"mydat$Centrecode, mydat$FSUSN,mydat$Round". So,  I tried to automate using 
following code. 
  
nvar <- paste("mydat","$",names(mydat)[1:3],sep="") 
mydat1 <- paste(eval(parse(text=nvar))) 
newds <- data.frame(mydat1_u) 
  
I am finding problem in the second line. Please help me.  
Thank you for your kind help. 



-- 
View this message in context: 
http://r.789695.n4.nabble.com/How-to-evaluate-sequence-of-strings-like-this-tp4681823.html
Sent from the R help mailing list archive at Nabble.com. 
    [[alternative HTML version deleted]] 

__ 
[hidden email] 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. 


__ 
[hidden email] 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. 






If you reply to this email, your message will be added to the discussion below: 
http://r.789695.n4.nabble.com/How-to-evaluate-sequence-of-strings-like-this-tp4681823p4681833.html
  
To start a new topic under R help, email ml-node+s789695n78969...@n4.nabble.com 
To unsubscribe from R help, click here.
NAML



--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-evaluate-sequence-of-strings-like-this-tp4681823p4681841.html
Sent from the R help mailing list archive at Nabble.com.
[[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] rJava problems

2013-12-08 Thread Tolga Uzuner
Thank you Rob. I used to have the 64-bit R also installed, but removed it and 
did not reinstall it. I also cleared out all rJava.dll files on my computer 
before reinstalling R fresh. I am running R through Rgui,  not Rstudio. I will 
post RVersion data later once I return to my PC, apologies.

Sent from my iPhone

> On 8 Dec 2013, at 12:50 pm, Robert Baer  wrote:
> 
> You don't really provide enough information like
> R.Version()
> 
> but my guess is that you are running 64-bit R either directly or through R 
> Studio but that you have only 32-bit Java installed.   I am doing fine on 
> Windows with Java 7 update 45 but had some 64-bit run issues with only Java 7 
> update 40 64-bit JDK.
> 
> HTH,
> Rob
> 
> 
>> On 12/8/2013 8:03 AM, Tolga Uzuner wrote:
>> Dear R Users
>> Have run into a problem with the rJava package recently. I do not seem to be 
>> able to load the package. I am on R 3.0.2 and updated the rJava package this 
>> morning from the Pennsylvania mirrors. I get the following error:
>> 
>> 
>> package ‘mnormt’ successfully unpacked and MD5 sums checked
>> package ‘rJava’ successfully unpacked and MD5 sums checked
>> 
>> The downloaded binary packages are in
>> C:\Users\t_uzu_000\AppData\Local\Temp\RtmpOC9zec\downloaded_packages
>> > library(rJava)
>> Error in get(Info[i, 1], envir = env) :
>> cannot allocate memory block of size 2.8 Gb
>> Error: package or namespace load failed for ‘rJava’
>> >
>> 
>> 
>> Any pointers ?
>> 
>> Thanks in advance
>> 
>> __
>> 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] Problems updating packages

2013-12-08 Thread Uwe Ligges



On 08.12.2013 19:12, Tolga Uzuner wrote:

OK thanks. The odd thing is, this just started happening. And I am an Admin on 
my machine.

Or I think I am...hmm, let me check, maybe I did something to my own privileges 
recently by mistake.



Right click R and "start as Administrator"?

Best,
Uwe Ligges


Sent from my iPhone


On 8 Dec 2013, at 01:07 pm, Uwe Ligges  wrote:




On 08.12.2013 16:37, Tolga Uzuner wrote:
Dear R Users
Ive just uninstalled R and reinstalled from scratch. I then hit Update
Packages and get the following message:


update.packages(ask='graphics',checkBuilt=TRUE)

--- Please select a CRAN mirror for use in this session ---
Warning: package 'foreign' in library 'C:/Program
Files/R/R-3.0.2/library' will not be updated
Warning: package 'lattice' in library 'C:/Program
Files/R/R-3.0.2/library' will not be updated
Warning: package 'Matrix' in library 'C:/Program
Files/R/R-3.0.2/library' will not be updated
Warning: package 'mgcv' in library 'C:/Program Files/R/R-3.0.2/library'
will not be updated
Warning: package 'nlme' in library 'C:/Program Files/R/R-3.0.2/library'
will not be updated




Why would this be the case ?


You do not have permissions to update packages in that library.

Best,
Uwe Ligges






Thanks in advance

__
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] Problems updating packages

2013-12-08 Thread Tolga Uzuner
OK thanks. The odd thing is, this just started happening. And I am an Admin on 
my machine.

Or I think I am...hmm, let me check, maybe I did something to my own privileges 
recently by mistake.

Sent from my iPhone

> On 8 Dec 2013, at 01:07 pm, Uwe Ligges  
> wrote:
> 
> 
> 
>> On 08.12.2013 16:37, Tolga Uzuner wrote:
>> Dear R Users
>> Ive just uninstalled R and reinstalled from scratch. I then hit Update
>> Packages and get the following message:
>> 
>> > update.packages(ask='graphics',checkBuilt=TRUE)
>> --- Please select a CRAN mirror for use in this session ---
>> Warning: package 'foreign' in library 'C:/Program
>> Files/R/R-3.0.2/library' will not be updated
>> Warning: package 'lattice' in library 'C:/Program
>> Files/R/R-3.0.2/library' will not be updated
>> Warning: package 'Matrix' in library 'C:/Program
>> Files/R/R-3.0.2/library' will not be updated
>> Warning: package 'mgcv' in library 'C:/Program Files/R/R-3.0.2/library'
>> will not be updated
>> Warning: package 'nlme' in library 'C:/Program Files/R/R-3.0.2/library'
>> will not be updated
>> >
>> 
>> Why would this be the case ?
> 
> You do not have permissions to update packages in that library.
> 
> Best,
> Uwe Ligges
> 
> 
> 
> 
>> 
>> Thanks in advance
>> 
>> __
>> 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] Problems updating packages

2013-12-08 Thread Uwe Ligges



On 08.12.2013 16:37, Tolga Uzuner wrote:

Dear R Users
Ive just uninstalled R and reinstalled from scratch. I then hit Update
Packages and get the following message:

 > update.packages(ask='graphics',checkBuilt=TRUE)
--- Please select a CRAN mirror for use in this session ---
Warning: package 'foreign' in library 'C:/Program
Files/R/R-3.0.2/library' will not be updated
Warning: package 'lattice' in library 'C:/Program
Files/R/R-3.0.2/library' will not be updated
Warning: package 'Matrix' in library 'C:/Program
Files/R/R-3.0.2/library' will not be updated
Warning: package 'mgcv' in library 'C:/Program Files/R/R-3.0.2/library'
will not be updated
Warning: package 'nlme' in library 'C:/Program Files/R/R-3.0.2/library'
will not be updated
 >

Why would this be the case ?


You do not have permissions to update packages in that library.

Best,
Uwe Ligges






Thanks in advance

__
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] subest a data set on two conditions

2013-12-08 Thread arun
Hi,
Try:
#Eitherindx <- which(df$pvalue <0.05)
 indx1 <- sort(c(indx,ifelse(!indx%%2,indx-1,indx+1)))
df[indx1,]

#or
 df[!!with(df,ave(pvalue,((seq-1)%/%2)+1,FUN= function(x) any(x <0.05))),]
A.K.


How can I subset the example data set based on pvalue ( <0.05) and also include 
the set of each pairs? 
I could subset with this code a<-subset(df, pvalue <0.05) whcih would give me 
this output 

    Estimate      pvalue seq pairs 
10 0.01133065 0.004946311  10     2 
12 0.02026090 0.039022875  12     2 
17 0.01621716 0.022891429  17     1 
19 0.01555321 0.033382339  19     1 

But I also want to include seq 9, 11, 18 and 20 which are sets of the variable 
pairs in the output 




> dput(df) 
structure(list(Estimate = c(0.00485470080131958, 0.0017750187497085, 
0.00335445588953967, -0.000584531421758813, 0.00606953408663915, 
-0.00528701750277387, 0.00566389678093939, -0.0157431826077494, 
0.00797445327627353, 0.0113306462560471, 0.00458009238873928, 
0.0202609029566437, 0.000973530938029486, -0.00183247733386492, 
0.00115028173291761, -0.00743448971374577, 0.016217161692567, 
-0.000945376803907414, 0.0155532095509903, -0.00617109741106529 
), pvalue = c(0.171288761250697, 0.507252376337703, 0.328418897915535, 
0.924674871720598, 0.254431502614107, 0.212506044108723, 0.274117055540994, 
0.0963539806017105, 0.156704628343227, 0.00494631086965616, 0.401874172161139, 
0.0390228749596093, 0.817093606803661, 0.581289013427265, 0.776977123239984, 
0.318257277798551, 0.0228914288352906, 0.86659585959993, 0.0333823392712699, 
0.639843703507484), seq = 1:20, pairs = c(1L, 2L, 1L, 2L, 1L, 
2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L, 1L, 2L)), 
datalabel = "", time.stamp = " 8 Dec 2013 12:55", .Names = c("Estimate", 
"pvalue", "seq", "pairs"), formats = c("%9.0g", "%9.0g", "%9.0g", 
"%9.0g"), types = c(255L, 255L, 253L, 253L), val.labels = c("", 
"", "", ""), var.labels = c("Estimate", "pvalue", "seq", "pairs" 
), row.names = c("1", "2", "3", "4", "5", "6", "7", "8", "9", 
"10", "11", "12", "13", "14", "15", "16", "17", "18", "19", "20" 
), version = 12L, class = "data.frame")

__
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] rJava problems

2013-12-08 Thread Robert Baer

You don't really provide enough information like
 R.Version()

but my guess is that you are running 64-bit R either directly or through 
R Studio but that you have only 32-bit Java installed.   I am doing fine 
on Windows with Java 7 update 45 but had some 64-bit run issues with 
only Java 7 update 40 64-bit JDK.


HTH,
Rob


On 12/8/2013 8:03 AM, Tolga Uzuner wrote:

Dear R Users
Have run into a problem with the rJava package recently. I do not seem 
to be able to load the package. I am on R 3.0.2 and updated the rJava 
package this morning from the Pennsylvania mirrors. I get the 
following error:



package ‘mnormt’ successfully unpacked and MD5 sums checked
package ‘rJava’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\t_uzu_000\AppData\Local\Temp\RtmpOC9zec\downloaded_packages
> library(rJava)
Error in get(Info[i, 1], envir = env) :
cannot allocate memory block of size 2.8 Gb
Error: package or namespace load failed for ‘rJava’
>


Any pointers ?

Thanks in advance

__
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] R, RStudio, Rcpp Appreciation

2013-12-08 Thread Thell Fowler
Many times we [devs & users] get into a zone and go on extended binges into
our own projects neglecting the niceties of society.  Then, while either
still on a particular path or even when we reach our destination, we don't
directly state our appreciation for those special individuals whose
projects and interests make our own possible.

Consider this as such a statement.  Thank you, not only for the work you
share and the effort you give but also for the ability you give to others.

And, in closing I just want to say...  Rcpp rules! :)
-- 
Sincerely,
Thell

[[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] rJava problems

2013-12-08 Thread patrick . toche
same problem I'm having...

https://groups.google.com/forum/#!topic/shiny-discuss/ivJzaaUIZcQ



On Sunday, December 8, 2013 10:55:02 PM UTC+8, neo wrote:
>
> A small follow-on to this: I uninstalled the package, restarted my 
> machine, and reinstalled the package. Now, when I try and load the 
> package, I get an entirely different error message: 
>
>  > library("rJava") 
> Error : .onLoad failed in loadNamespace() for 'rJava', details: 
>call: inDL(x, as.logical(local), as.logical(now), ...) 
>error: unable to load shared object 
> 'C:/Users/t_uzu_000/Documents/R/win-library/3.0/rJava/libs/i386/rJava.dll': 
>
>LoadLibrary failure:  %1 is not a valid Win32 application. 
>
> Error: package or namespace load failed for ‘rJava’ 
>
> Any thoughts appreciated. 
>
> Kind regards 
>
> On 08/12/2013 09:03, Tolga Uzuner wrote: 
> > Dear R Users 
> > Have run into a problem with the rJava package recently. I do not seem 
> > to be able to load the package. I am on R 3.0.2 and updated the rJava 
> > package this morning from the Pennsylvania mirrors. I get the 
> > following error: 
> > 
> >  
> > package ‘mnormt’ successfully unpacked and MD5 sums checked 
> > package ‘rJava’ successfully unpacked and MD5 sums checked 
> > 
> > The downloaded binary packages are in 
> > C:\Users\t_uzu_000\AppData\Local\Temp\RtmpOC9zec\downloaded_packages 
> > > library(rJava) 
> > Error in get(Info[i, 1], envir = env) : 
> > cannot allocate memory block of size 2.8 Gb 
> > Error: package or namespace load failed for ‘rJava’ 
> > > 
> >  
> > 
> > Any pointers ? 
> > 
> > Thanks in advance 
>
> __ 
> r-h...@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 evaluate sequence of strings like this

2013-12-08 Thread arun
Hi,
You could do without "eval(parse(.."

mydat <- 
data.frame(Centercode=letters[1:5],FSUSN=letters[6:10],Round=letters[11:15],stringsAsFactors=FALSE)
mydat1 <- paste(mydat$Centercode, mydat$FSUSN,mydat$Round,sep="")
 mydat2 <- as.character(interaction(mydat,sep=""))
 identical(mydat1,mydat2)
#[1] TRUE
#or
mydat3 <- do.call(paste0,mydat)
identical(mydat1,mydat2)
#[1] TRUE
A.K.


On Sunday, December 8, 2013 8:58 AM, kingsly  wrote:
Hello Dear R community,
 This is my problem.  I have a data set (dataframe) called "mydat". It consist 
of 3 numerical variable.  They are Centrecode, FSUSN and Round. I want to 
create unique ID by combining these 3 variables.
Follwing commands gives me what I need.

mydat1 <- paste(mydat$Centrecode, mydat$FSUSN,mydat$Round,sep="")
newds <- data.frame(mydat1)
 
 For a large data set, I don't want to write like this ...    
"mydat$Centrecode, mydat$FSUSN,mydat$Round". So,  I tried to automate using 
following code.
 
nvar <- paste("mydat","$",names(mydat)[1:3],sep="")
mydat1 <- paste(eval(parse(text=nvar)))
newds <- data.frame(mydat1_u)
 
I am finding problem in the second line. Please help me. 
Thank you for your kind help.



--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-evaluate-sequence-of-strings-like-this-tp4681823.html
Sent from the R help mailing list archive at Nabble.com.
    [[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] growth curve estimation

2013-12-08 Thread Dániel Kehl
Dear Community,

I am struggling with a growth curve estimation problem. It is a classic BMI 
change with age calculation. I am not an expert of this field but have some 
statistical experience in other fields.
Of course I started reading classical papers related to the topic and 
understood the concept of the LMS method. After that I thought it will be a 
"piece of cake", R must have a package related to the topic, so I just need the 
data and I am just a few lines of code from the results.

I encountered some problems:
- found at least three packages related to LMS: gamlss, VGAM and an old one 
lmsqreg (I did not try this because it does not support my R version (3.0.1.))
- it was relatively easy to get plots of percentiles in both packages, although 
they were far not the same (I also tried an other software, LMSchartmaker it 
gave different results from the previous ones)
- I tried to get tables of predicted values (with the predict function in VGAM 
and with centiles.pre in gamlss) but without any success.
- I tried to use the function gamlss() instead of lms() in gamlss but I could 
not force them to give the same (or very similar results), but the 
centiles.pred() function did work as expected for the model resulted from 
galmss()
- lms gives really different results if k is specified different ways, which is 
"best"?

Also I have a general question: some publications state they estimated the 
centiles so that aroun 18 years of age the curves pass through certain points. 
How is that possible?

Thank you for any suggestions or insights about the methods or preferred 
package!

Here is my code (without data):

#gamlss
library(gamlss)
library(VGAM)
library(foreign)
adatok <- read.spss("MDSZ adatok.sav", to.data.frame=TRUE)

adatok_fiu <- subset(adatok, adatok$gender == "Fiúk")[,2:3]
row.names(adatok_fiu) <- NULL
adatok_lany <- subset(adatok, adatok$gender == "L÷nyok")[,2:3]
row.names(adatok_lany) <- NULL

m1 <- lms(BMI,age,data=adatok_fiu, cent=c(3,10,25,50,75,90,97), families="BCCG")
fittedPlot(m1, x=adatok_fiu$age)
m1 <- lms(BMI,age,data=adatok_fiu, cent=c(3,10,25,50,75,90,97), 
families="BCCG", method.pb="GAIC", k=log(1455))
fittedPlot(m1, x=adatok_fiu$age)
m1 <- lms(BMI,age,data=adatok_fiu, cent=c(3,10,25,50,75,90,97), 
families="BCCG", method.pb="GAIC")
fittedPlot(m1, x=adatok_fiu$age)

m2 <- lms(BMI,age,data=adatok_lany, cent=c(3,10,25,50,75,90,97), 
families="BCCG")
m2 <- lms(BMI,age,data=adatok_lany, cent=c(3,10,25,50,75,90,97), 
families="BCCG", method.pb="GAIC", k=log(1144))
m2 <- lms(BMI,age,data=adatok_lany, cent=c(3,10,25,50,75,90,97), 
families="BCCG", method.pb="GAIC")

m3 <- gamlss(BMI~age, family=BCT, data=adatok_fiu)
centiles(m3,xvar=adatok_fiu$age, cent=c(3,10,25,50,75,90,97))

newx <- seq(12,20,.5)

centiles.pred(m1, xname="age", xvalues=newx)
centiles.pred(m3, xname="age", xvalues=newx)
centiles(m1,adatok_fiu$age)

#VGAM
library(foreign)
library(VGAM)
library(VGAMdata)

adatok <- read.spss("MDSZ adatok.sav", to.data.frame=TRUE)

adatok_fiu <- subset(adatok, adatok$gender == "Fiúk")
adatok_lany <- subset(adatok, adatok$gender == "L÷nyok")

fit1 <- vgam(BMI ~ s(age), lms.bcn(percentiles = c(3, 10, 25, 50, 75, 90, 97)), 
adatok_fiu)
fit2 <- vgam(BMI ~ s(age), lms.bcn(percentiles = c(3, 10, 25, 50, 75, 90, 97)), 
adatok_lany)

qtplot(fit1, percentiles = c(3, 10, 25, 50, 75, 90, 97), xlim = c(10.5, 20.5), 
ylim=c(13,34),
   las = 1, ylab = "BMI", lcol = 4, pch=NA)

qtplot(fit2, percentiles = c(3, 10, 25, 50, 75, 90, 97), xlim = c(10.5, 20.5), 
ylim=c(13,34),
   las = 1, ylab = "BMI", lcol = 3, add=TRUE, pch=NA, label=FALSE)


Thank you:
Daniel

[[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] Problems updating packages

2013-12-08 Thread Tolga Uzuner

Dear R Users
Ive just uninstalled R and reinstalled from scratch. I then hit Update 
Packages and get the following message:


> update.packages(ask='graphics',checkBuilt=TRUE)
--- Please select a CRAN mirror for use in this session ---
Warning: package 'foreign' in library 'C:/Program 
Files/R/R-3.0.2/library' will not be updated
Warning: package 'lattice' in library 'C:/Program 
Files/R/R-3.0.2/library' will not be updated
Warning: package 'Matrix' in library 'C:/Program 
Files/R/R-3.0.2/library' will not be updated
Warning: package 'mgcv' in library 'C:/Program Files/R/R-3.0.2/library' 
will not be updated
Warning: package 'nlme' in library 'C:/Program Files/R/R-3.0.2/library' 
will not be updated

>

Why would this be the case ?

Thanks in advance

__
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] rJava problems

2013-12-08 Thread Tolga Uzuner
A small follow-on to this: I uninstalled the package, restarted my 
machine, and reinstalled the package. Now, when I try and load the 
package, I get an entirely different error message:


> library("rJava")
Error : .onLoad failed in loadNamespace() for 'rJava', details:
  call: inDL(x, as.logical(local), as.logical(now), ...)
  error: unable to load shared object 
'C:/Users/t_uzu_000/Documents/R/win-library/3.0/rJava/libs/i386/rJava.dll':

  LoadLibrary failure:  %1 is not a valid Win32 application.

Error: package or namespace load failed for ‘rJava’

Any thoughts appreciated.

Kind regards

On 08/12/2013 09:03, Tolga Uzuner wrote:

Dear R Users
Have run into a problem with the rJava package recently. I do not seem 
to be able to load the package. I am on R 3.0.2 and updated the rJava 
package this morning from the Pennsylvania mirrors. I get the 
following error:



package ‘mnormt’ successfully unpacked and MD5 sums checked
package ‘rJava’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\t_uzu_000\AppData\Local\Temp\RtmpOC9zec\downloaded_packages
> library(rJava)
Error in get(Info[i, 1], envir = env) :
cannot allocate memory block of size 2.8 Gb
Error: package or namespace load failed for ‘rJava’
>


Any pointers ?

Thanks in advance


__
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 evaluate sequence of strings like this

2013-12-08 Thread Peter Alspach
Tena koe

Try

apply(mydat, 1, paste, collapse='')

HTH 

Peter Alspach

From: r-help-boun...@r-project.org [r-help-boun...@r-project.org] On Behalf Of 
kingsly [ecoking...@yahoo.co.in]
Sent: Monday, December 09, 2013 12:22 AM
To: r-help@r-project.org
Subject: [R] How to evaluate sequence of strings like this

Hello Dear R community,
 This is my problem.  I have a data set (dataframe) called "mydat". It consist 
of 3 numerical variable.  They are Centrecode, FSUSN and Round. I want to 
create unique ID by combining these 3 variables.
Follwing commands gives me what I need.

mydat1 <- paste(mydat$Centrecode, mydat$FSUSN,mydat$Round,sep="")
newds <- data.frame(mydat1)

 For a large data set, I don't want to write like this ...
"mydat$Centrecode, mydat$FSUSN,mydat$Round". So,  I tried to automate using 
following code.

nvar <- paste("mydat","$",names(mydat)[1:3],sep="")
mydat1 <- paste(eval(parse(text=nvar)))
newds <- data.frame(mydat1_u)

I am finding problem in the second line. Please help me.
Thank you for your kind help.



--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-evaluate-sequence-of-strings-like-this-tp4681823.html
Sent from the R help mailing list archive at Nabble.com.
[[alternative HTML version deleted]]

The contents of this e-mail are confidential and may be ...{{dropped:14}}

__
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] Why daisy() in cluster library failed to exclude NA when computing dissimilarity

2013-12-08 Thread Sarah Goslee
Hi,

Please don't cross-post. It's also not necessary to post more than once to
the same list if you don't get an immediate response, especially if you've
posted on the weekend.

On Sunday, December 8, 2013, Gundala Viswanath wrote:

> Hi,
>
>
> According to daisy function from cluster documentation, it can compute
> dissimilarity when NA (missing) value(s) is present.
>
> http://stat.ethz.ch/R-manual/R-devel/library/cluster/html/daisy.html
>
> But why when I tried this code
>
> library(cluster)
> x <- c(1.115,NA,NA,0.971,NA)
> y <- c(NA,1.006,NA,NA,0.645)
> df <- as.data.frame(rbind(x,y))
> daisy(df,metric="gower")
>
> It gave this message:
>
> Dissimilarities :
>x
> y NA
>
> Metric :  mixed ;  Types = I, I, I, I, I
> Number of objects : 2
> Warning messages:
> 1: In min(x) : no non-missing arguments to min; returning Inf
> 2: In max(x) : no non-missing arguments to max; returning -Inf


The third column of your dataframe (note that df() is a base function and
thus a bad name for a user object) is all NA, so it's impossible to apply
the Gower standardization. daisy() does handle NA values, but it can't read
minds to figure out what you expect if all values are NA.


> I welcome other alternative than gower.
>
> I expect the dissimilarity output gives a non-NA value e.g. 0. What's
> the right way to do it?


If a column has all NA values then it adds nothing to the analysis except
problems, and you need to remove it.

Sarah




-- 
Sarah Goslee
http://www.stringpage.com
http://www.sarahgoslee.com
http://www.functionaldiversity.org

[[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] rJava problems

2013-12-08 Thread Tolga Uzuner

Dear R Users
Have run into a problem with the rJava package recently. I do not seem 
to be able to load the package. I am on R 3.0.2 and updated the rJava 
package this morning from the Pennsylvania mirrors. I get the following 
error:



package ‘mnormt’ successfully unpacked and MD5 sums checked
package ‘rJava’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Users\t_uzu_000\AppData\Local\Temp\RtmpOC9zec\downloaded_packages
> library(rJava)
Error in get(Info[i, 1], envir = env) :
cannot allocate memory block of size 2.8 Gb
Error: package or namespace load failed for ‘rJava’
>


Any pointers ?

Thanks in advance

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


[R] How to evaluate sequence of strings like this

2013-12-08 Thread kingsly
Hello Dear R community,
 This is my problem.  I have a data set (dataframe) called "mydat". It 
consist of 3 numerical variable.  They are Centrecode, FSUSN and Round. I 
want to create unique ID by combining these 3 variables.
Follwing commands gives me what I need.

mydat1 <- paste(mydat$Centrecode, mydat$FSUSN,mydat$Round,sep="")
newds <- data.frame(mydat1)
 
 For a large data set, I don't want to write like this ...    
"mydat$Centrecode, mydat$FSUSN,mydat$Round". So,  I tried to automate using 
following code.
 
nvar <- paste("mydat","$",names(mydat)[1:3],sep="")
mydat1 <- paste(eval(parse(text=nvar)))
newds <- data.frame(mydat1_u)
 
I am finding problem in the second line. Please help me. 
Thank you for your kind help.



--
View this message in context: 
http://r.789695.n4.nabble.com/How-to-evaluate-sequence-of-strings-like-this-tp4681823.html
Sent from the R help mailing list archive at Nabble.com.
[[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.