Re: [R] Counting the number of non-NA values per day

2009-08-12 Thread Moshe Olshansky
Try tempFun - function(x) sum(!is.na(x)) nonZeros - aggregate(pollution[pol],format(pollution[date],%Y-%j), FUN = tempFun) --- On Wed, 12/8/09, Tim Chatterton tim.chatter...@uwe.ac.uk wrote: From: Tim Chatterton tim.chatter...@uwe.ac.uk Subject: [R] Counting the number of non-NA values per

Re: [R] Re : How to Import Excel file into R 2.9.0 version

2009-08-12 Thread Moshe Olshansky
Alternatively download the xlsReadWrite package from http://treetron.googlepages.com/ install it an proceed as in older version of R. --- On Tue, 11/8/09, Inchallah Yarab inchallahya...@yahoo.fr wrote: From: Inchallah Yarab inchallahya...@yahoo.fr Subject: [R] Re : How to Import Excel file

Re: [R] R help from command line

2009-08-12 Thread Patrick Connolly
On Tue, 11-Aug-2009 at 02:43PM -0500, Peng Yu wrote: | Hi, | | I frequently need to open multiple help pages in R, which requires the | start of multiple R sessions. I am wondering if there is a way to | invoke the help page from the command line just like 'man'. If you use ESS (with Emacs) you

Re: [R] paste first row string onto every string in column

2009-08-12 Thread milton ruser
Hi Jill, Completely not elegant, but may be usefull. Of course other colleagues will solve this with 1 line command :-) cheers milton df-read.table(stdin(), head=T, sep=,) V1,V2,V3,V4 DPA1*,DPA1*,DPB1*,DPB1* 0103,0104,0401,0601 0103,0103,0301,0402 df.new-as.matrix(df) for (i in 2:dim(df)[1])

Re: [R] pretty display or print for data frames ?

2009-08-12 Thread Patrick Connolly
On Wed, 12-Aug-2009 at 12:38PM +0800, Leon Yee wrote: Hi, all I have a question of adjusting the output of a data frame with many columns. By default, print() will print out several columns according to the window size, and then it scrolls down and print out left columns. How can

Re: [R] How to label and unlabel points on scatterplot with mouse pointer

2009-08-12 Thread milton ruser
Hi Hitesh, while the rigth response not arrive, you can play with: id-1:10 x-runif(10) y-runif(10) plot(x,y) identify(x, y , labels = id) Try give a look on spatstat help. I am not quite sure, but may be there you can find some solution (sorry if it is not true) cheers milton On Wed, Aug 12,

[R] MCMC sampling question

2009-08-12 Thread Thomas Mang
Hello, Consider MCMC sampling with metropolis / metropolis hastings proposals and a density function with a given valid parameter space. How are MCMC proposals performed if the parameter could be located at the very extreme of the parameter space, or even 'beyond that' ? Example to express

Re: [R] pretty display or print for data frames ?

2009-08-12 Thread Leon Yee
Patrick Connolly wrote: On Wed, 12-Aug-2009 at 12:38PM +0800, Leon Yee wrote: Hi, all I have a question of adjusting the output of a data frame with many columns. By default, print() will print out several columns according to the window size, and then it scrolls down and print out

Re: [R] paste first row string onto every string in column

2009-08-12 Thread Patrick Connolly
On Tue, 11-Aug-2009 at 06:48PM -0700, Jill Hollenbach wrote: | | Hi, | I am trying to edit a data frame such that the string in the first line is | appended onto the beginning of each element in the subsequent rows. The data | looks like this: | | df | V1 V2 V3 V4 | 1 DPA1*

Re: [R] Is there a summary on different version of 'apply' functions? What is the meaning of the prefixes?

2009-08-12 Thread Patrick Burns
Hadley's answer is probably better, but 'The R Inferno' page 15 is an answer to the literal question. Patrick Burns patr...@burns-stat.com +44 (0)20 8525 0696 http://www.burns-stat.com (home of The R Inferno and A Guide for the Unwilling S User) hadley wickham wrote: You might also want to

Re: [R] How to read and write an S4 class

2009-08-12 Thread ml-r-help
see ?dput ?save e.g. setClass(track, representation(x=numeric, y=numeric)) x - new(track, x=1:4, y=5:8) # save as binary fn - tempfile() save(x, ascii=FALSE, file=fn) rm(x) load(fn) x # save as ASCII save(x, ascii=TRUE, file=fn) # ASCII text representation from which to regenerate the data

Re: [R] runmax function only for positive numbers?

2009-08-12 Thread Duncan Murdoch
Jiucang Hao wrote: Hi All, I did a google search and could not find the answer. Thus I post this message. I found runmax only work for positive numbers. x = rep(-1,10) runmax(x,3) x = rep(0, 10) runmax(x,3) for 32-bit R, i got very small numbers: 2.121996e-314 for 64-bit R, i got NaN.

[R] Zoo and numeric data

2009-08-12 Thread Mark Breman
Hi, I have a csv file with different datatypes: 2009-01-01, character1, 10, 20.1 2009-01-02, character2, 11, 21.1 (I have attached the file to this post) I read this file with read.zoo as I want a zoo/xts timeseries: t = read.zoo(./data.txt, sep=,, dec = ., header=FALSE) If I look at the zoo

Re: [R] MCMC sampling question

2009-08-12 Thread Duncan Murdoch
Thomas Mang wrote: Hello, Consider MCMC sampling with metropolis / metropolis hastings proposals and a density function with a given valid parameter space. How are MCMC proposals performed if the parameter could be located at the very extreme of the parameter space, or even 'beyond that' ?

[R] installing mlica, or other ICA package

2009-08-12 Thread Žroutík
Dear R-users, was anybody able to install the mlica package succesfully? Or other ICA (Independent Component Analysis) package? But not the e1071. I have found mlica in the archive http://lib.stat.cmu.edu/R/CRAN/src/contrib/Archive/mlica/, repacked it to ZIP, installed and got an updating HTML

Re: [R] Zoo and numeric data

2009-08-12 Thread Achim Zeileis
On Wed, 12 Aug 2009, Mark Breman wrote: Hi, I have a csv file with different datatypes: 2009-01-01, character1, 10, 20.1 2009-01-02, character2, 11, 21.1 (I have attached the file to this post) I read this file with read.zoo as I want a zoo/xts timeseries: t = read.zoo(./data.txt, sep=,,

[R] Problem Installing R 2.9.1.1 RHEL x86_64 binary

2009-08-12 Thread Jeroen Ooms
I just grabbed the new EL5 binary's for my x64 VPS from CRAN. However, where updates usually go smoothly, I now get these errors: -bash-3.2# rpm -i R-2.9.1-1.el5.x86_64.rpm error: Failed dependencies: R-devel = 2.9.1-1.el5 is needed by R-2.9.1-1.el5.x86_64 -bash-3.2# rpm -i

[R] Simulating points from GLM corresponding to new x-values

2009-08-12 Thread Jacob Nabe-Nielsen
Dear List, Does anyone know how to simulate data from a GLM object correponding to values of the independent (x) variable that do not occur in the original dataset? I have tried using simulate(), but it generates a new value of the dependent variable corresponding to each of the original

[R] A function for plotting a boxplot with added dot and bars (for mean and SE) - please help improve my code

2009-08-12 Thread Tal Galili
Hello people, A while back I wanted to plot boxplots with interactions that will have a dot for the mean of the sample + bars for the SE. After searching for some code, I found something that did it for one level, but couldn't find something that will allow for interactions the way the original

[R] Re : paste first row string onto every string in column

2009-08-12 Thread Inchallah Yarab
try this , save your data in C:/ and write this (data - read.csv2(c:/jill.csv, sep=,)) (C-data[1,]) A - numeric(4) B - numeric(4) for (i in 1 :4){ A[i] - paste(data[1,i],data[2,i]) B[i] - paste(data[1,i],data[3,i]) } A B (data1 - rbind(as.character(A),as.character(B))) (data2 - rbind(C,data1))

Re: [R] Problem Installing R 2.9.1.1 RHEL x86_64 binary

2009-08-12 Thread Gavin Simpson
On Wed, 2009-08-12 at 02:28 -0700, Jeroen Ooms wrote: I just grabbed the new EL5 binary's for my x64 VPS from CRAN. However, where updates usually go smoothly, I now get these errors: -bash-3.2# rpm -i R-2.9.1-1.el5.x86_64.rpm error: Failed dependencies: R-devel = 2.9.1-1.el5 is

Re: [R] Re : paste first row string onto every string in column

2009-08-12 Thread Gavin Simpson
On Wed, 2009-08-12 at 09:52 +, Inchallah Yarab wrote: try this , save your data in C:/ and write this (data - read.csv2(c:/jill.csv, sep=,)) Why use read.csv2 yet change the separator to be the decimal point indicator in that function. You are really asking for trouble reading data that

Re: [R] Problem Installing R 2.9.1.1 RHEL x86_64 binary

2009-08-12 Thread Gavin Simpson
On Wed, 2009-08-12 at 10:55 +0100, Gavin Simpson wrote: snip / What could be the problem? Do you have perl(File::Copy::Recursive) or pcre-devel installed? If not, yum install perl(File::Copy::Recursive) pcre-devel as route in a terminal will install those packages and their ^^

[R] Re : Zoo and numeric data

2009-08-12 Thread Inchallah Yarab
why you don't use read.csv2 (you save your file.csv) and you write read.csv2(path file,sep=,) hope this helps De : Mark Breman breman.m...@gmail.com À : r-h...@stat.math.ethz.ch Envoyé le : Mercredi, 12 Août 2009, 10h46mn 43s Objet : [R] Zoo and numeric data

[R] the problem about normalize the data frame

2009-08-12 Thread Gina Liao
Hello, I'd like to normalize a data frame which are 45000 obs. of 212 variables.I want to normalize the data frame by each row. But I failed.Here is my R code, can you tell me where am I wrong? bb-function(normalize) (dat[i,]-min(dat[i,]))/(max(dat[i,])-min(dat[i,])) dat1-apply(dat,1,bb)

Re: [R] A function for plotting a boxplot with added dot and bars (formean and SE) - please help improve my code

2009-08-12 Thread ONKELINX, Thierry
This can be done much easier and transparent with ggplot2 library(ggplot2) ggplot(mtcars, aes(x = factor(round(wt)), y = mpg, colour = factor(am))) + geom_boxplot() + geom_point(stat = summary, fun.y = mean, position = position_dodge(width = 0.75)) HTH, Thierry

Re: [R] the problem about normalize the data frame

2009-08-12 Thread Tal Galili
Hi Gina. I am not sure your normalization process does what you want, but just to get the code working, here is how it can be done: # example data my.data - data.frame(rnorm(100,3,4), rnorm(100,3,4)) bb-function(dat) { (dat-min(dat))/(max(dat)-min(dat)) } dat1-t(apply(my.data,1,bb)) Best,

Re: [R] A function for plotting a boxplot with added dot and bars (formean and SE) - please help improve my code

2009-08-12 Thread Tal Galili
Thanks Thierry, I didn't know about that, it's always nice to see different ways of doing things. Question: How would you add the bars ? Hope to see more interesting replies, Tal On Wed, Aug 12, 2009 at 1:29 PM, ONKELINX, Thierry thierry.onkel...@inbo.be wrote: This can be done much

Re: [R] Slicing cra**y csv files

2009-08-12 Thread jorgusch
First of all, sorry for not giving all information. Secondly, thanks a lot. This is a real help!! I did not know, that you can use names... This is really simple and works great!!! If anyone is close enough to the people writing the help in R, please tell them that they should write a tutorial

[R] C-statistic comparison with partially paired datasets

2009-08-12 Thread Hanneke Wijnhoven
Does anyone know of an R-function or method to compare two C-statistics (Harrells's C - rcorr.cens) obtained from 2 different models in partially paired datasets (i.e. some similar and some different cases), with one continuous independent variable in each separate model? (in a survival

[R] Help for R (Advanced matrix addition (large or undefined number of matrices)

2009-08-12 Thread Rusyte, Lina
Dear Sirs, I would like to ask you, what function can I use for matrices addition? I couldn't find any information about it in the manual or in the internet. (A+B suits, when the number of matrixes is small, function sum() doesn't suit for matrices addition, because it sums all variables in the

Re: [R] How to label and unlabel points on scatterplot with mouse pointer

2009-08-12 Thread Hitesh Singla
Thanks milton, But that does not work in my case.. Any other suggestion be appreciated. Thanks and regards, Hitesh Singla Hi Hitesh, while the rigth response not arrive, you can play with: id-1:10 x-runif(10) y-runif(10) plot(x,y) identify(x, y , labels = id) Try give a look on

Re: [R] Simulating points from GLM corresponding to new x-values

2009-08-12 Thread Clifford Long
Would the predict routine (using 'newdata') do what you need? Cliff Long Hollister Incorporated On Wed, Aug 12, 2009 at 4:33 AM, Jacob Nabe-Nielsenjacobn...@me.com wrote: Dear List, Does anyone know how to simulate data from a GLM object correponding to values of the independent (x)

[R] Combinatorial problem

2009-08-12 Thread David Scott
I have been struggling trying to write some code to produce all combinations subject to some restrictions. I thought someone might have some bright ideas. I have 11 values which fall into 5 groups. I want all combinations of 2,3, and 4 values where each value must be from a different group.

[R] CRDW test

2009-08-12 Thread Radha Krishna
Hello All, Could any one of you kindly let me know , if there is an R package which has Cointegrated Regression Durbin Watson test ? lmtest package has a function dwtest but this is not for cointegrated systems, which uses different critical values Regards Radha [[alternative HTML

Re: [R] Combinatorial problem

2009-08-12 Thread Dimitris Rizopoulos
you could try something like the following: groups - list(gp1 = 1:3, gp2 = 4:5, gp3 = 6:7, gp4 = 8:10, gp5 = 11) combn(5, 2, function (x) expand.grid(groups[x]), simplify = FALSE) combn(5, 3, function (x) expand.grid(groups[x]), simplify = FALSE) combn(5, 4, function (x)

Re: [R] Problem with modifying a data frame

2009-08-12 Thread Henrique Dallazuanna
Try this: data$x[data$x == 6] - 66 On Tue, Aug 11, 2009 at 3:05 PM, SNN s.nan...@yahoo.com wrote: Hi All, this could be a simple question but I am looking into modifying a data frame using a condition without the need to loop over that data, would that be possible? I have tried the

Re: [R] C-statistic comparison with partially paired datasets

2009-08-12 Thread Frank E Harrell Jr
Hanneke Wijnhoven wrote: Does anyone know of an R-function or method to compare two C-statistics (Harrells's C - rcorr.cens) obtained from 2 different models in partially paired datasets (i.e. some similar and some different cases), with one continuous independent variable in each separate

Re: [R] Help for R (Advanced matrix addition (large or undefined number of matrices)

2009-08-12 Thread Ben Bolker
Rusyte, Lina wrote: Dear Sirs, I would like to ask you, what function can I use for matrices addition? I couldn't find any information about it in the manual or in the internet. (A+B suits, when the number of matrixes is small, function sum() doesn't suit for matrices addition,

Re: [R] Combinatorial problem

2009-08-12 Thread Bernd Bischl
Dimitris Rizopoulos wrote: you could try something like the following: groups - list(gp1 = 1:3, gp2 = 4:5, gp3 = 6:7, gp4 = 8:10, gp5 = 11) combn(5, 2, function (x) expand.grid(groups[x]), simplify = FALSE) combn(5, 3, function (x) expand.grid(groups[x]), simplify = FALSE)

[R] Re : paste first row string onto every string in column

2009-08-12 Thread Inchallah Yarab
Try this , save your data in C:/ and write this (data - read.csv2(c:/jill.csv, sep=,)) (C-data[1,]) A - numeric(4) B - numeric(4) for (i in 1 :4){ A[i] - paste(data[1,i],data[2,i]) B[i] - paste(data[1,i],data[3,i]) } A B (data1 - rbind(as.character(A),as.character(B))) (data2 -

Re: [R] Varying x-axis labels in lattice

2009-08-12 Thread Frank E Harrell Jr
Thanks very much Deepayan and Duncan. Both of your suggestions are very helpful and should do what I need. Frank Deepayan Sarkar wrote: On Tue, Aug 11, 2009 at 6:30 AM, Frank E Harrell Jrf.harr...@vanderbilt.edu wrote: Dear Group: I want to use lattice with a formula such as y ~ x | v to

Re: [R] Zoo and numeric data

2009-08-12 Thread Gabor Grothendieck
See zoo-faq number 4: vignette(zoo-faq) On Wed, Aug 12, 2009 at 4:46 AM, Mark Bremanbreman.m...@gmail.com wrote: Hi, I have a csv file with different datatypes: 2009-01-01, character1, 10, 20.1 2009-01-02, character2, 11, 21.1 (I have attached the file to this post) I read this file

Re: [R] A function for plotting a boxplot with added dot and bars (formean and SE) - please help improve my code

2009-08-12 Thread ONKELINX, Thierry
Two solutions with errorbars library(ggplot2) #option 1 lowCI - function(x){mean(x) + qt(0.025, length(x) - 1) * sd(x) / sqrt(length(x))} highCI - function(x){mean(x) + qt(0.975, length(x) - 1) * sd(x) / sqrt(length(x))} ggplot(mtcars, aes(x = factor(round(wt)), y = mpg, colour = factor(am))) +

Re: [R] Help on a combinatorial task (lists?)

2009-08-12 Thread jim holtman
It would appear that if you were extracting the values at the indices in 'res' that you should get: 2,2,2 x - list(c(1,2,3,4), c(1,2,4,3), c(1,4,2,3)) res - c(2,2,3) x [[1]] [1] 1 2 3 4 [[2]] [1] 1 2 4 3 [[3]] [1] 1 4 2 3 ?mapply mapply(function(a,b)a[b], x, res) [1] 2 2 2 On Tue,

[R] calling a function with dynamically generated buttons

2009-08-12 Thread Anne Skoeries
Hallo, I'm dynamically generating buttons depending on the number of rows of my dataframe. Every button is supposed to call a function which generates a plot with the values of one of my dataframe rows. My code looks like this: base - tktoplevel() plotten - function(mat, namen, titel) {

Re: [R] Re : Zoo and numeric data

2009-08-12 Thread Gavin Simpson
On Wed, 2009-08-12 at 10:03 +, Inchallah Yarab wrote: why you don't use read.csv2 (you save your file.csv) and you write read.csv2(path file,sep=,) No you don't!!! Please understand what read.csv2 is for. It is for locales where the , is used as the decimal point, e.g. 5,2323 == 5.2323. As

Re: [R] Problem with modifying a data frame

2009-08-12 Thread Jorge Ivan Velez
Dear Nancy, Try also: x - c(4,5,6,6,8) y - c(a,b,b,b,c) mydata - data.frame(x,y) mydata mydata$x - with(mydata, ifelse(x == 6, 66, x)) mydata See ?ifelse for more details. BTW, be careful: data is an R reserved name :-) HTH, Jorge On Tue, Aug 11, 2009 at 2:05 PM, SNN wrote: Hi All,

Re: [R] merge zoo objects contained in a list

2009-08-12 Thread stephen sefick
All of the data frames in the list (list of 74) have the same column names, and some have the exact same index values, while others have out of sync, but in the same range. I can send a small example off list. I will look at it again when I get into work this morning to see if I can fix it.

[R] logged2

2009-08-12 Thread amor Gandhi
Hi, Can you please tell me what does the the function logged2 in R do im list or..? As I have ?logged2 No documentation for 'logged2' in specified packages and libraries: you could try '??logged2' ??logged2 No help files found with alias or concept or title matching ‘logged2’ using fuzzy

Re: [R] logged2

2009-08-12 Thread Steve Lianoglou
Hi, On Aug 12, 2009, at 9:26 AM, amor Gandhi wrote: Hi, Can you please tell me what does the the function logged2 in R do im list or..? As I have ?logged2 No documentation for 'logged2' in specified packages and libraries: you could try '??logged2' ??logged2 No help files found with

Re: [R] How to label and unlabel points on scatterplot with mouse pointer

2009-08-12 Thread Duncan Murdoch
Hitesh Singla wrote: Thanks milton, But that does not work in my case.. Any other suggestion be appreciated. You can't do what you want with standard graphics or grid/lattice/ggplot2, as far as I know. But there are various other graphics systems in contributed packages that can

[R] hmm.discnp or other?

2009-08-12 Thread Aaron Mackey
(I think) I'd like to use the hmm.discnp package for a simple discrete, two-state HMM, but my training data is irregularly shaped (i.e. the observation chains are of varying length). Additionally, I do not see how to label the state of the observations given to the hmm() function. Ultimately, I'd

Re: [R] calling a function with dynamically generated buttons

2009-08-12 Thread jim holtman
Untested, but try something like this: for(i in 1:(reihen-1)) { but - tkbutton(base, text = classi[i], command = local({ anzeige - data.matrix(dataframe[i,-c(spalten)]) namen - names(anzeige) tit - paste(classi[i],

Re: [R] metaplot in rmeta: y-axis disappears

2009-08-12 Thread Roaman
Thank you, the x-axis includes zero, but even, when I try to plot it not including zero, the y-axis keeps disappearing. One can't even add the axis afterwards! Here is an example: library(rmeta) set.seed(123) # simulated data: theta - 0.5 sds - runif(50,0.8,8) b - rnorm(50,0,0.3)

[R] axis scale

2009-08-12 Thread maram salem
Dear All, I'm trying to plot a histogram (with the relative frequencies as the Y axis), But the scale of the y axis is given by 0e+00, 1e-04, 2e-04, 3e-04,. Now, I have 2 questions 1- Does (1e-04=0.01831563)? 2- If this true,how can i change the given scale to (0.01,0.03,0.05,0.07,0.09)?

[R] CCF for hourly time series?

2009-08-12 Thread Katharina Appel
Hello, I have a dataframe containing various time series (not time series objects though!)with hourly time steps. I´d like to perform ccf for I need to know the correlation factors for different lags. Here is an example: x-as.POSIXct(c(2008-12-25 16:00:00, 2008-12-25 17:00:00, 2008-12-25

Re: [R] pretty display or print for data frames ?

2009-08-12 Thread Erik Iverson
I sometimes use the View() (note the capital V) function to view long/wide data.frames. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Leon Yee Sent: Wednesday, August 12, 2009 2:12 AM To: Patrick Connolly Cc:

[R] SOLVED: Lattice: How to do error bars

2009-08-12 Thread amvds
Thank you Gerrit, Your suggestion proved right after all: This does put error bars (dy) on the points. You only need to figure out the proper y axis scaling. xyplot(y~x|f,data=xy,groups=dy,panel=function(x,y,groups,subscripts,...) {panel.xyplot(x,y,...)

[R] Symbolic references - passing variable names into functions

2009-08-12 Thread Alexander Shenkin
Hello All, I am trying to write a function which would operate on columns of a dataframe specified in parameters passed to that function. f = function(dataf, col1 = column1, col2 = column2) { dataf$col1 = dataf$col2 # just as an example } The above, of course, does not work as

Re: [R] calling a function with dynamically generated buttons

2009-08-12 Thread Anne Skoeries
Thanks, works just fine! Great! -- Anne Skoeries Am 12.08.2009 um 16:04 schrieb jim holtman: Untested, but try something like this: for(i in 1:(reihen-1)) { but - tkbutton(base, text = classi[i], command = local({ anzeige - data.matrix(dataframe[i,-c(spalten)])

Re: [R] paste first row string onto every string in column

2009-08-12 Thread Benilton Carvalho
you could stick everything in a 1-liner, but that would make it less readable: myf - function(x){ tmp - as.character(x) c(tmp[1], paste(tmp[1], tmp[-1], sep=)) } df2 - as.data.frame(sapply(df, myf)) b On Aug 12, 2009, at 3:39 AM, milton ruser wrote: Hi Jill, Completely not elegant,

Re: [R] Symbolic references - passing variable names into functions

2009-08-12 Thread Erik Iverson
I think ONE answer to what you actually want to do might be f - function(dataf, col1 = column1, col2 = column2) { dataf[[col1]] - dataf[[col2]] # just as an example dataf } -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org]

[R] Re : Re : Zoo and numeric data

2009-08-12 Thread Inchallah Yarab
Thank you Gavin very much for this explication!!! inchallah yarab De : Gavin Simpson gavin.simp...@ucl.ac.uk Cc : r-help@r-project.org Envoyé le : Mercredi, 12 Août 2009, 14h50mn 37s Objet : Re: [R] Re : Zoo and numeric data On Wed, 2009-08-12 at 10:03

[R] Superscripts in axis label

2009-08-12 Thread Buckmaster, Sarah
Hi All, I am trying to lable the y-axis on my scatterplot with the following: Soil moisture content (m3m-3) I am using the following coding for plotting the graph: plot(soilmoisture~gradientlevel, xlab=Levels of droughting gradient, ylab=Soil moisture content (m3m-3), bty=l, font.main=2,

Re: [R] ggplot2: override facet names in facet_wrap?

2009-08-12 Thread hadley wickham
That's on the to do list :( Hadley On Tue, Aug 11, 2009 at 10:00 PM, Ben Bolkerbol...@ufl.edu wrote:  Thanks.  I can get it to work for facet_grid (which will do for my current purposes) but am curious about whether there's a way to do the same for facet_wrap (which doesn't have a labeller

Re: [R] CCF for hourly time series?

2009-08-12 Thread Katharina Appel
Hi Andreas, thank you for replying so soon. You are right, your code works perfectly for my example. Unfortunately, the real data contains inner NAs, which I forgot to include. Sorry about that. Any other suggestions? Thanks, Katharina Original-Nachricht Datum: Wed, 12 Aug

Re: [R] Symbolic references - passing variable names into functions

2009-08-12 Thread Gabor Grothendieck
Returning the changed value as in Erik's answer is probably the most common and R-like solution but here are two others. The assign/get approach is perhaps the closest to what you are asking for. # replacement function approach # replacement function - rhs is formula whose response is assigned

Re: [R] SystemFit

2009-08-12 Thread Arne Henningsen
Hi Ferdogan, Sorry for the late response. On Thu, Jul 23, 2009 at 8:29 AM, Ferdoganferdog...@hotmail.com wrote: I have two products which are substitudes. I try to fix a system as below to mydata. Demand1 = A1 -B1*Price1 + C1*Price2 Demand2 = A2 +B2*Price1 - C2*Price2 I would expect C1

[R] Help for R (Advanced matrix addition (large or undefined number of matrices)

2009-08-12 Thread Lina Rusyte
Dear Sirs,   I would like to ask you, what function can I use for matrices addition? I couldn’t find any information about it in the manual or in the internet. (A+B suits, when the number of matrixes is small, function sum() doesn’t suit for matrices addition, because it sums all variables

Re: [R] axis scale

2009-08-12 Thread Don MacQueen
Without a short reproducible example your question is difficult to understand, and difficult to give a useful answer. See comments below. -Don At 7:13 AM -0700 8/12/09, maram salem wrote: Dear All, I'm trying to plot a histogram (with the relative frequencies as the Y axis), But the scale of

[R] Generating logistic regression data for specific ORs

2009-08-12 Thread Denis Aydin
Dear R-users I want to generate data for a logistic regression for an epidemiological simulation. First, I created a disease-vector containing a 1 if a subject is a cases (i.e. has the disease) and a 0 if a subject is a control. E.g.: disease - as.factor( c(rep(1, n.cases), rep(0,

Re: [R] paste first row string onto every string in column

2009-08-12 Thread Don MacQueen
Let's start with something simple and relatively easy to understand, since you're new to this. First, here's an example of the core of the idea: paste('a',1:4) [1] a 1 a 2 a 3 a 4 Make it a little closer to your situation: paste('a*',1:4, sep='') [1] a*1 a*2 a*3 a*4 Sometimes it helps

Re: [R] C-statistic comparison with partially paired datasets

2009-08-12 Thread Hanneke Wijnhoven
Frank, Thank you for your quick response! I want to compare the discriminative capacity of different anthropometric measures in predicting mortality, focussing on the thin site of these measures. Since these associations are not linear (U shaped for BMI and inversily J-shaped for mid-upper

Re: [R] inserting into data frame gives invalid factor level, NAs generated

2009-08-12 Thread Scott Sherrill-Mix
Your running into the pretty common factor vs character problem in R. By default data.frame turns character vectors into factor (sort of like ENUM in mysql) vectors. Since you only have 1 factor (empty string '') in your starting dataframe, when you go to insert new data R sees a new value and

[R] inserting into data frame gives invalid factor level, NAs generated

2009-08-12 Thread karinlag
I am calculating some values that I am inserting into a data frame. From what I have read, creating the dataframe ahead of time is more efficient, since rbind (so far the only solution I have found to appending to a data frame) is not very fast. What I am doing is the following: # create data

Re: [R] Superscripts in axis label

2009-08-12 Thread Eik Vettorazzi
Hi Sarah, expression works well, but you have to use it as function. plot(1,ylab=expression(Soil moisture content ~~bgroup((,m^3*m^{-3}, see ?plotmath for further examples hth. Buckmaster, Sarah schrieb: Hi All, I am trying to lable the y-axis on my scatterplot with the following:

Re: [R] nominal to numeric function

2009-08-12 Thread Daniel Malter
Hi you can use newvariable=as.numeric(variablename). This converts your factors into numeric variables, but not always with the desired result. So make sure that you check whether newvariable gives you what you want. Otherwise recoding by hand is indicated. Best, Daniel Noah Silverman-3

Re: [R] nominal to numeric function

2009-08-12 Thread Phil Spector
It's generally safer to use as.numeric(as.character(variablename)) since it eliminates problems associated with factors. - Phil Spector Statistical Computing Facility

Re: [R] Superscripts in axis label

2009-08-12 Thread Eik Vettorazzi
oops, there was a little problem with an automated text replacement in my last post. m^3 should be read as m ^ 3 (without white space). or, using curly brackets for safety, try plot(1,ylab=expression(Soil moisture content~~bgroup((,m^{3}*m^{-3}, hth. Buckmaster, Sarah schrieb: Thanks

[R] Using bold font with bquote

2009-08-12 Thread Jonathan R. Blaufuss
I'm trying to annotate a density plot and I'm using bquote to paste the sigma symbol next to the numeric text of the standard deviation calculation that I am performing. I have been able to successfully turn the sigma symbol and numeric output the color blue, but when I try to change the font of

[R] getting dates from a ts object

2009-08-12 Thread Data Analytics Corp.
Hi, I have a ts object called data.gas that has three economic variables: gasoline consumption (gas), price per gallon (price), and household income (income) by month from January 1970 to December 2008. I want to plot this gas and price variables using ggplot2, but ggplot2 will not allow an

Re: [R] getting dates from a ts object

2009-08-12 Thread Gabor Grothendieck
time(obj) gives the times of a ts object, obj. On Wed, Aug 12, 2009 at 12:51 PM, Data Analytics Corp.dataanalyt...@earthlink.net wrote: Hi, I have a ts object called data.gas that has three economic variables: gasoline consumption (gas), price per gallon (price), and household income

Re: [R] paste first row string onto every string in column

2009-08-12 Thread Jill Hollenbach
Thanks so much everybody, this has been incredibly helpful--not only is my immediate issue solved but I've learned a lot in the process. The lapply solution is best for me, as I need flexibility to edit df's with varying numbers of columns. Now, one more question: after appending the string

[R] R numeric string problem

2009-08-12 Thread Andrew C
Hi, I have a text (.dat) file, in which each row contains several long numeric strings. One of the strings is 38 digits long, for example: 03200801200801172008011720092904008901 When I read in the data file, this string shows up as 3.200801e+36. To get rid of the scientific notation, I used

Re: [R] R numeric string problem

2009-08-12 Thread Henrique Dallazuanna
Use colClasses argument in read.table to set the class of column: For a file with two columns, where the first is string and the other is numeric: read.table('your_file.dat', colClasses = c('character', 'numeric')) On Wed, Aug 12, 2009 at 1:43 PM, Andrew C acarr...@gmail.com wrote: Hi, I

Re: [R] Map of UK Counties - to use in R

2009-08-12 Thread Roger Bivand
The illustration you show is for the so-called traditional or historical counties of England, which may be available somewhere. There are non-georeferenced PNG files on Wikipedia, which might be used, but as far as I can see, only UK-based academics can register for access to the edina UK borders

[R] Obtaining the value of x at a given value of y in a smooth.spline object

2009-08-12 Thread Kavitha Venkatesan
I have some data fit to a smooth.spline object as follows: (x=vector of data for the predictor variable, y=vector of data for the response variable) fit - smooth.spline(x,y) Now, given a spline fit point y_new, I want to be able to find out what value of x_new yielded this fit value. How to do

Re: [R] R numeric string problem

2009-08-12 Thread Bert Gunter
You need to read up about finite precision arithmetic and floating point representation. In brief, note that 2^64 requires 20 decimal digits, and some bits in double precision must be given up to sign, exponent, etc. leaving 53 bits for precision = 16 decimal digits. This is exactly the number of

Re: [R] Using bold font with bquote

2009-08-12 Thread Scott Sherrill-Mix
From ?plotmath, it looks like when using expressions you set the font inside the expression (e.g. bold(x)). It looks you tried this already but I wonder if there was something tiny out of place since the following works for me:

Re: [R] nominal to numeric function

2009-08-12 Thread Noah Silverman
Hi, Thanks for the tip, Neither method works as my data is truly nominal - foo - c(blue, red, green) as.numeric(foo) [1] NA NA NA Warning message: NAs introduced by coercion Rapid Miner has a function that will

Re: [R] nominal to numeric function

2009-08-12 Thread Dimitris Rizopoulos
another approach may be: foo - c(blue, red, green) s.foo - sample(foo, 20, TRUE) s.foo match(s.foo, foo) I hope it helps. Best, Dimitris Noah Silverman wrote: Hi, Thanks for the tip, Neither method works as my data is truly nominal - foo - c(blue,

[R] Games in R

2009-08-12 Thread David Croll
Hi everybody - this is an oddball question. I wonder if anybody has programmed any games in R, such as Sudoku, Tic-Tac-Toe and the like. Or even a flight simulator... R mateys! Let's make some t-tests! Regards, David __ R-help@r-project.org

Re: [R] problem loading ncdf library on MAC

2009-08-12 Thread Dan Kelley
I think ncdf is broken now, and so is Rnetcdf. I can't build from source, either. If I find a solution, I'll post it here. FYI, I have an intel-based Mac running the latest OS and with R 2.9.1 -- View this message in context:

Re: [R] Using bold font with bquote

2009-08-12 Thread Jonathan R. Blaufuss
Scott, Your suggestion works great for changing the numbers to bold font, but is it possible to change the sigma symbol and the equals sign to bold font as well? I've poked around ?plotmath and am I right in saying that there is a different method for controlling symbol fonts? Thank you for

Re: [R] Map of UK Counties - to use in R

2009-08-12 Thread Hisaji ONO
Hello. shapefiles in geographic coordinates for Epi Info http://www.cdc.gov/epiinfo/europe.htm second-level at 1998, free available but not public domain Regards. --- Roger Bivand roger.biv...@nhh.no wrote: The illustration you show is for the so-called traditional or historical

[R] biOps load problem

2009-08-12 Thread Jonathan Lees
I am trying to install and use the biOps package on my x86_64 GNU/Linux ssytem. I have installed the fftw-3.2.2.tar.gz and biOps_0.2.1.tar.gz but when I start R and try to load the library, I get this message: ## library(biOps) Error in dyn.load(file,

[R] Attached file following download failure

2009-08-12 Thread Fowler, Mark
Hello, I'm working with a package that uses download.file in functions to extract information from remote databases. My current environment is Windows XP Pro SP3, R 2.7. A full extraction can be a great deal of data, so the download is accomplished in generally manageable packets, such that a

Re: [R] problem loading ncdf library on MAC

2009-08-12 Thread Steve Lianoglou
Hi, On Aug 12, 2009, at 2:23 PM, Dan Kelley wrote: I think ncdf is broken now, and so is Rnetcdf. I can't build from source, either. If I find a solution, I'll post it here. FYI, I have an intel-based Mac running the latest OS and with R 2.9.1 While I haven't compiled it myself, it

Re: [R] Games in R

2009-08-12 Thread Bjørn Arild Mæland
Hi, There's a couple of games listed on crantastic: http://crantastic.org/tags/games -Bjorn 2009/8/12 David Croll david.cr...@gmx.ch: Hi everybody - this is an oddball question. I wonder if anybody has programmed any games in R, such as Sudoku, Tic-Tac-Toe and the like. Or even a flight

  1   2   >