Hello all:
I've read the document named "A Brief Introduction to R, the multilevel package
and the nlme package".
At p68, one can transform the dataset to the required format by using
"make.univ".
I wanna know,how the new variable "MULTDV" is calculated(can you show me the
formula if possible pl
rrookie1982 wrote:
>
> I want to write a formula of the type
>
> http://n4.nabble.com/file/n1016112/expression.gif
>
> into my plot, where the values 1.234 and -0.567 should origin from
> variables in the program.
>
Uwe Ligges-3 wrote:
>
> It is much easier, just write the formula down i
sorry for bothering you again,
the problem solved. the command should be :
uprange=rollapply(zoo(x),width=10,FUN=function(x)quantile(x,0.8),align='right')
Gabor Grothendieck wrote:
>
> There is no quantile method defined for zoo objects so it falls
> through to the default method but that meth
Gabor,
about problem 1. , now I understand.
But in problem 2. , I do as your recommandation. and it still doesn't work.
I wonder is there any detail introduction about the form of the 'FUN' in the
'rollapply'?
Can you help me again?
Thank you very much!
Best regard
Saji
There is no quantile m
David Winsemius comcast.net> writes:
>
>
> On Jan 17, 2010, at 8:17 PM, maiya wrote:
>
> >
> > There must be a very basic thing I am not getting...
> >
> > I'm working with some entropy functions and the convention is to use
> > log(0)=0.
> >
>
> I suppose the outcome of that effort may depen
On Jan 17, 2010, at 8:17 PM, maiya wrote:
There must be a very basic thing I am not getting...
I'm working with some entropy functions and the convention is to use
log(0)=0.
I suppose the outcome of that effort may depend on whether you have
assumed the needed godlike capacities to chang
Are you telling us the whole story? Or did you also
get a warning message which should have twigged the
answer for you?
Try ifelse() instead of if().
-Peter Ehlers
maiya wrote:
There must be a very basic thing I am not getting...
I'm working with some entropy functions and the convention is
There must be a very basic thing I am not getting...
I'm working with some entropy functions and the convention is to use
log(0)=0.
So I wrote a function:
llog<-function(x){
if (x ==0) 0 else log(x)
}
which seems to work fine for individual numbers e.g.
>llog(0/2)
[1] 0
but if I try whole ve
Hello,
I'm am in the process of trying to port a RATS functions to R and have
the problem, that RATS allows for the creation of submatrixes that are
linked to their basematrix.
Basically it should work like this:
a = matrix(1:(4*3),4,3)
a
# [,1] [,2] [,3]
# [1,]159
# [2,]2
Any entry in the weather data is a good day. That is the point. And
please ignore my mistake about the quarters getting too large in
weather. I am being swamped with versions, and it does not matter for
this purpose.. so, the bad weather days are not in the weather data set.
I am trying to get gw=
But, but, but there is no weather goodness variable in
weather?!?!?!
> str(weather)
'data.frame': 155 obs. of 4 variables:
$ Date :Class 'Date' num [1:155] 14245 14245 14245 14245 14245 ...
$ minute : int 5 15 30 45 0 15 30 45 0 15 ...
$ hour : int 15 15 15 15 17 17 17 17 18 1
Never used coplot, but why not try removing the rows with missing variables?
Perhaps with:
dat <- cbind(E2=resid(baea.ancova6, type = "normalized"), year, population)
coplot(E2~year|population, data=dat[apply(dat, 1, function(x) !any(is.na
(x))),])
Regards,
Simon Knapp
On Mon, Jan 18, 2010 at 6:
I want to learn content-type of a file. what should I do?
In my code I want to do:
I give an url to download.
the function learns the content-type and
if it is a text file downloads it.
else will raise an error.
[[alternative HTML version deleted]]
__
Hi Steve,
These might help.
#generate some example data similar to your original email, with one extra
line containing all NAs (first col included to provide similarity with your
data)
labs <- c('4er66', '4gcyi', '5d3hh', '5d3wt', 'v3st5', 'a22g5', 'b5dd3',
'g44d2', 'z')
dat <- scan()
1 NA
Here are some sample data sets.
I also tried making a combined field in each set such as
adq=paste(as.character(arr$Date), as.character(arr$quarter))
and similarly for the weather set, so I have unique single things to
compare, but that did not seem to help much.
Thanks,
Jim
On 1/17/10 5:50 PM,
On Sun, 17 Jan 2010, Vera wrote:
2010/1/16 Thomas Lumley :
On Sat, 16 Jan 2010, Vera wrote:
Thanks for your help so far, everyone.
Thomas: I haven't looked very deep into the survey package yet, so I
don't know if what I'm looking for is actually missing or if I just
haven't found it yet.
Wh
Hello again,
On Jan 17, 2010, at 5:42 PM, Rolf Turner wrote:
Notice that your output is 6 x 5 whereas your input is 5 x 6.
Now *what* did you do wrong?
Whoa! Let's try that again, but with a better example.
> X = matrix(as.character(1:6),2,3)
> X
[,1] [,2] [,3]
[1,] "1" "3" "5"
[
My guess (since we still have no data on which to test these ideas)
is that you need either to merge() or to use a matrix created from the
dates and qtr-hours entries in "gw", since matching on dates and hours
separately will not uniquely classify the good qtr-hours within their
proper cor
On Jan 17, 2010, at 4:37 PM, Steve Sidney wrote:
Well now I am totally baffled !!
Using
sum( !is.na(b[,3])) I get the total of all col 3 except those that
are NA -
Great solves the first problem
What I can't seem to do is use the same logic to count all the 1's
in that
col, whi
In respect of your matrix problem:
(1) mode(mm) <- "numeric"
OR:
(2) mm <- apply(mm,2,as.numeric)
In respect of your data frame problem:
as.data.frame(lapply(X,as.numeric))
(where X is your data frame) should work. This will of course
convert every column of your data frame to nume
Hi,
I find the following works in R 2.10.1 on Mac OSX.
> m = matrix(rep("3", 30), 5,6)
> m
[,1] [,2] [,3] [,4] [,5] [,6]
[1,] "3" "3" "3" "3" "3" "3"
[2,] "3" "3" "3" "3" "3" "3"
[3,] "3" "3" "3" "3" "3" "3"
[4,] "3" "3" "3" "3" "3" "3"
[5,] "3" "3" "3" "3" "3" "3"
Dear list-members,
I am moving some of my heavy processing to a new machine (running SuSE
Enterprise Linux 10 SP2)
and I need packages 'extRemes' and 'ismev'loaded within a BATCH process (to
calculate a confidence
interval in a GPD model using the profile likelihood method).
My problem is that
Try this:
class(mm) <- "numeric"
On Sun, Jan 17, 2010 at 5:17 PM, ivan popivanov
wrote:
>
> Hello,
>
>
>
> This turned out to be surprisingly hard for me:
>
>
>
> Let's say I have
>
>
>
> mm = matrix(as.character(seq(1,30, 1)), nrow=3); mm
>
> [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,1
Ravi Varadhan jhmi.edu> writes:
>
> Dear Hans,
>
> I agree with your comments. My intuition was that the quadratic
> form would be better behaved than the radical form (less
> nonlinear!?). So, I was "hoping" to see a change in behavior when
> the cost function was altered from a radical (i.
Hello,
This turned out to be surprisingly hard for me:
Let's say I have
mm = matrix(as.character(seq(1,30, 1)), nrow=3); mm
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10]
[1,] "1" "4" "7" "10" "13" "16" "19" "22" "25" "28"
[2,] "2" "5" "8" "11" "14" "17" "20" "23" "26"
Thank you Dennis.
arr$gw <- as.numeric(weather$Date == arr$Date & arr$quarter %in%
weather$quarter)
seems to be what I want to do, but in fact, with the full data set, it
misidentifies the rows, so I think the error message must mean something.
> arrr$Date <- as.Date(as.character(ewr$Date),format=
Well now I am totally baffled !!
Using
sum( !is.na(b[,3])) I get the total of all col 3 except those that are NA -
Great solves the first problem
What I can't seem to do is use the same logic to count all the 1's in that
col, which are there before I use the cast with margins.
So it se
2010/1/16 Thomas Lumley :
> On Sat, 16 Jan 2010, Vera wrote:
>
>> Thanks for your help so far, everyone.
>>
>> Thomas: I haven't looked very deep into the survey package yet, so I
>> don't know if what I'm looking for is actually missing or if I just
>> haven't found it yet.
>> What is "missing", f
No, I cannot find counterexamples, so that actually seems to give identical
solutions! That is fantastic.
I guess my homework is now convince myself we can go from this quadratic
objective
sum_i,j [ sum_k P[i,k]*G[k,j] - I[i,j] ]^2
to a linear one:
sum_i,j c[i,j]*P[i,j]
Thanks !
Erwin
-
On Sun, 17 Jan 2010, Andreas Wittmann wrote:
Thank you very much for your quick answers.
Sorry, but i forgot to explain i want to find the closest and smaller element
for each entry, so ind1[3] is smaller as 11 and close to 11, ind1[2] is
smaller as 5 and close to 5 and ind1[1] is smaller tha
On 18/01/2010, at 9:02 AM, Joshua Wiley wrote:
Hello Alan,
Following up on Gabor's suggestion, if you have different packages
loaded, one of those packages could have a function
Object?
'diff' that would not show up with a call to ls() so you could also
try
search()
which will
Hello Alan,
Following up on Gabor's suggestion, if you have different packages
loaded, one of those packages could have a function 'diff' that would
not show up with a call to ls() so you could also try
search()
which will show you what packages are loaded.
HTH,
Joshua
On Sun, Jan 17, 2010 a
I thought it would be possible to make rep() work for functions
by writing a method for the function class. I tried:
rep.function <- function(x,...) {
times <- as.list(...)[[1]]
rslt <- vector("list",times)
rslt[1:times] <- list(x)
rslt
}
But then doing
rep(sin,2)
still gave an
Hello - I'm trying to construct a coplot to check the residuals conditioned
on a factor using the following formula, however I keep getting an error
message. I've used the same formula for another data set and it worked fine
- the only difference is that now I have missing values for each level (
SInce you provided no data, it is hard to determine how to compare. If you
also want the date, then the following will work:
arr$GoodWeather <- arr$quarter %in% gw$quarter & arr$date %in% gw$date
If your "quarter" is just the minutes of arrival, you may have to convert
that to the appropriate q
On 1/17/10 1:06 PM, David Winsemius wrote:
>
> On Jan 17, 2010, at 12:37 PM, James Rome wrote:
>
>> I don't think it is that simple because it is not a one-to-one match. In
>> the arr data frame, there are many arrivals in a quarter hour with good
>> weather on a given day. So I need to match th
Bingo,
I knew it was something simple and that I wasn't seeing the wood for the
trees.
David, Ista
Apologies for the vague description, which I thought was clear enough, but
yes I now think that I understand that I need to count the 1's and be able
to sum the total of 1' and 0's by ignoring
Try bquote:
a <- 0.1; b <- 0.2
plot(0, main = bquote(tau(A) == .(a)*lg(A^.(b
On Sun, Jan 17, 2010 at 12:47 PM, rrookie1982 wrote:
>
> Hallo together,
>
> I want to write a formula of the type
>
> http://n4.nabble.com/file/n1016112/expression.gif
>
>
>
>
>
>
>
> into my plot, where the value
On Jan 17, 2010, at 12:37 PM, James Rome wrote:
I don't think it is that simple because it is not a one-to-one
match. In
the arr data frame, there are many arrivals in a quarter hour with
good
weather on a given day. So I need to match the date and the quarter
hour.
And all of the rows i
On 17.01.2010 18:47, rrookie1982 wrote:
text(0,7.5,substitute(expression(paste(symbol("t"),"(A) = ",c1 +
lg(A^c2),sep="")),list(c1=0,456,c2=-0.123)),pos=4)
It is much easier, just write the formula down in R syntax and
substitute the relevant variables as in:
text(0, 7.5, substitute(tau(A
Hallo together,
I want to write a formula of the type
http://n4.nabble.com/file/n1016112/expression.gif
into my plot, where the values 1.234 and -0.567 should origin from variables
in the program. The threads in this forum gave me some ideas that the
functions expression(), paste(), and
On Jan 17, 2010, at 12:30 PM, Andreas Wittmann wrote:
Thank you very much for your quick answers.
Sorry, but i forgot to explain i want to find the closest and
smaller element for each entry, so ind1[3] is smaller as 11 and
close to 11, ind1[2] is smaller as 5 and close to 5 and ind1[1] is
I don't think it is that simple because it is not a one-to-one match. In
the arr data frame, there are many arrivals in a quarter hour with good
weather on a given day. So I need to match the date and the quarter hour.
And all of the rows in the weather data frame are times with good
weather--uniq
On Jan 17, 2010, at 11:56 AM, Steve Sidney wrote:
David
Thanks, I'll try that..but no what I need is the total (1's) for
each of the rows, labelled 1-6 at the top of each col in the table
provided.
Part of my confusion with your request (which remains unaddressed) is
what you mean
Thank you very much for your quick answers.
Sorry, but i forgot to explain i want to find the closest and smaller
element for each entry, so ind1[3] is smaller as 11 and close to 11,
ind1[2] is smaller as 5 and close to 5 and ind1[1] is smaller than 3 and
close to 3.
best regards
Andreas
Hi Steve,
It's still not clear to me what you want. Please give a minimal
example so I can understand what you're trying to do.
-Ista
On Sun, Jan 17, 2010 at 11:56 AM, Steve Sidney wrote:
> David
>
> Thanks, I'll try that..but no what I need is the total (1's) for each of
> the rows, labelle
David
Thanks, I'll try that..but no what I need is the total (1's) for each of
the rows, labelled 1-6 at the top of each col in the table provided.
What I guess I am not sure of is how to identify the col after the melt and
cast.
Steve
- Original Message -
From: "David Winsemi
Is it not giving you the location of the minimum value not the value?
See
ind1<-c(1,4,10)
ind2<-c(3,5,11)
i=3
(ind1-ind2[i])
(aa <- abs(ind1-ind2[i]))
which.min(aa)
--- On Sun, 1/17/10, Andreas Wittmann wrote:
> From: Andreas Wittmann
> Subject: [R] enty-wise closest element
> To: r-help@r-p
On Jan 17, 2010, at 11:00 AM, Andreas Wittmann wrote:
Dear R-users,
i have a simple problem maybe, but i don't see the solution. i want
to find the entry-wise closest element of an vector compared with
another.
ind1<-c(1,4,10)
ind2<-c(3,5,11)
for (i in length(ind2):1)
{
print(which.min(
Klaus,
I am happy to know that the quadratic cost LSAP seems to work well for you.
The Hungarian algorithm is a classic for solving linear sum assignment problem,
which is closely related to matching in bipartite graphs. You can google or
wiki these terms to get papers and books on this top
Hey all,
I read in a paper about the zipf distribution, which seems different from
what i learned here. It says: we can generate a random dataset of pairs of
the form (x,y). By modifying some variable Z during data generation, we can
generate dataset where x and y can be closely correlated or tota
Deepayan Sarkar wrote:
On Sat, Jan 16, 2010 at 11:56 PM, Peter Ehlers wrote:
Marius Hofert wrote:
Dear ExpeRts,
I have the scatter plot matrix as given below. I would like the different
"sub-plots" in the scatter plot matrix to be colored differently. How do I
get all points shown in the uppe
Dear R-users,
i have a simple problem maybe, but i don't see the solution. i want to
find the entry-wise closest element of an vector compared with another.
ind1<-c(1,4,10)
ind2<-c(3,5,11)
for (i in length(ind2):1)
{
print(which.min(abs(ind1-ind2[i])))
}
for ind2[3] it should be ind1[3] 10,
Dear Hans,
I agree with your comments. My intuition was that the quadratic form would be
better behaved than the radical form (less nonlinear!?). So, I was "hoping"
to see a change in behavior when the cost function was altered from a radical
(i.e. sqrt) form to quadratic, but I was still su
On Jan 17, 2010, at 5:31 AM, Steve Sidney wrote:
Sorry to repeat the meassage, not sure if the HTML version has been
received - Apologies for duplication
Dear list
I am trying to count the no of occurances in a column of a data
frame and there is missing data identifed by NA.
I am able
Dear Erwin, Ravi and Hans Werner,
thanks a lot for your replies. I don't think I have access to Cplex and
therefore probably cannot try that out but will read about MIQP.
I played a bit then around with Ravi's suggestions and made also the
observation that the linear cost function often found t
Its likely that in one of your sessions you do have a diff and in the
other you don't and this has nothing to do with XP vs. Windows 7. In
the session with no diff, the only diff around is the function, diff,
and you can't subscript a function.
Try this to see what variables are in your workspace
Instead of making two vectors, you
might want to just have one matrix
with two rows:
amat <- matrix(a, nrow=2)
Then you can do:
amat[1,]
amat[2,]
Patrick Burns
patr...@burns-stat.com
+44 (0)20 8525 0696
http://www.burns-stat.com
(home of "The R Inferno" and "A Guide for the Unwilling S User"
try this:
a <- c(1,2,3,4,5,6)
n <- length(a)
a[seq(1, n, 2)]
a[seq(2, n, 2)]
I hope it helps.
Best,
Dimitris
Walther, Alexander wrote:
Dear list,
is there a command that selects every second value from a given vector?
For instance,
a <- c(1,2,3,4,5,6)
should yield
1,3,5
and
2,4,6
wh
Dear list,
is there a command that selects every second value from a given vector?
For instance,
a <- c(1,2,3,4,5,6)
should yield
1,3,5
and
2,4,6
which i intend to place into two seperate vectors.
best
Alex
__
R-help@r-project.org mailing list
Hello,
I am a newbie.
I can run the following code stored in "test.txt" without error using my
XP machine:
x <- scan("C:\\Rwork\\A.txt")
x10 = filter(x, rep(1/10,10), sides=1)
x
x10
for(i in 10:length(x)){
if (x[i] > x10[i]) diff[i]="b" else diff[i]="s"
}
However, if I run it in another PC
Sorry to repeat the meassage, not sure if the HTML version has been
received - Apologies for duplication
Dear list
I am trying to count the no of occurances in a column of a data frame and
there is missing data identifed by NA.
I am able to melt and cast the data correctly as well as sum the
Dear list
I am trying to count the no of occurances in a column of a data frame and there
is missing data identifed by NA.
I am able to melt and cast the data correctly as well as sum the occurances
using margins and sum.
Here are the melt and cast commands
bw = melt(res, id=c("lab","r"), "pf
On Sat, Jan 16, 2010 at 11:56 PM, Peter Ehlers wrote:
> Marius Hofert wrote:
>>
>> Dear ExpeRts,
>>
>> I have the scatter plot matrix as given below. I would like the different
>> "sub-plots" in the scatter plot matrix to be colored differently. How do I
>> get all points shown in the upper-left p
On 01/17/2010 04:05 AM, alessia matano wrote:
Dear all,
I am trying to apply the sapply function on a list, which comes out
from a matrix of 25 rows and two columns, so that each element of the
list, is a two column element. In my function within sapply, say f, I
would like each element of the
Ravi Varadhan jhmi.edu> writes:
>
> Interesting!
>
> Now, if I change the "cost matrix", D, in the LSAP formulation slightly
> such that it is quadratic, it finds the best solution to your example:
Dear Ravi,
I thought your solution is ingenious, but after the discussion with
Erwin Kalvela
Hello.
I've just started using R and am trying to figure out if the two codes
snippets below have the same output
gBest<-floor(runif(popsize,min=1,max=top))
velocity[i,j]<<-.4* velocity[i,j] + 1 * runif(1) * (pbestsVar[i,j] -
popVar[i,j]) + 1 * runif(1) * (archiveVar[gBest,j] - popVar[i,j])
and
67 matches
Mail list logo