Re: [R] Extract data from Array to Table

2015-02-12 Thread Sven E. Templer
Make use of the plyr and reshape2 package (both on CRAN):

library(plyr)
d<-adply(ArrayDiseaseCor, 1:2)
# adply calls function identity by default
d<-melt(d)
d<-subset(d,value>.5)
head(d)

You will have to rename columns, or adjust arguments in melt/adply.
Note: use set.seed before sampling for reproducible code!

Best, S.

On 11 February 2015 at 17:11, Karim Mezhoud  wrote:
> Dear All,
> I am facing the task to extract data from array to table. here an example
> of array.
>
> ##Get A list of Matrices with unequal rows
>
> Disease <- NULL
> Diseases <- NULL
> ListMatByGene <- NULL
> for(i in 1:3){
>
> Disease[[i]] <-matrix(sample(-30:30,25+(5*
> i)),5+i)
> rownames(Disease[[i]]) <- paste0("Sample",1:(5+i))
> colnames(Disease[[i]]) <- paste0("Gene",1:5)
>
> D <- paste0("Disease",i)
> Diseases[[D]] <- Disease[[i]]
> }
>
>
> ## get the same Column from all matrices
> getColumn <- function(x, colNum, len = nrow(x)){
> y <- x[,colNum]
> length(y) <- len
> y
> }
>
> ## get Matrices by the same columns of the list of matrices
> getMatrices <- function(colNums, dataList = x){
> # the number of rows required
> n <- max(sapply(dataList, nrow))
> lapply(colNums, function(x, dat, n) { # iterate along requested columns
> do.call(cbind, lapply(dat, getColumn,x, len=n)) # iterate along
> input data list
> }, dataList, n)
> }
>
> ## Rotate the list of matrices by 90°
> G <- paste0("Gene",1:5)
> ListMatByGene[G] <- getMatrices(c(1:ncol(Diseases[[1]])),dataList=Diseases)
>
> ## get Disease correlation by gene
> DiseaseCorrelation <- lapply(ListMatByGene,function(x) cor(x,use="na",
> method="spearman"))
>
> ##convert the list of Matrices to array
> ArrayDiseaseCor <- array(unlist(DiseaseCorrelation), dim =
> c(nrow(DiseaseCorrelation[[1]]), ncol(DiseaseCorrelation[[1]]),
> length(DiseaseCorrelation)))
> dimnames(ArrayDiseaseCor) <- list(names(Diseases), names(Diseases),
> colnames(Diseases[[1]]))
>
> ## Select only correlation bigger than 0.5 from the array
> FilterDiseaseCor <- apply(ArrayDiseaseCor,MARGIN=c(1,2) ,function(x)
> x[abs(x)>0.5])
>
> ## Final result
> FilterDiseaseCor
>
>  Disease1   Disease2  Disease3
> Disease1 Numeric,5  Numeric,2 -0.9428571
> Disease2 Numeric,2  Numeric,5 Numeric,2
> Disease3 -0.9428571 Numeric,2 Numeric,5
>
>
> Question is:
> How can get a table as:
>
> D1  D2   Cor   Gene
> Disease1Disease2  -0.94Gene2
> Disease1Disease2   0.78Gene4
> Disease3Disease2   0.5  Gene5
> ...
>
> and
>  Disease1   Disease2  Disease3
> Disease1510
> Disease21 53
> Disease30  3   5
>
> Or in general, How can I extract data from Array to Table?
>
> Thanks
> Karim
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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

Re: [R] Extract data from Array to Table

2015-02-12 Thread Sven E. Templer
see inline

On 12 February 2015 at 09:10, Sven E. Templer  wrote:
> Make use of the plyr and reshape2 package (both on CRAN):
>

I forgot:

library(reshape2)

> library(plyr)
> d<-adply(ArrayDiseaseCor, 1:2)
> # adply calls function identity by default
> d<-melt(d)
> d<-subset(d,value>.5)
> head(d)
>
> You will have to rename columns, or adjust arguments in melt/adply.
> Note: use set.seed before sampling for reproducible code!
>
> Best, S.
>
> On 11 February 2015 at 17:11, Karim Mezhoud  wrote:
>> Dear All,
>> I am facing the task to extract data from array to table. here an example
>> of array.
>>
>> ##Get A list of Matrices with unequal rows
>>
>> Disease <- NULL
>> Diseases <- NULL
>> ListMatByGene <- NULL
>> for(i in 1:3){
>>
>> Disease[[i]] <-matrix(sample(-30:30,25+(5*
>> i)),5+i)
>> rownames(Disease[[i]]) <- paste0("Sample",1:(5+i))
>> colnames(Disease[[i]]) <- paste0("Gene",1:5)
>>
>> D <- paste0("Disease",i)
>> Diseases[[D]] <- Disease[[i]]
>> }
>>
>>
>> ## get the same Column from all matrices
>> getColumn <- function(x, colNum, len = nrow(x)){
>> y <- x[,colNum]
>> length(y) <- len
>> y
>> }
>>
>> ## get Matrices by the same columns of the list of matrices
>> getMatrices <- function(colNums, dataList = x){
>> # the number of rows required
>> n <- max(sapply(dataList, nrow))
>> lapply(colNums, function(x, dat, n) { # iterate along requested columns
>> do.call(cbind, lapply(dat, getColumn,x, len=n)) # iterate along
>> input data list
>> }, dataList, n)
>> }
>>
>> ## Rotate the list of matrices by 90°
>> G <- paste0("Gene",1:5)
>> ListMatByGene[G] <- getMatrices(c(1:ncol(Diseases[[1]])),dataList=Diseases)
>>
>> ## get Disease correlation by gene
>> DiseaseCorrelation <- lapply(ListMatByGene,function(x) cor(x,use="na",
>> method="spearman"))
>>
>> ##convert the list of Matrices to array
>> ArrayDiseaseCor <- array(unlist(DiseaseCorrelation), dim =
>> c(nrow(DiseaseCorrelation[[1]]), ncol(DiseaseCorrelation[[1]]),
>> length(DiseaseCorrelation)))
>> dimnames(ArrayDiseaseCor) <- list(names(Diseases), names(Diseases),
>> colnames(Diseases[[1]]))
>>
>> ## Select only correlation bigger than 0.5 from the array
>> FilterDiseaseCor <- apply(ArrayDiseaseCor,MARGIN=c(1,2) ,function(x)
>> x[abs(x)>0.5])
>>
>> ## Final result
>> FilterDiseaseCor
>>
>>  Disease1   Disease2  Disease3
>> Disease1 Numeric,5  Numeric,2 -0.9428571
>> Disease2 Numeric,2  Numeric,5 Numeric,2
>> Disease3 -0.9428571 Numeric,2 Numeric,5
>>
>>
>> Question is:
>> How can get a table as:
>>
>> D1  D2   Cor   Gene
>> Disease1Disease2  -0.94Gene2
>> Disease1Disease2   0.78Gene4
>> Disease3Disease2   0.5  Gene5
>> ...
>>
>> and
>>  Disease1   Disease2  Disease3
>> Disease1510
>> Disease21 53
>> Disease30  3   5
>>
>> Or in general, How can I extract data from Array to Table?
>>
>> Thanks
>> Karim
>>
>> [[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.

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

[R] How to subset data, by sorting names alphabetically.

2015-02-12 Thread samarvir singh
hello,

I am cleaning some large data with 4 million observation and 7 variable.
Of the 7 variables , 1 is name/string

I want to subset data, which have same name

Example-

 Name var1 var2 var3 var4 var5 var6
aa-   -   - - --
ab
bd
ac
ad
af
ba
bd
aa
av

i want to sort the data something like this

aa
aa
all aa in a same subset

and all ab in same subset

every column with same name in a subset



thanks in advance.
I am new to R community.
appreciate your help
- Samarvir

[[alternative HTML version deleted]]

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


Re: [R] How to subset data, by sorting names alphabetically.

2015-02-12 Thread Jim Lemon
Hi Samarvir,
Assuming that you want to generate a separate data frame for each
value of "Name",

# name of initial data frame is ssdf
for(nameval in unique(ssdf$Name)) assign(nameval,ssdf[ssdf$Name==nameval,])

This will produce as many data frames as there are unique values of
ssdf$Name, each named by the values it contains.

Jim


On Thu, Feb 12, 2015 at 3:57 PM, samarvir singh  wrote:
> hello,
>
> I am cleaning some large data with 4 million observation and 7 variable.
> Of the 7 variables , 1 is name/string
>
> I want to subset data, which have same name
>
> Example-
>
>  Name var1 var2 var3 var4 var5 var6
> aa-   -   - - --
> ab
> bd
> ac
> ad
> af
> ba
> bd
> aa
> av
>
> i want to sort the data something like this
>
> aa
> aa
> all aa in a same subset
>
> and all ab in same subset
>
> every column with same name in a subset
>
>
>
> thanks in advance.
> I am new to R community.
> appreciate your help
> - Samarvir
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] [UPDATE] grofit issues with replicates - probit or logit or glmm

2015-02-12 Thread Marcelo Laia
I done a mistake when I paste the script in the message. An update:

url.csv <-
https://dl.dropboxusercontent.com/u/34009642/cepajabo07_wide_acumulado.csv

data02 <- read.table(url.csv, header=TRUE, sep="\t", dec=",")

head(data02)

timepoints <- 1:5 # 5 days
time <- t(matrix(rep(timepoints, 120), c(5, 120))) 
# 5 days and 120 experimentos
# (6 iso * 4 doses
# * 5 rep)
time

MyOpt1 <- grofit.control(smooth.gc = 0.5, parameter = 28, 
interactive = FALSE)

MyOpt2 <- grofit.control(smooth.gc = 0.5, parameter = 28, 
interactive = FALSE, log.x.dr = TRUE)

TestRun1 <- grofit(time, data02, TRUE, MyOpt1)
TestRun2 <- grofit(time, data02, TRUE, MyOpt2)

TestRun1$drFit
TestRun2$drFit

colData <- c("black", "cyan", "magenta", "blue")

plot(TestRun1$gcFit, opt = "s", colData = colData, colSpline = 1, 
pch = 1:4, cex = 1)

plot(TestRun2$gcFit, opt = "s", colData = colData, colSpline = 1, 
pch = 1:4, cex = 1)

plot(TestRun1$drFit$drFittedSplines[[1]], colData = colData, 
pch = 1:4, cex = 1)

plot(TestRun2$drFit$drFittedSplines[[1]], colData = colData, 
pch = 1:4, cex = 1)

Thank you very much!

Marcelo

On 12/02/15 at 12:57am, Marcelo Laia wrote:
> Hello
> 
> I tried use grofit package in our data set. We provide a subset of our
> data with X iso, and 4 doses, and insect died was count each day for
> long 5 days. We started with Y insects per dishes. When one is dead, it
> was counted and removed. Died insect is cumulative in the next days.
> i.e. day 1 died 1. day 2 no died, so, day 2 is assigned 1 died (from day
> 1).
> 
> Here is the script:
> 
> library(lattice)
> library(grofit)
> library(repmis)
> 
> url.csv <- 
> https://dl.dropboxusercontent.com/u/34009642/cepajabo07_wide_acumulado.csv
> 
> data02 <- read.table(url.csv, header=TRUE, sep="\t", dec=",")
> 
> head(data02)
> 
> timepoints <- 1:5 # 5 days
> time <- t(matrix(rep(timepoints, 120), c(5, 120))) # 5 days and 120 
> experiments
># (6 iso * 4 doses
># * 5 rep)
> time
> 
> TestRun1$drFit
> TestRun2$drFit
> 
> colData <- c("black", "cyan", "magenta", "blue")
> 
> plot(TestRun1$gcFit, opt = "s", colData = colData, colSpline = 1, 
>  pch = 1:4, cex = 1)
> 
> plot(TestRun2$gcFit, opt = "s", colData = colData, colSpline = 1, 
>  pch = 1:4, cex = 1)
> 
> plot(TestRun1$drFit$drFittedSplines[[1]], colData = colData, 
>  pch = 1:4, cex = 1)
> 
> plot(TestRun2$drFit$drFittedSplines[[1]], colData = colData, 
>  pch = 1:4, cex = 1)
> 
> The problem: grofit didn't deal with replicates and do a curve for each
> ones.
> 
> Is it a way to get response curve with the replicates?
> 
> We are interested in LD50, and dose response curve, and graphs.
> 
> Any suggestion is very welcome!
> 
> Thank you!
> 
> -- 
> Marcelo
> 

--

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


[R] apply two functions to column

2015-02-12 Thread arnaud gaboury
I am little lost between all the possibilities to apply a function to
a data.frame or data.table.

Here is mine:

structure(list(name = c("poisonivy", "poisonivy", "poisonivy",
"poisonivy", "poisonivy", "poisonivy", "poisonivy", "poisonivy",
"cruzecontrol", "agreenmamba", "agreenmamba", "vairis", "vairis",
"vairis", "vairis", "vairis", "vairis", "xaeth"), text = c("ok",
"need items ?", "i didn't submit pass codes for a long now",
"ok", "<@U03AEKYL4>: what app are you talking about ?", "some testing
with my irc client",
"ha ha sorry", "for me there is no such question", "Lol.",
"<@U03AEKWTL|agreenmamba> uploaded a file:
",
"<@U032FHV3S> ", "ok, see you around",
"yeah, I had a procrastination rush so I started to decode a little",
" when you submit passcodes",
"intel", "what is the cooldown time or how does it work...;",
"anybody knows how does \"Passcode circuitry too hot. Wait for cool
down to enter another passcode.\" works?",
"and people told that agent their geocities experience would never
amount to anything (the convo yesterday) "
), ts = c("1423594336.000138", "1423594311.000136", "1423594294.000135",
"1423594258.000133", "1423594244.000131", "1423497058.000127",
"1423497041.000126", "1423478555.000123", "1423494427.000125",
"1423492370.000124", "1423478364.000121", "1423594358.000139",
"1423594329.000137", "1423594264.000134", "1423594251.000132",
"1423592204.000130", "1423592174.000129", "1423150354.000112"
)), .Names = c("name", "text", "ts"), class = c("data.table",
"data.frame"), row.names = c(NA, -18L))

As you can see, it is of class data.frame and data.table.

I need to work on last column "t"s. These are characters and are times
in epoch format. I want to have time in Posix. I must thus do two
things:
- characters to numeric : myData$ts <- as.numeric(myData$ts)
- epoch to Posix : mapply(as.POSIXct, tz = 'GMT', origin =
'1970-01-01', myMerge$ts)

I wonder:
- if I can apply these two functions at the same time
- what will be the fastest way : use dplyr package, or work with
data.table ? My real data will be much more important than the one
posted.

Thank you for advice and hint.

-- 

google.com/+arnaudgabourygabx

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


Re: [R] Terminating a program using R

2015-02-12 Thread S Ellison
> I would like to query that if it is possible for R to terminate a program 
> such as
> notepad, word, etc.?

pskill from the tools package says it supports the Windows system call
'TerminateProcess'.

You can get a process's ID using the windows command line 'tasklist'.

I got this to work on my text editor process (TextPad) using

pname <- "TextPad.exe"  #Amend to your process name
tl <- system('tasklist', intern=TRUE)   #Get the task list 
pid.line <- tl[grep(pname, tl)]#Find the row that matches 
[WARNING - I assumed only one]
pid.char <- gsub(paste("^",pname," *([0-9]+).*", sep=""), "\\1", pid.line) 
   #Extract the PID 
pid <- as.numeric(pid.char)   #Convert to integer
pskill(pid)   #Kill the process


You'll have to tweak that if you have more than one process with the same name, 
and also to check for nonexistence of an expected process.


S Ellison



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

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


Re: [R] apply two functions to column

2015-02-12 Thread Jeff Newmiller
You don't need to do these operations in pieces so the mapply is unnecessary. 
Neither dplyr nor data.table can go faster than (assuming your data frame is 
called DF):

DF$dtm <- as.POSIXct( as.numeric( DF$ts ), tz="GMT", origin="1970-01-01" )

They can in this case save you from having to retype DF more than once, but in 
this case even achieving that requires more typing than the above does.
---
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.

On February 12, 2015 6:15:35 AM EST, arnaud gaboury  
wrote:
>I am little lost between all the possibilities to apply a function to
>a data.frame or data.table.
>
>Here is mine:
>
>structure(list(name = c("poisonivy", "poisonivy", "poisonivy",
>"poisonivy", "poisonivy", "poisonivy", "poisonivy", "poisonivy",
>"cruzecontrol", "agreenmamba", "agreenmamba", "vairis", "vairis",
>"vairis", "vairis", "vairis", "vairis", "xaeth"), text = c("ok",
>"need items ?", "i didn't submit pass codes for a long now",
>"ok", "<@U03AEKYL4>: what app are you talking about ?", "some testing
>with my irc client",
>"ha ha sorry", "for me there is no such question", "Lol.",
>"<@U03AEKWTL|agreenmamba> uploaded a file:
>should I stay or should I go?>",
>"<@U032FHV3S> ", "ok, see you around",
>"yeah, I had a procrastination rush so I started to decode a little",
>" when you submit
>passcodes",
>"intel", "what is the cooldown time or how does it work...;",
>"anybody knows how does \"Passcode circuitry too hot. Wait for cool
>down to enter another passcode.\" works?",
>"and people told that agent their geocities experience would never
>amount to anything (the convo yesterday) "
>), ts = c("1423594336.000138", "1423594311.000136",
>"1423594294.000135",
>"1423594258.000133", "1423594244.000131", "1423497058.000127",
>"1423497041.000126", "1423478555.000123", "1423494427.000125",
>"1423492370.000124", "1423478364.000121", "1423594358.000139",
>"1423594329.000137", "1423594264.000134", "1423594251.000132",
>"1423592204.000130", "1423592174.000129", "1423150354.000112"
>)), .Names = c("name", "text", "ts"), class = c("data.table",
>"data.frame"), row.names = c(NA, -18L))
>
>As you can see, it is of class data.frame and data.table.
>
>I need to work on last column "t"s. These are characters and are times
>in epoch format. I want to have time in Posix. I must thus do two
>things:
>- characters to numeric : myData$ts <- as.numeric(myData$ts)
>- epoch to Posix : mapply(as.POSIXct, tz = 'GMT', origin =
>'1970-01-01', myMerge$ts)
>
>I wonder:
>- if I can apply these two functions at the same time
>- what will be the fastest way : use dplyr package, or work with
>data.table ? My real data will be much more important than the one
>posted.
>
>Thank you for advice and hint.

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


[R] Problem Solved: optim fails when using arima

2015-02-12 Thread Prof J C Nash (U30A)
I would not say it is fully "solved" since in using Nelder-Mead
you did not get the Hessian.

The issue is almost certainly that there is an implicit bound due to
log() or sqrt() where a parameter gets to be near zero and the finite
difference approximation of derivatives steps over the cliff. Probably
some NM steps are doing the same, but returning a large function value
which will allow NM to "work", but possibly make it inefficient.

JN

On 15-02-12 06:00 AM, r-help-requ...@r-project.org wrote:
> Message: 30
> Date: Wed, 11 Feb 2015 08:10:03 -0700
> From: Albert Shuxiang Li 
> To: r-help@r-project.org
> Subject: [R] Problem Solved: optim fails when using arima
> Message-ID:
>   
> Content-Type: text/plain; charset="UTF-8"
> 
> I am using arima(x, order=c(p,0,q)) function for my project, which deals
> with a set of large differenced time series data, data size varies from
> 8000 to 7. I checked their stationarity before applying arima.
> Occasionally, arima(x, order=c(p,0,q)) gives me error like following (which
> stops script running):
> 
> Error in optim(init[mask], armafn, method = optim.method, Hessian = TRUE, :
> non-finite finite-difference value [16]
> 
> The last [16] would change anyting from 1 to 16. Using argument
> method="CSS", or "ML", or default did not help. I am using the newest R
> version 3.1.2 for windows 7.
> 
> I have done a lot of research on internet for this Error Message, and tried
> a lot of suggested solutions too. But the results are negative. Then,
> finally, I used following line which solved my problem.
> 
> arima(x, order=c(p,0,q), optim.method="Nelder-Mead")
> 
> Hope this helps others with similar situations.
> 
> Shuxiang Albert Li
> 
>   [[alternative HTML version deleted]]

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


[R] adehabitatHR KD ID and XY assignement

2015-02-12 Thread Gwen G. Lockhart

Hello Everyone...

I am fairly new to R. I would like to use the adehabitatHR package to create 
kernel density and isopleths from my sea turtle GPS data. I�m running into some 
issues�

Basically I am having trouble assigning IDs and XY fields within R to create 
KDs and MCPs.

Thank you in advance for any help!



Gwen Lockhart
GIS Research Specialist
Virginia Aquarium and Marine Science Center Foundation
Division of Research and Conservation
glock...@virginiaaquarium.com
Desk: 757-385-6486
Cell: 757-748-6757


#loading packages
`library(adehabitatHR)
library(raster)
library(rgdal)
library(maptools)`

#read CSV with UTM xy and ids

track<-
read.table("T:/GIS/Data/Tracking/state_space_model/20150210_AbHabiatatHRmodel/All_prelim_model_6hr_utm_forage_10A.csv",
   header=TRUE, sep=",", na.strings="NA", dec=".", strip.white=TRUE)

# Turn track into a SpatialPointsDataFrame sby specifying that the "X" and "Y" 
columns are the coordinates:
coordinates(track) <- c("X", "Y")
class(track)
plot(track)


#Project into utm:
proj4string(track) <- CRS("+init=epsg:32618")
#read shore;ine file
shore <- 
readShapeSpatial("C:/Users/gemme001/Desktop/R_state_space/STATES_VA_COAST_UTM.shp",
 delete_null_obj=TRUE)
plot(shore)
proj4string(shore) <- CRS("+init=epsg:32618")


#Add to list the list with the names "map" and "relocs"
my.homerange.data <- list(map = shore, relocs = track)

#THIS IS WHERE I AM RUNNING INTO ISSUES#
#Assign IDs and XY � the IDs work but coordinates don�t work.  I get the 
following error: Error in `[.data.frame`(x@data, i, j, ..., drop = FALSE) : 
undefined columns selected
id<-my.homerange.data$relocs$Name
xy<-(my.homerange.data$relocs["X","Y"]


#Create CP � this works
cp <- mcp(my.homerange.data$relocs[,1], percent=95)
class(cp)
plot(cp)


#Create KUD.  This doesn�t work.  I get the following:  Error in xy.coords(x, 
y, xlabel, ylabel, log) : 'x' is a list, but does not have components 'x' and 
'y'
kud <- kernelUD(track[,1], h="href")

[[alternative HTML version deleted]]

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

Re: [R] help in anova

2015-02-12 Thread S Ellison
> R-ouput
> 
>   Df  Sum SqMean SqF value 
> Pr(>F)
> treatment314015  4672  65.021 < 2e-16 
> ***
> variety  3 5883   1961   27.295 
> 2.95e-12 ***
> treatment:variety  9  5474   608 8.465 8.93e-09 
> ***
> soilgroup -missing
> treatment:variety:soilgroup - missing
> Here, I am missing value of soil group and interation of treatment: variety:
> soilgroup- Can any one please tell me why?

Do the lines 
> soilgroup -missing
> treatment:variety:soilgroup - missing
Actually appear in your output? If so, I have no idea.

But if the terms are simply absent, one possibility is that soilgroup is 
completely confounded with an earlier factor in the model and therefore 
unidentifiable. aov seems fairly tolerant of that in one sense - instead of 
throwing an error and stopping it tells you what it can identify and leaves out 
anything it can't.

S Ellison



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

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


[R] horizontal bar plots for CI visualization

2015-02-12 Thread michael.eisenring
2.50%   97.50%
intercept   29787966
glands  13143611
damage  169 6144
treatment L1778 6703
treatment L4-3899   5125
Length  -1817   1828
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] ggplot2 shifting bars to only overlap in groups

2015-02-12 Thread Hörmetjan Yiltiz
Hi all,

I have four factors for a continuous time variable along with its
confidence interval. I would like to produce a publication quality error
bar chart that is clear to understand. For now, I used colors, x axis
position, facets and alpha level to distinguish them.

I would like to overlap each pairs of bars with the same color a bit as a
group, but not overlap each and every bars with each other.

Here is a minimal example:

N = 32
df<- data.frame(gender=gl(2,1,N, c("male","female")),
  direction=gl(2,2,N, c("up","down")),
  condition=gl(4,4,N, c("c1","c2","c3","c4")),
  location=gl(2,16,N, c("east","west")),
  t=rnorm(N, 1, 0.5),
  ci=abs(rnorm(N, 0, 0.2)))
pp <-
  ggplot(df, aes(x=gender, y=t, fill=condition, alpha=direction)) +
  facet_grid(location~.) +
  geom_bar(position=position_dodge(.9), stat="identity", color="black") +
  geom_errorbar(aes(ymin=t-ci, ymax=t+ci),
width=.2,# Width of the error bars
position=position_dodge(.9)) +
  scale_alpha_discrete(range= c(0.4, 1))
pp



In the attachment, I have added the output figure, while manually editing
the SVG file to make the lower-left group of bars to make them as I wanted.
(The spacing in between each pair is not necessarily required.)


​Best
,

He who is worthy to receive his days and nights is worthy to receive* all
else* from you (and me).
 The Prophet, Gibran Kahlil
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

[R] gsub : replace regex pattern with values from another data.frame

2015-02-12 Thread arnaud gaboury
I have two df (and dt):

df1
structure(list(name = c("poisonivy", "poisonivy", "poisonivy",
"poisonivy", "poisonivy", "poisonivy", "poisonivy", "poisonivy",
"cruzecontrol", "agreenmamba", "agreenmamba", "vairis", "vairis",
"vairis", "vairis", "vairis", "vairis", "xaeth"), text = c("ok",
"need items ?", "i didn't submit pass codes for a long now",
"ok", "<@U03AEKYL4>: what app are you talking about ?", "some testing
with my irc client",
"ha ha sorry", "for me there is no such question", "Lol.",
"<@U03AEKWTL|agreenmamba> uploaded a file:
",
"<@U032FHV3S> ", "ok, see you around",
"yeah, I had a procrastination rush so I started to decode a little",
" when you submit passcodes",
"intel", "what is the cooldown time or how does it work...;",
"anybody knows how does \"Passcode circuitry too hot. Wait for cool
down to enter another passcode.\" works?",
"and people told that agent their geocities experience would never
amount to anything (the convo yesterday) "
), ts = c("1423594336.000138", "1423594311.000136", "1423594294.000135",
"1423594258.000133", "1423594244.000131", "1423497058.000127",
"1423497041.000126", "1423478555.000123", "1423494427.000125",
"1423492370.000124", "1423478364.000121", "1423594358.000139",
"1423594329.000137", "1423594264.000134", "1423594251.000132",
"1423592204.000130", "1423592174.000129", "1423150354.000112"
)), .Names = c("name", "text", "ts"), class = c("data.table",
"data.frame"), row.names = c(NA, -18L))

df2
structure(list(id = c("U03KH8Z52", "U02AF1DTJ", "U02AF0ZT8",
"U03AEKWTL", "U02BCJH0G", "U033YA1MS", "U029QMCRR", "U03H139M5",
"U02AET1D0", "U02A6U41Z", "U02B5T4CX", "U02B2QU4R", "U03F0LQ5X",
"U03JNFKLY", "U02ASMBMQ", "U029QLQC7", "U03AEMBQU", "U02B4D3Q1",
"U02AGDC14", "U029A467C", "U02A7NFG6", "U02AESPPL", "U02AQANK7",
"U03ADJDFK", "U03EYR0KB", "U02AW7Q5Q", "U02AE8RKD", "U02FT84BS",
"U02B25M3B", "U03EZDQT7", "U02AECKFF", "U03H2691M", "U02DWTJ5V",
"U02AFTAHH", "U029QQEPM", "U03C51Z42", "U02CAK2CV", "U03AK21DP",
"U03FFN8ED", "U02B23V03", "U029T2143", "U02C1LEEX", "U03AF2QH2",
"U03E0GN0S", "U03AG20R9", "U02AES8S2", "U02AG64S7", "U02B5A0R7",
"U02AS4SLR", "U03C2SG0R", "U03AV7CCW", "U032XPFDU", "U03AUKSSV",
"U02C2A61Y", "U02AESHJQ", "U02BLSKHU", "U02E34WM6", "U03AK6P26",
"U02E6ADRZ", "U03FCDQ50", "U03EW1CC5", "U02BL0DBD", "U02FHQZ6D",
"U02B47T63", "U03H2TTQP", "U03AVP71V", "U03JLV38V", "U02E39HAY",
"U02AE5281", "U032FHV3S", "U03AL2096", "U02ARUG6M", "U02AECRSP",
"U02B42XG4", "U03AFQZNS", "U02AE7H41", "U03G9UNTG", "U02GEQ0E6",
"U02AGLE5A", "U02BQTRC9", "U03H0J6GS", "U02B3D27F", "U02AEKTHV",
"U02C52YN3", "U02E33MUW", "U03AKUT85", "U03B53EHG", "U02FBN38P",
"U03AH3E5W", "U02B5PLE0", "U02AS4RCK", "U03ANE1GZ", "U02E8LZQB",
"U03EPGJ98", "U02E3N220", "U03AEKYL4", "U02AE7HT1", "U02C1RR3G",
"U03JH408J", "U03KL0FKN", "U02B44R92", "U03EURWGX"), name = c("10k_affair",
"1upwuzhere", "4xcss", "agreenmamba", "ait109", "arly69", "azkop13",
"barcik75", "bigolnob", "blackrose", "blink619", "bobaloo23",
"bodger", "bomb", "bootswithdefer", "brandizzle", "bregalad",
"camon", "celticrain", "ch3mical", "checksum", "cocothunder",
"cruxicon", "cruzecontrol", "crystalskunk", "cscheetah", "dabcelin",
"deelicious", "delthanar", "drkaosdk", "droidenl-joe", "dukeceph",
"fillerbunny", "flickohmsford", "flyingg0d", "garaxiel", "goby9",
"gymbal", "hideandseek", "hobojr", "ijackportals", "invalidcharactr",
"itso9", "j0shs", "jarvis", "jc0mm5", "jencyberchic", "jimbobradyson",
"joespr0cket", "jostrander", "jueliet", "karlashi", "khan99",
"kingkonn0r", "krispycridder", "kritickalmass", "lawgiver", "maxcorbett",
"memory556", "meta000x", "minkovsky", "mistylady", "mstephans",
"mstrinity", "nocarryr", "ollietronic", "philistine11", "pickledpickles",
"piercingsbykris", "poisonivy", "raugmor", "remarks999", "rheds77",
"rhinz", "rigiritter", "robbie0017", "rohdef", "ryoziya", "s4n1ty",
"sacredcow133", "samwill", "sgtlemonpepper", "sivan", "spline9",
"starwolf", "stueliueli", "sweetiris", "swift2plunder", "swissphoenix",
"synyck", "test", "therug", "tinja551", "trulyjuan", "twinster",
"vairis", "vinylz3ro", "watervirus", "xaeth", "yagamiyukari",
"zafo", "zexium")), .Names = c("id", "name"), class = c("data.table",
"data.frame"), row.names = c(NA, -102L))

I need to replace this regex pattern in df1 :
(?<=<@)[^|]{9}(?=>|) by its corresponding name from df2.

E.g : if <@U03KH8Z52> is found in df1, then I want to replace it by
the "name" which correspond to this id in df2., in this case
10k_affair

I know of replace an expression with gsub:
gsub('(?<=<@)[^|]{9}(?=>|)', 'toto', df1, perl = T)
but I have no idea how to replace it with value from another df.

Thank you for hints

__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listi

Re: [R] suggestion for optimal plotting to show significant differences

2015-02-12 Thread PIKAL Petr
Hi Rich

> -Original Message-
> From: Richard M. Heiberger [mailto:r...@temple.edu]
> Sent: Wednesday, February 11, 2015 10:53 PM
> To: PIKAL Petr
> Cc: r-help@r-project.org
> Subject: Re: [R] suggestion for optimal plotting to show significant
> differences
>
> Petr,
>
> My first attempt is to use the simple=TRUE argument to interaction2wt.
>
> Then the bwplots in the item|item panel show the behavior of value over
> day for each item.  You get a plot similar to this panel with the
> growth curve plots from nlme, for example,
> bwplot(value ~ day | item, data=test, horizontal=FALSE) I am
> treating set as a replication and each box is cumulated over the three
> sets.

Yes, that is the point - set is actually replication of result.

>
> My analysis question is about day.  You have it as numeric.  My
> inclination would be to make day factor.  Then you could model the
> interaction of day and item.

Hm. I hoped I can do

fit<-lm(value~day*item, data=test)
summary(fit)

in which case I can compare differences in intercepts and/or slopes for each 
item.

However I am rather lost in aov

test$dayf <- factor(test$day)

fit1 <- aov(value~item+dayf, data=test)
summary(fit)
fit2 <- aov(value~item/dayf, data=test)
summary(fit)
and
fit3 <- aov(value~item*dayf, data=test)
summary(fit)
which gives bascally the same result as fit2

> anova(fit1, fit2)
Analysis of Variance Table

Model 1: value ~ item + dayf
Model 2: value ~ item/dayf
  Res.DfRSS Df Sum of Sq  F Pr(>F)
1131 160.59
2 96 128.60 3531.993 0.6824 0.8993

TukeyHSD(fit1, which="item")
TukeyHSD(fit2, which="item")

Both models seems to give quite similar results and I am not sure what actually 
differs in those models. I believe that model2 tests each item within 
particular day (but I am not sure about it).

However this discussion is probably deviating more to the statistics issue than 
to R itself.

I just thought that somebody helps me with a method for comparison of item 
performance in case that relation of value to day is not simple linear (as in 
my example) and cannot be expressed by some formula (like examples in nlme).

So far the best options are either your bwplot or my ggplots.

p<-ggplot(test, aes(x=day, y=value, colour=item))
p+geom_point()+stat_smooth(method="lm", formula= y~poly(x,2))

p<-ggplot(test, aes(x=dayf, y=value, colour=item))
p+geom_boxplot()

p<-ggplot(test, aes(x=item, y=value))
p+geom_boxplot()+facet_wrap(~day)

Thank you for your suggestions which directed me to interaction plots which I 
was not aware of.

Best regards
Petr


>
> Rich
>
> On Mon, Feb 9, 2015 at 6:01 AM, PIKAL Petr 
> wrote:
> > Hallo Richard.
> >
> > I tried your suggestion but it seems to be no better than simple
> ggplot. Let me extend the example a bit to 8 items which is more
> realistic.
> >
> > item<-rep(letters[1:8], each=18)
> > day<-rep((0:5)*100, 24)
> > set<-rep(rep(1:3, each=6), 8)
> > test<-data.frame(item, day, set)
> > set.seed(111)
> > test$value<-(test$day/100+1)+rnorm(144)
> > test$value<-test$value+(as.numeric(test$item)*1.3)
> >
> > Value is increasing during time (day) for each tested subject (item),
> each item is measured 3 times (set) each day.
> >
> > Here is some graph
> > p<-ggplot(test, aes(x=day, y=value, colour=item))
> > p+geom_point()+stat_smooth(method="lm", formula= y~poly(x,2))
> >
> > I can do lm or aov, however I am not sure about proper formula.
> >
> > fit<-lm(value~day, data=test)
> > summary(fit)
> > # this shows that value is increasing with day
> >
> > fit<-lm(value~day/item, data=test)
> > summary(fit)
> > # this suggests that value is decreasing with day (which is wrong)
> >
> > fit<-lm(value~day*item, data=test)
> > summary(fit)
> > # and this tells me that value is increasing with day and items have
> different intercepts but the same rate of growth (I hope I got it
> right).
> >
> > I do not have your book available but I went through help pages.
> >
> > Your interaction graph is not much better than ggplot.
> > I can do
> >
> > interaction2wt(value ~ item * day, data=test)
> >
> > which probably is closer to actual problem.
> >
> > The basic problem is that increase of value with days is in fact not
> linear and actually it can increase in the beginning and then stagnate
> or it can stagnate in beginning and then increase. I am not aware of
> any way how to compare time behaviour of different items in such
> situations if I cannot state some common formula in which case I would
> use probably nlme.
> >
> > Thank for your insight, I try to go through it more deeply.
> >
> > Best regards
> > Petr
> >
> >
> >> -Original Message-
> >> From: Richard M. Heiberger [mailto:r...@temple.edu]
> >> Sent: Friday, February 06, 2015 6:14 PM
> >> To: PIKAL Petr
> >> Cc: r-help@r-project.org
> >> Subject: Re: [R] suggestion for optimal plotting to show significant
> >> differences
> >>
> >> I would try one of these illustrations for starts.
> >> interaction2wt (two-way tables) is designed to

[R] Shiny User Group

2015-02-12 Thread Doran, Harold
I found a google user group for shiny, and am curious if there is an SIG as 
well. Didn't see one in my searches, but looking for an active place to ask 
questions and share code.

Thanks.

[[alternative HTML version deleted]]

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


Re: [R] ggplot2 shifting bars to only overlap in groups

2015-02-12 Thread John Kane
I am gettting the error"
Error in rep_len(rep.int(seq_len(n), rep.int(k, n)), length) : 
  object 'N' not found

Also your image did not come through.  Try sending it as a pdf file.

when I try to create 
df<- data.frame(gender=gl(2,1,N, c("male","female")),
  direction=gl(2,2,N, c("up","down")),
  condition=gl(4,4,N, c("c1","c2","c3","c4")),
  location=gl(2,16,N, c("east","west")),
  t=rnorm(N, 1, 0.5),
  ci=abs(rnorm(N, 0, 0.2)))

John Kane
Kingston ON Canada


> -Original Message-
> From: hyil...@gmail.com
> Sent: Thu, 12 Feb 2015 22:08:36 +0800
> To: r-help@r-project.org
> Subject: [R] ggplot2 shifting bars to only overlap in groups
> 
> Hi all,
> 
> I have four factors for a continuous time variable along with its
> confidence interval. I would like to produce a publication quality error
> bar chart that is clear to understand. For now, I used colors, x axis
> position, facets and alpha level to distinguish them.
> 
> I would like to overlap each pairs of bars with the same color a bit as a
> group, but not overlap each and every bars with each other.
> 
> Here is a minimal example:
> 
> N = 32
> df<- data.frame(gender=gl(2,1,N, c("male","female")),
>   direction=gl(2,2,N, c("up","down")),
>   condition=gl(4,4,N, c("c1","c2","c3","c4")),
>   location=gl(2,16,N, c("east","west")),
>   t=rnorm(N, 1, 0.5),
>   ci=abs(rnorm(N, 0, 0.2)))
> pp <-
>   ggplot(df, aes(x=gender, y=t, fill=condition, alpha=direction)) +
>   facet_grid(location~.) +
>   geom_bar(position=position_dodge(.9), stat="identity", color="black") +
>   geom_errorbar(aes(ymin=t-ci, ymax=t+ci),
> width=.2,# Width of the error bars
> position=position_dodge(.9)) +
>   scale_alpha_discrete(range= c(0.4, 1))
> pp
> 
> 
> 
> In the attachment, I have added the output figure, while manually editing
> the SVG file to make the lower-left group of bars to make them as I
> wanted.
> (The spacing in between each pair is not necessarily required.)
> 
> 
> ​Best
> ,
> 
> He who is worthy to receive his days and nights is worthy to receive* all
> else* from you (and me).
>  The Prophet, Gibran
> Kahlil
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.


Can't remember your password? Do you need a strong and secure password?
Use Password manager! It stores your passwords & protects your account.

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

Re: [R] horizontal bar plots for CI visualization

2015-02-12 Thread John Kane
And?

John Kane
Kingston ON Canada


> -Original Message-
> From: michael.eisenr...@agroscope.admin.ch
> Sent: Thu, 12 Feb 2015 13:56:37 +
> To: r-help@r-project.org
> Subject: [R] horizontal bar plots for CI visualization


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

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


Re: [R] ggplot2 shifting bars to only overlap in groups

2015-02-12 Thread Hörmetjan Yiltiz
You are most likely simply not running the whole lines of code: note that
the first line is:
N = 32

​Best
,

He who is worthy to receive his days and nights is worthy to receive* all
else* from you (and me).
 The Prophet, Gibran Kahlil


On Thu, Feb 12, 2015 at 11:31 PM, John Kane  wrote:

> I am gettting the error"
> Error in rep_len(rep.int(seq_len(n), rep.int(k, n)), length) :
>   object 'N' not found
>
> Also your image did not come through.  Try sending it as a pdf file.
>
> when I try to create
> df<- data.frame(gender=gl(2,1,N, c("male","female")),
>   direction=gl(2,2,N, c("up","down")),
>   condition=gl(4,4,N, c("c1","c2","c3","c4")),
>   location=gl(2,16,N, c("east","west")),
>   t=rnorm(N, 1, 0.5),
>   ci=abs(rnorm(N, 0, 0.2)))
>
> John Kane
> Kingston ON Canada
>
>
> > -Original Message-
> > From: hyil...@gmail.com
> > Sent: Thu, 12 Feb 2015 22:08:36 +0800
> > To: r-help@r-project.org
> > Subject: [R] ggplot2 shifting bars to only overlap in groups
> >
> > Hi all,
> >
> > I have four factors for a continuous time variable along with its
> > confidence interval. I would like to produce a publication quality error
> > bar chart that is clear to understand. For now, I used colors, x axis
> > position, facets and alpha level to distinguish them.
> >
> > I would like to overlap each pairs of bars with the same color a bit as a
> > group, but not overlap each and every bars with each other.
> >
> > Here is a minimal example:
> >
> > N = 32
> > df<- data.frame(gender=gl(2,1,N, c("male","female")),
> >   direction=gl(2,2,N, c("up","down")),
> >   condition=gl(4,4,N, c("c1","c2","c3","c4")),
> >   location=gl(2,16,N, c("east","west")),
> >   t=rnorm(N, 1, 0.5),
> >   ci=abs(rnorm(N, 0, 0.2)))
> > pp <-
> >   ggplot(df, aes(x=gender, y=t, fill=condition, alpha=direction)) +
> >   facet_grid(location~.) +
> >   geom_bar(position=position_dodge(.9), stat="identity", color="black") +
> >   geom_errorbar(aes(ymin=t-ci, ymax=t+ci),
> > width=.2,# Width of the error bars
> > position=position_dodge(.9)) +
> >   scale_alpha_discrete(range= c(0.4, 1))
> > pp
> >
> >
> >
> > In the attachment, I have added the output figure, while manually editing
> > the SVG file to make the lower-left group of bars to make them as I
> > wanted.
> > (The spacing in between each pair is not necessarily required.)
> >
> >
> > ​Best
> > ,
> > 
> > He who is worthy to receive his days and nights is worthy to receive* all
> > else* from you (and me).
> >  The Prophet, Gibran
> > Kahlil
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> > http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> 
> Can't remember your password? Do you need a strong and secure password?
> Use Password manager! It stores your passwords & protects your account.
> Check it out at http://mysecurelogon.com/password-manager
>
>
>

[[alternative HTML version deleted]]

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

Re: [R] Mixed-effects model for pre-post randomization design

2015-02-12 Thread Marco Barbàra
Thank you very much, Ben. Your answer has been very useful.

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


Re: [R] horizontal bar plots for CI visualization

2015-02-12 Thread Michael Dewey



On 12/02/2015 13:56, michael.eisenr...@agroscope.admin.ch wrote:

There are a number of options for doing this. You might consider using 
forest plots as provided by one of a number of the meta-analysis 
packages. See the CRAN MetaAnalysis task view for more details.


--
Michael
http://www.dewey.myzen.co.uk

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


Re: [R] ggplot2 shifting bars to only overlap in groups

2015-02-12 Thread John Kane

I'm a bit blind today. I read df as a dput() .

John Kane
Kingston ON Canada

-Original Message-
From: hyil...@gmail.com
Sent: Thu, 12 Feb 2015 23:38:01 +0800
To: jrkrid...@inbox.com
Subject: Re: [R] ggplot2 shifting bars to only overlap in groups

You are most likely simply not running the whole lines of code: note that the 
first line is:

N = 32

 Best
,

He who is worthy to receive his days and nights is worthy to receive* all 
else* from you (and me).
                                                 The Prophet, Gibran Kahlil 

On Thu, Feb 12, 2015 at 11:31 PM, John Kane  wrote:

I am gettting the error"
 Error in rep_len(rep.int [http://rep.int](seq_len(n), rep.int 
[http://rep.int](k, n)), length) :
   object 'N' not found

 Also your image did not come through.  Try sending it as a pdf file.

 when I try to create
 df<- data.frame(gender=gl(2,1,N, c("male","female")),
           direction=gl(2,2,N, c("up","down")),
           condition=gl(4,4,N, c("c1","c2","c3","c4")),
           location=gl(2,16,N, c("east","west")),
           t=rnorm(N, 1, 0.5),
           ci=abs(rnorm(N, 0, 0.2)))

 John Kane
 Kingston ON Canada

 > -Original Message-
 > From: hyil...@gmail.com
 > Sent: Thu, 12 Feb 2015 22:08:36 +0800
 > To: r-help@r-project.org
 > Subject: [R] ggplot2 shifting bars to only overlap in groups
 >
 > Hi all,
 >
 > I have four factors for a continuous time variable along with its
 > confidence interval. I would like to produce a publication quality error
 > bar chart that is clear to understand. For now, I used colors, x axis
 > position, facets and alpha level to distinguish them.
 >
 > I would like to overlap each pairs of bars with the same color a bit as a
 > group, but not overlap each and every bars with each other.
 >
 > Here is a minimal example:
 >
 > N = 32
 > df<- data.frame(gender=gl(2,1,N, c("male","female")),
 >           direction=gl(2,2,N, c("up","down")),
 >           condition=gl(4,4,N, c("c1","c2","c3","c4")),
 >           location=gl(2,16,N, c("east","west")),
 >           t=rnorm(N, 1, 0.5),
 >           ci=abs(rnorm(N, 0, 0.2)))
 > pp <-
 >   ggplot(df, aes(x=gender, y=t, fill=condition, alpha=direction)) +
 >   facet_grid(location~.) +
 >   geom_bar(position=position_dodge(.9), stat="identity", color="black") +
 >   geom_errorbar(aes(ymin=t-ci, ymax=t+ci),
 >                 width=.2,                    # Width of the error bars
 >                 position=position_dodge(.9)) +
 >   scale_alpha_discrete(range= c(0.4, 1))
 > pp
 >
 >
 >
 > In the attachment, I have added the output figure, while manually editing
 > the SVG file to make the lower-left group of bars to make them as I
 > wanted.
 > (The spacing in between each pair is not necessarily required.)
 >
 >
 > Best
 > ,
 > 
 > He who is worthy to receive his days and nights is worthy to receive* all
 > else* from you (and me).
 >                                                  The Prophet, Gibran
 > Kahlil

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

 
 Can't remember your password? Do you need a strong and secure password?
 Use Password manager! It stores your passwords & protects your account.
 Check it out at http://mysecurelogon.com/password-manager 
[http://mysecurelogon.com/password-manager]


FREE ONLINE PHOTOSHARING - Share your photos online with your friends and 
family!
Visit http://www.inbox.com/photosharing to find out more!

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

[R] 32bit R303 calls external C functions

2015-02-12 Thread Li, Yan
Dear All,

I build a R package which will need to call external C functions. I registered 
the C functions in the NAMESPACE file and include 32bit and 64bit dlls in the 
packages. If I load the package in 64bit R and calls the external C functions, 
it works fine. However if I load the package in 32bit R and call the external C 
functions, it either does not work properly or gives back error message saying 
cannot find the external C functions.

When I built the same package in R2.15.1, there is no such issue.

I checked the update news for R303 and found most .C is replaced by .Call. I 
modified the code but the package cannot be loaded and R ended abnormally.

Does anyone know if there any difference of 32bit R303 calling external C from 
64bitR303? Thank you!

Regards,
Yan

[[alternative HTML version deleted]]

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


[R] Installing RStudio

2015-02-12 Thread John Sorkin
Windows 7, 64-bit.
 
I am trying to install RStudio. Before installing RStudio, I installed R 3.1.2. 
During the installation or R, I installled (as per the default) 32- and 64-bit 
packages. When I tried to install RStudio, I received the message
R does not appear to be installed. Please install R before using RStudio.
I know R is installed, beacuse I am able to run R.
Can anyone suggest what I can do to get RStudio installed?
Thank you
John
 
John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and Geriatric 
Medicine
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing) 

Confidentiality Statement:
This email message, including any attachments, is for the sole use of the 
intended recipient(s) and may contain confidential and privileged information. 
Any unauthorized use, disclosure or distribution is prohibited. If you are not 
the intended recipient, please contact the sender by reply email and destroy 
all copies of the original message. 
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] problems with packages installation

2015-02-12 Thread PIKAL Petr
Dear all

I just switched to new version

> version
   _
platform   i386-w64-mingw32
arch   i386
os mingw32
system i386, mingw32
status Under development (unstable)
major  3
minor  2.0
year   2015
month  02
day11
svn rev67792
language   R
version.string R Under development (unstable) (2015-02-11 r67792)
nickname   Unsuffered Consequences

and started to have problems with installing packages through utils

> setInternet2(TRUE)
> utils:::menuInstallPkgs()
--- Please select a CRAN mirror for use in this session ---
also installing the dependencies ‘colorspace’, ‘Rcpp’, ‘stringr’, 
‘RColorBrewer’, ‘dichromat’, ‘munsell’, ‘labeling’, ‘plyr’, ‘digest’, ‘gtable’, 
‘reshape2’, ‘scales’, ‘proto’

trying URL 'http://cran.at.r-project.org/src/contrib/colorspace_1.2-4.zip'
Error in download.file(url, destfile, method, mode = "wb", ...) :
  cannot open URL 
'http://cran.at.r-project.org/src/contrib/colorspace_1.2-4.zip'
In addition: Warning message:
In download.file(url, destfile, method, mode = "wb", ...) :
  cannot open: HTTP status was '404 Not Found'
Warning in download.packages(pkgs, destdir = tmpd, available = available,  :
  download of package ‘colorspace’ failed


Before I start to disturb our IT I just want to know what could be the issue. 
AFAIK I did not change anything on my PC. In previous R-devel version I used 
this package installation worked (and still works)

> utils:::menuInstallPkgs()
--- Please select a CRAN mirror for use in this session ---
trying URL 'http://cran.at.r-project.org/bin/windows/contrib/3.2/mice_2.22.zip'
Content type 'application/zip' length 1148843 bytes (1.1 Mb)
opened URL
downloaded 1.1 Mb

package ‘mice’ successfully unpacked and MD5 sums checked

The downloaded binary packages are in
C:\Documents and Settings\PikalP\Local 
Settings\Temp\RtmpgZuQB3\downloaded_packages

> version
   _
platform   i386-w64-mingw32
arch   i386
os mingw32
system i386, mingw32
status Under development (unstable)
major  3
minor  2.0
year   2014
month  07
day16
svn rev66175
language   R
version.string R Under development (unstable) (2014-07-16 r66175)
nickname   Unsuffered Consequences

can you suggest what changed between those 2 R versions what prevents me in 
convenient installation of packages.

Petr

BTW. I can install packages manually but when there are many dependencies it 
can be rather tricky.



Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou určeny 
pouze jeho adresátům.
Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
svého systému.
Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
zpožděním přenosu e-mailu.

V případě, že je tento e-mail součástí obchodního jednání:
- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, a 
to z jakéhokoliv důvodu i bez uvedení důvodu.
- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany příjemce 
s dodatkem či odchylkou.
- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
dosažením shody na všech jejích náležitostech.
- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu případně 
osobě, kterou adresát zastupuje, předloženy nebo jejich existence je adresátovi 
či osobě jím zastoupené známá.

This e-mail and any documents attached to it may be confidential and are 
intended only for its intended recipients.
If you received this e-mail by mistake, please immediately inform its sender. 
Delete the contents of this e-mail with all attachments and its copies from 
your system.
If you are not the intended recipient of this e-mail, you are not authorized to 
use, disseminate, copy or disclose this e-mail in any manner.
The sender of this e-mail shall not be liable for any possible damage caused by 
modifications of the e-mail or by delay with transfer of the email.

In case that this e-mail forms part of business dealings:
- the sender reserves the right to end negotiations about entering into a 
contract in any time, for any reason, and without stating any reasoning.
- if the e-mail contains an offer, the recipient is entitled to immediately 
accept such offer; The sender of this e-mail (offer) excludes any acceptance of 
the offer on the part of the recipient containing any amendment or variation.
- the 

Re: [R] Installing RStudio

2015-02-12 Thread Jeff Newmiller
Ah, ask in the RStudio support area?
---
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.

On February 12, 2015 11:22:56 AM EST, John Sorkin  
wrote:
>Windows 7, 64-bit.
> 
>I am trying to install RStudio. Before installing RStudio, I installed
>R 3.1.2. During the installation or R, I installled (as per the
>default) 32- and 64-bit packages. When I tried to install RStudio, I
>received the message
>R does not appear to be installed. Please install R before using
>RStudio.
>I know R is installed, beacuse I am able to run R.
>Can anyone suggest what I can do to get RStudio installed?
>Thank you
>John
> 
>John David Sorkin M.D., Ph.D.
>Professor of Medicine
>Chief, Biostatistics and Informatics
>University of Maryland School of Medicine Division of Gerontology and
>Geriatric Medicine
>Baltimore VA Medical Center
>10 North Greene Street
>GRECC (BT/18/GR)
>Baltimore, MD 21201-1524
>(Phone) 410-605-7119
>(Fax) 410-605-7913 (Please call phone number above prior to faxing) 
>
>Confidentiality Statement:
>This email message, including any attachments, is for t...{{dropped:12}}

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


Re: [R] problems with packages installation

2015-02-12 Thread Jeff Newmiller
Time to (re)read the Posting Guide... questions about unreleased versions of R 
are off topic here. Go to R-devel.
---
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.

On February 12, 2015 11:40:48 AM EST, PIKAL Petr  wrote:
>Dear all
>
>I just switched to new version
>
>> version
>   _
>platform   i386-w64-mingw32
>arch   i386
>os mingw32
>system i386, mingw32
>status Under development (unstable)
>major  3
>minor  2.0
>year   2015
>month  02
>day11
>svn rev67792
>language   R
>version.string R Under development (unstable) (2015-02-11 r67792)
>nickname   Unsuffered Consequences
>
>and started to have problems with installing packages through utils
>
>> setInternet2(TRUE)
>> utils:::menuInstallPkgs()
>--- Please select a CRAN mirror for use in this session ---
>also installing the dependencies ‘colorspace’, ‘Rcpp’, ‘stringr’,
>‘RColorBrewer’, ‘dichromat’, ‘munsell’, ‘labeling’, ‘plyr’, ‘digest’,
>‘gtable’, ‘reshape2’, ‘scales’, ‘proto’
>
>trying URL
>'http://cran.at.r-project.org/src/contrib/colorspace_1.2-4.zip'
>Error in download.file(url, destfile, method, mode = "wb", ...) :
>cannot open URL
>'http://cran.at.r-project.org/src/contrib/colorspace_1.2-4.zip'
>In addition: Warning message:
>In download.file(url, destfile, method, mode = "wb", ...) :
>  cannot open: HTTP status was '404 Not Found'
>Warning in download.packages(pkgs, destdir = tmpd, available =
>available,  :
>  download of package ‘colorspace’ failed
>
>
>Before I start to disturb our IT I just want to know what could be the
>issue. AFAIK I did not change anything on my PC. In previous R-devel
>version I used this package installation worked (and still works)
>
>> utils:::menuInstallPkgs()
>--- Please select a CRAN mirror for use in this session ---
>trying URL
>'http://cran.at.r-project.org/bin/windows/contrib/3.2/mice_2.22.zip'
>Content type 'application/zip' length 1148843 bytes (1.1 Mb)
>opened URL
>downloaded 1.1 Mb
>
>package ‘mice’ successfully unpacked and MD5 sums checked
>
>The downloaded binary packages are in
>C:\Documents and Settings\PikalP\Local
>Settings\Temp\RtmpgZuQB3\downloaded_packages
>
>> version
>   _
>platform   i386-w64-mingw32
>arch   i386
>os mingw32
>system i386, mingw32
>status Under development (unstable)
>major  3
>minor  2.0
>year   2014
>month  07
>day16
>svn rev66175
>language   R
>version.string R Under development (unstable) (2014-07-16 r66175)
>nickname   Unsuffered Consequences
>
>can you suggest what changed between those 2 R versions what prevents
>me in convenient installation of packages.
>
>Petr
>
>BTW. I can install packages manually but when there are many
>dependencies it can be rather tricky.
>
>
>
>Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou
>určeny pouze jeho adresátům.
>Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě
>neprodleně jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho
>kopie vymažte ze svého systému.
>Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento
>email jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
>Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou
>modifikacemi či zpožděním přenosu e-mailu.
>
>V případě, že je tento e-mail součástí obchodního jednání:
>- vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření
>smlouvy, a to z jakéhokoliv důvodu i bez uvedení důvodu.
>- a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně
>přijmout; Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky
>ze strany příjemce s dodatkem či odchylkou.
>- trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve
>výslovným dosažením shody na všech jejích náležitostech.
>- odesílatel tohoto emailu informuje, že není oprávněn uzavírat za
>společnost žádné smlouvy s výjimkou případů, kdy k tomu byl písemně
>zmocněn nebo písemně pověřen a takové pověření nebo plná moc byly
>adresátovi tohoto emailu případně osobě, kterou adresát zastupuje,
>předloženy nebo jejich existence je adresátovi či osobě jím zastoupené
>známá.
>
>This e-mail and any documents attached to it may be confidential and
>are intended only for its intended recipients.
>If you received this e-mail by mistake, please immediately inform its
>sender. Delete the contents of this e-

Re: [R] Shiny User Group

2015-02-12 Thread Hadley Wickham
Maybe https://groups.google.com/forum/#!forum/shiny-discuss ?

Hadley

On Thu, Feb 12, 2015 at 9:07 AM, Doran, Harold  wrote:
> I found a google user group for shiny, and am curious if there is an SIG as 
> well. Didn't see one in my searches, but looking for an active place to ask 
> questions and share code.
>
> Thanks.
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
http://had.co.nz/

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


Re: [R] problems with packages installation

2015-02-12 Thread Richard M. Heiberger
You should install Rtools first.

Then you will need to use
install.packages(c(A"","B","etc"), type="source", dependencies=TRUE)

Rich

On Thu, Feb 12, 2015 at 11:40 AM, PIKAL Petr  wrote:
> Dear all
>
> I just switched to new version
>
>> version
>_
> platform   i386-w64-mingw32
> arch   i386
> os mingw32
> system i386, mingw32
> status Under development (unstable)
> major  3
> minor  2.0
> year   2015
> month  02
> day11
> svn rev67792
> language   R
> version.string R Under development (unstable) (2015-02-11 r67792)
> nickname   Unsuffered Consequences
>
> and started to have problems with installing packages through utils
>
>> setInternet2(TRUE)
>> utils:::menuInstallPkgs()
> --- Please select a CRAN mirror for use in this session ---
> also installing the dependencies ‘colorspace’, ‘Rcpp’, ‘stringr’, 
> ‘RColorBrewer’, ‘dichromat’, ‘munsell’, ‘labeling’, ‘plyr’, ‘digest’, 
> ‘gtable’, ‘reshape2’, ‘scales’, ‘proto’
>
> trying URL 'http://cran.at.r-project.org/src/contrib/colorspace_1.2-4.zip'
> Error in download.file(url, destfile, method, mode = "wb", ...) :
>   cannot open URL 
> 'http://cran.at.r-project.org/src/contrib/colorspace_1.2-4.zip'
> In addition: Warning message:
> In download.file(url, destfile, method, mode = "wb", ...) :
>   cannot open: HTTP status was '404 Not Found'
> Warning in download.packages(pkgs, destdir = tmpd, available = available,  :
>   download of package ‘colorspace’ failed
> 
>
> Before I start to disturb our IT I just want to know what could be the issue. 
> AFAIK I did not change anything on my PC. In previous R-devel version I used 
> this package installation worked (and still works)
>
>> utils:::menuInstallPkgs()
> --- Please select a CRAN mirror for use in this session ---
> trying URL 
> 'http://cran.at.r-project.org/bin/windows/contrib/3.2/mice_2.22.zip'
> Content type 'application/zip' length 1148843 bytes (1.1 Mb)
> opened URL
> downloaded 1.1 Mb
>
> package ‘mice’ successfully unpacked and MD5 sums checked
>
> The downloaded binary packages are in
> C:\Documents and Settings\PikalP\Local 
> Settings\Temp\RtmpgZuQB3\downloaded_packages
>
>> version
>_
> platform   i386-w64-mingw32
> arch   i386
> os mingw32
> system i386, mingw32
> status Under development (unstable)
> major  3
> minor  2.0
> year   2014
> month  07
> day16
> svn rev66175
> language   R
> version.string R Under development (unstable) (2014-07-16 r66175)
> nickname   Unsuffered Consequences
>
> can you suggest what changed between those 2 R versions what prevents me in 
> convenient installation of packages.
>
> Petr
>
> BTW. I can install packages manually but when there are many dependencies it 
> can be rather tricky.
>
>
> 
> Tento e-mail a jakékoliv k němu připojené dokumenty jsou důvěrné a jsou 
> určeny pouze jeho adresátům.
> Jestliže jste obdržel(a) tento e-mail omylem, informujte laskavě neprodleně 
> jeho odesílatele. Obsah tohoto emailu i s přílohami a jeho kopie vymažte ze 
> svého systému.
> Nejste-li zamýšleným adresátem tohoto emailu, nejste oprávněni tento email 
> jakkoliv užívat, rozšiřovat, kopírovat či zveřejňovat.
> Odesílatel e-mailu neodpovídá za eventuální škodu způsobenou modifikacemi či 
> zpožděním přenosu e-mailu.
>
> V případě, že je tento e-mail součástí obchodního jednání:
> - vyhrazuje si odesílatel právo ukončit kdykoliv jednání o uzavření smlouvy, 
> a to z jakéhokoliv důvodu i bez uvedení důvodu.
> - a obsahuje-li nabídku, je adresát oprávněn nabídku bezodkladně přijmout; 
> Odesílatel tohoto e-mailu (nabídky) vylučuje přijetí nabídky ze strany 
> příjemce s dodatkem či odchylkou.
> - trvá odesílatel na tom, že příslušná smlouva je uzavřena teprve výslovným 
> dosažením shody na všech jejích náležitostech.
> - odesílatel tohoto emailu informuje, že není oprávněn uzavírat za společnost 
> žádné smlouvy s výjimkou případů, kdy k tomu byl písemně zmocněn nebo písemně 
> pověřen a takové pověření nebo plná moc byly adresátovi tohoto emailu 
> případně osobě, kterou adresát zastupuje, předloženy nebo jejich existence je 
> adresátovi či osobě jím zastoupené známá.
>
> This e-mail and any documents attached to it may be confidential and are 
> intended only for its intended recipients.
> If you received this e-mail by mistake, please immediately inform its sender. 
> Delete the contents of this e-mail with all attachments and its copies from 
> your system.
> If you are not the intended recipient of this e-mail, you are not authorized 
> to use, disseminate, copy or disclose this e-mail in any manner.
> The sender of this e-mail shall not be liable for any possible damage caused 
> by modifications of the e-mail or by delay with transfer of the email.
>
> In case that this e-mail forms part of 

[R] Censoring in R2OpenBUGS

2015-02-12 Thread arnabkm2007
Hi, 

I am trying to run the following model for OpenBUGS and want to use
R2OpenBUGS package. The model specifies weibull distribution for censored
data. 

  
  weibull.model <- function() 
  { 

for(i in 1:n) 
{ 
  
  exp.alpha[i] ~ dgamma(a.alpha, b.alpha) 
  alpha[i] <- log(exp.alpha[i]) 
  
  linear.part[i] <- alpha[i] + inprod(nu[ ], x[i, ]) 
  lambda[i] <- exp(linear.part[i]) 
  
  time[i] ~ (dweib(shape, lambda[i]) C(censored.time[i], )) 
  
} 

shape ~ dgamma(a.shape, b.shape) 

for(j in 1:p) 
{ 
  
  beta[j]  ~ dnorm(prior.mean, prior.tau) 
  gamma[j] ~ dbern(pi[j]) 
  pi[j]~ dbeta(1, 1) 
  nu[j]   <- beta[j] * gamma[j] 
  
} 

  } 
  


But R is throwing the following error. 

Error: unexpected symbol in: 
"   
  time[i] ~ (dweib(shape, lambda[i]) C" 

Any help regarding this will be appreciated. 

Thanks & Regards, 
Arnab 


Arnab Kumar Maity 
Graduate Teaching Assistant 
Division of Statistics 
Northern Illinois University 
DeKalb, IL 60115 
Email: ma...@math.niu.edu 
Ph: 779-777-3428 



--
View this message in context: 
http://r.789695.n4.nabble.com/Censoring-in-R2OpenBUGS-tp4703160.html
Sent from the R help mailing list archive at Nabble.com.

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


[R] SIMPLE question

2015-02-12 Thread CHIRIBOGA Xavier
Hi everybody!



I want to do a boxcox transformation, but I got this:



Error: could not find function "boxcox"



What can I do? I am using R studio.



Thanks!!!



Xavier

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


[R] WG: horizontal bar plots for CI visualization

2015-02-12 Thread michael.eisenring
2.50%   97.50%
intercept   29787966
glands  13143611
damage  169 6144
treatment L1778 6703
treatment L4-3899   5125
Length  -1817   1828
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.


[R] Sorting Surv objects

2015-02-12 Thread Professor Bickis
It seems that Surv objects do not sort correctly.   This seems to be a bug.  
Anyone else found this?

> survival.data
[1] 4+ 3  1+ 2  5+
> class(survival.data)
[1] "Surv"
> sort(survival.data)
[1] 2  1+ 4+ 3  5+

An easy work-around is to define a function sort.Surv

sort.Surv<-function(a){ord<-order(a[,1])
+ a[ord]}

> sort(survival.data)
[1] 1+ 2  3  4+ 5+

I am using R 3.1.2 GUI 1.65 Mavericks build (6833) running under Yosemite.

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


Re: [R] Installing RStudio

2015-02-12 Thread ARNAB KR MAITY
Dear John,


I think you have to specify the directory of R in the R-studio installation
process. Somehow the installation wizard is unable to find the address of R
in your system.

Thanks & Regards,
Arnab



Arnab Kumar Maity
Graduate Teaching Assistant
Division of Statistics
Northern Illinois University
DeKalb, IL 60115
Email: ma...@math.niu.edu
Ph: 779-777-3428

On Thu, Feb 12, 2015 at 10:22 AM, John Sorkin 
wrote:

> Windows 7, 64-bit.
>
> I am trying to install RStudio. Before installing RStudio, I installed R
> 3.1.2. During the installation or R, I installled (as per the default) 32-
> and 64-bit packages. When I tried to install RStudio, I received the message
> R does not appear to be installed. Please install R before using RStudio.
> I know R is installed, beacuse I am able to run R.
> Can anyone suggest what I can do to get RStudio installed?
> Thank you
> John
>
> John David Sorkin M.D., Ph.D.
> Professor of Medicine
> Chief, Biostatistics and Informatics
> University of Maryland School of Medicine Division of Gerontology and
> Geriatric Medicine
> Baltimore VA Medical Center
> 10 North Greene Street
> GRECC (BT/18/GR)
> Baltimore, MD 21201-1524
> (Phone) 410-605-7119
> (Fax) 410-605-7913 (Please call phone number above prior to faxing)
>
> Confidentiality Statement:
> This email message, including any attachments, is for ...{{dropped:16}}

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


Re: [R] SIMPLE question

2015-02-12 Thread Rui Barradas

Hello,

Try the following.

install.packages("sos")  #if not yet

Then,

library(sos)
findFn("boxcox")


There are several hits, maybe you could start with package car

Hope this helps,

Rui Barradas

Em 12-02-2015 16:19, CHIRIBOGA Xavier escreveu:

Hi everybody!



I want to do a boxcox transformation, but I got this:



Error: could not find function "boxcox"



What can I do? I am using R studio.



Thanks!!!



Xavier

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



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


Re: [R] 32bit R303 calls external C functions

2015-02-12 Thread Duncan Murdoch

On 12/02/2015 11:08 AM, Li, Yan wrote:

Dear All,

I build a R package which will need to call external C functions. I registered 
the C functions in the NAMESPACE file and include 32bit and 64bit dlls in the 
packages. If I load the package in 64bit R and calls the external C functions, 
it works fine. However if I load the package in 32bit R and call the external C 
functions, it either does not work properly or gives back error message saying 
cannot find the external C functions.

When I built the same package in R2.15.1, there is no such issue.

I checked the update news for R303 and found most .C is replaced by .Call. I 
modified the code but the package cannot be loaded and R ended abnormally.

Does anyone know if there any difference of 32bit R303 calling external C from 
64bitR303? Thank you!


There's no R303; the current version is 3.1.2.  So if you meant 3.0.3, 
I'd suggest upgrading.  If you meant something else, you're probably in 
the wrong place.


For 3.1.2, there are big differences:  32 bit R can't call 64 bit .dlls 
and vice versa.   You can either install the package from source in both 
versions, or arrange to compile both 32 bit and 64 bit dlls, in which 
case both versions can use the binary of the package.


If you've already done all that, then you'll need to give more details, 
e.g. access to the source for the package, to get more specific help.


Duncan Murdoch

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


Re: [R] 32bit R303 calls external C functions

2015-02-12 Thread Li, Yan
I meant R3.0.3. I need this package working in R3.0.3.

I have 32bit and 64bit dlls both included in the package.


-Original Message-
From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com] 
Sent: Thursday, February 12, 2015 1:01 PM
To: Li, Yan; r-help@r-project.org
Subject: Re: [R] 32bit R303 calls external C functions

On 12/02/2015 11:08 AM, Li, Yan wrote:
> Dear All,
>
> I build a R package which will need to call external C functions. I 
> registered the C functions in the NAMESPACE file and include 32bit and 64bit 
> dlls in the packages. If I load the package in 64bit R and calls the external 
> C functions, it works fine. However if I load the package in 32bit R and call 
> the external C functions, it either does not work properly or gives back 
> error message saying cannot find the external C functions.
>
> When I built the same package in R2.15.1, there is no such issue.
>
> I checked the update news for R303 and found most .C is replaced by .Call. I 
> modified the code but the package cannot be loaded and R ended abnormally.
>
> Does anyone know if there any difference of 32bit R303 calling external C 
> from 64bitR303? Thank you!

There's no R303; the current version is 3.1.2.  So if you meant 3.0.3, I'd 
suggest upgrading.  If you meant something else, you're probably in the wrong 
place.

For 3.1.2, there are big differences:  32 bit R can't call 64 bit .dlls 
and vice versa.   You can either install the package from source in both 
versions, or arrange to compile both 32 bit and 64 bit dlls, in which case both 
versions can use the binary of the package.

If you've already done all that, then you'll need to give more details, e.g. 
access to the source for the package, to get more specific help.

Duncan Murdoch

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


Re: [R] gsub : replace regex pattern with values from another data.frame

2015-02-12 Thread arnaud gaboury
On Thu, Feb 12, 2015 at 3:40 PM, arnaud gaboury
 wrote:
> I have two df (and dt):
>
> df1
> structure(list(name = c("poisonivy", "poisonivy", "poisonivy",
> "poisonivy", "poisonivy", "poisonivy", "poisonivy", "poisonivy",
> "cruzecontrol", "agreenmamba", "agreenmamba", "vairis", "vairis",
> "vairis", "vairis", "vairis", "vairis", "xaeth"), text = c("ok",
> "need items ?", "i didn't submit pass codes for a long now",
> "ok", "<@U03AEKYL4>: what app are you talking about ?", "some testing
> with my irc client",
> "ha ha sorry", "for me there is no such question", "Lol.",
> "<@U03AEKWTL|agreenmamba> uploaded a file:
>  should I stay or should I go?>",
> "<@U032FHV3S> ", "ok, see you around",
> "yeah, I had a procrastination rush so I started to decode a little",
> " when you submit passcodes",
> "intel", "what is the cooldown time or how does it work...;",
> "anybody knows how does \"Passcode circuitry too hot. Wait for cool
> down to enter another passcode.\" works?",
> "and people told that agent their geocities experience would never
> amount to anything (the convo yesterday) "
> ), ts = c("1423594336.000138", "1423594311.000136", "1423594294.000135",
> "1423594258.000133", "1423594244.000131", "1423497058.000127",
> "1423497041.000126", "1423478555.000123", "1423494427.000125",
> "1423492370.000124", "1423478364.000121", "1423594358.000139",
> "1423594329.000137", "1423594264.000134", "1423594251.000132",
> "1423592204.000130", "1423592174.000129", "1423150354.000112"
> )), .Names = c("name", "text", "ts"), class = c("data.table",
> "data.frame"), row.names = c(NA, -18L))
>
> df2
> structure(list(id = c("U03KH8Z52", "U02AF1DTJ", "U02AF0ZT8",
> "U03AEKWTL", "U02BCJH0G", "U033YA1MS", "U029QMCRR", "U03H139M5",
> "U02AET1D0", "U02A6U41Z", "U02B5T4CX", "U02B2QU4R", "U03F0LQ5X",
> "U03JNFKLY", "U02ASMBMQ", "U029QLQC7", "U03AEMBQU", "U02B4D3Q1",
> "U02AGDC14", "U029A467C", "U02A7NFG6", "U02AESPPL", "U02AQANK7",
> "U03ADJDFK", "U03EYR0KB", "U02AW7Q5Q", "U02AE8RKD", "U02FT84BS",
> "U02B25M3B", "U03EZDQT7", "U02AECKFF", "U03H2691M", "U02DWTJ5V",
> "U02AFTAHH", "U029QQEPM", "U03C51Z42", "U02CAK2CV", "U03AK21DP",
> "U03FFN8ED", "U02B23V03", "U029T2143", "U02C1LEEX", "U03AF2QH2",
> "U03E0GN0S", "U03AG20R9", "U02AES8S2", "U02AG64S7", "U02B5A0R7",
> "U02AS4SLR", "U03C2SG0R", "U03AV7CCW", "U032XPFDU", "U03AUKSSV",
> "U02C2A61Y", "U02AESHJQ", "U02BLSKHU", "U02E34WM6", "U03AK6P26",
> "U02E6ADRZ", "U03FCDQ50", "U03EW1CC5", "U02BL0DBD", "U02FHQZ6D",
> "U02B47T63", "U03H2TTQP", "U03AVP71V", "U03JLV38V", "U02E39HAY",
> "U02AE5281", "U032FHV3S", "U03AL2096", "U02ARUG6M", "U02AECRSP",
> "U02B42XG4", "U03AFQZNS", "U02AE7H41", "U03G9UNTG", "U02GEQ0E6",
> "U02AGLE5A", "U02BQTRC9", "U03H0J6GS", "U02B3D27F", "U02AEKTHV",
> "U02C52YN3", "U02E33MUW", "U03AKUT85", "U03B53EHG", "U02FBN38P",
> "U03AH3E5W", "U02B5PLE0", "U02AS4RCK", "U03ANE1GZ", "U02E8LZQB",
> "U03EPGJ98", "U02E3N220", "U03AEKYL4", "U02AE7HT1", "U02C1RR3G",
> "U03JH408J", "U03KL0FKN", "U02B44R92", "U03EURWGX"), name = c("10k_affair",
> "1upwuzhere", "4xcss", "agreenmamba", "ait109", "arly69", "azkop13",
> "barcik75", "bigolnob", "blackrose", "blink619", "bobaloo23",
> "bodger", "bomb", "bootswithdefer", "brandizzle", "bregalad",
> "camon", "celticrain", "ch3mical", "checksum", "cocothunder",
> "cruxicon", "cruzecontrol", "crystalskunk", "cscheetah", "dabcelin",
> "deelicious", "delthanar", "drkaosdk", "droidenl-joe", "dukeceph",
> "fillerbunny", "flickohmsford", "flyingg0d", "garaxiel", "goby9",
> "gymbal", "hideandseek", "hobojr", "ijackportals", "invalidcharactr",
> "itso9", "j0shs", "jarvis", "jc0mm5", "jencyberchic", "jimbobradyson",
> "joespr0cket", "jostrander", "jueliet", "karlashi", "khan99",
> "kingkonn0r", "krispycridder", "kritickalmass", "lawgiver", "maxcorbett",
> "memory556", "meta000x", "minkovsky", "mistylady", "mstephans",
> "mstrinity", "nocarryr", "ollietronic", "philistine11", "pickledpickles",
> "piercingsbykris", "poisonivy", "raugmor", "remarks999", "rheds77",
> "rhinz", "rigiritter", "robbie0017", "rohdef", "ryoziya", "s4n1ty",
> "sacredcow133", "samwill", "sgtlemonpepper", "sivan", "spline9",
> "starwolf", "stueliueli", "sweetiris", "swift2plunder", "swissphoenix",
> "synyck", "test", "therug", "tinja551", "trulyjuan", "twinster",
> "vairis", "vinylz3ro", "watervirus", "xaeth", "yagamiyukari",
> "zafo", "zexium")), .Names = c("id", "name"), class = c("data.table",
> "data.frame"), row.names = c(NA, -102L))
>
> I need to replace this regex pattern in df1 :
> (?<=<@)[^|]{9}(?=>|) by its corresponding name from df2.
>
> E.g : if <@U03KH8Z52> is found in df1, then I want to replace it by
> the "name" which correspond to this id in df2., in this case
> 10k_affair
>
> I know of replace an expression with gsub:
> gsub('(?<=<@)[^|]{9}(?=>|)', 'toto', df1, perl = T)
> but I have no

Re: [R] ggplot2 shifting bars to only overlap in groups

2015-02-12 Thread Hörmetjan Yiltiz
I did not know the SVG file did not come through. I thought SVG should be
able to pass through the filter. Here is a PDF file along with an PNG.
Guess one of them should be able to pass.

祝好,

He who is worthy to receive his days and nights is worthy to receive* all
else* from you (and me).
 The Prophet, Gibran Kahlil


On Fri, Feb 13, 2015 at 12:04 AM, John Kane  wrote:

>
> I'm a bit blind today. I read df as a dput() .
>
> John Kane
> Kingston ON Canada
>
> -Original Message-
> From: hyil...@gmail.com
> Sent: Thu, 12 Feb 2015 23:38:01 +0800
> To: jrkrid...@inbox.com
> Subject: Re: [R] ggplot2 shifting bars to only overlap in groups
>
> You are most likely simply not running the whole lines of code: note that
> the first line is:
>
> N = 32
>
>  Best
> ,
> 
> He who is worthy to receive his days and nights is worthy to receive* all
> else* from you (and me).
>  The Prophet, Gibran Kahlil
>
> On Thu, Feb 12, 2015 at 11:31 PM, John Kane  wrote:
>
> I am gettting the error"
>  Error in rep_len(rep.int [http://rep.int](seq_len(n), rep.int [
> http://rep.int](k, n)), length) :
>object 'N' not found
>
>  Also your image did not come through.  Try sending it as a pdf file.
>
>  when I try to create
>  df<- data.frame(gender=gl(2,1,N, c("male","female")),
>direction=gl(2,2,N, c("up","down")),
>condition=gl(4,4,N, c("c1","c2","c3","c4")),
>location=gl(2,16,N, c("east","west")),
>t=rnorm(N, 1, 0.5),
>ci=abs(rnorm(N, 0, 0.2)))
>
>  John Kane
>  Kingston ON Canada
>
>  > -Original Message-
>  > From: hyil...@gmail.com
>  > Sent: Thu, 12 Feb 2015 22:08:36 +0800
>  > To: r-help@r-project.org
>  > Subject: [R] ggplot2 shifting bars to only overlap in groups
>  >
>  > Hi all,
>  >
>  > I have four factors for a continuous time variable along with its
>  > confidence interval. I would like to produce a publication quality error
>  > bar chart that is clear to understand. For now, I used colors, x axis
>  > position, facets and alpha level to distinguish them.
>  >
>  > I would like to overlap each pairs of bars with the same color a bit as
> a
>  > group, but not overlap each and every bars with each other.
>  >
>  > Here is a minimal example:
>  >
>  > N = 32
>  > df<- data.frame(gender=gl(2,1,N, c("male","female")),
>  >   direction=gl(2,2,N, c("up","down")),
>  >   condition=gl(4,4,N, c("c1","c2","c3","c4")),
>  >   location=gl(2,16,N, c("east","west")),
>  >   t=rnorm(N, 1, 0.5),
>  >   ci=abs(rnorm(N, 0, 0.2)))
>  > pp <-
>  >   ggplot(df, aes(x=gender, y=t, fill=condition, alpha=direction)) +
>  >   facet_grid(location~.) +
>  >   geom_bar(position=position_dodge(.9), stat="identity", color="black")
> +
>  >   geom_errorbar(aes(ymin=t-ci, ymax=t+ci),
>  > width=.2,# Width of the error bars
>  > position=position_dodge(.9)) +
>  >   scale_alpha_discrete(range= c(0.4, 1))
>  > pp
>  >
>  >
>  >
>  > In the attachment, I have added the output figure, while manually
> editing
>  > the SVG file to make the lower-left group of bars to make them as I
>  > wanted.
>  > (The spacing in between each pair is not necessarily required.)
>  >
>  >
>  > Best
>  > ,
>  > 
>  > He who is worthy to receive his days and nights is worthy to receive*
> all
>  > else* from you (and me).
>  >  The Prophet, Gibran
>  > Kahlil
>
> > __
>  > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>  > https://stat.ethz.ch/mailman/listinfo/r-help [
> https://stat.ethz.ch/mailman/listinfo/r-help]
>  > PLEASE do read the posting guide
>  > http://www.R-project.org/posting-guide.html [
> http://www.R-project.org/posting-guide.html]
>  > and provide commented, minimal, self-contained, reproducible code.
>
>  
>  Can't remember your password? Do you need a strong and secure password?
>  Use Password manager! It stores your passwords & protects your account.
>  Check it out at http://mysecurelogon.com/password-manager [
> http://mysecurelogon.com/password-manager]
>
> 
> FREE ONLINE PHOTOSHARING - Share your photos online with your friends and
> family!
> Visit http://www.inbox.com/photosharing to find out more!
>
>
>


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

Re: [R] gsub : replace regex pattern with values from another data.frame

2015-02-12 Thread arnaud gaboury
On Thu, Feb 12, 2015 at 7:12 PM, arnaud gaboury
 wrote:
> On Thu, Feb 12, 2015 at 3:40 PM, arnaud gaboury
>  wrote:
>> I have two df (and dt):
>>
>> df1
>> structure(list(name = c("poisonivy", "poisonivy", "poisonivy",
>> "poisonivy", "poisonivy", "poisonivy", "poisonivy", "poisonivy",
>> "cruzecontrol", "agreenmamba", "agreenmamba", "vairis", "vairis",
>> "vairis", "vairis", "vairis", "vairis", "xaeth"), text = c("ok",
>> "need items ?", "i didn't submit pass codes for a long now",
>> "ok", "<@U03AEKYL4>: what app are you talking about ?", "some testing
>> with my irc client",
>> "ha ha sorry", "for me there is no such question", "Lol.",
>> "<@U03AEKWTL|agreenmamba> uploaded a file:
>> > should I stay or should I go?>",
>> "<@U032FHV3S> ", "ok, see you around",
>> "yeah, I had a procrastination rush so I started to decode a little",
>> " when you submit passcodes",
>> "intel", "what is the cooldown time or how does it work...;",
>> "anybody knows how does \"Passcode circuitry too hot. Wait for cool
>> down to enter another passcode.\" works?",
>> "and people told that agent their geocities experience would never
>> amount to anything (the convo yesterday) "
>> ), ts = c("1423594336.000138", "1423594311.000136", "1423594294.000135",
>> "1423594258.000133", "1423594244.000131", "1423497058.000127",
>> "1423497041.000126", "1423478555.000123", "1423494427.000125",
>> "1423492370.000124", "1423478364.000121", "1423594358.000139",
>> "1423594329.000137", "1423594264.000134", "1423594251.000132",
>> "1423592204.000130", "1423592174.000129", "1423150354.000112"
>> )), .Names = c("name", "text", "ts"), class = c("data.table",
>> "data.frame"), row.names = c(NA, -18L))
>>
>> df2
>> structure(list(id = c("U03KH8Z52", "U02AF1DTJ", "U02AF0ZT8",
>> "U03AEKWTL", "U02BCJH0G", "U033YA1MS", "U029QMCRR", "U03H139M5",
>> "U02AET1D0", "U02A6U41Z", "U02B5T4CX", "U02B2QU4R", "U03F0LQ5X",
>> "U03JNFKLY", "U02ASMBMQ", "U029QLQC7", "U03AEMBQU", "U02B4D3Q1",
>> "U02AGDC14", "U029A467C", "U02A7NFG6", "U02AESPPL", "U02AQANK7",
>> "U03ADJDFK", "U03EYR0KB", "U02AW7Q5Q", "U02AE8RKD", "U02FT84BS",
>> "U02B25M3B", "U03EZDQT7", "U02AECKFF", "U03H2691M", "U02DWTJ5V",
>> "U02AFTAHH", "U029QQEPM", "U03C51Z42", "U02CAK2CV", "U03AK21DP",
>> "U03FFN8ED", "U02B23V03", "U029T2143", "U02C1LEEX", "U03AF2QH2",
>> "U03E0GN0S", "U03AG20R9", "U02AES8S2", "U02AG64S7", "U02B5A0R7",
>> "U02AS4SLR", "U03C2SG0R", "U03AV7CCW", "U032XPFDU", "U03AUKSSV",
>> "U02C2A61Y", "U02AESHJQ", "U02BLSKHU", "U02E34WM6", "U03AK6P26",
>> "U02E6ADRZ", "U03FCDQ50", "U03EW1CC5", "U02BL0DBD", "U02FHQZ6D",
>> "U02B47T63", "U03H2TTQP", "U03AVP71V", "U03JLV38V", "U02E39HAY",
>> "U02AE5281", "U032FHV3S", "U03AL2096", "U02ARUG6M", "U02AECRSP",
>> "U02B42XG4", "U03AFQZNS", "U02AE7H41", "U03G9UNTG", "U02GEQ0E6",
>> "U02AGLE5A", "U02BQTRC9", "U03H0J6GS", "U02B3D27F", "U02AEKTHV",
>> "U02C52YN3", "U02E33MUW", "U03AKUT85", "U03B53EHG", "U02FBN38P",
>> "U03AH3E5W", "U02B5PLE0", "U02AS4RCK", "U03ANE1GZ", "U02E8LZQB",
>> "U03EPGJ98", "U02E3N220", "U03AEKYL4", "U02AE7HT1", "U02C1RR3G",
>> "U03JH408J", "U03KL0FKN", "U02B44R92", "U03EURWGX"), name = c("10k_affair",
>> "1upwuzhere", "4xcss", "agreenmamba", "ait109", "arly69", "azkop13",
>> "barcik75", "bigolnob", "blackrose", "blink619", "bobaloo23",
>> "bodger", "bomb", "bootswithdefer", "brandizzle", "bregalad",
>> "camon", "celticrain", "ch3mical", "checksum", "cocothunder",
>> "cruxicon", "cruzecontrol", "crystalskunk", "cscheetah", "dabcelin",
>> "deelicious", "delthanar", "drkaosdk", "droidenl-joe", "dukeceph",
>> "fillerbunny", "flickohmsford", "flyingg0d", "garaxiel", "goby9",
>> "gymbal", "hideandseek", "hobojr", "ijackportals", "invalidcharactr",
>> "itso9", "j0shs", "jarvis", "jc0mm5", "jencyberchic", "jimbobradyson",
>> "joespr0cket", "jostrander", "jueliet", "karlashi", "khan99",
>> "kingkonn0r", "krispycridder", "kritickalmass", "lawgiver", "maxcorbett",
>> "memory556", "meta000x", "minkovsky", "mistylady", "mstephans",
>> "mstrinity", "nocarryr", "ollietronic", "philistine11", "pickledpickles",
>> "piercingsbykris", "poisonivy", "raugmor", "remarks999", "rheds77",
>> "rhinz", "rigiritter", "robbie0017", "rohdef", "ryoziya", "s4n1ty",
>> "sacredcow133", "samwill", "sgtlemonpepper", "sivan", "spline9",
>> "starwolf", "stueliueli", "sweetiris", "swift2plunder", "swissphoenix",
>> "synyck", "test", "therug", "tinja551", "trulyjuan", "twinster",
>> "vairis", "vinylz3ro", "watervirus", "xaeth", "yagamiyukari",
>> "zafo", "zexium")), .Names = c("id", "name"), class = c("data.table",
>> "data.frame"), row.names = c(NA, -102L))
>>
>> I need to replace this regex pattern in df1 :
>> (?<=<@)[^|]{9}(?=>|) by its corresponding name from df2.
>>
>> E.g : if <@U03KH8Z52> is found in df1, then I want to replace it by
>> the "name" which correspond to this id in df2., in

Re: [R] Sorting Surv objects

2015-02-12 Thread Prof Brian Ripley

On 12/02/2015 16:26, Professor Bickis wrote:

It seems that Surv objects do not sort correctly.   This seems to be a bug.  
Anyone else found this?


This is presumably about Surv() from package survival, not mentioned.

There was a bug, corrected in R-devel (and I will port to R-patched
before 3.1.3).

However, sorting censored survival events is a matter of definition (in 
?xtfrm but cross-referenced from ?sort) and the definition chosen is not 
that of lifetimes (as deaths at T sort after those alive at T and so 
lived longer).



survival.data

[1] 4+ 3  1+ 2  5+


Please follow the posting guide and give a reproducible example.

library(survival)
d <- Surv(c(2,1,4,3,5), c(1,0,1,0,1))

> d
[1] 2  1+ 4  3+ 5
> sort(d)
[1] 1+ 2  3+ 4  5

in R-devel.  But

> sort(Surv(c(2,2,4,3,5), c(1,0,1,0,1)))
[1] 2+ 2  3+ 4  5


class(survival.data)

[1] "Surv"

sort(survival.data)

[1] 2  1+ 4+ 3  5+

An easy work-around is to define a function sort.Surv

sort.Surv<-function(a){ord<-order(a[,1])
+ a[ord]}


sort(survival.data)

[1] 1+ 2  3  4+ 5+

I am using R 3.1.2 GUI 1.65 Mavericks build (6833) running under Yosemite.




--
Brian D. Ripley,  rip...@stats.ox.ac.uk
Emeritus Professor of Applied Statistics, University of Oxford
1 South Parks Road, Oxford OX1 3TG, UK

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


[R] Sorting Surv objects

2015-02-12 Thread Professor Bickis
It seems that Surv objects do not sort correctly.   This seems to be a bug.  
Anyone else found this?

>survival.data
[1] 4+ 3  1+ 2  5+
>class(survival.data)
[1] "Surv"
>sort(survival.data)
[1] 2  1+ 4+ 3  5+

An easy work-around is to define a function sort.Surv

>sort.Surv<-function(a){ord<-order(a[,1]); a[ord]}
>sort(survival.data)
[1] 1+ 2  3  4+ 5+

I am using R 3.1.2 GUI 1.65 Mavericks build (6833) running under Yosemite.

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


Re: [R] SIMPLE question

2015-02-12 Thread JS Huang
Hi, 

  Maybe the following link helps.

http://r.789695.n4.nabble.com/box-cox-td4363944.html




--
View this message in context: 
http://r.789695.n4.nabble.com/SIMPLE-question-tp4703176p4703180.html
Sent from the R help mailing list archive at Nabble.com.

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


Re: [R] Installing RStudio

2015-02-12 Thread Robert Baer


On 2/12/2015 10:22 AM, John Sorkin wrote:

Windows 7, 64-bit.
  
I am trying to install RStudio. Before installing RStudio, I installed R 3.1.2. During the installation or R, I installled (as per the default) 32- and 64-bit packages. When I tried to install RStudio, I received the message

R does not appear to be installed. Please install R before using RStudio.
I know R is installed, beacuse I am able to run R.
Can anyone suggest what I can do to get RStudio installed?
Thank you
John
  
Tools > Global opetions > general, and fill in the top box to point the 
top line at the Installed version of R you wish to use. Usually, it will 
do a pretty good job of finding it on its own, but you can always adjust 
you version to suit here.


Rob



John David Sorkin M.D., Ph.D.
Professor of Medicine
Chief, Biostatistics and Informatics
University of Maryland School of Medicine Division of Gerontology and Geriatric 
Medicine
Baltimore VA Medical Center
10 North Greene Street
GRECC (BT/18/GR)
Baltimore, MD 21201-1524
(Phone) 410-605-7119
(Fax) 410-605-7913 (Please call phone number above prior to faxing)

Confidentiality Statement:
This email message, including any attachments, is for ...{{dropped:18}}


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


Re: [R] suggestion for optimal plotting to show significant differences

2015-02-12 Thread Richard M. Heiberger
## The next step is to think of this in the analysis of covariance setting.

## this example is based on

library(HH)

demo("ancova", package="HH", ask=FALSE)

item<-rep(letters[1:8], each=18)
day<-rep((0:5)*100, 24)
set<-rep(rep(1:3, each=6), 8)
test<-data.frame(item, day, set)
set.seed(111)
test$value<-(test$day/100+1)+rnorm(144)
test$value<-test$value+(as.numeric(test$item)*1.3)
test$dayf <- factor(test$day)


Fitalphabeta <- aov(value ~ day, data=test)
AB <- xyplot(value ~ day | item, data=test, layout=c(8,1),
scales=list(alternating=1),
 main="regression, ignoring item\ncommon slope, common intercept") +
   layer(panel.abline(coef(Fitalphabeta)))
AB

Fitalphabeta0 <- aov(value ~ 0 + item, data=test)
AB0 <- xyplot(value ~ day | item, data=test, layout=c(8,1),
scales=list(alternating=1),
  main="anova, ignoring day\nzero slope, variable intercept") +
layer(panel.abline(a=coef(Fitalphabeta0)[panel.number()], b=0))
AB0

Fitalphaibeta <- aov(value ~ 0 + item + day, data=test)
AiB <- xyplot(value ~ day | item, data=test, layout=c(8,1),
scales=list(alternating=1),
  main="ancova\ncommon slope, variable intercept") +

layer(panel.abline(a=coef(Fitalphaibeta)[panel.number()],
b=rev(coef(Fitalphaibeta))[1]))
AiB

Fitalphaibetaj <- aov(value ~ 0 + item / day, data=test)
AiBj <- xyplot(value ~ day | item, data=test, layout=c(8,1),
scales=list(alternating=1),
   main="ancova with interaction\nvariable slope, variable
intercept") +

layer(panel.abline(a=coef(Fitalphaibetaj)[panel.number()],
b=coef(Fitalphaibetaj)[8 + panel.number()]))
AiBj

## this is very tight on the standard 7x7 plotting surface.
## it will look ok with 10in wide and 7in high
## pdf("AB2x2.pdf", height=7, width=10)
print(AB,   split=c(1, 1, 2, 2), more=TRUE)
print(AB0,  split=c(1, 2, 2, 2), more=TRUE)
print(AiB,  split=c(2, 1, 2, 2), more=TRUE)
print(AiBj, split=c(2, 2, 2, 2), more=FALSE)
## dev.off()

## this arrangement matches the arrangement in demo("ancova")
## this too is very tight on the standard 7x7 plotting surface.
## it will look ok with 10in wide and 10in high
## pdf("AB2x3.pdf", height=10, width=10)
print(AB,   split=c(1, 2, 2, 3), more=TRUE)
print(AB0,  split=c(2, 3, 2, 3), more=TRUE)
print(AiB,  split=c(2, 2, 2, 3), more=TRUE)
print(AiBj, split=c(2, 1, 2, 3), more=FALSE)
## dev.off()


On Thu, Feb 12, 2015 at 9:48 AM, PIKAL Petr  wrote:
> Hi Rich
>
>> -Original Message-
>> From: Richard M. Heiberger [mailto:r...@temple.edu]
>> Sent: Wednesday, February 11, 2015 10:53 PM
>> To: PIKAL Petr
>> Cc: r-help@r-project.org
>> Subject: Re: [R] suggestion for optimal plotting to show significant
>> differences
>>
>> Petr,
>>
>> My first attempt is to use the simple=TRUE argument to interaction2wt.
>>
>> Then the bwplots in the item|item panel show the behavior of value over
>> day for each item.  You get a plot similar to this panel with the
>> growth curve plots from nlme, for example,
>> bwplot(value ~ day | item, data=test, horizontal=FALSE) I am
>> treating set as a replication and each box is cumulated over the three
>> sets.
>
> Yes, that is the point - set is actually replication of result.
>
>>
>> My analysis question is about day.  You have it as numeric.  My
>> inclination would be to make day factor.  Then you could model the
>> interaction of day and item.
>
> Hm. I hoped I can do
>
> fit<-lm(value~day*item, data=test)
> summary(fit)
>
> in which case I can compare differences in intercepts and/or slopes for each 
> item.
>
> However I am rather lost in aov
>
> test$dayf <- factor(test$day)
>
> fit1 <- aov(value~item+dayf, data=test)
> summary(fit)
> fit2 <- aov(value~item/dayf, data=test)
> summary(fit)
> and
> fit3 <- aov(value~item*dayf, data=test)
> summary(fit)
> which gives bascally the same result as fit2
>
>> anova(fit1, fit2)
> Analysis of Variance Table
>
> Model 1: value ~ item + dayf
> Model 2: value ~ item/dayf
>   Res.DfRSS Df Sum of Sq  F Pr(>F)
> 1131 160.59
> 2 96 128.60 3531.993 0.6824 0.8993
>
> TukeyHSD(fit1, which="item")
> TukeyHSD(fit2, which="item")
>
> Both models seems to give quite similar results and I am not sure what 
> actually differs in those models. I believe that model2 tests each item 
> within particular day (but I am not sure about it).
>
> However this discussion is probably deviating more to the statistics issue 
> than to R itself.
>
> I just thought that somebody helps me with a method for comparison of item 
> performance in case that relation of value to day is not simple linear (as in 
> my example) and cannot be expressed by some formula (like examples in nlme).
>
> So far the best options are either your bwplot or my ggplots.
>
> p<-ggplot(test, aes(x=day, y=value, colour=item))
> p+geom_point()+stat_smooth(method="lm", formula= y~poly(x,2))
>
> p<-ggplot(test, aes(x=dayf, y=value, colour=item))
> p+geom_boxplot()
>
> p<-ggplot(test, aes(x=item, y=value))
> p+geom_boxplot()+f

Re: [R] read.table with missing data and consecutive delimiters

2015-02-12 Thread MacQueen, Don
To which I will add, you could have tried

  count.fields('test.dat', sep='$' )

which I expect would have given you 3,3,2,3, and hence a pointer to where
the problem is.

count.fields is mentioned in the "See Also" section of ?read.table

-- 
Don MacQueen

Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062





On 2/11/15, 12:34 PM, "Rui Barradas"  wrote:

>Hello,
>
>You're missing a dollar sign: 2$$$5, not 2$$5.
>
>Hope this helps,
>
>Rui Barradas
>
>Em 11-02-2015 14:53, Tim Victor escreveu:
>> All,
>>
>> Assume we have data in an ASCII file that looks like
>>
>> Var1$Var2$Var3$Var4
>> 1$2$3$4
>> 2$$5
>> $$$6
>>
>> When I execute
>>
>> read.table( 'test.dat', header=TRUE, sep='$' )
>>
>> I, of course, receive the following error:
>>
>> Error in scan(file, what, nmax, sep, dec, quote, skip, nlines,
>>na.strings,
>>   :
>>line 2 did not have 4 elements
>>
>> When I set fill=TRUE, e.g., read.table( 'test.dat', header=TRUE,
>>sep='$',
>> fill=TRUE )
>>
>> I get:
>>
>>Var1 Var2 Var3 Var4
>> 11234
>> 22   NA5   NA
>> 3   NA   NA   NA6
>>
>>
>> What I need is
>>
>>Var1 Var2 Var3 Var4
>> 11234
>> 22   NA   NA5
>> 3   NA   NA   NA6
>>
>> What am I missing?
>>
>> Thanks,
>>
>> Tim
>>
>>  [[alternative HTML version deleted]]
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>>http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>__
>R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>https://stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide
>http://www.R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.

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


Re: [R] 32bit R303 calls external C functions

2015-02-12 Thread Uwe Ligges



On 12.02.2015 19:07, Li, Yan wrote:

I meant R3.0.3. I need this package working in R3.0.3.

I have 32bit and 64bit dlls both included in the package.


So it should be fine. Maybe you compiled it for a different R version or 
on another OS


Best,
Uwe Ligges





-Original Message-
From: Duncan Murdoch [mailto:murdoch.dun...@gmail.com]
Sent: Thursday, February 12, 2015 1:01 PM
To: Li, Yan; r-help@r-project.org
Subject: Re: [R] 32bit R303 calls external C functions

On 12/02/2015 11:08 AM, Li, Yan wrote:

Dear All,

I build a R package which will need to call external C functions. I registered 
the C functions in the NAMESPACE file and include 32bit and 64bit dlls in the 
packages. If I load the package in 64bit R and calls the external C functions, 
it works fine. However if I load the package in 32bit R and call the external C 
functions, it either does not work properly or gives back error message saying 
cannot find the external C functions.

When I built the same package in R2.15.1, there is no such issue.

I checked the update news for R303 and found most .C is replaced by .Call. I 
modified the code but the package cannot be loaded and R ended abnormally.

Does anyone know if there any difference of 32bit R303 calling external C from 
64bitR303? Thank you!


There's no R303; the current version is 3.1.2.  So if you meant 3.0.3, I'd 
suggest upgrading.  If you meant something else, you're probably in the wrong 
place.

For 3.1.2, there are big differences:  32 bit R can't call 64 bit .dlls
and vice versa.   You can either install the package from source in both
versions, or arrange to compile both 32 bit and 64 bit dlls, in which case both 
versions can use the binary of the package.

If you've already done all that, then you'll need to give more details, e.g. 
access to the source for the package, to get more specific help.

Duncan Murdoch

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



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


Re: [R] Censoring in R2OpenBUGS

2015-02-12 Thread Uwe Ligges

On 12.02.2015 16:05, arnabkm2007 wrote:

Hi,

I am trying to run the following model for OpenBUGS and want to use
R2OpenBUGS package. The model specifies weibull distribution for censored
data.


   weibull.model <- function()
   {

 for(i in 1:n)
 {

   exp.alpha[i] ~ dgamma(a.alpha, b.alpha)
   alpha[i] <- log(exp.alpha[i])

   linear.part[i] <- alpha[i] + inprod(nu[ ], x[i, ])
   lambda[i] <- exp(linear.part[i])

   time[i] ~ (dweib(shape, lambda[i]) C(censored.time[i], ))

 }

 shape ~ dgamma(a.shape, b.shape)

 for(j in 1:p)
 {

   beta[j]  ~ dnorm(prior.mean, prior.tau)
   gamma[j] ~ dbern(pi[j])
   pi[j]~ dbeta(1, 1)
   nu[j]   <- beta[j] * gamma[j]

 }

   }



But R is throwing the following error.

Error: unexpected symbol in:
"
   time[i] ~ (dweib(shape, lambda[i]) C"

Any help regarding this will be appreciated.


See ?write.model:

"As a difference, BUGS syntax allows truncation specification like this: 
dnorm(...) I(...) but this is illegal in R. To overcome this 
incompatibility, use dummy operator %_% before I(...): dnorm(...) %_% 
I(...). The dummy operator %_% will be removed before the BUGS code is 
saved."


Best,
Uwe Ligges






Thanks & Regards,
Arnab


Arnab Kumar Maity
Graduate Teaching Assistant
Division of Statistics
Northern Illinois University
DeKalb, IL 60115
Email: ma...@math.niu.edu
Ph: 779-777-3428



--
View this message in context: 
http://r.789695.n4.nabble.com/Censoring-in-R2OpenBUGS-tp4703160.html
Sent from the R help mailing list archive at Nabble.com.

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



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


Re: [R] How to subset data, by sorting names alphabetically.

2015-02-12 Thread Greg Snow
The split function does essentially this, but puts the results into a list
rather than using the dangerous and messy assign function.  The overall
syntax is simpler as well.

On Thu, Feb 12, 2015 at 3:14 AM, Jim Lemon  wrote:

> Hi Samarvir,
> Assuming that you want to generate a separate data frame for each
> value of "Name",
>
> # name of initial data frame is ssdf
> for(nameval in unique(ssdf$Name)) assign(nameval,ssdf[ssdf$Name==nameval,])
>
> This will produce as many data frames as there are unique values of
> ssdf$Name, each named by the values it contains.
>
> Jim
>
>
> On Thu, Feb 12, 2015 at 3:57 PM, samarvir singh 
> wrote:
> > hello,
> >
> > I am cleaning some large data with 4 million observation and 7 variable.
> > Of the 7 variables , 1 is name/string
> >
> > I want to subset data, which have same name
> >
> > Example-
> >
> >  Name var1 var2 var3 var4 var5 var6
> > aa-   -   - - --
> > ab
> > bd
> > ac
> > ad
> > af
> > ba
> > bd
> > aa
> > av
> >
> > i want to sort the data something like this
> >
> > aa
> > aa
> > all aa in a same subset
> >
> > and all ab in same subset
> >
> > every column with same name in a subset
> >
> >
> >
> > thanks in advance.
> > I am new to R community.
> > appreciate your help
> > - Samarvir
> >
> > [[alternative HTML version deleted]]
> >
> > __
> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> > https://stat.ethz.ch/mailman/listinfo/r-help
> > PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> > and provide commented, minimal, self-contained, reproducible code.
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

[[alternative HTML version deleted]]

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


Re: [R] horizontal bar plots for CI visualization

2015-02-12 Thread Ben Bolker
  agroscope.admin.ch> writes:

> 
>   2.50%   97.50%
> intercept 29787966
> glands13143611
> damage169 6144
> treatment L1  778 6703
> treatment L4  -3899   5125
> Length-1817   1828
> 

  plotrix::plotCI(..., err="x") 

??

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


Re: [R] How to subset data, by sorting names alphabetically.

2015-02-12 Thread Leandro Roser
Hi, a solution could be:

# example matrix a:
a <- matrix(1:100, 10, 10)
a[, 1] <- (sample(c("aa","bb" , "ab"), 10,  rep=TRUE))
a <- a[order(a[, 1]), ]  # order the matrix by row = 1


#subsetting a:

lev <- levels(as.factor(a[, 1]))
subs <- list()
for(i in 1:length(lev)) {
subs[[i]]  <- a[a[, 1] %in% lev[i], ]
}

#result:
subs


## an alternative, with column 1 as name of list:

# example matrix a:
a <- matrix(1:100, 10, 10)
a[, 1] <- (sample(c("aa","bb" , "ab"), 10,  rep=TRUE))
a <- a[order(a[, 1]), ]  # order the matrix by row = 1

lev <- levels(as.factor(a[, 1]))
subs <- list()
for(i in 1:length(lev)) {
subs[[i]]  <- a[a[, 1] %in% lev[i], -1]
}
names(subs) <- lev

#result:
subs

2015-02-12 19:20 GMT-03:00 Greg Snow <538...@gmail.com>:
> The split function does essentially this, but puts the results into a list
> rather than using the dangerous and messy assign function.  The overall
> syntax is simpler as well.
>
> On Thu, Feb 12, 2015 at 3:14 AM, Jim Lemon  wrote:
>
>> Hi Samarvir,
>> Assuming that you want to generate a separate data frame for each
>> value of "Name",
>>
>> # name of initial data frame is ssdf
>> for(nameval in unique(ssdf$Name)) assign(nameval,ssdf[ssdf$Name==nameval,])
>>
>> This will produce as many data frames as there are unique values of
>> ssdf$Name, each named by the values it contains.
>>
>> Jim
>>
>>
>> On Thu, Feb 12, 2015 at 3:57 PM, samarvir singh 
>> wrote:
>> > hello,
>> >
>> > I am cleaning some large data with 4 million observation and 7 variable.
>> > Of the 7 variables , 1 is name/string
>> >
>> > I want to subset data, which have same name
>> >
>> > Example-
>> >
>> >  Name var1 var2 var3 var4 var5 var6
>> > aa-   -   - - --
>> > ab
>> > bd
>> > ac
>> > ad
>> > af
>> > ba
>> > bd
>> > aa
>> > av
>> >
>> > i want to sort the data something like this
>> >
>> > aa
>> > aa
>> > all aa in a same subset
>> >
>> > and all ab in same subset
>> >
>> > every column with same name in a subset
>> >
>> >
>> >
>> > thanks in advance.
>> > I am new to R community.
>> > appreciate your help
>> > - Samarvir
>> >
>> > [[alternative HTML version deleted]]
>> >
>> > __
>> > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> > https://stat.ethz.ch/mailman/listinfo/r-help
>> > PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> > and provide commented, minimal, self-contained, reproducible code.
>>
>> __
>> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
>> https://stat.ethz.ch/mailman/listinfo/r-help
>> PLEASE do read the posting guide
>> http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>
>
>
>
> --
> Gregory (Greg) L. Snow Ph.D.
> 538...@gmail.com
>
> [[alternative HTML version deleted]]
>
> __
> R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.



-- 
Lic. Leandro Gabriel Roser
 Laboratorio de Genética
 Dto. de Ecología, Genética y Evolución,
 F.C.E.N., U.B.A.,
 Ciudad Universitaria, PB II, 4to piso,
 Nuñez, Cdad. Autónoma de Buenos Aires,
 Argentina.
 tel ++54 +11 4576-3300 (ext 219)
 fax ++54 +11 4576-3384

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