x-c(1,4,9,20,3,7)
i want to get a serie c(5,13,29,23,10).
y - c()
for (i in 2:length(x)){
y[i-1] - x[i-1]+x[i]}
is there more simple way to get?
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing list
On Fri, Dec 13, 2013 at 10:11 PM, æ°´éæµæ·± 1248283...@qq.com wrote:
i have write a function to convert decimal number into binary number in R.
dectobin-function(x){
as.numeric(intToBits(x))-x1
paste(x1,collapse=)-x2
as.numeric(gsub(0+$,,x2))-x3
return(as.character(x3))}
On 14-Dec-2013 10:46:10 Ë®¾²Á÷Éî wrote:
x-c(1,4,9,20,3,7)
i want to get a serie c(5,13,29,23,10).
y - c()
for (i in 2:length(x)){
y[i-1] - x[i-1]+x[i]}
is there more simple way to get?
x - c(1,4,9,20,3,7)
N - length(x)
x[1:(N-1)] + x[2:N]
# [1] 5 13 29 23 10
Best wishes,
there is a file which contain such lines:
test -function(x,f){
n- length(x);
sum(f*(x[1:(n-1)]+x[2:n])/2)/sum(f) - result;
return(result);
}
i can read it into terminal , cat test.R
how can i do it in R?
readLines(c:/test.R,n=-1)
[1] test -function(x,f){
See ?source
Uwe Ligges
On 14.12.2013 12:22, 水静流深 wrote:
there is a file which contain such lines:
test -function(x,f){
n- length(x);
sum(f*(x[1:(n-1)]+x[2:n])/2)/sum(f) - result;
return(result);
}
i can read it into terminal , cat test.R
how can i do it in R?
Dear users of R,
How can i plot the values in column C with A on x-axis and B on y-axis?s
-
A BC 0.451 0.333 1134
0.491 0.270 1433
0.389 0.249 7784
0.425 0.819 6677
0.457 0.429 99053
0.436 0.524 111049 0.423 0.270
Please do not send emails using html. Please use dput() to send
your data to the list
st - read.table(text=s, header=TRUE)
plot(B~A, st, type=n)
with(st, text(A, B, C))
-
David L Carlson
Department of Anthropology
Texas AM University
College Station, TX
HI,
Using ?ggplot()
s -read.table(text=A B C
0.451 0.333 1134
0.491 0.270 1433
0.389 0.249 7784
0.425 0.819 6677
0.457 0.429 99053
0.436 0.524 111049
0.423 0.270 121093
0.463 0.315 131019,sep=,header=TRUE)
library(ggplot2)
David,
how should R interpret 110+? It cannot be numeric, perhaps you have
not recognized the + there?
Uwe
On 14.12.2013 01:35, David Winsemius wrote:
I thought that setting colClasses to numeric would coerce errant data to NA.
Instead read.table is throwing
errors. This is not what I
Hi,
Try:
x[-1]+x[-length(x)]
A.K.
On Saturday, December 14, 2013 5:46 AM, 水静流深 1248283...@qq.com wrote:
x-c(1,4,9,20,3,7)
i want to get a serie c(5,13,29,23,10).
y - c()
for (i in 2:length(x)){
y[i-1] - x[i-1]+x[i]}
is there more simple way to get?
[[alternative HTML version
On Dec 13, 2013, at 1:34 PM, Trevor Davies wrote:
Is there a quick function that can convert minutes (seconds) after midnight
to a time?
i.e 670.93 (minutes after midnight) -- 11:10:56.**
I know it can be done by hand but I thought there must be a function for
this already.
format(
On Dec 14, 2013, at 7:53 AM, Uwe Ligges wrote:
David,
how should R interpret 110+? It cannot be numeric, perhaps you have not
recognized the + there?
I specifically included the fragment ofthe much longer file that was throwing
the error. If this behavior doesn't appear flawed to you,
Hi every one,
I have a simple question. I want to make a vector from one of the colomns in a
data set. for example I have this data:
x1 x2 x3
1 5 7
4 8 9
8 6 12
4 8 13
I want to convert x1 to a vector such as:
x1= c(1,4,8,4)
How I can do it?
Thanks
[[alternative HTML
On 13.12.2013 20:11, J Karon wrote:
I get an invalid connection method error message when trying to write an R
object from a user-defined function to my hard drive (running Windows 7)
using write.csv. I have previously not had this problem with the same
user-defined function. The error
On 14.12.2013 17:50, David Winsemius wrote:
On Dec 14, 2013, at 7:53 AM, Uwe Ligges wrote:
David,
how should R interpret 110+? It cannot be numeric, perhaps you have not recognized the
+ there?
I specifically included the fragment ofthe much longer file that was throwing
the error. If
This is the R-help mailing list. If your problem persists when using R
from the command line or with the GUI shipped with R on your
(unspecified) platform post back here. Otherwise the RStudio support
forum is at https://support.rstudio.com
Best,
Ista
On Sat, Dec 14, 2013 at 12:22 AM, yuanzhi
Dear Arun and david,Thanks for your reply. If instead of text i want to add
points, what change in code should occur?
eliza
Date: Sat, 14 Dec 2013 07:48:52 -0800
From: smartpink...@yahoo.com
Subject: Re: [R] plot two columns against one
To: r-help@r-project.org
CC: eliza_bo...@hotmail.com
On Dec 14, 2013, at 6:34 AM, Patty Haaem wrote:
Hi every one,
I have a simple question. I want to make a vector from one of the colomns in
a data set. for example I have this data:
x1 x2 x3
1 5 7
4 8 9
86 12
4 8 13
I want to convert x1 to a vector such as:
x1=
Hi,
Try:
dat1 - read.table(text=x1 x2 x3
1 5 7
4 8 9
8 6 12
4 8 13,sep=,header=TRUE)
vec1 - dat1[,1]
vec1
#[1] 1 4 8 4
A.K.
On Saturday, December 14, 2013 12:55 PM, Patty Haaem elham_h...@yahoo.com
wrote:
Hi every one,
I have a simple question. I want to make a vector
Hi Eliza,
Try:
ggplot(s,aes(x=A,y=B))+geom_point(colour=white,shape=21,size=4,aes(fill=factor(C)))+theme_bw()+theme(legend.position=none)
A.K.
On Saturday, December 14, 2013 12:29 PM, eliza botto eliza_bo...@hotmail.com
wrote:
Dear Arun and david,
Thanks for your reply. If instead of
Suppose I have a dataframe 'd' defined as
L3 - LETTERS[1:3]
d0 - data.frame(cbind(x = 1, y = 1:10), fac = sample(L3, 10, replace
= TRUE))
(d - d0[d0$fac %in% c('A', 'B'),])
x y fac
2 1 2 B
3 1 3 A
4 1 4 A
5 1 5 A
6 1 6 B
8 1 8 A
Even though factor 'fac' in 'd' only
On 14.12.2013 21:09, Gang Chen wrote:
Suppose I have a dataframe 'd' defined as
L3 - LETTERS[1:3]
d0 - data.frame(cbind(x = 1, y = 1:10), fac = sample(L3, 10, replace
= TRUE))
(d - d0[d0$fac %in% c('A', 'B'),])
x y fac
2 1 2 B
3 1 3 A
4 1 4 A
5 1 5 A
6 1 6 B
8 1
Dear Gang,
this seem to solve your problem.
http://stackoverflow.com/questions/1195826/dropping-factor-levels-in-a-subsetted-data-frame-in-r
best
daniel
Feladó: r-help-boun...@r-project.org [r-help-boun...@r-project.org] ;
meghatalmaz#243;: Gang Chen
Thanks both Uwe and Daniel for the great help!
On Sat, Dec 14, 2013 at 3:30 PM, Dániel Kehl ke...@ktk.pte.hu wrote:
Dear Gang,
this seem to solve your problem.
http://stackoverflow.com/questions/1195826/dropping-factor-levels-in-a-subsetted-data-frame-in-r
best
daniel
Hi all:
Assume that I have variables, say v1, v2,...,v100 and I want to use one
variable in each roop. How can I do this? See below
for (i in 1:100){
f(vi)
}
Thanks
David
[[alternative HTML version deleted]]
__
R-help@r-project.org mailing
Hi,
If the variables described are the columns in a data.frame,
set.seed(24)
dat1 - as.data.frame(matrix(sample(100,100*10,replace=TRUE),ncol=100))
f1 - function(x) mean(x,na.rm=TRUE)
sapply(1:100,function(i) f1(dat1[,i]))
#or
sapply(colnames(dat1),function(x) f1(dat1[,x]))
#IF these are
Hi David,
On 12/14/2013 01:06 PM, Marino David wrote:
Hi all:
Assume that I have variables, say v1, v2,...,v100 and I want to use one
variable in each roop. How can I do this? See below
for (i in 1:100){
f(vi)
}
for (i in 1:100){
f(get(paste0(v, i)))
}
Cheers,
H.
Thanks
David
or for a different view
library(lattice)
xyplot(B+C ~A, data = s,
outer = T,
scales = list(relation = free),
pch = as.numeric(rownames(s)),
col = as.numeric(rownames(s)))
Duncan
Duncan Mackay
Department of Agronomy and Soil Science
University of
Hi
have a look at the latticeExtra package
library(latticeExtra)
? useOuterStrips
or
xyplot(y~x| paste(grouping1, grouping2), data=na.omit(mydata), layout =
c(...
HTH
Duncan Mackay
Department of Agronomy and Soil Science
University of New England
Armidale NSW 2351
Email: home:
Thanks Hervé Pagès and A. K.. It works.
Thank you!
David
2013/12/14 Hervé Pagès hpa...@fhcrc.org
Hi David,
On 12/14/2013 01:06 PM, Marino David wrote:
Hi all:
Assume that I have variables, say v1, v2,...,v100 and I want to use one
variable in each roop. How can I do this? See below
Very elegant! Thank you Eric.
(You omitted library(plyr), so I had to search for arrange())
-Michael
On 12/13/2013 3:01 PM, rmail...@justemail.net wrote:
Perhaps this?
library(reshape2)
library(stringr)
GeisslerLong - melt (Geissler, id.vars = c(boys))
GeisslerLong - transform (
31 matches
Mail list logo