Displaying 20 results from an estimated 30000 matches similar to: "data types changing"
2010 May 18
2
Function that is giving me a headache- any help appreciated (automatic read )
note: whole function is below- I am sure I am doing something silly.
when I use it like USGS(input="precipitation") it is choking on the
precip.1 <- subset(DF, precipitation!="NA")
b <- ddply(precip.1$precipitation, .(precip.1$gauge_name), cumsum)
DF.precip <- precip.1
DF.precip$precipitation <- b$.data
part, but runs fine outside of the function:
days=7
2009 Oct 06
1
ggplot2 applying a function based on facet
Look at the bottom of the message for my question
#here is a little function that I wrote
USGS <- function(input="discharge", days=7){
library(chron)
library(gsubfn)
#021973269 is the Waynesboro Gauge on the Savannah River Proper (SRS)
#02102908 is the Flat Creek Gauge (ftbrfcms)
#02133500 is the Drowning Creek (ftbrbmcm)
#02341800 is the Upatoi Creek Near Columbus (ftbn)
#02342500 is
2011 Jan 11
1
how to sort new data frame based on the original data frame
I have a really simple question
I have a data frame of 8 variables (the first column is the subjects' id):
SubID G1 G2 G3 G4 W1 W2 W3 W4
1 6 5 6 2 6 2 2 4
2 6 4 7 2 6 6 2 3
3 5 5 5 5 5 5 4 5
2012 Mar 01
2
identifying a column name correctly to use in a formula
Hi,
I have a large matrix (SNPs) that I want to cycle over with logistic
regression with interaction terms. I have made a loop but I am struggling
to identify to the formula the name of the column in a way which is
meaningful to the formula. It errors becasue it is not evaluated proporly.
(below is a pilot with only 7 to 33 columns, my actual has 200,000 columns)
My attempts:
for (i in 7:33)
2010 Sep 09
0
Fast / dependable way to "stack together" data frames from a list
Hi, everybody:
I asked about this in r-help last week and promised
a summary of answers. Special thanks to the folks
that helped me understand do.call and pointed me
toward plyr.
We face this problem all the time. A procedure
generates a list of data frames. How to stack them
together?
The short answer is that the plyr package's rbind.fill
method is probably the fastest method that is not
2008 Apr 04
1
Problems with Unit Root testing using ur.df function
Hi All,
I'm new to R and am trying to run a unit root test on the vector "y" (a time
series of inflation (i.e. changes in the Consumer Price Index quarter on
quarter)).
I've run the Augmented-Dickey-Fuller Test below (R's URCA package). It gives
me an error that it cannot find the function ur.df unless I comment out the
third last line of code (see below).
I try to call
2010 Apr 28
1
Strange zoo behaviour, possible bug?
Hi all,
I bumped into this awkward zoo behaviour. I'd be half tempted to call it a bug, what do you think? It's annoying to work around it :( I wonder if this was the behaviour of older zoo versions, I can't remember coming across this sort of thing...
> version
_
platform i386-pc-solaris2.10
arch i386
os solaris2.10
system i386,
2013 Mar 10
0
max row
HI,
Using
c11<- 0.01
c12<- 0.01
c1<- 0.10
c2<- 0.10
One possible problem is that:
dim(res5)
#[1] 513? 20
res6<-aggregate(.~m1+n1+m+n,data=res5[,c(1:6,9:12,21:24)] ,max)
#Error in `[.data.frame`(res5, , c(1:6, 9:12, 21:24)) :
?# undefined columns selected
A.K.
________________________________
From: Joanna Zhang <zjoanna2013 at gmail.com>
To: arun <smartpink111 at
2007 Jan 30
2
Rbind for appending zoo objects
Hi R,
y1 <- zoo(matrix(1:10, ncol = 2), 1:5)
colnames(y1)=c("a","b")
y2 <- zoo(matrix(rnorm(10), ncol = 2), 6:10)
colnames(y2)=c("b","a")
> y1
a b
1 1 6
2 2 7
3 3 8
4 4 9
5 5 10
> y2
b a
6 0.9070204 0.3527630
7 1.2405943 0.8275001
8 -0.1690653 -0.1724976
9 -0.6905223 -1.1127670
10
2011 Jan 18
3
error message
I was running a sampling syntax based on a data frame (ago) of 160 rows and
25 columns. Below are the column names:
> names(ago)
[1] "SubID" "AGR1" "AGR2" "AGR3" "AGR4" "AGR5" "AGR6" "AGR7"
"AGR8"
[10] "AGR9" "AGR10" "WAGR1" "WAGR2"
2013 Jan 30
3
arithmetic and logical operators
Why, in R, does (0.1 + 0.05) > 0.15 evaluate to True? What am I missing
here? How can I ensure this (ostensibly incorrect) behavior doesn't
introduce bugs into my code? Thanks for your time.
Dave Mitchell
[[alternative HTML version deleted]]
2011 Oct 25
2
R for loop nested?
Hi,
I'm trying to execute the same R code on multiple data frames listed in a single directory. The code works fine if I use the code
(below) for each file. However, I have several files and it becomes
tedious to run each one, name it and then aggregate into a single
dataframe.
Name
0.0 1
21.15 2
2400.26 1
3222.14 2
name = read.table(file.choose(),header=F) #
2007 Dec 14
3
Array dimnames
Dear all,
Possibly a rudimentary question, however any help is greatly appreciated. I
am sorting a large matrix into an array of dim(p(i),q,3). I put each entry
into a corresponding matrix (1 of the 3) based on some criteria. I figure
this will assist me in condensing code as I can loop through the 3rd
dimension of the array instead of generating 3 separate matrices and using
the same block of
2010 May 05
1
rcorr p-values for pearson's correlation coefficients
Hi! All,
To find co-expressed genes from a expression matrix of dimension (9275
X 569), I used rcorr function from library(Hmisc) to calculate pearson
correlation coefficient (PCC) and their corresponding p-values. From
the correlation matrix (9275 X 9275) and pvalue matrix (9275 X 9275)
obtained using rcorr function, I wanted to select those pairs whose
PCC's are above 0.8 cut-off and then
2009 Jan 21
1
problem with rbind
Hi All,
I have a problem with rbind.
I have data that consist of weight height .. etc of 1000 patients. I would
like to find the mean and the standard deviation ( for the weight , height
etc) for each gender.
data<-read.table("data.txt", header=T, sep='\t')
fdata=NULL
for (i in 1:50){
nn<-names(X)[i]
m<-tapply(X[,i],data$gender,mean,na.rm=T)
s<-tapply(X[,i],
2012 Sep 24
0
stop on rows where !is.na(mydata$ti_all)
Dear R experts,
I got help to build a loop but there is a bug inside it that causes
one part of the mechanism to fail.
It should grow once, but if keep growing on rows where $ti_all is not NA.
Here is a wall of code that very crudely demonstrates the problem,
there is a couple of dim() outputs at the end where you can see how it
the second time around keeps adds (2) rows, but this does not
2007 Nov 07
2
Trouble in creating a list
I want to create a list based on the information from a data.frame,
Model. So I tried the following:
MyList <- list(colnames(Model)[2] = levels(Model$(colnames(Model)[2])))
but it failed with an error:
Error: unexpected '=' in "list(colnames(Model)[2] ="
I have the following problems with this command line:
(1) I wanted to use colnames(Model)[2] as a tag for the list:
2009 Jul 30
1
stepwise variable selection method wanted
Hi List,
I am looking for a variable selection procedure with a forward-backward selection method.
Firstly, it is meant to work with the cophenetic
correlation coefficient (CPCC) and intended to find the variable combination with the
highest cophenetic correlation. Secondly, it is aimed at Gower metric with
wards method (though this could be easily extended) aimed at categorical data.
What I
2010 Nov 23
1
Barplot and plot means with confidence intervals in the same plot
I want to obtain a barplot with error bars and a mean plot with error bars
with other scale on the left in the same plot. I need help to get the same
x axis (centered) when overlay two plots (barplot2 and plotCI (or
lineplot.CI) with errorbars), with diferent y axis. I use par (new=T) but
the X axis names are not centered with the figures.
An example of my data:
2011 Mar 16
3
Reorganize data frame
Hi group,
I am trying to convert the organization of a data frame so I can do some
correlations between stocks,
I have something like this:
stock.returns <-
data.frame(rbind(c("MSFT","20110301",0.05),c("MSFT","20110302",0.01),c("GOOG","20110301",-0.01),c("GOOG","20110302",0.04)))
colnames(stock.returns) <-