Thanks, the second approach worked fine on Windows.
--JJS
On Thu, August 15, 2013 8:38 am, Jeffrey Dick wrote:
> Sorry, I can't generate an error when running those commands in R on Linux
> 64-bit. But if I move to Windows (R version 3.0.1, XML_3.98-1.1), I get a
> different error ...
>
>> requir
On 15/08/2013 21:11, Daren Zou wrote:
Hi, i was messing around with R and noticed that there is an object for
timeseries which can be initialized with the ts() function. however it seems
that it can only be initialized with a vector of data points and its assumed
that these data points occur a
Perhaps this is simple and common, but it took me quite a while to admit I
cannot solve it in a simple way.
The data frame `df` has the following columns:
unixtime, value, factor
Now I need a matrix of:
unixtime, value-difference-between-factor1-and-factor2
The naive solution is:
Dear all,
I'm using package "ridge" to deal with multicollinearity. It's been convenient
to automatically choose lambda.
However, how do I tell whether the OLS results have been improved after
applying ridge regression?
I only notice that more variables become statistically significant and som
Say I have a dataframe for plotting scatterplot. The dataframe would be
organized in the following fashion (in CSV format):
name ABC EFG132 45256 67
to, say 200 000 entries
I am going to first do a scatterplot, after which I am going to subset a
portion of the dataset into A using alpha
Hi, i was messing around with R and noticed that there is an object for
timeseries which can be initialized with the ts() function. however it seems
that it can only be initialized with a vector of data points and its assumed
that these data points occur at regular time periods, user to specify
The function crossprod() might be useful?
crossprod(X) is a more efficient way of producing t(X) %*% X
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Praveen Surendran
Sent: Thursday, 15 August 2013 10:30p
To: r-help@r-project.
Hi Steve,
Thanks. The error problem is solved by using quotes.
Will post at data-table mailing list regarding the issue of:
system.time(ans <- dt1[, .SD[.N], by='Date'])
# user system elapsed
# 39.284 0.000 39.352
A.K.
- Original Message -
From: Steve Lianoglou
To: arun
How about this:
df1000cols =
setNames(as.data.frame(matrix(numeric(0),ncol=1000)),paste0("V",1:1000))
-Original Message-
From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
Behalf Of Pooya Lalehzari
Sent: Friday, 16 August 2013 8:27a
To: Bert Gunter
Cc: r-help@r
Hi,
On Thu, Aug 15, 2013 at 4:03 PM, arun wrote:
> HI Steve,
>
> Thanks for testing.
>
> When I run a slightly bigger dataset:
> set.seed(1254)
> name<- sample(letters,1e7,replace=TRUE)
> number<- sample(1:10,1e7,replace=TRUE)
>
> datTest<- data.frame(name,number,stringsAsFactors=FALSE)
> library
Bill that is very impresive. The only problem I'm having is that I want
the paste0(toupper(...)) to be a general function that returns a
character string that is a legal part of a formula object that can't be
converted to a 'name'.
Frank
---
Oops, I left "(" out
I have an 8 core machine and I wish to use 6 of them to run a task
much more complicated than this example.
multitest <- function(n = 1000, lam = 500)
{
### Purpose:- Simple parallel task to check why mclapply doesn't work
###
-
Oops, I left "(" out of the list of operators.
ff <- function(expr) {
if (is.call(expr) && is.name(expr[[1]]) &&
is.element(as.character(expr[[1]]),
c("~","+","-","*","/","%in%","("))) {
for(i in seq_along(expr)[-1]) {
expr[[i]] <- Recall(expr[[i]])
}
Try this one
ff <- function (expr)
{
if (is.call(expr) && is.name(expr[[1]]) &&
is.element(as.character(expr[[1]]), c("~", "+", "-", "*", "/", ":",
"%in%"))) {
# the above list should cover the standard formula operators.
for (i in seq_along(expr)[-1]) {
On Thu, 15 Aug 2013, arun wrote:
It's better to dput() your dataset.
A.K.,
That's what I usually do; with such a small data set I thought the raw
data would be equally good.
#or
xyplot(pct~sampdate,data=burns.date.ffg,groups=func_feed_grp,pch=1:7,type="l")
What I see in the plots are 7
I really appreciate the excellent ideas from Bill Dunlap and Greg Snow.
Both suggestions almost work perfectly. Greg's recognizes expressions
such as sex=='female' but not ones such as age > 21, age < 21, a - b >
0, and possibly other legal R expressions. Bill's idea is similar to
what Dunca
Slightly modified, also seems to work.
gsubfn( "([[:alpha:]][[:alnum:]]*)((?=\\s*[-+~*)])|$)",function(x,...)
paste0(toupper(x),'z'), test, perl=TRUE )
#[1] "Y1z + Y2z ~ Az*(Bz + Cz) + Dz + Fz * (h == 3) + (sex == 'male')*Iz"
A.K.
- Original Message -
From: Greg Snow <538...@gmail.com>
HI Steve,
Thanks for testing.
When I run a slightly bigger dataset:
set.seed(1254)
name<- sample(letters,1e7,replace=TRUE)
number<- sample(1:10,1e7,replace=TRUE)
datTest<- data.frame(name,number,stringsAsFactors=FALSE)
library(data.table)
dtTest<- data.table(datTest)
system.time(res3<- dtTest[
Dear Witold E Wolski,
Re:
> I am have a procedure which generates multidimensional arrays.
>
> To compute them is expensive so I want to store them in order to be
> able to analyse them later.
>
> I am using at the moment
>
> problem is that the array is always assigned to a variable ma (the
>
That is great!
Thank you so much.
-Original Message-
From: arun [mailto:smartpink...@yahoo.com]
Sent: Thursday, August 15, 2013 5:29 PM
To: Ista Zahn
Cc: Pooya Lalehzari; R help
Subject: Re: [R] How can I create a data.table with 1000 variables
(Var1:Var1000)
Just to add:
You could c
Just to add:
You could convert "logi" to "numeric" by:
Large_Table2<-data.frame(matrix(nrow = 0, ncol=1000, dimnames =
list(c(),paste0("Var", 1:1000
str(Large_Table2)
#'data.frame': 0 obs. of 1000 variables:
# $ Var1 : logi
# $ Var2 : logi
# $ Var3 : logi
---
Larg
... But of course R is not C++ or Java, so there is no need to
"declare" anything, and the OP's question strongly suggests to me that
he/she has made no effort to learn R. My advice would be:
1. Stop posting.
2. Read An Introduction to R or other R tutorial and learn how the
language works.
-- B
Hi,
May be this helps:
Large_Table<- data.frame(lapply(paste0("Var",1:1000),function(x)
{x1<-data.frame(numeric());colnames(x1)<-x; x1}))
str(Large_Table)
'data.frame': 0 obs. of 1000 variables:
$ Var1 : num
$ Var2 : num
A.K.
- Original Message
On Thu, Aug 15, 2013 at 5:09 PM, Pooya Lalehzari
wrote:
>
> Here is the sample code.
>
> Large_Table = data.frame(
> Var1=numeric(),
> Var2=numeric(),
> Var3=numeric(),
> .
> .
>
Here is the sample code.
Large_Table = data.frame(
Var1=numeric(),
Var2=numeric(),
Var3=numeric(),
.
.
.
Var1000
Here is a first stab:
library(gsubfn)
test <- "y1 + y2 ~ a*(b + c) + d + f * (h == 3) + (sex == 'male')*i"
gsubfn( "([a-zA-Z][a-zA-Z0-9]*)((?=\\s*[-+~)*])|\\s*$)",
function(x,...) paste0(toupper(x),'z'), test, perl=TRUE )
On Wed, Aug 14, 2013 at 9:13 PM, Frank Harrell wrote:
> I would like t
I usually get better results with data.table except for this situation.
If I take another example unrelated to the current topic:
set.seed(1254)
name<- sample(letters,1e6,replace=TRUE)
number<- sample(1:10,1e6,replace=TRUE)
datTest<- data.frame(name,number,stringsAsFactors=FALSE)
system.time(r
Dr. Therneau,
Thank you as always for first writing, and second continuing the Cox model in R
(and earlier I believe in SAS).
While your comments concerning non-proportional hazards is helpful, it does not
fully address the question, "What alternatives do I have if I assume
proportional assump
Hi,
On Thu, Aug 15, 2013 at 1:38 PM, arun wrote:
> I tried it again on a fresh start using the data.table alone:
> Now.
>
> dt1 <- data.table(dat2, key=c('Date', 'Time'))
> system.time(ans <- dt1[, .SD[.N], by='Date'])
> # user system elapsed
> # 40.908 0.000 40.981
> #Then tried:
> syste
Hi Rich,
It's better to dput() your dataset. From what you showed:
burns.date.ffg<- read.table(text="
'sampdate','func_feed_grp','pct'
'2000-07-18','Filterer',0.0351
'2000-07-18','Gatherer',0.7054
'2000-07-18','Grazer',0.0442
'2000-07-18','Predator',0.1078
'2000-07-18','Shredder',0.1074
'2003-07-0
I tried it again on a fresh start using the data.table alone:
Now.
dt1 <- data.table(dat2, key=c('Date', 'Time'))
system.time(ans <- dt1[, .SD[.N], by='Date'])
# user system elapsed
# 40.908 0.000 40.981
#Then tried:
system.time(res7<- dat2[cumsum(rle(dat2[,1])$lengths),])
# user syst
On 08/15/2013 04:16 PM, Pooya Lalehzari wrote:
Hello everyone,
How can I create a data_table with 1000 variables (Var1:Var1000)?
I'm not familiar with data_table, but here's an example to get you
started in figuring this out:
> n <- 3
> var.range <- 1:n
> prefix <- "Var"
> data <- as.data.f
On Thu, 15 Aug 2013, arun wrote:
#Not sure about your exact specification, so this would get you started.
xyplot(pct~sampdate,data=burns.date.ffg,groups=func_feed_grp,pch=1:7,type="l")
A.K./Dennis;
Now I see the source of my error: I quoted the data file name! Removing
the quotation marks p
Sorry. data.table or even data.frame (as they are related). My question is, if
there is a short form to refer to all 1000 of them similar to what exists in
SAS.
Thank you,
Pooya Lalehzari.
-Original Message-
From: Bert Gunter [mailto:gunter.ber...@gene.com]
Sent: Thursday, August 15,
Please:
1. Define "data_table" (??)
2. Follow the advice from the posting guide link below to post a
coherent question.
-- Bert
On Thu, Aug 15, 2013 at 1:16 PM, Pooya Lalehzari
wrote:
> Hello everyone,
> How can I create a data_table with 1000 variables (Var1:Var1000)?
>
> Thank you,
> Pooya
Hello everyone,
How can I create a data_table with 1000 variables (Var1:Var1000)?
Thank you,
Pooya Lalehzari
THIS E-MAIL IS FOR THE SOLE USE OF THE INTENDED RECIPIENT(S) AND MAY CONTAIN
CONFIDENTIAL AND PRIVILEGED INFORMATION.ANY UNAUTHORIZED REVIEW, USE, DISCLOSURE
OR DISTRIBUTION IS PROHIBITE
Hi,
Looks like you have some free time on your hands :-)
Something looks a bit off here, though, I was surprised to see the
time you reported for the data.table option:
> #separate the data.table creation step:
> dt1 <- data.table(dat2, key=c('Date', 'Time'))
> system.time(ans <- dt1[, .SD[.N],
Speed comparison:
dat1<-structure(list(Date = c("06/01/2010", "06/01/2010", "06/01/2010",
"06/01/2010", "06/02/2010", "06/02/2010", "06/02/2010", "06/02/2010",
"06/02/2010", "06/02/2010", "06/02/2010"), Time = c(1358L, 1359L,
1400L, 1700L, 331L, 332L, 334L, 335L, 336L, 337L, 338L), O = c(136.4
Dumb error. Thanks for letting me know. Gerard
On Aug 15, 2013, at 11:38 AM, "Richard M. Heiberger" wrote:
> typo
>
> run_plots <- functon()
>
>
> On Thu, Aug 15, 2013 at 1:10 PM, Gerard Smits wrote:
> Hi All,
>
> I have a number of plots to run and was hoping to use a function instead o
typo
run_plots <- functon()
On Thu, Aug 15, 2013 at 1:10 PM, Gerard Smits wrote:
> Hi All,
>
> I have a number of plots to run and was hoping to use a function instead
> of bock copying my code and retyping my parameters.
>
> I am using R 3.0.0 on a mac.
>
> My code is as follows:
>
> library
HI,
xyplot(pct~sampdate|func_feed_grp,data='burns.date.ffg')
#Error in eval(substitute(groups), data, environment(x)) :
# invalid 'envir' argument of type 'character'
xyplot(pct~sampdate|func_feed_grp,data=burns.date.ffg) #no error
#Not sure about your exact specification, so this would get yo
Hi Duncan,
Thank you very much for your quick response!
It turns out I was typing the shell commands in another xterm which was ssh'ed
to another linux computer and I completely forgot about it. After finding that
out and checking with my own computer, the libxml2 is installed but
libxml2-
Hi Tao
In the same R session as you call install.packages(),
what does
system("which xml2-config", intern = TRUE)
return?
Basically, the error message from the configuration script for the
XML package is complaining that it cannot find the executable xml2-config
in your PATH.
(You can also
R users,
Poster abstracts are now being accepted for the 2014 ASA Conference on
Statistical Practice, February 20-24, Tampa, Florida, USA. Presenters are
required to host their posters during their assigned 90-minute session.
Based on a survey of the 2013 attendees there was particular interest
I'm not an expert useR but I asked a similar question to stack overflow
that might give you new ideas.
http://stackoverflow.com/questions/17458556/how-can-i-speed-up-this-sapply-for-cross-checking-samples
On Thu, Aug 15, 2013 at 2:30 AM, Praveen Surendran
wrote:
> Dear Doran, Bert and Roger,
>
On Aug 15, 2013, at 2:23 AM, Lucas Holland wrote:
> Hello all,
>
> I’ve fitted a bivariate smoothing model (with GAM) to some data, using two
> explanatory variables, x and y. Now I’d like to add the surface
> corresponding to my fit to a 3D scatterplot generated using plot3d().
>
> My appr
Hi list,
I have encountered the "Cannot find xml2-config" problem too during XML package
installation on my 64-bit Redhat (v. 6.4) linux machine. After looking through
the old posts I checked all the necessary libraries and they all seem to be
properly installed (see below). I don't understan
Hi All,
I have a number of plots to run and was hoping to use a function instead of
bock copying my code and retyping my parameters.
I am using R 3.0.0 on a mac.
My code is as follows:
library (car)
cres<-read.csv("//users//smits//r_work//cres.csv", header = TRUE)
attach(cres);
run_plots <- f
This is a level of complexity I've not before encountered and I have not
seen the solution in Deepayan Sarkar's book. Briefly, I want to plot values
for each of 5 factors over a range of dates to visualize whether the
relative values of each factor change over time.
The data frame structure i
I'm trying to write a function to make gam (in mgcv) give me the
fixed-effects "within" estimator, which is equivalent to the OLS dummy
variable estimator. Basically this involves subtracting the
within-group means from the IVs and the DV, adding their overall means
back in, and fitting the mo
R 3.0.1
OS X 10.8.4
Colleagues,
I am using sendmailR to send myself notifications when a lengthy R process
completes. Sample code is:
require("sendmailR")
NOTIFY <- "Notification"
FROM<- ""
TO <- FROM
CONTROL <-
On Thu, Aug 15, 2013 at 7:40 AM, Weiwu Zhang wrote:
> 2013/8/15 Berend Hasselman :
>> n[1,,drop=FALSE]
>>
>> Berend
>
> Thanks a lot, and I wasn't aware I can do ?`[`
See:
?"?"
;-) (Sorry, couldn't resist!)
-- Bert
>
> __
> R-help@r-project.org
Thanks very much for your contribution, Siraaj. I appreciate you taking the
time to help me learn loops, etc. BNC
-Original Message-
From: Siraaj Khandkar [mailto:sir...@khandkar.net]
Sent: Wednesday, August 14, 2013 9:08 PM
To: Crombie, Burnette N
Cc: r-help@r-project.org
Subject: Re:
2013/8/15 Berend Hasselman :
> n[1,,drop=FALSE]
>
> Berend
Thanks a lot, and I wasn't aware I can do ?`[`
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting
Thanks very much A.K. I can see from answers to my previous posts, too, that I
will be using lapply() a lot in my R future. BNC
From: arun kirshna [via R] [mailto:ml-node+s789695n4673817...@n4.nabble.com]
Sent: Wednesday, August 14, 2013 11:06 PM
To: Crombie, Burnette N
Subject: Re: condense re
Hi,
You could try:
res<-data.frame(lapply(wkend,function(x) seq(x,as.Date("2013-12-26"),by=7)))
colnames(res)<- paste0("date",1:3)
head(res)
# date1 date2 date3
#1 2013-01-04 2013-01-05 2013-01-06
#2 2013-01-11 2013-01-12 2013-01-13
#3 2013-01-18 2013-01-19 2013-01-20
#4 2013-01-
I think substitute() or bquote() will do a better job here than gsub() be
they work on the parsed formula rather than on the raw string. The
terms() function will interpret the formula-specific operators like "+"
and ":" to come up with a list of the 'variables' (or 'terms') in the formula
E.g.,
Post to R-sig-ecology , not here.
-- Bert
On Thu, Aug 15, 2013 at 2:20 AM, Chris McOwen
wrote:
> Dear list,
>
> I have 50 sites where information was recorded over a 45 year time period.
> The recorded data could take one of four forms: Fishing effort,
> Environmental, Both or Inconclusive.
>
On 15-08-2013, at 09:29, Zhang Weiwu wrote:
> When you select a single row from a matrix, the dimsion is lost:
>
>> n <- matrix(nrow = 3, ncol = 5)
>> dim(n)
> [1] 3 5
>> dim(n[1,])
> NULL
>> dim(n[2,])
> NULL
>
> This doesn't happen if you select more than one row:
>
>> dim(n[1:2,])
> [1] 2
You might also try (could be faster):
library(data.table)
dt1<- data.table(df,key=c("case","obsdate"))
dt1[,date_end:=obsdate-1]
dt1[,date_end:=c(date_end[-1],as.Date("2011-03-31")),by=case]
dt1<-subset(dt1,select=c(1,2,4,3))
dt1
# case obsdate date_end score
#1: a 2001-04-01 2007-05-1
Dear Doran, Bert and Roger,
Thank you for attending my query and for your valuable responses.
The task is slightly more complex. Here's the real case... I have genetic
variation data (40,000 single nucleotide polymorphisms) from 90,000
individuals. This makes the 90,000 (samples) rows/columns o
Ah, yes. it was the
net$Time[net$From=="A" & net$To=="C"]),
notation I was missing. I suppose I'd think of that as similar to an array
slice Perl (no, I know it's not the same!)
I'll have to spend a little time looking at your sample data-generation code
too :)
Thanks very much,
jack
___
Hello all,
I’ve fitted a bivariate smoothing model (with GAM) to some data, using two
explanatory variables, x and y. Now I’d like to add the surface corresponding
to my fit to a 3D scatterplot generated using plot3d().
My approach so far is to create a grid of x and y values and the correspo
When you select a single row from a matrix, the dimsion is lost:
n <- matrix(nrow = 3, ncol = 5)
dim(n)
[1] 3 5
dim(n[1,])
NULL
dim(n[2,])
NULL
This doesn't happen if you select more than one row:
dim(n[1:2,])
[1] 2 5
This is causing trouble. SCENARIO: when I filter out unqualified sam
On Wed, 14 Aug 2013, Hervé Pagès wrote:
Hi Zhang,
First note that a list is a vector (try is.vector(list())).
The documentation for sapply() and Vectorize() should say *atomic*
vector instead of vector in the desccription of the 'simplify' and
'SIMPLIFY' arguments.
So in order for sapply() t
Dear list,
I have 50 sites where information was recorded over a 45 year time period. The
recorded data could take one of four forms: Fishing effort, Environmental, Both
or Inconclusive.
What i am aiming to do is cluster sites based on their similarity through time,
essentially i view this as
Dear list,
I have 50 sites where information was recorded over a 45 year time period.
The recorded data could take one of four forms: Fishing effort,
Environmental, Both or Inconclusive.
What i am aiming to do is cluster sites based on their similarity through
time, essentially i view this
Hi,One way would be:
df<-
data.frame(case,obsdate=as.Date(obsdate,format="%d/%m/%Y"),score,stringsAsFactors=FALSE)
#using as.data.frame(cbind(... should be avoided
df$date_end<-as.Date(unlist(lapply(with(df,tapply(obsdate,case,FUN=function(x)
x-1)),function(x)
c(x[-1],as.Date("31/03/2011",fo
G'day,
I wonder if there exists a package that deals with the prediction of
time series based on a method proposed by Farmer & Sidorowich (1987) and
further developments by others. This method relies on the state space
representation of a time series and uses the nearest neighbor of a state
fo
Sorry, I can't generate an error when running those commands in R on Linux
64-bit. But if I move to Windows (R version 3.0.1, XML_3.98-1.1), I get a
different error ...
> require(XML)
Loading required package: XML
> doc <- htmlTreeParse("
http://www.sec.gov/cgi-bin/browse-edgar?CIK=MSFT&Find=Searc
One of those simple tasks, but I can't get to first base with it. I've got a
data set of observations of subjects over a 10 year period beginning on 1st
April 2001 and ending on 31st March 2011. One of may variables is a score
based on an intervention on a given date. Before the intervention t
On 15/08/2013 10:56, Witold E Wolski wrote:
Hi,
I am a bit surprised that an example code from an R-package installed
from CRAN can fail:
n<-20
p<-10
X<-matrix(rnorm(n*p),ncol=p)
pc<-adalasso.net(X,k=5)
Performing local (adaptive) lasso regressions
Vertex no Error in glmnet(XXtrain, ytrain,
Hi,
I am a bit surprised that an example code from an R-package installed
from CRAN can fail:
> n<-20
> p<-10
> X<-matrix(rnorm(n*p),ncol=p)
> pc<-adalasso.net(X,k=5)
Performing local (adaptive) lasso regressions
Vertex no Error in glmnet(XXtrain, ytrain, type.gaussian = type,
standardize = FALS
I am still trying to get my head around biomod2. I have run through the
tutorial a few times, which works really well in a linear format.
But, I want to see the models and assess them at every part of the process. So,
I need to:
1: be able to re-access all the files from /.BIOMOD_DATA/ once R i
I'm trying to install FEAR package on my personal laptop with Windows 7
operating system. I've followed the instructions step by step but still
encountered this problem:I thought I installed FEAR in the default
location,C:Program FilesRR-3.0.1libraryFEARHowever, I couldn't find it in the
librar
75 matches
Mail list logo