You posted this earlier, did you not, and no one answered, perhaps
because no one understood and/or perhaps because you failed to follow
the posting guide (no minimal reproducible example nor code; and HTML
to a plain text list). Please be more patient and stop spamming the
list. And perhaps try f
FAQ 7.31
0.2 is slightly larger than 1/5, and 1-0.8 is slightly smaller. The argument
to numeric has to be an integer, so fractions are discarded. This behavior is
not unique to R.
--
Sent from my phone. Please excuse my brevity.
On April 27, 2016 8:29:13 PM GMT+01:00, Scott Rifkin wrote:
>W
Tena koe Simon
plot(1:10, 1:10, type='n')
polygon(c(2,3,6,8), c(2,5,5,3), density=20, angle=90)
polygon(c(2,3,6,8), 5+c(2,5,5,3), density=20, angle=0)
I don't understand your problem. Perhaps if you "provide[d] commented,
minimal, self-contained, reproducible code" it would help.
HTH
Pet
> numeric(0.2*25)
[1] 0 0 0 0 0
> numeric((1-0.8)*25)
[1] 0 0 0 0
> print(c(0.2*25, (1-0.8)*25), digits=17)
[1] 5. 4.9991
> 0.2*25 - (1-0.8)*25
[1] 8.881784e-16
> as.integer(c(0.2*25, (1-0.8)*25), digits=17)
[1] 5 4
> ## See FAQ 7.31 for other examples of floating point
I am trying to use the angle option in polygon to create polygons filled with
horizontal and vertical lines. The polygons I am crating are irregular and it
the angle function appears to set the angle of the shading perpendicular to the
polygon sides rather than perpendicular to the axes. Is th
Why does:
> numeric(0.2*25)
return
[1] 0 0 0 0 0
but
> numeric((1-0.8)*25)
returns
[1] 0 0 0 0
[running version 3.2.0]
[Apologies if this has been asked before - it's a hard question to find
specific search terms for]
Thanks,
Scott
__
R-hel
Hello all, I have used describeBy to generate the following summary
statistics. I simply need x and y error bars on a plot that has CQN
(xaxis) and Price (yaxis). There should be four total points on the graph
(one for each supplier).
Using "error.crosses(desc$CQN, desc$Price)" does not work.
Hi!
I have this code which is working
formula <- function(x){
return(x)
}
For( x in names)
{
x5 <- rbind(x5,formula(x))
}
Now, I want to convert this code to parallel processing, so i am using
foreach function
foreach(x=names, .packages="checkpoint" ,.combine=
I came up with this, using recursion. Short and should work for n
greater than 9 :)
Peter
sumsToN = function(n)
{
if (n==1) return(1);
out = lapply(1:(n-1), function(i) {
s1 = sumsToN(n-i);
lapply(s1, c, i)
})
c(n, unlist(out, recursive = FALSE));
}
> sumsToN(4)
[[1]]
[1] 4
[[2]
This is not the most efficient, but gets the idea across. This is the
largest sum I can compute on my laptop with 16GB of memory. If I try to
set N to 9, I run out of memory due to the size of the expand.grid.
> N <- 8 # value to add up to
> # create expand.grid for all combinations and convert
Hi Atte,
I'm not sure that this actually works, and it's very much a quick hack:
sums_x<-function(x,addends=1,depth=1) {
if(depth==1) {
addends<-rep(addends,x)
addlist<-list(addends)
} else {
addlist<-list()
}
lenadd<-length(addends)
while(lenadd > 2) {
addends<-c(addends[depth]+1,add
The subject of your email is missing. Perhaps you need to read the Posting
Guide (again?) about attachments. Embedding your example directly in the body
of the email is generally more accessible in archives than attaching it.
--
Sent from my phone. Please excuse my brevity.
On April 27, 2016 1
...
"(R is case sensitive, so "C" has no such problem)."
Well, not quite. Try ?C
To add to the previous comments, Dr. Gordon appears to need to do
her/his homework and spend some time with an R tutorial or two before
posting further here. There are many good ones on the web. Some
recommendations
Hi,
Your matrix needs to either be symmetric or an object of class dist.
Here's one way to reformat it:
Note that calling it dist is a poor idea, since dist() is a base function.
Also note that if the distance from 1-2 is 1 while distance from 2-1 is
Inf, as in your original matrix, then you
"c" an extremely commonly-used function. Functions are first-class objects that
occupy the same namespaces that variables do, so they can obscure each other.
In short, don't use variables called "c" (R is case sensitive, so "C" has no
such problem).
Wherever possible, avoid incremental concaten
Instead of talking about how you want to do something and showing us your
Matlab code, tell us what you want to do, include reproducible data, and show
us your R code so far. Your initial assumption, that you need a loop for these
examples is incorrect if I have understood you correctly. Many fu
Hello all, I have used describeBy to generate the following summary
statistics. I simply need x and y error bars on a plot that has CQN
(xaxis) and Price (yaxis). There should be four total points on the graph
(one for each supplier).
Using "error.crosses(desc$CQN, desc$Price)" does not work.
Hi,
Do you have ideas, how to find all those different combinations of
integers (>0) that produce as a sum, a certain integer.
i.e.: if that sum is
3, the possibilities are c(1,1,1), c(1,2), c(2,1)
4, the possibilities are
c(1,1,1,1),c(1,1,2),c(1,2,1),c(2,1,1),c(2,2),c(1,3),c(3,1)
etc.
Be
Hello,
Suppose the you need a loop to create a new variable , i.e., you are not
reading data from outside the loop. This is a simple example in Matlab code,
for i=1:5
r1=randn
r2=randn
r=[r1 r2]
c(i,:)=r; % creation of each row of c , % the ":" symbol indicates all
columns. In R this would be
Hello R users,
I have a quick question I was hoping to get your input on. I am new to R
and the smooth statistical regression world, and am trying to wrap my mind
around the issues concerning using splines for mixed effect modeling.
My question is the following: in the ‘gamm’ function, generaliz
Hi All,
I am addressing this post to all who are new to R.
When learing R in the last weeks I took some notes for myself to have code
snippets ready for the data analysis process. I put these snippets
together as a script template for future use. Almost all of the given command
prototypes are
I have this code which is working
library("checkpoint")
library("gtrendsR")
library("doParallel")
cl<-makeCluster(4)
registerDoParallel(cl)
gconnect(usr = "em...@gmail.com", psw = "password", verbose = FALSE)
names <- c("apple","shit", "android", "rocks")
formula <- function(x){
x0 <- gtrends(x,
Objective: Determine if a set of x and y-latitude points are inside of
a polygon using R.
Lets say I have 9 polygons. Where I have labeled the polygons to be
checked from 1-9. The problem I’m running into is running the
point.in.polygon to check if those points are in one of several
polygons, as m
Hi
License statement of Akima packages states:
This package is distributed under the ACM license at
http://www.acm.org/publications/policies/softwarecrnotice.
In detail:
1. Fortran code (src/*.f):
Copyrighted and Licensed by ACM,
see http://www.acm.org/publications/policies/softwarecrnotice
Dear Jean,
Have a look at
http://stackoverflow.com/questions/5595512/what-is-the-difference-between-require-and-library
Best regards,
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie & Kwaliteitszorg / team Biometrics & Qualit
Hi,
I am hired to translate into FORTRAN R functions. It works great and my
customer is happy. I am going to translate a function that call aspline in the
library AKIMA.
This function call 2 FORTRAN routines that must be include (I guess) in the
package AKIMA. And I have some questions.
Is the
Hi,
Is there any other difference between 'require' and 'library' than the error or
warning when the library is not found ?
Jean in France
Ce message et toutes les pièces jointes (ci-après le 'Message') sont établis à
l'intention exclusive des destinataires et les informations qui y figuren
Regress on a multivariate polynomial:
lm(y ~ polym(x1, x2, x3, x4, degree = 3))
See ?polym
__
R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www
Hi Georg
Something was wrong with your data. Even with
> res
[1]
Levels: Check OK
>
> table(res)
res
CheckOK
0 0
table gives me different result from yours.
I can repeat your result with
> res<-as.numeric(res)
> table(res)
< table of extent 0 >
> res
[1] NA NA NA NA NA N
Hi All,
Say I have the values of function f(x1,x2,x3,x4) for each values of
x1,x2,x3,x4 but not complete. But the functional form is not known.
Techniques like regression, etc. are not able to give me satisfactory
results and msy be more complex than we thought.
I wanted to use Taylor's approxim
Hi Petr,
Hi Jim,
many thanks for your help. Today I constructed a sample dataset and tested
your suggestions. Everything worked OK.
Then I took the code and testet on the original data. And - it worked OK
this morning also.
I went back to my script of Thuesday and ran it again. OK. Then I used
31 matches
Mail list logo