Re: [R] NADA Package install disappearance

2013-05-23 Thread Prof Brian Ripley
On 22/05/2013 21:06, Rich Shepard wrote: On Wed, 22 May 2013, rwillims wrote: I have been using the NADA package to do some statistical analysis, however I have just found that the package is no longer available for install. I've downloaded an older version ( NADA_1.5-4.tar.gz ) and tried to

[R] convert a character string to a name

2013-05-23 Thread jpm miao
Hi, From time to time I need to do the aggregation. To illustrate, I present a toy example as below. In this example, the task is to aggregate x and y by z with the function mean. Could I call the aggregation function with x_test, where x_test=c(x,y)? Thanks Miao

Re: [R] adding rows without loops

2013-05-23 Thread Blaser Nello
Merge should do the trick. How to best use it will depend on what you want to do with the data after. The following is an example of what you could do. This will perform best, if the rows are missing at random and do not cluster. DF1 - data.frame(X.DATE=rep(01052007, 7), X.TIME=c(2:5,7:9)*100,

Re: [R] convert a character string to a name

2013-05-23 Thread arun
 with(dftest,aggregate(cbind(x,y),list(z),FUN=mean)) #  Group.1 x y #1   0 7 1 #2   1 6 2 #or library(plyr) ddply(dftest,.(z),numcolwise(mean)) #  z x y #1 0 7 1 #2 1 6 2 A.K. - Original Message - From: jpm miao miao...@gmail.com To: r-help r-help@r-project.org Cc: Sent:

Re: [R] convert a character string to a name

2013-05-23 Thread Blaser Nello
If you want to use the character string: attach(dftest) aggregate(cbind(sapply(x_test, get))~z, data=dftest, FUN=mean) # or with(dftest,aggregate(cbind(sapply(x_test, get)),list(z),FUN=mean)) detach(dftest) Cheers, Nello -Original Message- From: r-help-boun...@r-project.org

Re: [R] ordered and unordered variables

2013-05-23 Thread PIKAL Petr
Hi Try to put your question on stackexchange. Or maybe it is already answered there. I am not an statistical expert but based on common sense (which can be counter intuitive sometimes) I will use ordered factor if I expect influence of tension value on breaks. Anyway I will probably consult

Re: [R] convert a character string to a name

2013-05-23 Thread jim holtman
try this: dftest-data.frame(x=1:12, y=(1:12)%%4, z=(1:12)%%2) aggregate(cbind(x,y)~z, data=dftest, FUN=mean) z x y 1 0 7 1 2 1 6 2 x_test=c(x,y) a - formula(paste0('cbind(' + , x_test[1] + , ',' + , x_test[2] +

Re: [R] convert a character string to a name

2013-05-23 Thread arun
Sorry, didn't read your question properly #Just a modification without attach():  aggregate(cbind(sapply(x_test,get,dftest))~z,data=dftest,FUN=mean) #  z x y #1 0 7 1 #2 1 6 2 #if you need to aggregate() all the columns except the grouping column  aggregate(.~z,data=dftest,FUN=mean) # z x y #1

[R] Transform Coordinate System of an ASCII-Grid

2013-05-23 Thread jas
Dear all, I have an ASCII-Grid for Switzerland in the Swiss National Coordinate System of CH1903. Now for a Webapplication of the ASCII-Grid, I need to deliver the ASCII-Grid in the WGS84 System. Via coordinates(ascii) I can export the coordinates and convert them with a formula into WGS84. My

Re: [R] using metafor for meta-analysis of before-after studies (escalc, SMCC)

2013-05-23 Thread Viechtbauer Wolfgang (STAT)
The mean percentage change and the raw mean change are not directly comparable, even after standardization based on the SD of the percentage change or raw change values. So, I would not mix those in the same analysis. Best, Wolfgang -Original Message- From: Qiang Yue

[R] Fwd: Merge

2013-05-23 Thread Keniajin Wambui
-- Forwarded message -- From: Keniajin Wambui kiang...@gmail.com Date: Thu, May 23, 2013 at 11:36 AM Subject: Merge To: r-help@r-project.org I am using R 3.01 on R Studio to merge two data sets with approx 120 variables and the other with 140 variables but with a serialno as the

Re: [R] Transform Coordinate System of an ASCII-Grid

2013-05-23 Thread Daisy Englert Duursma
Hello, You question is a bit unclear. Do you just want to change to decimal degrees? Can you please provide an example of your code and include a small example ascii. On Thu, May 23, 2013 at 5:44 PM, jas jacqueline.schwei...@wuestundpartner.com wrote: Dear all, I have an ASCII-Grid for

Re: [R] point.in.polygon help

2013-05-23 Thread Daisy Englert Duursma
It would be useful to know what your ultimate goal is. On Wed, May 22, 2013 at 6:29 AM, karengrace84 kgfis...@alumni.unc.edu wrote: I am new to mapping with R, and I would like to use the point.in.polygon function from the sp package, but I am unsure of how to get my data in the correct format

[R] SEM: multigroup model

2013-05-23 Thread Amarnath Bose
Dear R Gurus, I am trying to run a multigroup SEM using Prof. John Fox's SEM package. The two groups are Ready to Eat denoted by RTE and Ready to Cook denoted by RTC. I ran a omnibus CFA on the data of consumer perceptions preferences and am satisfied with what I

Re: [R] Transform Coordinate System of an ASCII-Grid

2013-05-23 Thread Barry Rowlingson
On Thu, May 23, 2013 at 8:44 AM, jas jacqueline.schwei...@wuestundpartner.com wrote: Dear all, I have an ASCII-Grid for Switzerland in the Swiss National Coordinate System of CH1903. Now for a Webapplication of the ASCII-Grid, I need to deliver the ASCII-Grid in the WGS84 System. Via

Re: [R] SEM: multigroup model

2013-05-23 Thread John Fox
Dear Amarnath Bose, There's nothing obviously wrong with the commands that you report -- in fact, your commands have the same structure as the multigroup SEM example in ?sem -- so the usual advice about including reproducible code producing the error applies. If you like, you could send me your

Re: [R] Transform Coordinate System of an ASCII-Grid

2013-05-23 Thread jas
Hello Berry, thank you for your reply. yes, the flat versus round earth projection is a difficulty, as my grid isn't that far spread out, I thought I would just use the method anyways. I usually use raster or maptools (readAsciiGrid). I am gonna look in to the mapper's forum, thank you for

Re: [R] Fwd: Merge

2013-05-23 Thread Rui Barradas
Hello, Try the following. rm(list = ls()) dat1 - read.table(text = Serialno name year outcome 1 ken1989 d 2 mary 1989a 4 john1989 a 5 tom 1989 a 6 jolly 1989 d , header = TRUE, stringsAsFactors =

Re: [R] adding rows without loops

2013-05-23 Thread Adeel - SafeGreenCapital
Thank you Blaser: This is the exact solution I came up with but when comparing 8M rows even on an 8G machine, one runs out of memory. To run this effectively, I have to break the DF into smaller DFs, loop through them and then do a massive rmerge at the end. That's what takes 8+ hours to

Re: [R] point.in.polygon help

2013-05-23 Thread karengrace84
I am looking at fish tagging data. I have gps coordinates of where each fish was tagged and released, and I have a map of 10 coastal basins of the state of Louisiana. I am trying to determine which basin each fish was tagged in. -- View this message in context:

Re: [R] adding rows...

2013-05-23 Thread Adeel - SafeGreenCapital
Hi Rainer: Thanks for the reply. Posting the large dataset is a task. There are 8M rows between the two of them and the first discrepancy in the data doesn't happen until at least the 40,000th row on each dataframe. The examples I posted are a pretty good abstraction of the root of the issue.

Re: [R] Fwd: Merge

2013-05-23 Thread arun
You could also do: library(plyr) res1-join(dat1,dat2,type=full) res1 #   Serialno    name year outcome disch_type #1 1 ken 1989   d   NA #2 2    mary 1989   a   NA #3 4    john 1989   a   NA #4 5 tom 1989   a   NA #5 6 

Re: [R] using metafor for meta-analysis of before-after studies (escalc, SMCC)

2013-05-23 Thread Qiang Yue
Dear Dr. Viechtbauer: Thanks so much! Now all these issues are clear. With best regards. Qiang Yue From: Viechtbauer Wolfgang (STAT) Date: 2013-05-23 05:06 To: qiangmoon; r-help Subject: RE: RE: [R] using metafor for meta-analysis of before-after studies (escalc, SMCC) The mean

Re: [R] ordered and unordered variables

2013-05-23 Thread Greg Snow
Meng, This really comes down to what question you are trying to answer. Before worrying about details of default contrasts and issues like that you first need to work out what is really the question of interest. The main difference between declaring a variable ordered or not is the default

Re: [R] adding rows without loops

2013-05-23 Thread Rainer Schuermann
Using the data generated with your code below, does rbind( DF1, DF2[ !(DF2$X.TIME %in% DF1$X.TIME), ] ) DF1 - DF1[ order( DF1$X.DATE, DF1$X.TIME ), ] do the job? Rgds, Rainer On Thursday 23 May 2013 05:54:26 Adeel - SafeGreenCapital wrote: Thank you Blaser: This is the exact solution I

Re: [R] convert a character string to a name

2013-05-23 Thread Greg Snow
Here are a couple of approaches: dftest-data.frame(x=1:12, y=(1:12)%%4, z=(1:12)%%2) x_test=c(x,y) aggregate( dftest[,x_test], dftest['z'], FUN=mean ) z x y 1 0 7 1 2 1 6 2 ### Or tmp.f - as.formula( paste( 'cbind(', + paste( x_test, collapse=',' ), + ') ~ z' ) ) aggregate( tmp.f,

[R] Removing rows w/ smaller value from data frame

2013-05-23 Thread ramoss
Hello, I have a column called max_date in my data frame and I only want to keep the bigger values for the same activity. How can I do that? data frame: activitymax_dt A2013-03-05 B 2013-03-28 A 2013-03-28 C 2013-03-28 B 2013-03-01

Re: [R] Removing rows w/ smaller value from data frame

2013-05-23 Thread PIKAL Petr
Hi change max_dt do PISIX class and use standard comparison operator and use the result for selecting rows. s-seq(c(ISOdate(2000,3,20)), by = day, length.out = 10) ss[5] [1] TRUE TRUE TRUE TRUE FALSE FALSE FALSE FALSE FALSE FALSE Regards Petr -Original Message- From:

[R] error message solution: cannot allocate vector of size 200Mb

2013-05-23 Thread Ray Cheung
Dear All, I wrote a program using R 2.15.2 but this error message cannot allocate vector of size 200Mb appeared. I want to ask in general how to handle this situation. I try to run the same program on other computers. It is perfectly fine. Can anybody help? Thank you very much in advance. Best

Re: [R] error message solution: cannot allocate vector of size 200Mb

2013-05-23 Thread Gyanendra Pokharel
Try in R 64 bit. Thanks Gyanendra Pokharel University of Guelph Guelph, ON On Thu, May 23, 2013 at 10:53 AM, Ray Cheung ray1...@gmail.com wrote: Dear All, I wrote a program using R 2.15.2 but this error message cannot allocate vector of size 200Mb appeared. I want to ask in general how to

Re: [R] group data based on row value

2013-05-23 Thread David Carlson
The OP indicated that the middle group should be closed on both ends, i.e. [0.1, 0.6]. dat2 - rbind(dat, 0.1, 0.6) dat2$group - factor(ifelse(dat2$Var.1, A, ifelse(dat2$Var.6, C, B))) dat2 Var group 1 0.0 A 2 0.2 B 3 0.5 B 4 1.0 C 5 4.0 C 6 6.0 C 7 0.1 B 8 0.6

Re: [R] sample(c(0, 1)...) vs. rbinom

2013-05-23 Thread Albyn Jones
After a bit of playing around, I discovered that sample() does something similar in other situations: set.seed(105021) sample(1:5,1,prob=c(1,1,1,1,1)) [1] 3 set.seed(105021) sample(1:5,1) [1] 2 set.seed(105021) sample(1:5,5,prob=c(1,1,1,1,1)) [1] 3 4 2 1 5 set.seed(105021) sample(1:5,5)

[R] Could graph objects be stored in a two-dimensional list?

2013-05-23 Thread jpm miao
Hi, I have a few graph objects created by some graphic package (say, ggplot2, which I use frequently). Because of the existent relation between the graphs, I'd like to index them in two dimensions as p[1,1], p[1,2], p[2,1], p[2,2] for convenience. To my knowledge, the only data type capable

Re: [R] calcul of the mean in a period of time

2013-05-23 Thread arun
HI GG, I should had checked with multiple t=0 only rows. Apologies! Check if this work: (Changed the thread name as the solution applies to that problem) dat2- read.csv(dat6.csv,header=TRUE,sep=\t,row.names=1) str(dat2) #'data.frame':    3896 obs. of  3 variables: # $ patient_id: int  2 2 2 2 2

[R] apply function within different groups

2013-05-23 Thread Estefanía Gómez Galimberti
Hi, I have a very big data frame and I would like to apply a function to one of the columns within different groups  and obtain another dataframe My data frame is like this: group var1 var2 myvar group1 1 a 100 group2 2 b 200 group2 34 c 300 group3 5 d 400 group3 6 e 500 group4 7 f 600

Re: [R] Removing rows w/ smaller value from data frame

2013-05-23 Thread arun
Hi, Try: datNew- read.table(text= activity    max_dt A    2013-03-05 B    2013-03-28 A    2013-03-28 C    2013-03-28 B    2013-03-01 ,sep=,header=TRUE,stringsAsFactors=FALSE) datNew$max_dt- as.Date(datNew$max_dt)  aggregate(max_dt~activity,data=datNew,max) # 

[R] xml newbie

2013-05-23 Thread Alexander Coppock
Dear r-helpers, I am trying to extract quantities of interest from my iTunes library xml file.  For example, i'd like to be able to run a simple regression of playcount on track number, under the theory that tracks near the beginning of albums get played more (either because they are better

[R] Error in png: unable to start png() device

2013-05-23 Thread Ondrej Novak
Hi, I use R 2.14.0 on Win XP Pro SP3 and it behaves same - some times. After I draw a lot of plots (more then 200, 2 concurrent rgui processes running in parallel) to png then I get same error message. Bmp(), jpg(), png() - same error. Restart of Rgui helps nothing. Solutin - restart system and

Re: [R] Removing rows w/ smaller value from data frame

2013-05-23 Thread arun
From your email, it seems like aggregate() is working. Could you please provide the sessionInfo()? My guess is that some other loaded library is masking the summarize(). For example, if I load library(Hmisc) #The following object is masked from ‘package:plyr’: #  #   is.discrete, summarize

Re: [R] apply function within different groups

2013-05-23 Thread arun
Hi, May be this helps: dat1- read.table(text= group var1 var2 myvar group1 1 a 100 group2 2 b 200 group2 34 c 300 group3 5 d 400 group3 6 e 500 group4 7 f 600 ,sep=,header=TRUE,stringsAsFactors=FALSE) library(plyr) ddply(dat1,.(group),summarize, f_myvar=mifunc(myvar)) #   group f_myvar #1

Re: [R] adding rows without loops

2013-05-23 Thread William Dunlap
This is the exact solution I came up with ... exact, really? Is the time-consuming part the initial merge DFm - merge(DF1, DF2, by=c(X.DATE, X.TIME), all=TRUE) or the postprocessing to turn runs of NAs into the last non-NA value in the column while(any(is.na(DFm))){ if

Re: [R] Could graph objects be stored in a two-dimensional list?

2013-05-23 Thread Jeff Newmiller
You could use lists of lists, and index them with vectors. a - list() a[[1]] - list() a[[2]] - list() a[[c(1,1)]] - g11 a[[c(1,2)]] - g12 a[[c(2,1)]] - g21 a[[c(2,2)]] - g22 print(a[[c(2,1)]]) but this seems like an inefficient use of memory because your indexed data is stored more compactly

Re: [R] apply function within different groups

2013-05-23 Thread Estefanía Gómez Galimberti
Thanks a lot!!! It works perkectly! Just one thing, is there a way to preserve my original data frame so i don´t need to join both tables? I could do it with rbind but my original data frame is not in order, so Thanks again! From: arun

[R] FW: Kernel smoothing with bandwidth which varies with x

2013-05-23 Thread IOANNA
Hello all, I would like to use the Nadaraya-Watson estimator assuming a Gaussian kernel: So far I sued the library(sm) library(sm) x-runif(5000) y-rnorm(5000) plot(x,y,col='black') h1-h.select(x,y,method='aicc') lines(ksmooth(x,y,bandwidth=h1)) which works fine. What if my data were clustered

Re: [R] Could graph objects be stored in a two-dimensional list?

2013-05-23 Thread William Dunlap
To my knowledge, the only data type capable of storing graph objects (and any R object) is list, but unfortunately it is available in only one dimension. Could the graphs be stored in any two-dimensional data type? Lists can have any number of dimensions you want, just as with other vector types.

Re: [R] sample(c(0, 1)...) vs. rbinom

2013-05-23 Thread Nordlund, Dan (DSHS/RDA)
-Original Message- From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- project.org] On Behalf Of Albyn Jones Sent: Thursday, May 23, 2013 8:30 AM To: r-help@r-project.org Subject: Re: [R] sample(c(0, 1)...) vs. rbinom After a bit of playing around, I discovered that

Re: [R] apply function within different groups

2013-05-23 Thread arun
Hi, No problem. Try: dat2-within(dat1,f_myvar-ave(myvar,group,FUN=mifunc))  dat2 #   group var1 var2 myvar f_myvar #1 group1    1    a   100  NA #2 group2    2    b   200 299 #3 group2   34    c   300 300 #4 group3    5    d   400 499 #5 group3    6    e   500 500 #6 group4   

Re: [R] apply function within different groups

2013-05-23 Thread arun
Using the previous solution: dat3-mutate(dat1,f_myvar=ddply(dat1,.(group),summarize,f_myvar=mifunc(myvar))[,2]) identical(dat2,dat3) #[1] TRUE A.K. - Original Message - From: arun smartpink...@yahoo.com To: Estefanía Gómez Galimberti tef...@yahoo.com Cc: R help r-help@r-project.org

Re: [R] sample(c(0, 1)...) vs. rbinom

2013-05-23 Thread Albyn Jones
the something similar is return a different result in two situations where one might expect the same result, ie when a probability vector with equal probabilities is supplied versus the default of equal probabilities. And, assuming that by concerns me you mean worries me, I have no clue why you

Re: [R] data frame sum

2013-05-23 Thread arun
Hi, ab- cbind(a,b) indx-duplicated(names(ab))|duplicated(names(ab),fromLast=TRUE) res1-cbind(ab[!indx],v2=rowSums(ab[indx]))  res1[,order(as.numeric(gsub([A-Za-z],,names(res1,] #v1 v2 v3 #1  3  4  5 #Another example: a2- data.frame(v1=c(3,6,7),v2=c(2,4,8))  b2-

[R] strings

2013-05-23 Thread Robin Mjelle
I have two files containing words. I want to print the are in file 1 but NOT in file 2. How do I go about? file 1: ABL1 1 ALKBH1 2 ALKBH2 3 ALKBH3 4ANKRD17 5 APEX1 6 APEX2 7 APTX 8 ASF1A 9 ASTE1 10 ATM 11 ATR 12 ATRIP 13 ATRX 14

Re: [R] strings

2013-05-23 Thread arun
Hi, Try: dat1- structure(list(V2 = c(ALKBH1, ALKBH2, ALKBH3, ANKRD17, APEX1, APEX2, APTX, ASF1A, ASTE1, ATM, ATR, ATRIP, ATRX, ATXN3, BCCIP, BLM, BRCA1, BRCA2)), .Names = V2, class = data.frame, row.names = c(NA, 18L)) dat2- structure(list(V2 = c(ALKBH3, APEX1, APEX2, APLF, APTX, ATM, ATR,

Re: [R] point.in.polygon help

2013-05-23 Thread MacQueen, Don
In that case I'd definitely look more at the over() function than that ugly bit I suggested before. Get your fish info into a SpatialPointsDataFrame Since your polygons are in a SpatialPolygonsDataFrame, I would expect the data frame part has one row per basin, and it contains the basin names or

Re: [R] strings

2013-05-23 Thread MacQueen, Don
See the setdiff() function -- Don MacQueen Lawrence Livermore National Laboratory 7000 East Ave., L-627 Livermore, CA 94550 925-423-1062 On 5/23/13 11:04 AM, Robin Mjelle robinmje...@gmail.com wrote: I have two files containing words. I want to print the are in file 1 but NOT in file

Re: [R] strings

2013-05-23 Thread William Dunlap
You recommended library(sqldf) sqldf('SELECT * FROM dat1 EXCEPT SELECT * FROM dat2') Using nothing but the core R packages setdiff() returns the difference between two sets. setdiff(dat1$V2, dat2$V2) [1] ALKBH1 ALKBH2 ANKRD17 ASF1A ASTE1 ATRXATXN3 BCCIP If there are

Re: [R] strings

2013-05-23 Thread arun
#or  dat1$V2[is.na(match(dat1$V2,dat2$V2))] #[1] ALKBH1  ALKBH2  ANKRD17 ASF1A   ASTE1   ATRX    ATXN3  #[8] BCCIP   a[is.na(match(a,b))] #[1] 2 2 4 A.K. - Original Message - From: William Dunlap wdun...@tibco.com To: arun smartpink...@yahoo.com; R help r-help@r-project.org Cc:

[R] glmnet package: command meanings

2013-05-23 Thread C W
Hi List, I have a little confused when to glmnet() vs cv.glmnet(). I know that, glmnet(): gives the fit cv.glment(): does the cv after the fit I just want to get the beta coefficients after the fit, that's it! But of all the glmnet examples I've seen, the beta coefficient is obtained ONLY AFTER

Re: [R] Error in png: unable to start png() device

2013-05-23 Thread Uwe Ligges
On 23.05.2013 17:06, Ondrej Novak wrote: Hi, I use R 2.14.0 on Win XP Pro SP3 and it behaves same - some times. After I draw a lot of plots (more then 200, 2 concurrent rgui processes running in parallel) to png then I get same error message. Bmp(), jpg(), png() - same error. Restart of Rgui

Re: [R] FW: Kernel smoothing with bandwidth which varies with x

2013-05-23 Thread Uwe Ligges
On 23.05.2013 18:10, IOANNA wrote: Hello all, I would like to use the Nadaraya-Watson estimator assuming a Gaussian kernel: So far I sued the library(sm) library(sm) x-runif(5000) y-rnorm(5000) plot(x,y,col='black') h1-h.select(x,y,method='aicc') lines(ksmooth(x,y,bandwidth=h1)) which works

[R] Distance calculation

2013-05-23 Thread eliza botto
Dear useRs, i have the following data arranged in three columns structure(c(0.492096635764151, 0.42688044914, 0.521585941816778, 1.66472272302545, 2.61878329527404, 2.19154489521664, 0.493876245329722, 0.4915787202584, 0.889477365620806, 0.609135860199222, 0.739201878930367,

Re: [R] Could graph objects be stored in a two-dimensional list?

2013-05-23 Thread David Winsemius
On May 23, 2013, at 8:30 AM, jpm miao wrote: Hi, I have a few graph objects created by some graphic package (say, ggplot2, which I use frequently). Because of the existent relation between the graphs, I'd like to index them in two dimensions as p[1,1], p[1,2], p[2,1], p[2,2] for

[R] order panels in xyplot by increasing slope

2013-05-23 Thread Belair, Ethan D
I am creating a few dozen multi-panel time series plots using lattice graphics in the lme4 package. Each panel in a given plot represents a tree. each multipanel plot is a particular treatment. Here's my issue: when you use xyplot() to plot this data it orders the panels alphabetically. I would

Re: [R] order panels in xyplot by increasing slope

2013-05-23 Thread Jim Lemon
On 05/24/2013 06:21 AM, Belair, Ethan D wrote: example.plot = xyplot(ht ~ time|tree, data=data, type = c(r, g, p), par.settings=simpleTheme(col=blue), main=abc, ) example.plot ... Hi Ethan, This may be what you want:

[R] subsetting and Dates

2013-05-23 Thread Denis Chabot
Hi, I am trying to understand why creating Date variables does not work if I subset to avoid NAs. I had problems creating these Date variables in my code and I thought that the presence of NAs was the cause. So I used a condition to avoid NAs. It turns out that NAs are not a problem and I do

[R] When the interaction term should be interpreted in AIC table?

2013-05-23 Thread Galina Kamorina
Hi, I would be very graitful if someone could help me to figure out my problem. I used mixed-effects models to analyse my data and AIC approach for model selection. I am studying an effect on Labrador tea on basal diameter of spruce in 2 different habitats (wet and dry zones) during 3 years.

Re: [R] subsetting and Dates

2013-05-23 Thread arun
You could convert those columns to Date class by: Data[,c(4,6)]-lapply(Data[,c(4,6)],as.Date,origin=1970-01-01) #or Data[,c(4,6)]-lapply(Data[,c(4,6)],function(x) structure(x,class=Date)) #  dat1  dat2  Dat1a  Dat1b  Dat2a  Dat2b #1  41327 41327 2013-02-22 2013-02-22 2013-02-22

Re: [R] Create and read symbolic links in Windows

2013-05-23 Thread Santosh
Dear R experts, This time I am unable create symbolic links to files as I had done last time. I could not replicate what I had successfully tried last time (rerun the same code without any modifications) . I get the following error message.. [1] FALSE Warning message: In file.link(.file1, file2,

Re: [R] subsetting and Dates

2013-05-23 Thread Denis Chabot
Thank you for the 2 methods to make the columns class Date, but I would really like to know why these variables were not in Date class with my code. Do you know? Denis Le 2013-05-23 à 21:44, arun smartpink...@yahoo.com a écrit : You could convert those columns to Date class by:

Re: [R] ordered and unordered variables

2013-05-23 Thread meng
Many thanks for your detailed reply. I'll read your mail thoroughly. Thanks! At 2013-05-23 21:56:29,Greg Snow 538...@gmail.com wrote: Meng, This really comes down to what question you are trying to answer. Before worrying about details of default contrasts and issues like that you

Re: [R] subsetting and Dates

2013-05-23 Thread David Winsemius
On May 23, 2013, at 7:06 PM, Denis Chabot wrote: Thank you for the 2 methods to make the columns class Date, but I would really like to know why these variables were not in Date class with my code. Do you know? I suspect that the problem lies in the dispatch to `[-.class` or `$-`. When

Re: [R] subsetting and Dates

2013-05-23 Thread arun
I guess it is due to vectorization. vec1- as.Date(Data[,2],origin=1899-12-30) class(vec1) #[1] Date  as.vector(vec1) # [1] 15758 15765 15772 15779    NA 15793 15800 15807    NA 15821 15828  head(as.list(vec1),2) #[[1]] #[1] 2013-02-22 # #[[2]] #[1] 2013-03-01  head(data.frame(vec1),2) #   

[R] Download data

2013-05-23 Thread Christofer Bogaso
Hello again, I need to download 'WTI - Cushing, Oklahoma' from ' http://www.eia.gov/dnav/pet/pet_pri_spt_s1_d.htm' which is available under the column 'View History' While I can get the data manually, however I was looking for some R implementation which can directly download data into R. Can

Re: [R] adding rows without loops

2013-05-23 Thread Adeel Amin
Rainer...I can't believe this did the trick. You're a genius. Thank you sir. On Thu, May 23, 2013 at 7:07 AM, Rainer Schuermann rainer.schuerm...@gmx.net wrote: Using the data generated with your code below, does rbind( DF1, DF2[ !(DF2$X.TIME %in% DF1$X.TIME), ] ) DF1 - DF1[ order(

Re: [R] subsetting and Dates

2013-05-23 Thread David Winsemius
On May 23, 2013, at 7:56 PM, arun wrote: I guess it is due to vectorization. The concept of vectorization is much broader than the activities of `as.vector`, but it needs a specific functional mechanism to be considered an explanation. vec1- as.Date(Data[,2],origin=1899-12-30) class(vec1)