Displaying 20 results from an estimated 9000 matches similar to: "Column name assignment problem"
2009 Mar 25
4
Manual sort in a for loop
Dear all,
I am trying to manually re-sort rows in a number of tables. The rows aren't sorted on any particular values but are simply ordered by user choice (as shown by the row numbers in the code). I have been able to carry out each re-arrangement without the use of the 'for' loop, but cannot seem to successfully execute the statements when incorporated into the loop. The code I have
2009 May 01
1
Problems with 'valid columns' when using merge
Dear all,
I am trying to use 'merge' within a loop, however, I receive an error relating to the 'by' argument of the command, as follows:
> merge_year <- 1986
>
> for (i in 1:10) { # Number of file pairs
+ assign(paste("merged_arunfek_", merge_year, sep=""), merge(x=paste("arunoff_",start_arunoff, sep=""),
2010 Apr 29
2
Split a vector by NA's - is there a better solution then a loop ?
Hi all,
I would like to have a function like this:
split.vec.by.NA <- function(x)
That takes a vector like this:
x <- c(2,1,2,NA,1,1,2,NA,4,5,2,3)
And returns a list of length of 3, each element of the list is the relevant
segmented vector, like this:
$`1`
[1] 2 1 2
$`2`
[1] 1 1 2
$`3`
[1] 4 5 2 3
I found how to do it with a loop, but wondered if there is some smarter
(vectorized) way
2009 Jul 25
2
labelling points plotted in a 2D plan
I created a 2 D plan:
> plot(range(-2.5,0.95),range(0.00,1.00),type="n",axes=TRUE)
I made a projection of points with their coordonates (X,Y) in that plan
> fullpoints=read.csv2("fullpoints.csv",h=T)
> plot(fullpoints)
The points are listed in that .csv file it is organized this way:
0,48875 0,142857143
0,409 0,142857143
0,45611 0,25
0,49833 0,222222222
0,61158
2009 Aug 20
4
simple randomization question: How to perform "sample" in chunks
Hello dear R-help group.
My task looks simple, but I can't seem to find a "smart" (e.g: non loop)
solution to it.
Task: I wish to randomize a data.frame by one column, while keeping the
inner-order in the second column as is.
So for example, let's say I have the following data.frame:
xx <-data.frame(a= c(1,2,2,3,3,3,4,4,4,4) ,
b =
2009 Feb 18
2
[package-car:Anova] extracting residuals from Anova for Type II/III Repeated Measures ?
Hello dear R members.
I have been learning the Anova syntax in order to perform an SS type III
Anova with repeated measures designs (thank you Prof. John Fox!)
And another question came up: where/what are the (between/within) residuals
for my model?
############ Play code:
phase <- factor(rep(c("pretest", "posttest", "followup"), c(5, 5, 5)),
2008 Oct 27
2
Need help
Hi All,
I am new comer here and for Statistics R. I want to know how to use R
to calculate one way repeated measure ANOVA, for example, on three
groups of data.
I appreciate if someone can help me solve this problem.
John
2009 Jul 26
1
Is there an R implementation for the "Barnard's exact test" (a substitute for fisher.test) ?
Hello R help members. I came across today with an article on Barnard's exact
test (http://www.cytel.com/Papers/twobinomials.pdf), that is supposed to
give a more powerful fisher.test - Because it doesn't assume that we know
the row and column totals are in advance. Any pointers to such a function ?
Thanks, Tal
--
----------------------------------------------
My contact information:
2011 Jan 26
1
boxplot - code for labeling outliers - any suggestions for improvements?
Hello all,
I wrote a small function to add labels for outliers in a boxplot.
This function will only work on a simple boxplot/formula command (e.g:
something like boxplot(y~x)).
Code + example follows in this e-mail.
I'd be happy for any suggestions on how to improve this code, for example:
- Handle boxplot.matrix (which shouldn't be too hard to do)
- Handle cases of complex
2009 Jul 01
1
Are there any bloggers amoung us going to useR 2009 ?
*(note*: This is an R community question, not a statistical nor coding
question. Since this is my first time writing such a post, I hope no one
will take offence of it.)
Hello all,
I will be attending useR 2009 next week, and was wondering if there are any
of you who are *bloggers *intending to participate and report on useR 2009?
If so - I would love to know your blogs URL so as to follow you.
2009 Aug 17
3
Replacing NA values in one column of a data.frame
Dear all,
I'm trying to replace NA values with -9999 in one column of a data frame. I've tried using is.na and the testdata[testdata$onecolumn==NA] <- 9999 approach, but whilst neither generate errors, neither result in -9999s appearing - the NAs remain there!
I'd be grateful for any advice on what I'm doing wrong or any other suitable approaches.
Many thanks,
Steve
2009 Mar 29
1
[cluster package question] What is the "sum of the dissimilarities" in the pam command ?
Hello Martin Maechler and All,
A simple question (I hope):
How can I compute the "sum of the dissimilarities" that appears in the pam
command (from the cluster package) ?
Is it the "manhattan" distance (such as the one implemented by "dist") ?
I am asking since I am running clustering on a dataset. I found 7 medoids
with the pam command, and from it I have the
2009 Aug 10
3
Bug in "seq" (or a "feature") ?
(I use R 2.9.1 with win XP)
If I run this code:
seq(-0.1,.9, by = .05)[seq(-0.1,.9, by = .05) <= 0.5]
I get this output:
[1] -0.10 -0.05 0.00 0.05 0.10 0.15 0.20 0.25 0.30 0.35 0.40 0.45
Why is 0.50 not in the results ?
(It seems that it gives a slightly bigger number then 0.5 but I don't
understand why it does that)
Where as if I try:
seq(-0.1,.9, by = .05)[seq(-0.1,.9, by = .05) <=
2010 Sep 01
6
Why is vector assignment in R recreates the entire vector ?
Hello all,
A friend recently brought to my attention that vector assignment actually
recreates the entire vector on which the assignment is performed.
So for example, the code:
x[10]<- NA # The original call (short version)
Is really doing this:
x<- replace(x, list=10, values=NA) # The original call (long version)
# assigning a whole new vector to x
Which is actually doing this:
x<-
2009 Mar 23
2
Looping of read.table and assignment
Dear all,
I am trying to read in and assign data from 50 tables in an automated fashion. I have the following code, which I created with the help of textbooks and the internet, but it only seems to read in the final data file over and over again. For example, when I type:> table_1951 I get the same values in the table as when I type> table_2000 despite the values in the source tables
2009 Mar 11
4
error.bars
Hi, I'm trying to use the function "error.bars", but the program don't
find it, and I dont't found any package with this function. Is there some
another functin to draw barplots with error bars?
Sueli Rodrigues
Eng. Agr?noma - UNESP
Mestranda - USP/ESALQ
PPG-Solos e Nutri??o de Plantas
Fones (19)93442981
(19)33719762
2009 Feb 21
1
variable/model selction (step/stepAIC) for biglm ?
Hello dear R mailing list members.
I have recently became curious of the possibility applying model
selection algorithms (even as simple as AIC) to regressions of large
datasets. I searched as best as I could, but couldn't find any
reference or wrapper for using step or stepAIC to packages such as
biglm.
Any ideas or directions of how to implement such a concept ?
Best,
Tal
--
2008 Dec 17
1
bug (?!) in "pam()" clustering from fpc package ?
Hello all.
I wish to run k-means with "manhattan" distance.
Since this is not supported by the function "kmeans", I turned to the "pam"
function in the "fpc" package.
Yet, when I tried to have the algorithm run with different starting points,
I found that pam ignores and keep on starting the algorithm from the same
starting-points (medoids).
For my
2009 Apr 25
3
ANOVA/statistics question
(Have searched for this already)
Hi,
How do you find the strength of correlation between two variables using an
ANOVA table? "Pr(>F)" gives the statistical significance of the
association, but not the strength of the correlation.
See data (from R) below
Readable:
"Df" "Sum Sq" "Mean Sq" "F value"
2009 Mar 28
4
Selecting elements from a vector (a simple question with weird results)
Hello people.
I wish to reorder a simple vector of numbers by another vector of the order
(and then do the same, but with a data frame rows)
I try this (which doesn't work) :
> aa <- c(3, 1 ,2 )
> aa[aa]
[1] 2 3 1
The same won't work if I try to order a data frame:
> data.frame(matrix(c(3,1,2), 3,2))[c(3,1,2),]
X1 X2
3 2 2
1 3 3
2 1 1
How should I do this?
p.s: