one solution is:
img1-matrix(1:5)
img2-matrix(2:5)
col-1:5 # col-c(green,yellow,...)
image(img1,col=col[sort(unique(img1))])
image(img2,col=col[sort(unique(img2))])
On 12/26/06, Milton Cezar Ribeiro [EMAIL PROTECTED] wrote:
Dear All,
How can I define a color sequence for each image value? I
Generally, you can create formula from string:
lda(formula(paste(names(iris)[5],~.)),iris)
On 12/28/06, Gabor Grothendieck [EMAIL PROTECTED] wrote:
Try:
lda(iris[-5], iris[,5])
On 12/26/06, Feng Qiu [EMAIL PROTECTED] wrote:
Hi everyone:
I'm trying to compose a string dynamicly
Try:
as.date(Date1)-as.date(Date2)
On 12/28/06, Brian Edward [EMAIL PROTECTED] wrote:
Hello all,
Can somebody point me to references or provide some code on dealing with
this date issue. Basically, I have two vectors of values that represent
dates. I want to convert these values into a
You have to create *formula* object from string and pass it to lda().
See my previous post.
On 12/29/06, Feng Qiu [EMAIL PROTECTED] wrote:
Hi Gabor:
Thank you! But it didn't work. Since lda() takes the variable
name as the input parameter. So what I was trying to do is make the
Generally, you can create formula from string:
lda(formula(paste(names(iris)[5],~.)),iris)
On 12/29/06, Feng Qiu [EMAIL PROTECTED] wrote:
Hi Gabor:
Thank you! But it didn't work. Since lda() takes the variable
name as the input parameter. So what I was trying to do is make the
Try this:
lda(formula(paste(names(iris)[5],~.)),iris)
You have to create *formula* object from string and pass it to lda().
On 12/29/06, Feng Qiu [EMAIL PROTECTED] wrote:
Hi Gabor:
Thank you! But it didn't work. Since lda() takes the variable
name as the input parameter. So what
It can be explained.
class(A)
[1] data.frame
length(A)
[1] 5
class(A==0)
[1] matrix
length(A==0)
[1] 10
class(-A*log(A))
[1] data.frame
length(-A*log(A))
[1] 5
as you can see, the result of A==0 is matrix with length=10, while the
result of -A*log(A) is still data.frame with length=5.
try apply() :
par(new=F);
apply(s,2,function(x){plot(x[[1]],x[[2]],type=o);par(new=T)})
On 1/8/07, Antje [EMAIL PROTECTED] wrote:
Hi all,
I've got the following problem. I have a vector containing file names. I
want to read these files as csv and calculate the density-function for
each file
Maybe I misunderstand what you want to do, one solution is:
l1
$a
[1] 1 2
$b
[1] 1 2 3
$c
[1] 1 2 3 4
l2
V1 V2
1 d nd
2 c nc
3 b nb
4 a na
names(l1)-sapply(names(l1),function(n)l2[l2$V1==n,2])
l1
$na
[1] 1 2
$nb
[1] 1 2 3
$nc
[1] 1 2 3 4
On 1/10/07, Christoph Heibl [EMAIL
NIR seems to be not dataset. It is a member of dataset yarn.
Try:
library(pls)
data(yarn)
str(yarn)
On 1/10/07, Carmen Meier [EMAIL PROTECTED] wrote:
I did just the download of the pls package, but the NIR dataset is not
available
require(pls)
[1] TRUE
data(NIR)
Warning message:
data
See changelog of pls 2.0-0
- The 'NIR' and 'sensory' data sets have been renamed to 'yarn' and 'oliveoil'.
you can see it in package source from CRAN
http://cran.r-project.org/src/contrib/Descriptions/pls.html
HTH
On 1/10/07, Carmen Meier [EMAIL PROTECTED] wrote:
talepanda schrieb:
NIR
col.region changes both colors in plot and colorkey.
try:
x - seq(pi/4, 5 * pi, length = 100)
y - seq(pi/4, 5 * pi, length = 100)
levelplot(z~x*y) #default
levelplot(z~x*y,col.regions=rainbow(24)) #custom color
On 1/11/07, Bram Kuijper [EMAIL PROTECTED] wrote:
Hi all,
I try to make a
because given data is a part of your data, I cannot examine,
however, try:
##out.block-identify(tb_ncs$y,tb_ncs$Slide)
out.block-identify(tb_ncs$Slide,tb_ncs$y)
On 1/11/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Dear R-users,
Following is part of my data, where slide has 36
levels and
the observation number
everytime I clicked on any point.What I want is
instead of obervation numbers it would be block and/or
slide numbers.
Any other idea how I can make it works ?
Thanks
--- talepanda [EMAIL PROTECTED] skrev:
because given data is a part of your data, I cannot
examine
try:
readLines(n=1)-str
On 1/13/07, Tong Wang [EMAIL PROTECTED] wrote:
Hi all,
Sorry about the simple question, but I have searched the web with
prompt , input etc. and never got the answer .
thanks a lot
tong
__
It's not R problem but specification of windows file system.
see MSDN:
http://msdn2.microsoft.com/en-us/library/aa365247.aspx
On 1/15/07, Brandt, T. (Tobias) [EMAIL PROTECTED] wrote:
Hi
I cannot seem to create any files that have the name CON before the file
extension, i.e. all of the
In R language, one solution is:
a-c(3,4,6,2,3)
which(a==max(a))
On 1/18/07, Feng Qiu [EMAIL PROTECTED] wrote:
Hi all:
A short question:
For example, a=[3,4,6,2,3], obviously the 3rd entry of the array
has the maxium value, what I want is index of the maxium value: 3. is
Probably, you have to manually create, but it is easy:
# for beside=F
mp - barplot(VADeaths)
text(mp,y-t(apply(VADeaths,2,cumsum)),y) # labels are values itself
# or
mp - barplot(VADeaths)
text(mp,t(apply(VADeaths,2,cumsum)),VADeaths) # labels are cumsum of values
# for besides=T
mp -
see:
?commandArgs
or more detail for R startup mechanisms:
?Startup
On 1/22/07, Deepak Chandra [EMAIL PROTECTED] wrote:
Hi All,
A simple and naive question from a newbie. How can one access command-line
arguments in R i.e. equivalent of argv in C?
Have spent a lot of time on finding it.
play below after your code and look at tk window:
tkentryconfigure(editMenu,0,state=disable)
tkentryconfigure(editMenu,0,state=active)
tkentryconfigure(topMenu,1,state=disable)
tkentryconfigure(topMenu,1,state=active)
HTH
On 1/22/07, Jarno Tuimala [EMAIL PROTECTED] wrote:
Hi!
I've
Usually (that is, not limited in R language), when error occurs in
try, stacks are rollbacked, so the variables defined in try no longer
exists after calling try.
One non-elegant solution is:
fit-NULL
try ( (fit = lm(y~x, data = data_fitting)), silent =T)
if(!is.null(fit)){
coeffs =
TeamInfo
TEAMNAME LEVEL WORKTIME BONUS
1 batch sunan B 135 9,818
2 batch Chenqi E 121 6,050
3 batch jiangxu F 97 4,189
4 online zhouxi F 63 2,720
5 online chenhe H 36 1,064
## try:
factor(TeamInfo$TEAM)
[1] batch batch batch
see:
?exists
HTH.
On 1/24/07, Shubha Vishwanath Karanth [EMAIL PROTECTED] wrote:
Hi,
Is there any way to check whether an R object exists or not? Say
example: a data frame.
Thanks,
Shubha
[[alternative HTML version deleted]]
__
non-elegant solution:
matrix(c(V1,rep(NA,-length(V1)%%5)),nrow=5)
HTH.
On 1/24/07, Shubha Vishwanath Karanth [EMAIL PROTECTED] wrote:
How to suppress the recycling of items in a matrix..instead NA can be
filled.
-Original Message-
From: Chuck Cleland [mailto:[EMAIL PROTECTED]
For Date class, *original* (that is, contents in memory) is 12853,
and 2005-03-11 is one expression of the original.
So you have to convert from the original to the charecter expression as follows.
s[1]-format(date)
s
[1] 2005-03-11 FALSE FALSE
s[1]-as.character(date)
s
[1] 2005-03-11
rownames()- is what you want.
dat-data.frame(V1=sample(10),V2=sample(10))
dat
V1 V2
1 2 5
2 3 8
3 8 4
4 9 6
5 6 2
6 5 7
7 10 3
8 4 9
9 1 10
10 7 1
dat-dat[order(dat$V2),]
dat
V1 V2
10 7 1
5 6 2
7 10 3
3 8 4
1 2 5
4 9 6
6 5 7
2 3 8
8 4
for the column names. For a data frame, 'rownames'
and 'colnames' are calls to 'row.names' and 'names' respectively,
but the latter are preferred.
On Wed, 24 Jan 2007, talepanda wrote:
rownames()- is what you want.
dat-data.frame(V1=sample(10),V2=sample(10))
dat
V1 V2
1
?Date seems to say that weekdays() is appropriate for that:
weekdays(as.Date(2006-12-01))
see:
?weekdays
On 1/25/07, John McHenry [EMAIL PROTECTED] wrote:
Hi WizaRds,
What is the standard way to get the day of the week from a date such
as as.Date(2006-12-01)? It looks like fCalendar has
It occurs why start or stop could not be converted into integer of
length 0 by using as.interger().
More presicely,
if( !isInteger(sa) || !isInteger(so) || k == 0 || l == 0 ) # c code
where sa is start, so is stop, k is length(start), l is length(stop)
For example:
substr(orz,character(0),0)
First question: Yes
Second question: z in func.int2 is z in myfunc (z=y^3).
You can easily test:
f0-function(){
z-1
f1-function()print(f1)
f2-function(z){f1();print(z)}
f2(z)
}
z-0
f0()
R language definition may be helpful
try:
plot(1:10,pch=1:10,cex=1:10)
pch specifies the types and cex specifies the sizes of symbols.
On 1/28/07, vinod gullu [EMAIL PROTECTED] wrote:
I want to plot variation of more than one variable in
single plot with different point types and points
sizes . Can someone help me to do that,
Currently, both color and plotting symbol does not change with the
grouping variable g1, that is, when
g1-rep(5:8,each=64)
,plotxy still generates same plot.
subscripts argument is useful for your purpose.
see:
panel section and details in
?xyplot
try:
plot-xyplot(y~x|f,
Dear R-er:
I want to use invisible function in some packages.
I know that triple colon operater is available.
However, how can I use all invisible functions in some packages.
One solution is , of course, to use ::: in every use, but is there
any workaround?
It is similar to using namespace
d-data.frame(id=1:4,x=c(0.1,0.5,0.2,0),y=c(3,1,9,5))
d
id x y
1 1 0.1 3
2 2 0.5 1
3 3 0.2 9
4 4 0.0 5
d[order(d$y),]
id x y
2 2 0.5 1
1 1 0.1 3
4 4 0.0 5
3 3 0.2 9
On 2/6/07, XinMeng [EMAIL PROTECTED] wrote:
Hello sir:
How can I sort a dataframe by sorting one of its column?
For size, maybe:
# Dimensions(in characters) of the internal pager.
#pgrows = 25
#pgcolumns = 80
pgrows = 48
pgcolumns = 128
in Rconsole, but location cannot be handled.
On 2/6/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Hi,
Using the Rconsole file I can specify the size and location of
summary.lm tells you F, df, and p value.
try:
summary(regression9)
On 2/6/07, Jason R. Finley [EMAIL PROTECTED] wrote:
Hello,
I have spent a good deal of time searching for an answer to this but
have come up empty-handed; I apologize if I missed something that is
common knowledge.
I am
:
On Tue, 6 Feb 2007, talepanda wrote:
For size, maybe:
# Dimensions(in characters) of the internal pager.
#pgrows = 25
#pgcolumns = 80
pgrows = 48
pgcolumns = 128
in Rconsole, but location cannot be handled.
For the very good reason that you can have multiple pagers and I at least
do
I think several ways can do that.
my code is:
data.frame(t(apply(dat,1,function(x)as.numeric(sub(\\*,,x[sort(1:2,grep(\\*,x)==2)])
HTH
On 2/7/07, Dale Steele [EMAIL PROTECTED] wrote:
Given two columns of type character in a dataframe of the form:
col1col2
31* 66
0 0*
I'm sorry, I forgot my definition of dat.
dat in code of previous post is:
dat-data.frame(col1=c(31*,0,102*,71*,31,66,47),col2=c(66,0*,66,80,2*,31*,38*))
dat
col1 col2
1 31* 66
20 0*
3 102* 66
4 71* 80
5 31 2*
6 66 31*
7 47 38*
On 2/7/07, talepanda [EMAIL PROTECTED
If I correctly understand,
hist(rep(1, 100), col=lightblue, border=black,breaks=0:10*0.1)
see:
breaks arg in ?hist
On 2/7/07, Dong H. Oh [EMAIL PROTECTED] wrote:
Dear expeRts,
I'd like to picture histogram of ones.
For example,
hist(rep(1, 100), col=lightblue, border=black)
A bin is
try:
mx[,new.col.names]
HTH.
On 2/7/07, [EMAIL PROTECTED] [EMAIL PROTECTED] wrote:
Hi R users,
I would like to know how to sort a matrix according a different order of
colnames (or rownames) ,e.g.,
mx = matrix(rnorm(1:20),5,4)
colnames(mx) = letters[1:4]
rownames(mx) = letters[1:5]
mx
Probably, you have to do it by hand.
Exactly, I do not know the reason, but I can imagine.
Once you define factor, the empty factor is not meaningless.
The simple way to do it is refactorize:
f-factor(1:3)
f
[1] 1 2 3
Levels: 1 2 3
factor(f[f!=2])
[1] 1 3
Levels: 1 3
On 2/9/07, Roger Leigh
Internally, labs in persp are drawn as when you use text function.
So you cannot change the sizes by cex.lab, but you can change by cex:
persp(x, y, z, cex=1.5)
gives larger labs in persp 3d plot.
Of course there may be some side effect because it may change the size
something other than labs.
try:
mtext(substitute(R^2 * : * GoodnessOfFits[i],list(i=graphNumber)))
HTH.
On 3/16/07, Bob Farmer [EMAIL PROTECTED] wrote:
Hi all:
I would like to create a line of plot margin text (using mtext() ) that
features both a superscript and a subset of an object. However, I
cannot seem to do
you can use nls:
see
?nls
and its example.
HTH.
On 3/16/07, Hufkens Koen [EMAIL PROTECTED] wrote:
Hi list,
I was wondering how I should go about fitting a sigmoid curve to a dataset.
More specifically how I estimate parameters a and b in the following
equation:
1 / 1+exp(-(x-a)*b)
?glht says
with 'print', 'summary', 'confint', 'coef' and 'vcov' methods
being available.
try:
example(glht)
summary(glht(amod, linfct = mcp(tension = Tukey)))
confint(glht(amod, linfct = mcp(tension = Tukey)))
On 3/19/07, Nair, Murlidharan T [EMAIL PROTECTED] wrote:
I used the multcomp
46 matches
Mail list logo