(1,2) I would get 1+2/1 = 3
for point (2,10) I would get 2+10/2 = 7
for point (4,8) I would get 4+8/4 = 6
I have tried using sapply here but I get this:
sapply(m,function(x,y) x+y/x)
Error in y/x : 'y' is missing
what I am doing wrong?
thanks
ADias
--
View this message in context:
http://r
David Winsemius wrote:
On Jan 30, 2011, at 5:27 PM, ADias wrote:
dados-
data
.frame
(Store
=
c
(Setubal
,lx
,Aveiro
,Coimbra
,Aveiro,Evora,Aveiro,Coimbra,Setubal),Prod=c(Bloco
Desenho,Bloco
Desenho
,Tinteiro
,RĂ©gua
,Lapiseira
,Regua
,Tinteiro,Lapiseira
Petr Pikal wrote:
Hi
r-help-boun...@r-project.org napsal dne 31.01.2011 09:44:00:
David Winsemius wrote:
On Jan 30, 2011, at 5:27 PM, ADias wrote:
dados-
data
.frame
(Store
=
c
(Setubal
,lx
,Aveiro
,Coimbra
,Aveiro,Evora,Aveiro,Coimbra
Hi
I am trying to create a function that is able to calculate this sum:
a-c(2,3,5)
b-(8,7)
with a meaning 235 and b 87. So the result of this sum would be 235 + 87
= 322.
I've searched a function like strsplit but that worked for integers and in
reverse - not spliting but combining.
Can you
Hi,
I have a data.frame and I need to know witch store sold more Lapiseiras. I
got a point where I am almost sure I am very closed to the answer but I am
missing somethiing.
So, the data frame is this one
Hi,
I have this character vector:
A-c(Tell me how many different letter this vector has?)
Is there a way with R that it can let me know how many different letters I
have on this vector?
If I use nchar(A) que gives me the number 50. With this function he is
counting all the letters present and
what I
am used to with other softwares. So I get really lost sometimes. But I am
getting better and I more and more find what I need just researching the
help pages.
many thanks
Regards,
ADias
--
View this message in context:
http://r.789695.n4.nabble.com/Relative-frequency-on-a-character-vector
I have done like this to get the result I need more directly
A-c(Tell me how many different letter this vector has?)
prop.table(table(strsplit(A,)))
?acdefhilmnors
t
0.16 0.02 0.04 0.02 0.02 0.14 0.04 0.06 0.04 0.06 0.04 0.04 0.04
Hi,
Is there an expression to double the values of a matrix - without using a
loop?
What I need is this:
Suppose we have this matrix
m
[,1] [,2] [,3]
[1,]7 174
[2,] 11 10 18
[3,] 15 19 18
and I want this matrix
[,1] [,2] [,3]
[1,] 112 102 115
Hi,
yes it works perfectly.
I have another question:
Is there way of selecting with a vector the values I wish to take out from a
matrix.
Example:
I have this matrix and I want to take out the numbers in bold and get the
second matrix below
m
[,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8]
Pete Brecknock wrote:
try ...
new_m = m[c(2,7,8),c(1,4,6,7)]
HTH
Pete
Hi Pete,
I haven't understood what you wanted to say here. Can you explain please?
thanks
ADias
--
View this message in context:
http://r.789695.n4.nabble.com/How-to-doulbe-all-the-value-on-a-matrix
Hi,
Suposse I have a vector:
v-c(10,13,4,6,45,27,32,21,1,8,14,36)
how do i sort just the odd numbers leaving the rest - the even numbers - on
the same positions as they already are on the vector?
thanks
AD.
--
View this message in context:
Hi,
I am with a problem on how to do a comparison of values. My script is as
follows:
repeat{
cat(How many teams to use? (to end write 0) )
nro-scan(n=1)
if(nro==0)break
cat(write the, nro, teams names \n)
teams-readLines(n=nro)
if (teams[1]==teams[2)next
else print(teams)
}
On this example I
Hi
Suppose we have an object with strings:
A-c(a,b,c,d)
Now I do:
B-matrix(A,4,4, byrow=F)
and I get
a a a a
b b b b
c c c c
d d d d
But what I really want is:
a b c d
b c d a
c d a b
d a b c
How can I do this?
thank you
A. Dias
--
View this message in context:
Hi
thank you all. I think I have what I need to solve my problem.
Regards,
A.Dias
--
View this message in context:
http://r.789695.n4.nabble.com/Help-with-For-instruction-tp3173074p3173386.html
Sent from the R help mailing list archive at Nabble.com.
Hi,
Still with the above problem:
But for instance, i have a data base with 30 variables and I created an
object each with one varibale missing:
DataBase - has 30 variables
DataBase1 has 29 variables with the 1st variable gone
DataBase2 has 29 variables with the 2nd variable gone
for(i in
Hi
Suppose you have the code below. The result I get from the cat function is
from the avgs object. Now, I have 30 diferent objects like this and I wish
to make a summary table, something like:
Avgs1 Avgs2
Avgs3
i= 2
Hi,
I am having a problem in doing something similar to this example:
Suppose I have this vector a, and from it I wish to create 5 other vector
each one with less one value than what object a has
So I have a
a-c(1,2,3,4,5)
and I want
a1 that shoud have (2,3,4,5)
a2 that should have (1,3,4,5)
a number (Zero ends))
n-scan(n=1)
if(n==0)break
i-(The number is odd)
p-(The number is even)
if (n%%2==0)
p else i
}
thanks,
Regards,
ADias
--
View this message in context:
http://r.789695.n4.nabble.com/How-to-make-this-script-ask-again-tp3170243p3170243.html
Sent from the R help mailing list
thank you for the answers, problem solved
Regards,
ADias.
--
View this message in context:
http://r.789695.n4.nabble.com/How-to-make-this-script-ask-again-tp3170243p3170611.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r
ADias wrote:
Hi,
I am using the code below to get a plot that will show me on the X axis
the number of clusters and on the Y axis the cluster average widths.
However I am getting this error:
Error in summary(silhouette(cutree(d, x), dist(iris[, -5])))$si.summary :
$ operator
Hello,
thank you all. I have been able to solve my problem with your help.
The problem I am trying to solve is:
I am working on a clustering method to group a data base. At the moment I am
using the clustering hierarchical method and trying to get to the best K
group value via the silhouette
Hi,
I am using code below to get a plot that will show me on the X axis the
number of clusters and on the Y axis the cluster average widths. However I
am getting this error:
Error in summary(silhouette(cutree(d, x), dist(iris[, -5])))$si.summary :
$ operator is invalid for atomic vectors
23 matches
Mail list logo