Hi,
Try:
dat1 -
read.csv(precipitationRglimclim.csv,header=TRUE,stringsAsFactors=FALSE,sep=\t)
library(reshape2)
dat2M - melt(dat1,id.var=c(year,month,day))
dat2M1 - dat2M[with(dat2M,order(year,month,day,variable)),]
dim(dat2M1)
#[1] 1972320 5
row.names(dat2M1) - 1:nrow(dat2M1)
Thank you Jeff. You are correct. I am relieved it is my mistake. Apologies for
bothering everyone. I will try harder next time!
Best wishes,
Hawthorne Beyer
University of Queensland
From: Jeff Newmiller [jdnew...@dcn.davis.ca.us]
Sent: 17 November 2013
First I want to apologize for posting in the wrong list. As I`ve experienced
very similar issues with respect to other R packages I thought that my
question was related to a general problem of mine when using the R help and
R documentation (and that this rugarch issue was just an example). That`s
Hi,
It is not very clear.
May be this gets you started:
set.seed(42)
lst1 - lapply(1:5, function(i) lapply(1:50,function(i) rnorm(sample(50,1
lst2 - lapply(lst1,function(x) data.frame(X=
rep(seq_along(x),sapply(x,length)),Y=unlist(x)))
pdf(test2.pdf)
lapply(lst2,function(x)
On 16-11-2013, at 13:11, Hans W.Borchers hwborch...@googlemail.com wrote:
I wanted to solve the following geometric optimization problem, sometimes
called the enclosing ball problem:
Given a set P = {p_1, ..., p_n} of n points in R^d, find a point p_0 such
that max ||p_i - p_0|| is
Berend Hasselman bhh at xs4all.nl writes:
Forgot to forward my answer to R-help.
Berend
Thanks, Berend, for thinking about it. \sum xi = 1 is a necessary condition
to generate a valid geometric solution. The three points in the example are
very regular and your apporach works, but imagine
On 17-11-2013, at 11:32, Hans W.Borchers hwborch...@googlemail.com wrote:
Berend Hasselman bhh at xs4all.nl writes:
Forgot to forward my answer to R-help.
Berend
Thanks, Berend, for thinking about it. \sum xi = 1 is a necessary condition
to generate a valid geometric solution. The
Berend Hasselman bhh at xs4all.nl writes:
It seems you are absolutely right. I always assumed a quadratic programming
solver will -- as all linear programming solvers do -- automatically require
the variables to be positive.
I checked it for some more examples in 10 and even 100 dimensions,
Dear all,
I would like to include a wide graph with narrow height in my LaTeX
output. Up to now I only get it done using Stangle and including
pdf(pietje-001.pdf,width=7,height=4)
xyplot(...)
dev.off()
What is the correct way of setting the canvas size?
Thanks.
Gerrit Draisma
Oops,
I forget to write the I included the lines pdf()..(dev.off()
in the file pietje.R generated by Stangle.
And now I see that included pietje.tex in reality was named pietje.rnw
with pietje.tex the result from Sweave.
Apologies for this confusion
Gerrit.
op 11/17/2013 12:43 PM Gerrit
Hi everyone!
I am in the process of writing an R-package and while writing a summary
function, I have come across a problem. I am able to print a summary table
(as in a standard glm() summary) by using *cat()* but the values I return is
also printet.
How am I able to remove the return values
On Nov 17, 2013, at 3:21 AM, Chris89 wrote:
Hi everyone!
I am in the process of writing an R-package and while writing a
summary
function, I have come across a problem. I am able to print a summary
table
(as in a standard glm() summary) by using *cat()* but the values I
return is
also
It's the (typical) na.action = na.omit problem. You have missing values
in your data, so the number of observations differs between models using
different variables.
BTW with the recent lme4 package, your code throws a lot of warnings
about the use of lmer with non-gaussian family and ignored
Dear Spencer,
I regularly use R (via the R Commander) for intro stats courses taught to
third-year sociology undergrads (in Canada). Without knowing where your
friend teaches, it's hard to know what her students are like, but in my
experience psychology students are generally more numerate than
Hi all,
I hope you can help.
I have a data frame 'df':
group=c(rep(1,8),rep(2,10),rep(3,11))
var=rnorm(29)
time=c(seq(1,8),seq(1,10),seq(1,11))
df=data.frame(group,var,time)
I would like to extract the value from 'var' for each 'group' at 'time'=4 and
repeat these extracted values in a new
On 17-11-2013, at 15:47, Benjamin Gillespie gy...@leeds.ac.uk wrote:
Hi all,
I hope you can help.
I have a data frame 'df':
group=c(rep(1,8),rep(2,10),rep(3,11))
var=rnorm(29)
time=c(seq(1,8),seq(1,10),seq(1,11))
df=data.frame(group,var,time)
I would like to extract the value
On 11/16/2013 11:45 AM, Jakub Szewczyk wrote:
I am trying to analyze a dataset where I have 1 continuous
between-item variable (C), and 2 factorial within-item variables (3-
and 2-level: F3, F2). I'm interested in whether slope of C is
different from 0 at different combinations of F3 and F2, and
Felipe,
I get the results like this by running the code:
z -read.table(text=date week length
7/13/2010 28 34
7/13/2010 28 35
7/14/2010 28 35
7/14/2010 28 35
7/14/2010 28 36
7/14/2010 28 36
7/20/2010 29 31
7/16/2010 29 34
7/18/2010 29 34
7/18/2010 29 34
7/21/2010 29 35
7/20/2010 29 36
7/21/2010 29
Hi, John: Thanks very much. That sounds like pretty close to what my
friend needs -- especially the comparison of Rcmdr with SPSS. (My
friend teaches at Santa Clara University, a private university supported
by the Catholic Church located in Santa Clara, California. I don't
know, but I'd
Hi,
Try:
indx - grep(Test,test_df[,1]) ##assuming that there is some pattern
res - within(test_df[-indx,],titel - rep(test_df$titel[indx],
diff(c(indx,nrow(test_df)+1))-1))
## If you need to change the class
res[] - lapply(res,function(x) if(any(grepl([[:alpha:]],x)))
as.character(x) else
Hi,
?merge() sometimes change the order.
For example:
df1 - df[-12,]
df2 - df1
merge(df1, df1[df1$time == 4, c(group, var)], by.x = group, by.y =
group, suffixes = c(, GroupSK0))
In that case,
df1$ord1 - with(df1,order(group,time))
res - merge(df1, df1[df1$time == 4, c(group, var)], by.x =
Michael Friendly wrote
On 11/14/2013 9:35 AM, yuanzhi wrote:
Hi, Carl Witthoft
yes, it looks like a mathematical question. I will try based on your
suggestion to calculate the volume of the intersection. But I still want
to
know whether there are some functions in R which can calculate the
Hi Felipe,
You may try ?mutate() with ?ddply() from library(plyr)
library(plyr)
library(reshape2)
res -
dcast(ddply(z,.(week),mutate,ID=seq_along(week)),ID~week,value.var=length)[,-1]
If you have multiple years, probably you may need:
z1 - z ##using the same example
z1[,1] -
Hi,
May be this helps:
dat1 - read.table(text=
data data freq
1 2 2
1 3 1
1 4 1
2 3 2
2 4 1
2 2 1
3 4 2,sep=,header=TRUE)
val- unique(c(dat1[,1],dat1[,2]))
dat2 -expand.grid(data=val,data.1=val)
library(plyr)
An approach using data tables:
###
library(data.table)
# dt: some data arranged by group
dt - data.table(group=c(rep(a,5), rep(b,10), rep(c,15)), values=1:30)
# summarize by group
smry - dt[,list(min=min(values), max=max(values), range=diff(range(values))),
by=group]
smry
###
-Original
Dear R People:
I'm sure that this is a very simple problem, but I have been wresting with
it for some time.
I have the following file that has the following one line:
CRS(+init=epsg:28992)
Fair enough. I scan it into R and get the following:
u
[1] CRS(\+init=epsg:28992\)
(1) The backslashes are not really there; they are an artefact of the R
print() function.
Try cat(u,\n). I think this might be an FAQ.
(2) Is not your problem the fact that your are setting replacement
equal to the
thing you are trying to get rid of? I.e. don't you want
v -
They're not actually there so don't try too hard to rid yourself of them:
x - \'
length(x)
print(x)
cat(x, \n)
Make sure you're clear on the difference between what's stored by the computer
and what it print()s. Rarely the same, though cat() is often slightly more
honest.
On Nov 17, 2013,
I actually solved the problem in a backhanded (backslashed?) sort of
way...took out the quotation marks in the original file. All is well.
Thanks!
On Sun, Nov 17, 2013 at 4:38 PM, Rolf Turner r.tur...@auckland.ac.nzwrote:
(1) The backslashes are not really there; they are an artefact of the
On Sun, Nov 17, 2013 at 10:42 PM, R. Michael Weylandt
michael.weyla...@gmail.com michael.weyla...@gmail.com wrote:
They're not actually there so don't try too hard to rid yourself of them:
x - \'
length(x)
print(x)
cat(x, \n)
Did you mean to do 'nchar(x)' to show that \ was one character?
Hello again!
I'm using python, rpy2, and R for a project. It's actually pretty
interesting. Anyhow, I pass in an R file to the python program. However,
I am getting the following errors, which seem more like R errors(?):
Loading required package: gstat
Loading required package: automap
Error
[See in-line below]
On 17-Nov-2013 22:38:30 Rolf Turner wrote:
(1) The backslashes are not really there; they are an artefact of the R
print() function.
Try cat(u,\n). I think this might be an FAQ.
(2) Is not your problem the fact that your are setting replacement
equal to the
thing
I believe matrix indexing makes Arun's complex code wholly unnececessary:
Starting with dat1 as above:
m - matrix(0,4,4)
m[as.matrix(dat1[,1:2])] - dat1[,3]
## yielding:
m
[,1] [,2] [,3] [,4]
[1,]0211
[2,]0121
[3,]0002
[4,]000
Googling R for psychology students I found this:
http://health.adelaide.edu.au/psychology/ccs/docs/lsr/lsr-0.3.pdf
and this:
https://personality-project.org/r/
The latter has links to many short courses and tutorials.
If you do end up using R, I find the following sites extremely helpful:
Hi Max,
Thanks very much for investigating and explaining that - your help and time is
much appreciated.
So as I understand it, using classProbs=F in trainControl() will give me the
same accuracy results as before. However, I was relying on the class
probabilities to return
Andrew,
What I still don't quite understand is which accuracy values from train() I
should trust: those using classProbs=T or classProbs=F?
It depends on whether you need the class probabilities and class
predictions to match (which they would if classProbs = TRUE).
Another option is to use
I would recommend it. I have no experience teaching statistics to
psychology students, but I have done a sequence of hands-on workshops
introducing R to a class of high school students who were engaged in a
three-year-long science research class. My presentations were not
discipline-specific, and
eric wrote
Is there an easy way to get the midpoint between two dates in a data frame
? If I have a dataframe that looks like this :
head(x)
instDay remDay exp.time mpy
1 2006-02-02 2006-04-03 60 0.2
2 2006-04-17 2006-08-17 122 0.3
4 2006-08-17 2006-10-23 67
Thanks so much, A.K.
Problem well solved.
Atem.
On Sunday, November 17, 2013 1:28 AM, arun smartpink...@yahoo.com wrote:
Hi,
Try:
dat1 -
read.csv(precipitationRglimclim.csv,header=TRUE,stringsAsFactors=FALSE,sep=\t)
library(reshape2)
dat2M - melt(dat1,id.var=c(year,month,day))
dat2M1 -
On Sun, Nov 17, 2013 at 6:24 PM, Barry Rowlingson
b.rowling...@lancaster.ac.uk wrote:
On Sun, Nov 17, 2013 at 10:42 PM, R. Michael Weylandt
michael.weyla...@gmail.com michael.weyla...@gmail.com wrote:
Did you mean to do 'nchar(x)' to show that \ was one character?
'length' gives the number of
Erin, at first glance I would say that this is an R error. When Rpy2
detects an error it will pass it through errors as library errors like
this. At first glance it appears that your r code is not loading the
requisite packages as it cannot find them. That I suspect is what is
causing your
OK, thanks.
I haven't reported the memory map errors because I haven't been able to
replicate them reliably: some times they occur, but some times don't, for the
same code. I'll have another try, and will report if I can get more information.
Thanks again.
On 18/11/2013, at 14:42 , Max Kuhn
Hi,
You may also check:
library(psych)
library(plyr)
df1 - data.frame(group=rep(letters[1:3],c(5,10,15)), values=1:30)
ddply(df1,.(group),mutate,Range=describe(values)$range) ##depends on how you
wanted the output
#or
ddply(df1,.(group),summarise,Range=describe(values)$range)
#or
Dear R Users,
I have a 7x16 matrix with missing values. I'd like to do some kind of
2-d surface fitting/interpolation to fill in the missing values, while
guaranteeing that they are positive. Most grateful if someone could
point me in the right direction.
Thanks in advance
Sample matrix
I have a matrix which has colnames and I would like to send this matrix using
sendmailR. How can I convert this simple matrix to a format which can be used
as the body variable in sendmailR? I see how I can create a file attachment
using mime_part but I would like to send the matrix in the body
On Sun, 17 Nov 2013, Ted Harding wrote:
[See in-line below]
On 17-Nov-2013 22:38:30 Rolf Turner wrote:
(1) The backslashes are not really there; they are an artefact of the R
print() function.
Try cat(u,\n). I think this might be an FAQ.
(2) Is not your problem the fact that your are
46 matches
Mail list logo