You can't do that on disk - try:
> dfr <- read.table ( "/Users/MAC/Desktop/data.txt" )
>
> dfr
>
A1 A2 A3 A4
Hi,
How do I rename the column labels in the table?
For Instance, if I have a table like this, and I want to have the column labels
changed from "A1 A2 A3 A4 A5" to "Mike Kate Michelle Paul Young"
A1 A2 A3A4A5
1 3344 55 6677
2
3
4
5
6
7
7
8
9
and my tex
Hi all. I have an SPSS file that I'm loading into R with the Hmisc spss.get
function. The trouble is that the SPSS file uses the Windows-1252 character set
(which I think is the default for SPSS on Windows) instead of plain-ol'
Latin-1, and since spss.get doesn't allow me to pass the "reencode"
On Fri, Sep 7, 2012 at 11:04 AM, STADLER Frederic
wrote:
> Hello,
> I am drawing a heatmap with hundreds of genes. Everything work fine, except
> when I want to had the name of the genes as the row.names with
>>row.names (a)<-a$Name
> And there's this things that duplicate are not allowed...
>
>
Dear R users,
could you please help me figure out why I am getting an error?
Initially my data looks like this:
> attributes(compl)$names
[1] "UserID" "compl_bin" "Sex.x" "PHQ_base"
"PHQ_Surv1" "PHQ_Surv2" "PHQ_Surv3"
[8] "PHQ_Surv4" "EFE"
Hi,
Try this:
dat1<-read.table(text="
Seamount Pico Nano Micro Total_Ch
1 0.0691 0.24200 0.00100 0.31210
1 0.0938 0.00521 0.02060 0.11961
1 0.1130 0.2 0.06620 0.37920
1 0.0864 0.15900 0.22300 0.46840
1 0.0262 0.04570 0.00261 0.07451
2 0.0314 0.17400 0.12800 0.33340
You cannot have duplicate row names. You have to do something to address that,
such as remove duplicates or aggregate your data.
---
Jeff NewmillerThe . . Go Live...
DCN:Basic
On 12-09-07 4:49 PM, Tinus Sonnekus wrote:
Hi All,
I have a data set wit three size classes (pico, nano and micro) and 12
different sites (Seamounts). I want to produce a table with the mean and
standard deviation values for each site.
Seamount PicoNano MicroTotal_Ch
1 Off_M
Hello,
Try the following.
agg1 <- aggregate(cbind(Pico, Nano, Micro) ~ Seamount, data = SChla, mean)
agg2 <- aggregate(cbind(Pico, Nano, Micro) ~ Seamount, data = SChla, sd)
names(agg1)[-1] <- paste("u", names(agg1)[-1], sep = ".")
names(agg2)[-1] <- paste("sd", names(agg2)[-1], sep = ".")
mer
On Sep 7, 2012, at 1:49 PM, Tinus Sonnekus wrote:
> Hi All,
>
> I have a data set wit three size classes (pico, nano and micro) and 12
> different sites (Seamounts). I want to produce a table with the mean and
> standard deviation values for each site.
>
> Seamount PicoNano Micro
Hi All,
I have a data set wit three size classes (pico, nano and micro) and 12
different sites (Seamounts). I want to produce a table with the mean and
standard deviation values for each site.
Seamount PicoNano MicroTotal_Ch
1 Off_Mount 1 0.0691 0.24200 0.00100 0.31210
2 Off_M
Hi,
You can also try this:
sapply(lapply(splitlist,rle),`[[`,2)[1,]
#[1] "a1" "a2"
sapply(lapply(splitlist,rle),`[[`,2)[2,]
#[1] "b1" "b2"
A.K.
- Original Message -
From: David Romano
To: r-help@r-project.org
Cc:
Sent: Friday, September 7, 2012 2:12 PM
Subject: [R] splitting charact
> ADD <- function(x) x <<- x+1
This would not solve the user's problem. "x <<- something" assigns something
to a variable
called (literally) 'x' in the first ancestral environment of ADD that already
contains
a variable called 'x' or in the global environment if 'x' were not found. E.g.,
if
Stephen,
You are looking for the nesting of the FirstFactor within the SecondFactor.
Here is an example for your two-way design.
The model.matrix shows the dummy variables.
The last four columns show the two-level comparisons of Fir within each
level of Sec
Rich
tmp <- data.frame(y=rnorm(16),
On Fri, Sep 7, 2012 at 3:16 PM, Rui Barradas wrote:
> Hello,
>
> Start by (re-)reading An Introduction to R, file R-intro.pdf in your doc
> directory. Chapter 10.
>
> You're just computing, not returning the result of that computation. Nor
> anything else, ADD() does not return a value.
Sure it d
On Sep 7, 2012, at 1:34 PM, David Winsemius wrote:
>
> On Sep 7, 2012, at 11:00 AM, wwreith wrote:
>
>> I am just starting to experiment with writing a function and have run into
>> what seems like a limitation or more likely a lack of understanding on my
>> part.
>>
>> Very Simple Example:
On Sep 7, 2012, at 11:00 AM, wwreith wrote:
> I am just starting to experiment with writing a function and have run into
> what seems like a limitation or more likely a lack of understanding on my
> part.
>
> Very Simple Example: I want to define a function that does 1+1=2.
>
> z<-1
> ADD<-fu
Hi all
I am using WinBugs 14, and packages arm, rbugs
to call WinBugs from R. I have to do the analysis
for a series for data sets. I have a for loop which calls function bugs
and then saves the result in Res[[i]]. Everything works just fine in the R
script.
However the for loop is for i in 1:1
Hello,
Start by (re-)reading An Introduction to R, file R-intro.pdf in your doc
directory. Chapter 10.
You're just computing, not returning the result of that computation. Nor
anything else, ADD() does not return a value. (See the example in
R-intro, section 10.1)
And you need to assign the
WHEW! Have you read An Introduction to R? If not, stop and do so. If
you have, stop and do so again. Or look for other web tutorials (you
may get some suggestions here) or books (CRAN is a good place to look
for this).
The problem is that you are so far from understanding how a function
works, tha
Hi,
You can also try this:
unlist(lapply(splitlist,head,1))
#[1] "a1" "a2"
unlist(lapply(splitlist,tail,1))
#[1] "b1" "b2"
A.K.
From: David Romano
To: r-help@r-project.org
Sent: Friday, September 7, 2012 2:12 PM
Subject: [R] splitting character vectors in
On 07-09-2012, at 21:54, William Dunlap wrote:
> The functions
> f1 <- function(x) x <- x + 1
> and
> f2 <- function(x) x + 1
> both return the same value. You can see
> this by doing
> z1 <- f1(10) ; print(z1)
> z2 <- f2(10) ; print(z2)
> or just
> print(f1(10))
> print(f2(10))
>
>
The functions
f1 <- function(x) x <- x + 1
and
f2 <- function(x) x + 1
both return the same value. You can see
this by doing
z1 <- f1(10) ; print(z1)
z2 <- f2(10) ; print(z2)
or just
print(f1(10))
print(f2(10))
f1(x) does not automatically print its output when run
directly from
On 07-09-2012, at 21:32, William Dunlap wrote:
> Berend,
> The OP's ADD() is returning the new value of x, as do all
> of your alternatives. His problem is that he is not assigning
> the output of ADD to a variable, as in
> z <- ADD(z)
> Ordinary functions do not alter their arguments. The
Berend,
The OP's ADD() is returning the new value of x, as do all
of your alternatives. His problem is that he is not assigning
the output of ADD to a variable, as in
z <- ADD(z)
Ordinary functions do not alter their arguments. There is
no need for the 'x <-' in the definiton of ADD. It ma
On 07-09-2012, at 20:00, wwreith wrote:
> I am just starting to experiment with writing a function and have run into
> what seems like a limitation or more likely a lack of understanding on my
> part.
>
> Very Simple Example: I want to define a function that does 1+1=2.
>
> z<-1
> ADD<-functi
Hello everyone,
I am running a mixed effects model where I have two fixed factors, one with
2 levels and one with 4, and their interaction. Let's say these are my
factors and their levels:
FirstFactor: 1, 2
SecondFactor: A, B, C, D
For the interaction, I am interested in the four two-way compari
If you know that there are exactly the same number of items in each string,
then something
simpler can be constructed.
> matrix(unlist(splitlist), length(splitlist[[1]]), length(splitlist))
[,1] [,2]
[1,] "a1" "a2"
[2,] "b1" "b2"
>
The rows above are what you are looking for.
If you intend
I am just starting to experiment with writing a function and have run into
what seems like a limitation or more likely a lack of understanding on my
part.
Very Simple Example: I want to define a function that does 1+1=2.
z<-1
ADD<-function(x)
{
x<-x+1
}
ADD(z)
z
output for z is 1 not the expec
On 07/09/2012 2:12 PM, David Romano wrote:
Hi folks,
Suppose I create the character vector charvec by
> charvec<-c("a1.b1","a2.b2")
> charvec
[1] "a1.b1" "a2.b2"
and then I use strsplit on charvec as follows:
> splitlist<-strsplit(charvec,split=".",fixed=TRUE)
> splitlist
[[1]]
[1] "a1" "b1"
Hi folks,
Suppose I create the character vector charvec by
> charvec<-c("a1.b1","a2.b2")
> charvec
[1] "a1.b1" "a2.b2"
and then I use strsplit on charvec as follows:
> splitlist<-strsplit(charvec,split=".",fixed=TRUE)
> splitlist
[[1]]
[1] "a1" "b1"
[[2]]
[1] "a2" "b2"
I was wondering whethe
Add asp=1 to your call to plot() to force equal scales on both axes.
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On
> Behalf
> Of Peter Langfelder
> Sent: Friday, September 07, 201
On Fri, Sep 7, 2012 at 9:04 AM, Chris82 wrote:
> Hey R users,
>
> I am a little bit confused.
>
>
> require(plotrix)
>
> plot(0,xlim=c(-10,10),ylim=c(-10,10),type="n",xlab="",ylab="")
> draw.circle(0,0,5)
>
> lines(c(0,0),c(0,5))
> lines(c(0,5),c(0,0))
The culprit are unequal margins. Issue
par(
On 06.09.2012 20:58, Santosh wrote:
Dear Rxperts..
I am trying to install a few packages in R (version 2.14.2) on a *64-bit
Window 7* workstation. Some of the errors are posted below.. Both 32-bit
and 64-bit versions of R were installed. I did not get errors while
installing packages through *
???
A previous answer pointed out ?toeplitz
entering
> toeplitz
gives
{
if (!is.vector(x))
stop("'x' is not a vector")
n <- length(x)
A <- matrix(0, n, n)
matrix(x[abs(col(A) - row(A)) + 1], n, n)
}
Why reinvent?
-- Bert
On Fri, Sep 7, 2012 at 8:19 AM, David L Carlso
On Sep 7, 2012, at 8:03 AM, Berg, Tobias van den wrote:
> Dear all,
>
> Probably I made a beginners mistake. While importing a spss file I didn't
> specify that missings should be NA (use.missings = TRUE). Thanks to Petr
> Pikal and Bert Gunter I now know how to check how many values are known
Hello,
I am drawing a heatmap with hundreds of genes. Everything work fine, except
when I want to had the name of the genes as the row.names with
>row.names (a)<-a$Name
And there's this things that duplicate are not allowed...
How can I do to allow duplicates ??? I don't have the choice I can't
The trailling arguments to Rscript, generally read by commandArgs(TRUE), come
into R as a vector of character strings. Your script can interpret those
character
strings in many ways. The OP's script processed them all with
eval(parse(text=arg[i]))
so all the arguments had to be valid R expres
Hello everyone
I am a frequent user of Random Forests and have currently switch to apply
cforest from the party package as it seems more appropriate to my current
analysis.
The problem I have is that I would like to see the individual predictions each
tree in the cforest does for each observa
Hey R users,
I am a little bit confused.
require(plotrix)
plot(0,xlim=c(-10,10),ylim=c(-10,10),type="n",xlab="",ylab="")
draw.circle(0,0,5)
lines(c(0,0),c(0,5))
lines(c(0,5),c(0,0))
This is not really a circle with a radius of 5.
best regards
--
View this message in context:
http://r.7
Dear all,
Probably I made a beginners mistake. While importing a spss file I didn't
specify that missings should be NA (use.missings = TRUE). Thanks to Petr Pikal
and Bert Gunter I now know how to check how many values are known within a
variable.
Although I can fit my logistic model on this d
Hi
It is good to cc to list. Somebody could have better insight.
>
> Dear Petr,
>
> Thank you for responding. It seems right what you say. The funny thing
> however is that the 'LO2' variable in SPSS has 2 answer categories. If
> I look at the same variable in R, again I see 2 different values
Hello. A quick question about incorporating variation due to study in the
metafor package. I'm working with a particular data set for meta-analysis
where some studies have multiple measurements. Others do not. So, let's say
the effect I'm looking at is response to two different kinds of drug
You appeaer to be using the rms package. Please follow the posting guide.
The error message looks to be self-explanatory (empty cell); you just have
to find which predictor it applies to.
As an aside, rms does not like you to use factor() in a model, and there's
probably a more concise way to dea
Hi
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Tvandenberg
> Sent: Friday, September 07, 2012 1:05 PM
> To: r-help@r-project.org
> Subject: [R] error: in catg (xi, name=nam, label=lab): "LO2" has <2
> category levels
>
>
Hello,
I am working with s.multinom() from the ade4package. I tried to plot the
results of my %PCA (via the function dudi.pca()) followed by a MCOA
(mcoa()). But when I give my variables to s.multinom() I get the following
Error message:
Error in FUN(1:14[[1L]], ...) : number 1 profile without da
You asked for existing functions, but I was more intrigued by trying to
create one:
symmat <- function(n) {
x <- matrix(1:n, nrow=n, ncol=n)
abs(x-col(x))+1
}
> symmat(4)
[,1] [,2] [,3] [,4]
[1,]1234
[2,]2123
[3,]3212
[4,]43
On Thu, Sep 6, 2012 at 7:22 PM, Michael wrote:
> Help! Weird behavioral difference between R interactive and command-line?
>
> Hi all,
>
> This weird problem has been bugging me for a while.
>
> If I run the R program in an interactive session, it worked;
>
> But if I run the R program on command-
Learn to use the str() function so you can answer these questions yourself. If
you type str(paste(i)) you can learn about the structure of the return value
from the paste function, which is not a matrix or a data frame, so
two-dimensional subscripting is not going to work on it. You may also ben
Dear R-users,
During a fit procedure in a Logistic prediction model I encounter the
following problem:
error: in catg (xi, name=nam, label=lab: X has <2 category levels
The following code is used:
fit <-lrm(MRI_Diag_RC ~ factor(O4_1r) + N6_1r + leeftijd + LO1 + LO2 + LO3+
LO4+ LO5+ LO6+ LO7+ L
One possibility
as.numeric(format(b, "%m"))-as.numeric(format(a, "%m"))
Regards
Petr
> -Original Message-
> From: r-help-boun...@r-project.org [mailto:r-help-bounces@r-
> project.org] On Behalf Of Rantony
> Sent: Friday, September 07, 2012 10:26 AM
> To: r-help@r-project.org
> Subject: [
Yes. Its working fine. We need to convert to "as.Date" thatz all.
Thank you Petr.
-Original Message-
From: PIKAL Petr [mailto:petr.pi...@precheza.cz]
Sent: Friday, September 07, 2012 3:42 PM
To: Akkara, Antony (GE Energy, Non-GE); r-help@r-project.org
Subject: RE: [R] Month Difference
On
Le 07/09/12 10:26, Rantony a écrit :
Hi,
i need a small help.
a<- as.Date("2012-01-01")
b<- as.Date("2012-12-01")
My requirement what is, i need to get the month difference of these two
dates.
Can any one help me please !
Here is a solution from here:
http
Problem solved, thanks.
I've used this instead: COSTaux_AVCAR <-
ddply(CARaux,c("SC","YEAR"),.fun = function(xx){sum(xx[ ,costcarin])})
-Original Message-
From: Jeff Newmiller [mailto:jdnew...@dcn.davis.ca.us]
Sent: donderdag 6 september 2012 14:56
To: Franckx Laurent; 'r-help
On 07-09-2012, at 10:26, Rantony wrote:
> Hi,
>
> i need a small help.
>
> a<- as.Date("2012-01-01")
> b<- as.Date("2012-12-01")
>
> My requirement what is, i need to get the month difference of these two
> dates.
One way is:
library(zoo)
(as.yearmon(b)-
On 09/07/2012 07:30 AM, Levi Waldron wrote:
For posterity, I found the TeachingDemos::shadowtext option most
agreeable for this problem:
* legend puts a large box around the text which did not seem
possible to shrink, and does not accept vector x, y arguments
* plotrix::boxed.labels di
Dear list,
following the vignette of the package 'spacemmakeR' I have built a
gabriel graph of ten randomly placed points:
library(spdep)
set.seed(3)
xyir<-matrix(runif(20),10,2)
nbgab<-graph2nb(gabrielneigh(xyir), sym=TRUE)
plot(nbgab,xyir,points=FALSE)
points(xyir,pch=20,cex=2,col=c(2,4,4,4,2,2
Turgut,
I'm afraid you'll have to write it by yourself.
Dhanoa and Sanderson (Can J Zool, 66:821-823, 2010) mention the FREML Excel
add-in written by Ripley and Thompson (available on the Royal Society of
Chemistry's website at the moment of writing that paper) and that the
simulation and extr
'paste' does not return a matrix, so trying to extract with the '[' is
incorrect. what did you expect from that expression?
Sent from my iPad
On Sep 7, 2012, at 2:41, Sri krishna Devarayalu Balanagu
wrote:
>
> Thank you for the answer. It's working.
> But the error occurring here also
>
>
Dear Sir,
I am shabbir Raza Khan doing research on arthropod diversity and
environment. I have done some analysis on DCA using software PCORD 0.5 but
I am unable to do the interpretation of the graph.Can you please help me
for the interpretation of graph.
Please reply my mail so that I can send yo
Thank you for the answer. It's working.
But the error occurring here also
df <- paste(i)[, c("Reference_ID", "Arm_ID")]
How to get rid of that.
-Original Message-
From: William Dunlap [mailto:wdun...@tibco.com]
Sent: Thursday, September 06, 2012 10:15 PM
To: Sri krishna Devarayalu Balan
Hi,
i need a small help.
a<- as.Date("2012-01-01")
b<- as.Date("2012-12-01")
My requirement what is, i need to get the month difference of these two
dates.
Can any one help me please !
- Antony
--
View this message in context:
http://r.789695.n4.nabble.c
62 matches
Mail list logo