Re: [R] repeating a function and combining the results

2013-12-03 Thread arun
HI, May be this helps: example - function(X,n){ lst1 - list() for(i in 1:n){ cell1 - sample(X,1) cell2 - sample(X,1) table1 - cbind(cell1,cell2) lst1[[i]] - table1 } do.call(rbind,lst1) } #or example1 - function(X,n){ table1 - vector() for(i in 1:n){ cell1 - sample(X,1) cell2 - sample(X,1)

[R] R lmer debugging: Error in [[-.data.frame(*tmp*, i, value = integer(0)) : replacement has 0 rows, data has 117

2013-12-03 Thread Cynthia Tedore
I am able to use lmer on an older computer without this error, but the new version (downloaded yesterday) gives me this error message: Error in [[-.data.frame(*tmp*, i, value = integer(0)) : replacement has 0 rows, data has 117 in response to this function:

Re: [R] What is the easiest way to interpolate vertical values on a square section of a nearly-planar 3D surface

2013-12-03 Thread Shane Carey
I have a similar problem that I need to solve. I need to be able to visualise a Geological fault in 3-D. I need to interpolate the x y z data and then visualise it on its side. Im not sure if or is capable of doing this? Thanks On Tue, Dec 3, 2013 at 4:02 AM, Mercutio Florid

Re: [R] R lmer debugging: Error in [[-.data.frame(*tmp*, i, value = integer(0)) : replacement has 0 rows, data has 117

2013-12-03 Thread Pascal Oettli
Hello, I get a result if I change 'as.factor(males)' to 'males'. Hope this helps, Pascal On 3 December 2013 18:43, Cynthia Tedore cynthia.ted...@biol.lu.se wrote: I am able to use lmer on an older computer without this error, but the new version (downloaded yesterday) gives me this error

Re: [R] repeating a function and combining the results

2013-12-03 Thread Bert Gunter
Arun has given you a number of ways to do what you (seem to) want. If this is fast enough, then you're done. If not, then the key to speeding things up is to do things differently. Note that a 1 x 9 matrix is a just a vector. Since each element of the vector is a different computation, apparently

Re: [R] International phonetic symbols in R.

2013-12-03 Thread Olivier Crouzet
Dear Rolf, I've started trying to understand your issue but it may take me some time as I'm rather busy within the next few days. However, if you can put the screen capture on an external web site, that would be great as it would help decipher what kind of system the student used for representing

Re: [R] interpretation of MDS plot in random forest

2013-12-03 Thread mbressan
sorry, in fact it was a trivial question! by just peeping into the function I've worked out this simple solution: MDSplot(iris.rf, iris$Species) legend(topleft, legend=levels(iris$Species), fill=brewer.pal(3, Set1)) thank you thanks andy it's a real honour form me to get a reply by you;

[R] purpose of the set.seed(function)

2013-12-03 Thread Charles Thuo
what is the purpose of the subject function Charles [[alternative HTML version deleted]] __ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide

[R] triangular matrix inverse

2013-12-03 Thread Michael Meyer
Greetings,   is there an algorithm which computes the inverse of a triangular matrix while being aware of its triangular form?   I know about solve() but this is probably not efficient on a triangular matrix.   Thanks, Michael Meyer [[alternative HTML version deleted]]

Re: [R] triangular matrix inverse

2013-12-03 Thread Martyn Byng
Hi, backsolve() is probably what you are looking for. Martyn -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Michael Meyer Sent: 03 December 2013 12:25 To: r-help@r-project.org Subject: [R] triangular matrix inverse Greetings,  

[R] Stats course in Coimbra, Portugal

2013-12-03 Thread Highland Statistics Ltd
There are a few remaining places on the following course: Data exploration, regression, GLM and GAM with introduction to R When: 3 - 7 February, 2014 Where: University of Coimbra, Coimbra, Portugal Further information: http://www.highstat.com/statscourse.htm Flyer:

Re: [R] Any R packages support conversion from PDF to XLS ?

2013-12-03 Thread Carl Witthoft
Pretty much nothing can convert arbitrary PDF files to unicode. It depends a lot on what is in the PDF to begin with -- properly encoded text or just bitmapped images, for example. I would recommend you search around to see whether there's a related archive in a different format. And in any

Re: [R] purpose of the set.seed(function)

2013-12-03 Thread Carl Witthoft
Seriously? You should be ashamed of yourself for even considering posting a question like this. Charles Thuo wrote what is the purpose of the subject function Charles [[alternative HTML version deleted]] __ R-help@ mailing list

Re: [R] purpose of the set.seed(function)

2013-12-03 Thread Jeff Newmiller
To start a random sequence that can be reproduced later. The particular seed value used should not be important unless either the random number generator or the computations that use the random numbers are flawed. ?set.seed http://en.m.wikipedia.org/wiki/Pseudorandom_number_generator

Re: [R] purpose of the set.seed(function)

2013-12-03 Thread Jan Kim
On Tue, Dec 03, 2013 at 02:42:42PM +0300, Charles Thuo wrote: what is the purpose of the subject function please see rule #6 of Ten Simple Rules for Reproducible Computational Research [Sandve et.al., PLoS Comput Biol 9(10): e1003285 doi:10.1371/journal.pcbi.1003285] Can't resist this

Re: [R] interpretation of MDS plot in random forest

2013-12-03 Thread Massimo Bressan
here it is an amended (more general) version library(randomForest) set.seed(1) data(iris) iris.rf - randomForest(Species ~ ., iris, proximity=TRUE, keep.forest=TRUE) x-MDSplot(iris.rf, iris$Species) #add legend legend(topleft, legend=levels(iris.rf$predicted),

Re: [R] ifelse -does it manage the indexing?

2013-12-03 Thread Hadley Wickham
A better solution to this problem is to use character indexing: x - c(Tuesday, Thursday, Sunday) c(Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6, Sunday = 7)[x] http://adv-r.had.co.nz/Subsetting.html#lookup-tables-character-subsetting Hadley On Mon, Dec 2, 2013

Re: [R] XLConnect readWorksheet comma decimal sign

2013-12-03 Thread Knut Krueger
Am 02.12.2013 21:28, schrieb David Winsemius: In fact you can set that globally with: ?options options()$OutDec # my setting [1] . Oh sorry I thought you mentioned to set excel globally to dot. no change when setting it to dot. I seems that XLConnect is not able to deal with NA in Excel,

Re: [R] Intepreting lm() results with factor

2013-12-03 Thread peter dalgaard
On 03 Dec 2013, at 01:08 , David Gwenzi dgwe...@gmail.com wrote: Dear all I have observations done in 4 different classes and the between classes *variance* is too high that I decided to run a model without pooling the *variance*. I used the following code first :

Re: [R] R lmer debugging: Error in [[-.data.frame(*tmp*, i, value = integer(0)) : replacement has 0 rows, data has 117

2013-12-03 Thread Ben Bolker
Pascal Oettli kridox at ymail.com writes: Hello, I get a result if I change 'as.factor(males)' to 'males'. Hope this helps, Pascal On 3 December 2013 18:43, Cynthia Tedore Cynthia.Tedore at biol.lu.se wrote: I am able to use lmer on an older computer without this error, but the

[R] Replace empty cels in multiple dataframes

2013-12-03 Thread Luis Santomé Collazo
Hi everyone, I'd like to replace the empty cells from a numerical variable (let's say variable AAA) with zero in multiple dataframes using plyr package. Of course all the dataframes have the same structure but different number of lines. I've been trying variations of: |dataset -

[R] why change days of the week from a factor to an ordered factor?

2013-12-03 Thread Alok Shende
Hi, There are two reasons. First is that in the day_of_week, the starting day is Friday so if you plot a graph, the left most column will start with Friday. You may like to start the column with Monday. The second reason is that instead of having all these long factor names (Monday,...), the code

Re: [R] R lmer debugging: Error in [[-.data.frame(*tmp*, i, value = integer(0)) : replacement has 0 rows, data has 117

2013-12-03 Thread Cynthia Tedore
males is a factor. If I don't specify that, then it treats it as a numeric. any other suggestions? On Tue, Dec 3, 2013 at 11:25 AM, Pascal Oettli kri...@ymail.com wrote: Hello, I get a result if I change 'as.factor(males)' to 'males'. Hope this helps, Pascal On 3 December 2013 18:43,

[R] Generating a matrix

2013-12-03 Thread Srdjan Santic
I'm trying to write a function that will generate a NxN matrix that has the value K on both diagonals, while the values outside the diagonals (up and down) are 1's (for conflicting positions such as [4,5] and [5,4] the larger value is written in the matrix). Basically, I'm trying to replicate

[R] httpuv_1.2.0 : websockets-hybi03.cpp

2013-12-03 Thread MAYER Hans
Dear All, I tried to compile httpuv_1.2.0 and got a lot of errors. See below. Compiling 1.0.6.3 was successful, but I need the latest version for shiny. Any ideas ? Kind regards Hans amur1:root R CMD INSTALL . * installing to library '/usr/local/lib/R/library' * installing *source* package

Re: [R] Generating a matrix

2013-12-03 Thread David Carlson
We don't do homework assignments on the list, but one answer requires no loops and an understanding of the various ways R uses vectors for indexing: ?[ - David L Carlson Department of Anthropology Texas AM University College Station, TX 77840-4352

Re: [R] R lmer debugging: Error in [[-.data.frame(*tmp*, i, value = integer(0)) : replacement has 0 rows, data has 117

2013-12-03 Thread Ben Bolker
Cynthia Tedore Cynthia.Tedore at biol.lu.se writes: males is a factor. If I don't specify that, then it treats it as a numeric. any other suggestions? transform(spiders,focal.chel=as.numeric(focal.chel), opponent.chel=as.numeric(opponent.chel),fmales=factor(males))

Re: [R] why change days of the week from a factor to an ordered factor?

2013-12-03 Thread S Ellison
There are two reasons. First is that in the day_of_week, the starting day is Friday so if you plot a graph, the left most column will start with Friday. You may like to start the column with Monday. Plotting levels in a particular order by default does not usually require an ordered

[R] Retrieving data from rotated netCDF-file

2013-12-03 Thread Sandra Stankowski
I’m trying to read some data from a NetCDF file with a rotated coordinate system using the function retrieve.nc() from the clim.pact package. I know, that the rotated pole is supposed to be at 198.0 E and 39.25 N, the top left corner is at 331.79 E and 21.67 N. The grid resolution is

Re: [R] Generating a matrix

2013-12-03 Thread arun
HI, You could try:  mat1 - matrix(0,8,8)  diag(mat1) - 5  mat2 - apply(mat1,2,rev)  diag(mat2) - 5  indx- which(mat2==5)  mat2[indx[indx%%8==1]+1] -1 mat2[indx[indx%%8==0]-1] -1  mat2[indx[!(indx%%8==0 |  indx%%8==1)]-1][mat2[indx[!(indx%%8==0 |indx%%8==1)]-1]==0] - 1  mat2[indx[!(indx%%8==0 | 

Re: [R] Any R packages support conversion from PDF to XLS ?

2013-12-03 Thread Tom Li
Pretty much nothing can convert arbitrary PDF files to unicode. It depends a lot on what is in the PDF to begin with -- properly encoded text or just bitmapped images, for example. I would recommend you search around to see whether there's a related archive in a different format.

[R] Spatial Correlation Map using R

2013-12-03 Thread Zilefac Elvis
Hi, I have rainfall data from 100 locations, with coordinates  for each location available. Now, I have a correlation matrix showing the correlation between rainfall at a single location against all other locations and so on for the 100 locations. How can I visualize this correlation matrix

[R] significance of random effect in mgcv gam

2013-12-03 Thread William Shadish
Dear R-helpers, I would like to test whether a random effect is significant when implemented with bs=re in mgcv gam. For example, if I run: M3b - gam(DVY ~ s(SessIDX, fTX, bs = re) + factor(TX), data = PCP, family = quasipoisson(link=log), method=REML)

[R] interaction plot with SE bar

2013-12-03 Thread Kristi Glover
Hi R user, I am just wondering how I can add Standard error bar in the interaction plot. I used the following code but I don't know how i can edit this to put a started error's bar on the mean. Would you give me some hints? or do other packages provide the information about plotting the SE

Re: [R] Spatial Correlation Map using R

2013-12-03 Thread Jim Lemon
On 12/04/2013 05:26 AM, Zilefac Elvis wrote: Hi, I have rainfall data from 100 locations, with coordinates for each location available. Now, I have a correlation matrix showing the correlation between rainfall at a single location against all other locations and so on for the 100 locations.

Re: [R] XLConnect readWorksheet comma decimal sign

2013-12-03 Thread Peter Keller
I can't tell since you didn't post any code, so forgive me if you've tried this. XLConnect has a colTypes parameter so you could try specifying the relevant columns to be read in as character, set forceConversion = TRUE, and then use as.numeric. Something like this: as.numeric(sub(,, .,

Re: [R] Spatial Correlation Map using R

2013-12-03 Thread Jim Lemon
On 12/04/2013 08:59 AM, Jim Lemon wrote: On 12/04/2013 05:26 AM, Zilefac Elvis wrote: Hi, I have rainfall data from 100 locations, with coordinates for each location available. Now, I have a correlation matrix showing the correlation between rainfall at a single location against all other

Re: [R] How to access data frame column name using variable ??

2013-12-03 Thread arun
Hi, Try: comb[,as.numeric(temp[1])] #[1] V1 V2  comb[,as.numeric(temp[3])] #[1] V1 V3 A.K. i have two data frame comb          [,1]   [,2]    [,3]   [,4]   [,5]    [,6] [1,]    V1   V1   V1   V1   V1   V1 [2,]    V2   V2   V2   V3   V3   V4 table     V1           V2 1 V1V2          

Re: [R] Replace empty cels in multiple dataframes

2013-12-03 Thread arun
On Tuesday, December 3, 2013 2:31 PM, Luis Santomé Collazo santome...@gmail.com wrote: Hi everyone, HI, ##Creating a reproducible example set.seed(45) lst1 - lapply(1:3,function(i) data.frame(AAA=sample(c(NA,1:10),20,replace=TRUE),BBB=sample(40,20,replace=TRUE)))

[R] Calculate external validation

2013-12-03 Thread Juan Manuel Reyes S
Dear R-project I could not validate one logistic model because when I used the function lrm.fit of the package rms the program showed a error message. It said that the variable Clam and offset must have same length. ext - lrm.fit( ,Clam, offset=X) In this case, Clam is variable depend or

Re: [R] Spatial Correlation Map using R

2013-12-03 Thread Zilefac Elvis
Hi Jim, I tried as you described but did not succeed. Can I send you sample data? Thanks, Zilefac. On Tuesday, December 3, 2013 4:19 PM, Jim Lemon j...@bitwrit.com.au wrote: On 12/04/2013 08:59 AM, Jim Lemon wrote: On 12/04/2013 05:26 AM, Zilefac Elvis wrote: Hi, I have rainfall data from

Re: [R] why change days of the week from a factor to an ordered factor?

2013-12-03 Thread David Winsemius
On Dec 2, 2013, at 6:58 PM, Bill wrote: Duncan, Thanks. Why doesn't coloursf2 - factor(1:8, levels = 8:1) give an ordering when you do str(coloursf2) like 876 ... Because the default for 'ordered' in factor is FALSE: coloursf2 - factor(1:8, levels = 8:1, ordered=TRUE) coloursf2 [1] 1

Re: [R] why change days of the week from a factor to an ordered factor?

2013-12-03 Thread Bert Gunter
But I think Bill continues to confuse the sort order of factor levels with the order of an ordered factor. ?ordered ## and some time with an R tutorial might help! Note: f1 - factor(1:5, lev = 5:1) f2 - factor(1:5,lev=5:1,ordered=TRUE) identical(f1,f2) [1] FALSE ## They are different

Re: [R] What is the easiest way to interpolate vertical values on a square section of a nearly-planar 3D surface

2013-12-03 Thread David Winsemius
On Dec 2, 2013, at 8:02 PM, Mercutio Florid wrote: I want to map out a mostly flat area of land, 300 meters on a side. I want to make (x,y,z) triples where x and y vary between -150 and 150 and there is just one z value. Eventually I will try to use graphics to actually draw this,

Re: [R] International phonetic symbols in R.

2013-12-03 Thread Olivier Crouzet
Well, thanks for sending me the files but I'm sorry to be rather pessimistic as for now... that's exactly what I was suspecting after a first look at the data in your first email... The short answer is: an obsolete IPA transcription system is used in the files so the student should rework the

Re: [R] ifelse -does it manage the indexing?

2013-12-03 Thread David Winsemius
On Dec 3, 2013, at 5:37 AM, Hadley Wickham wrote: A better solution to this problem is to use character indexing: x - c(Tuesday, Thursday, Sunday) c(Monday = 1, Tuesday = 2, Wednesday = 3, Thursday = 4, Friday = 5, Saturday = 6, Sunday = 7)[x]

[R] Sizing axis labels in ggplot2

2013-12-03 Thread David Arnold
All, Say I do: require(ggplot2) names(PlantGrowth) bp - ggplot(PlantGrowth,aes(x=group,y=weight))+geom_boxplot() But the default axis labels and tick labels are just too small for me to read. What is the easiest was to enlarge the font size of axis labels and tick labels? Thanks. D. --

[R] Looking for consultant in mathematics/ statistics

2013-12-03 Thread Michael Haenlein
Dear all, I am looking for a consultant who can help me to solve a mathematical/ statistical problem I have. The problem is more conceptual in nature (How to solve a given problem analytically) than programming-related. Although I also would need some programming support later, once the analytic

[R] persp and Response surface models

2013-12-03 Thread Erin Hodgess
Dear R People: I am using Response Surface Models and and also using the persp function to plot them. Today my particular model is y~ x1 + x2 + x3 I can fit my RSM easily. My question is: how do I use the persp such that I can fix the x3 at a particular value, please? smell.code -

Re: [R] persp and Response surface models

2013-12-03 Thread Erin Hodgess
SOLVED: xs - canonical(smell.rsm)$xs xs x1x2x3 0.1219125 0.1995746 1.7705249 persp(smell.rsm,~x1+x2,at=xs,contour=TRUE) On Tue, Dec 3, 2013 at 9:33 PM, Erin Hodgess erinm.hodg...@gmail.comwrote: Dear R People: I am using Response Surface Models and and also

[R] how to replace a text in a table by another text in R?

2013-12-03 Thread Kristi Glover
Hi R user, I have been struggling to add number in front of text. It mus t be easy. but I could not figure it out. example I have this data: name value central -10.91699497 western -10.16521404 upper -6.915860837 lower -6.546794281 southern -6.382722608 I want to following.

Re: [R] What is the easiest way to interpolate vertical values on a square section of a nearly-planar 3D surface

2013-12-03 Thread Nerd of Darkness
On 2013年12月04日 08:21, David Winsemius wrote: library(car) # will also need rgl scatter3d(dat$X, dat$Y, dat$Value) library(akima) akima.li - interp(dat$X, dat$Y, dat$Value, xo=seq(min(dat$X), max(dat$X), length = 100), yo=seq(min(dat$Y), max(dat$Y),

Re: [R] Sizing axis labels in ggplot2

2013-12-03 Thread arun
Hi, Try: bp+theme(axis.text=element_text(size=14),axis.title=element_text(size=16,face=bold)) A.K. On Tuesday, December 3, 2013 9:41 PM, David Arnold dwarnol...@suddenlink.net wrote: All, Say I do: require(ggplot2) names(PlantGrowth) bp -

Re: [R] how to replace a text in a table by another text in R?

2013-12-03 Thread arun
Hi, Use ?paste() dat1- read.table(text=name  value central    -10.91699497 western    -10.16521404 upper    -6.915860837 lower    -6.546794281 southern -6.382722608,sep=,header=TRUE,stringsAsFactors=FALSE)  number1 - c(1,3,2,4,5) dat1[,1] - paste0(number1,dat1[,1]) A.K. On Tuesday,

[R] R sendmail ASPMX.L.GOOGLE.COM:25 cannot be opened

2013-12-03 Thread Li Liu
Hello, everyone, I wish you would be kind enough to give me a hand. I am trying to send a mail through R and have met some problems. library(sendmailR) from - sprintf(sendmailR@\\%s, Sys.info()[4]) to - myem...@gmail.com subject - Hello from R body - list(It works!, mime_part(iris))

Re: [R] XLConnect readWorksheet comma decimal sign

2013-12-03 Thread Martin Studer
Hi, XLConnect can very well deal with missing values. By default, only blank cells (cells not containing any values) will be treated as missing values. Cells containing the text NA are not automatically treated as missing values as NA is a valid non-missing text string. If you want to treat the

[R] Problems with intersections between two charcter vectors

2013-12-03 Thread snow
I'm a beginner with R. I have two vectors in character format. I tried to get the intersection of these two vectors using intersect£¨£©. But there is no result. The process is below: a-c(CREB2¡± ,¡°ELK1¡± ,¡°ELK4¡± ,¡°MYC¡± ,¡°NR4A1¡± ,¡°FOS¡± ,¡°SRF¡± ,¡°TAU¡± ,¡°STMN1¡± ,¡°CPLA2) a[1]