Bill, Joshua, Phil
Thanks for the suggestions. Very much appreciated.
Kind regards
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/Rounding-variables-in-a-data-frame-tp3218729p3219060.html
Sent from the R help mailing list archive at Nabble.com.
_
Hi All
I am trying to use the round function on some columns of a dataframe while
leaving others unchanged. I wish to specify those columns to leave
unchanged.
My attempt is below - here, I would like the column d3 to be left but
columns d1, d2 and d4 to be rounded to 0 decimal places. I would w
Achim
Thanks. Much appreciated.
Best regards
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/zoo-column-names-tp3205568p3205584.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
h
Hi All
I am trying to find a way to prevent column names from changing on zoo
objects when I merge them.
I have column names that contain a "-" that after merging have become "."
# Example
zz1 = zoo(as.matrix(1:5))
zz2 = zoo(as.matrix(10:12))
names(zz1)=c("aa-1")
names(zz2)=c("bb-1")
zz3=merg
Thanks Gabor. Much appreciated (as always).
--
View this message in context:
http://r.789695.n4.nabble.com/Merging-zoo-objects-tp3184696p3186113.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https:/
Hi
I have n zoo objects M1, M2, M3, ... , Mn that I want to merge where n is a
number calculated at run-time.
I am struggling to find the correct syntax to do this
Assuming n is calculated as 10 (for example), I have tried
n = 10
# First Effort
alldata= merge(paste("M",rep(1:n), sep=""),all=T
If, as a new R user, you find the help page difficult to follow then Google
offers plenty of support to understand the apply function
e.g.
http://www.ats.ucla.edu/stat/r/library/advanced_function_r.htm
http://www.slideshare.net/dataminingtools/r-apply-functions
http://nsaunders.wordpress.com/2
Colin
Some links I used to get me going ...
http://www.ics.uci.edu/~vqnguyen/talks/SweaveSeminaR.pdf
http://www.r-bloggers.com/getting-started-with-sweave-r-latex-eclipse-statet-texlipse/
http://www.statistik.lmu.de/~leisch/Sweave/
http://stat.epfl.ch/webdav/site/stat/shared/Regression/EPFL-S
Is this what you are looking for ...
mylist=list()
for (i in 1:3){
mylist[i] = rnorm(1)
}
print(mylist)
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/appending-to-a-list-tp2527597p2527635.html
Sent from the R help mailing list archive at Nabble.com.
_
1. try the predict function
e.g. predict(arima1, n.ahead=10)
2. try the resid function
e.g. resid(arima1)
HTH
Pete
--
View this message in context:
http://r.789695.n4.nabble.com/R-time-series-analysis-tp2527513p2527625.html
Sent from the R help mailing list archive at Nabble.com.
___
Emily
Maybe this will help
# Data
y1=rnorm(10)
y2=runif(10)
x=1:10
# Set XPD and Outer Margin
par(xpd=NA,oma=c(3,0,0,0))
# Plot and Legend
plot(x,y1,type="n",ylab="")
lines(x,y1, col="red")
lines(x,y2, col="blue")
legend(par("usr")[1],par("usr")[3],c("Y1","Y2"),col=c("red","blue"),lty=1,xjust=
I am trying to download an Excel file from the the internet with the
following R command
download.file("http://ir.eia.gov/wpsr/psw09.xls","C:\\Temp\\psw09.xls";)
The file is downloaded but when I try and open it I get a message from Excel
telling me that the file is corrupt and it cannot be open
Jim
Is this what you need?
#create data
Lines <- "Drug1 Drug2 Drug3 Drug4
153 133 145 111
189 177 200 170
221 241 187 243
215 228 201 178
302 283 292 248
223 255 220 202
201 238 233 163
173 164 172 139
121 128 119 120
100 200 300 400"
# read in
Hi
How about ...
# Data
lines = "Col1 Col2 Col3 Col4
Text1 Text2 X0.1 5
Text1 Text2 X0.2 10
Text1 Text2 X0.3 15
Text1 Text3 X0.1 5
Text1 Text3 X0.2 10
Text1 Text3 X0.3 15"
# Create Dataframe
DF <- read.table(textConnection(lines), header = TRUE, check.names = FALSE)
# Create Numeric Variable
Venkatesh
Is this what you are looking for?
# Example data
df=data.frame(A=c(1,0,0,0,1),B=c(1,1,0,0,0),C=c(1,0,0,0,0),Val=c(1,0,1,0,1))
# Variation of code of David Winsemius
tbl = lapply(df[, 1:3] , function(x) table(x, df$Val))
fet = lapply(tbl, function(x) fisher.test(x))
# Identify intern
Hi Alessandra
Did you restart R?
You should be able to download packages using the Packages> Install
Package(s) ... from the menu bar in the GUI.
Once the package has been downloaded select Packages> Load Package ...
you should see what you just downloaded in a list of available packa
Also, the FAQ suggests using the alternative internet2.dll by starting R
with the flag --internet2
If you start R from a desktop icon, you can add the --internet flag to the
target line (right click, properties) e.g. "C:\Program
Files\R\R-2.8.1\bin\Rgui.exe" --internet2
see
http://cran.r-projec
Maybe this what you are looking for
lines1 <- "CODPROD N1 N3 N4
23 3 55 4
24 5 67 36
25 3 73 24"
df1 <- read.table(textConnection(lines1),header=TRUE)
lines2 <-"CODPROD N1 N2
30 34 45
45 0 78
65 0 56"
df2 <- read.table(textConnection(lines2),header=TRUE)
merge(df1, df2, by = inter
Dennis
Very nice!
Thanks
Pete
--
View this message in context:
http://n4.nabble.com/Summarization-tp1840718p1840730.html
Sent from the R help mailing list archive at Nabble.com.
__
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/lis
Hi All
I have a vector x containing 2 levels
x = c(1,1,1,0,0,0,0,1,1,0,0,0,1,1,0)
I would like to derive the following summarization
Level Count
1 3
0 4
1 2
0 3
1 2
0 1
I have generated an inelegant solution using lags and loops but feel sure
that there must be a better approach. If anyone ha
Look at the apply function
?apply
x = data.frame(x1=c(1,2,3,4,5),x2=c(2,4,6,8,10),x3=c(1,3,5,7,9))
x$x5=apply(x,1,mean)
x$x6=apply(x,1,sd)
print(x)
Abhishek Pratap wrote:
>
> Hi All
>
> I have a data frame in which there are 4 columns .
>
> Column 1 : name
>
> Column 2-4 : values
>
> I w
Try the merge function
?merge
in1 = "id trait1
110.2
211.1
39.7
610.2
78.9
10 9.7
11 10.2
"
in2 = "id trait2
1 9.8
2 10.8
4 7.8
5 9.8
6 10.1
1210.2
1310.1
"
data1 = read.table(textConnection(in1), header=T)
data2 = read.table(tex
Hi
I would like to understand how to extend the function (FUN) I am using in
rollapply below.
##
With the following simplified data, test1 yields parameters for a rolling
regression
data = data.frame(Xvar=c(70.67,70.54,69.87,69.51,70.69,72.66,72.65,73.36),
23 matches
Mail list logo