Re: [R] POSIXct bug for conversion of specific combinations of date and time

2013-08-25 Thread Jeff Newmiller
There have been a couple of threads recently on proper usage of POSIXct. I suggest you read the archives. After you read the archives: In your case, you don't seem to have zone offset data in your time info, so you probably need to use Sys.setenv to set an appropriate default time zone. The NA

Re: [R] If else loop problem: the condition has length > 1 and only the first element will be used

2013-08-25 Thread arun
HI, It may be better to provide an example dataset using ?dput(). dput(head(dataset),20) Try: signal3<- ifelse(t.tr=="Pst 24", signal2-17.29, ifelse(t.tr=="Pst 48", signal2 - 43.93256, etc.)) A.K. - Original Message - From: "Fethe, Michael" To: "r-help@r-project.org" Cc: Sent:

Re: [R] POSIXct bug for conversion of specific combinations of date and time

2013-08-25 Thread arun
Hi, Could you try:  time<-data.frame(date,hour,stringsAsFactors=FALSE)  time$convert<-as.POSIXct(paste(time[,1],time[,2]),format="%Y/%m/%d  %H:%M:%S") head(time) #    date hour convert #1 2012/10/21 00:02:38 2012-10-21 00:02:38 #2 2012/10/21 00:11:05 2012-10-21 00:11:05 #3 2012/

Re: [R] POSIXct bug for conversion of specific combinations of date and time

2013-08-25 Thread arun
HI, Couldn't reproduce the problem.  I am using R 3.0.1. time$convert<-as.POSIXct(paste(time[,1],time[,2]),format="%Y/%m/%d %H:%M:%S")  time date hour convert 1  2012/10/21 00:02:38 2012-10-21 00:02:38 2  2012/10/21 00:11:05 2012-10-21 00:11:05 3  2012/10/21 00:19:33 201

Re: [R] hide unused labels and resize panels in lattice barchart

2013-08-25 Thread Noah Hoffman
Hi Duncan, Thanks for the reply - my apologies: my example data set was definitely overly complex, and the labels too abstract. I'd really like to provide labels for the assignments on the axis ("species" in the new example below), and I'm not sure how I could accomplish this using your approach.

[R] If else loop problem: the condition has length > 1 and only the first element will be used

2013-08-25 Thread Fethe, Michael
Hi all, I'm running an if else loop to normalize my data to a known control. I have calculated values that need to be subtracted from each treatment applied. I'm trying this within a for loop with if and else commands to apply to correct subtraction. This is done as follows: attach(data.2013)

[R] centering text across panels of an annotated lattice figure

2013-08-25 Thread John G. Bullock
I have a multi-panel lattice figure. It has an even number of equal-width columns. I would like to center text across the columns. The xlab argument often handles this job nicely. But I want a more flexible solution. (I have many strings and want to position them at different heights, but alwa

[R] POSIXct bug for conversion of specific combinations of date and time

2013-08-25 Thread Carlos André Zucco
Hello everyone, I'm having a big trouble with which seems to be a bug in as.POSIXct() date-time conversion. I have massive GPS datasets in which each location has it's own date and time attribute. As I convert them to POSIXct format, 1300 cases (of about half a million locations) simply return NA

[R] Get Index of variables from stepAIC

2013-08-25 Thread Sachinthaka Abeywardana
I am regressing a gene on another gene subset. Then I use stepAIC to reduce the number of explanatory genes. How do I get the index of the NON-omitted variables, so that I could analyse them? gene_subset=c(y=genes[,i], genes[,other_genes]); reduced_model=stepAIC(y~.,data=gene_subset,trace=

[R] Analogues to my data and prediction problem

2013-08-25 Thread Ben Harrison
Hello, I am quite a novice when it comes to predictive modelling, so would like to see where my particular problem might lie in the spectrum of problems that you collectively have seen in your experiences. Background: I have been handed a piece of software that uses a kohonen SOM network to an

Re: [R] Partial correlation test

2013-08-25 Thread Jeff Newmiller
Please don't cross post [1]. Please post minimal example data only. You should not be trying to (or appearing to) use us to get your work done. [1] http://www.r-project.org/mail.html --- Jeff Newmiller

[R] Partial correlation test

2013-08-25 Thread Moshiur Rahman
Dear all, I'm writing my manuscript to publish after analysis my final data with ANOVA, ANCOVA, MANCOVA. In a section of my result, I did correlation of my data (2 categirical factors with 2 levels: Quantity & Quality; 2 dependent var: Irid.area & Casa.PC1, and 1 co-var: SL). But as some traits (h

Re: [R] Sorting data

2013-08-25 Thread arun
Hi, It's not clear what you really wanted.  May be this helps: dat1<- read.table(text="   V1 V2 V3 V4 V5 V6 V7 V8 V9 V10 V11 V12 V13 V14 V15 V16 V17 V18 V19 V20   V21 V22 V23 V24 V25 V26 1 1  1  3  1 NA NA  1 NA NA   1   2   7   5   3   2 1.0  15  17   5   1    NA   1   2  19   1   1 2

Re: [R] lags of a variable, with a factor

2013-08-25 Thread Jim Lemon
On 08/24/2013 08:25 PM, Jim Lemon wrote: > ... Oops, very bad editing of the function in the email - this should work: lags <- function(x, k=1, prefix='lag', by) { if(missing(by)) { n <- length(x) res <- data.frame(lag0=x) for (i in 1:k) { res <- cbind(res, c(rep(NA, i), x[1:(n-i)]))

Re: [R] Time axis formatting.

2013-08-25 Thread Jim Lemon
On 08/26/2013 01:09 AM, Sudheer Joseph wrote: Attached is a plot with a time series. If I have a time series object in R. How do I get the plot in the attached format of time axis?. When I issue plot(ts) I get a time series plot with tic only for years. Hi Sudheer, If your problem is similar t

Re: [R] Time axis formatting.

2013-08-25 Thread jim holtman
Forgot the year on the plot: n <- 100 x <- data.frame(time = seq(from = as.Date('2010-1-1') , to = as.Date('2012-1-1') , length = n ) , val = runif(n) ) plot(x$time, x$val, type = 'l', main = 'Default') # now

Re: [R] Time axis formatting.

2013-08-25 Thread jim holtman
Try this: n <- 100 x <- data.frame(time = seq(from = as.Date('2010-1-1') , to = as.Date('2012-1-1') , length = n ) , val = runif(n) ) plot(x$time, x$val, type = 'l', main = 'Default') # now plot with your own

[R] Incorporating a dataset only package

2013-08-25 Thread Tyler Rinker
Greetings R Community, I am attempting to make sure a parent package passes all CRAN checks for the dev version (R Under development (unstable) (2013-08-24 r63687) -- "Unsuffered Consequences").  The parent package I'm compiling relies on another package that is purely a dataset package as reco

[R] (no subject)

2013-08-25 Thread Tyler Rinker
Greeting R Community, Greetings R Community, I am attempting to make sure a parent package passes all CRAN checks for the dev version (R Under development (unstable) (2013-08-24 r63687) -- "Unsuffered Consequences").  The parent package I'm compiling relies on another package that is purely a

Re: [R] Installing package from website

2013-08-25 Thread Prof Brian Ripley
On 25/08/2013 18:55, Christofer Bogaso wrote: Hello again, I need to install Rmpi package from this http://www.stats.uwo.ca/faculty/yu/Rmpi/download/windows/MPICH2 I was wondering if there is any direct way to install this in R. The No, because it is not a proper R repository. In particular,

[R] Installing package from website

2013-08-25 Thread Christofer Bogaso
Hello again, I need to install Rmpi package from this http://www.stats.uwo.ca/faculty/yu/Rmpi/download/windows/MPICH2 I was wondering if there is any direct way to install this in R. The trivial method would obviously be download and save the required zip file in the local disk and install it fro

[R] caTools AUC different between mutli-class and subset binary

2013-08-25 Thread Charles Determan Jr
Greetings, This is more of an explanation question but I was using the colAUC function on the iris dataset and everything works smoothly. This provides the AUC for each pairwise comparison. I decided to do the actual subset for one of the comparisons and the numbers are different (.9326 v. .9152

Re: [R] sbusetting data by rows (every 69 rows)

2013-08-25 Thread arun
#or you could try:  lst2<- split(dat1,as.numeric(gl(69,69,2000))) # identical(lst1,lst2) #[1] TRUE A.K. - Original Message - From: arun To: R help Cc: Sent: Sunday, August 25, 2013 1:17 PM Subject: Re: sbusetting data by rows (every 69 rows) Hi, Try: set.seed(24) dat1<- as.data.f

Re: [R] Time axis formatting.

2013-08-25 Thread jim holtman
There was not attached plot or data. Plot without the x-axis (probably xaxt = 'n') and then use "axis" to create your own ticks. It would be helpful if you had supplied data using 'dput'. On Sun, Aug 25, 2013 at 11:09 AM, Sudheer Joseph wrote: > Attached is a plot with a time series. If I hav

Re: [R] From POSIXct to numeric and back with time zone

2013-08-25 Thread Spencer Graves
On 8/25/2013 8:42 AM, Jeff Newmiller wrote: That is only useful when converting numeric seconds to POSIXct, which I avoid doing if at all possible. This discussion is about converting datetime strings to POSIXct. Thanks. Please excuse me for jumping in the middle without reading the

Re: [R] Capturing the whole output using R

2013-08-25 Thread raishilpa
Thank yos so muchIt helped a lot :) On Sun, Aug 25, 2013 at 8:18 AM, arun kirshna [via R] < ml-node+s789695n4674468...@n4.nabble.com> wrote: > Hi, > > May be this helps: > #Creating some dummy data. > > set.seed(24) > lst1<-lapply(1:8,function(x) ts(sample(1:25,20,replace=TRUE))) > set.seed(

[R] Time axis formatting.

2013-08-25 Thread Sudheer Joseph
Attached is a plot with a time series. If I have a time series object in R. How do I get the plot in the attached format of time axis?. When I issue plot(ts) I get a time series plot with tic only for years. -- with best regards Sudheer *

Re: [R] Divide the data into sub data on a particular condition

2013-08-25 Thread raishilpa
thank you so much :) On Sun, Aug 25, 2013 at 7:48 AM, arun kirshna [via R] < ml-node+s789695n4674466...@n4.nabble.com> wrote: > > > Hi, > Try this: > > sapply(lst1,function(x) with(x,cor(CF,OSA))) > # 2231 2232 2233 > #-0.9607689 -1.000 0.9973233 > #or > library(plyr) > dd

Re: [R] hide unused labels and resize panels in lattice barchart

2013-08-25 Thread Duncan Mackay
Hi Noah All the categories have masked what is going on. I coverted some columns to factors and replotted tab$Label <- sapply(tab$label, pmatch, sort(unique(as.character(tab$label tab$Assign <- as.numeric(sub("[^0-9]+","",as.character(tab$assignment))) To get a look try xyplot(freq ~ Assig

Re: [R] From POSIXct to numeric and back with time zone

2013-08-25 Thread Jeff Newmiller
That is only useful when converting numeric seconds to POSIXct, which I avoid doing if at all possible. This discussion is about converting datetime strings to POSIXct. --- Jeff NewmillerThe .

Re: [R] EdgeR annotation

2013-08-25 Thread Martin Morgan
On 08/24/2013 04:50 AM, Robin Mjelle wrote: after updating R and edgeR I lost the annotations in the final Diff.Expressed matrix (toptags) when running the edgeR pipeline. How do I get the row.names from the data matrix into the topTag-matrix? data <- read.table("KO_and_WT_Summary_miRNA_Expressi

Re: [R] From POSIXct to numeric and back with time zone

2013-08-25 Thread David Winsemius
Thanks for those tips, Spencer. Will look at the code. That behavior is what I would have expected in my naïveté . -- David. Sent from my iPhone On Aug 25, 2013, at 7:56 AM, Spencer Graves wrote: > Is as.POSIXct1970{fda} useful here? That provides 1970-01-01 as the origin > for as.POSIXct.

Re: [R] how to combine apply and which or alternative ways to, do so

2013-08-25 Thread Gerrit Draisma
Ha Guillaume, Is this what you are looking for? #--- x1<-sample(1:10,5,replace=FALSE) x2<-sample(1:10,100,replace=TRUE) #This tapply(x1,1:5,FUN=function(i){which(x2==i)}) #or this tapply(x1,x1,FUN=function(i){which(x2==i)}) #--- Gerrit ___

Re: [R] fitted

2013-08-25 Thread David Winsemius
If by fitted values corresponding to each predictor you mean the regression coefficients , then use coef(ft) -- David. Sent from my iPhone On Aug 24, 2013, at 6:43 AM, alR wrote: > I have fitted a multiple regression model to the row of a matrix using lm: > > ft<-lm(datos[i, ]-r1 + r2+ r3

Re: [R] RCurl cookiejar

2013-08-25 Thread Hadley Wickham
Hi Earl, Have you read the libCurl documentation for CURLOPT_COOKIEJAR? : Pass a file name as char *, zero terminated. This will make libcurl write all internally known cookies to the specified file when curl_easy_cleanup(3)is called. If no cookies are known, no file will be created. Specify "-"

Re: [R] From POSIXct to numeric and back with time zone

2013-08-25 Thread Spencer Graves
Is as.POSIXct1970{fda} useful here? That provides 1970-01-01 as the origin for as.POSIXct.numeric. Spencer p.s. as.Date1970{Ecdat} does the same for as.Date.numeric. On 8/25/2013 7:35 AM, Jeff Newmiller wrote: If the data you are reading contains timestamp information from multiple time zon

Re: [R] From POSIXct to numeric and back with time zone

2013-08-25 Thread Jeff Newmiller
If the data you are reading contains timestamp information from multiple time zones in one field, then each time value needs to specify its own time offset. In most cases I encounter, each data set corresponds to it's own time zone. For importing the latter, using Sys.setenv() with a supported (

Re: [R] Selection of regressors

2013-08-25 Thread Adams, Jean
Note that this message is cross-posted in cross-validated ... http://stats.stackexchange.com/questions/68250/selection-of-regressors Jean On Sat, Aug 24, 2013 at 11:48 AM, beginner wrote: > I have a question about the package leaps which I am using for model > selection. > > I would like to co

[R] "block incomplete" error when compiling R

2013-08-25 Thread Kaiyin Zhong (Victor Chung)
Dear list, I am trying to compile R on a 64-bit Ubuntu 13.04 machine and get the following error: make[2]: Entering directory `/home/kaiyin/opt/R-2.15.0/src/library/Recommended' begin installing recommended package MASS Error in untar2(tarfile, files, list, exdir) : incomplete block on file make[

Re: [R] how to apply summation sign formula to R

2013-08-25 Thread Berend Hasselman
On 25-08-2013, at 08:45, Prof Brian Ripley wrote: > On 25/08/2013 06:12, Berend Hasselman wrote: >> >> On 24-08-2013, at 23:13, Sebastian Hersberger >> wrote: >> >>> Thanks. I restate my problem/question and hope its better understandable >>> now. >>> >>> Let us define A and B as kxk matri

Re: [R] Replace two nested loop with an apply kind of function

2013-08-25 Thread ginan
Dear Professor, thank you very much your suggestion. Yes, the real problem is the speed. I will check and try to understand how to use that R package, although it seems that it requires some knowledge of C++. Thank you very much once again, gul > The only reason to use one of the apply famil

[R] RCurl cookiejar

2013-08-25 Thread Earl Brown
R-helpers, When I use cURL in the Terminal: curl --cookie-jar cookie.txt --url "http://corpusdelespanol.org/x.asp"; --user-agent "Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:16.0) Gecko/20100101 Firefox/23.0" --location --include a cookie file "cookie.txt" is saved to my working directory.