Re: [R] Understanding lattice barchart() display

2012-10-23 Thread Peter Ehlers
On 2012-10-23 15:39, Rich Shepard wrote: On Tue, 23 Oct 2012, Bert Gunter wrote: I believe you are misunderstanding what a barchart is (or maybe I do, since I never use 'em). I believe that there should be one quant value for each tclass and stream, and you have several. Bert, My first a

[R] List of multidimensional arrays

2012-10-23 Thread Loukia Spineli
Dear all, I am trying to create a list, where each list element is a vector of different length arrays that contain 2by2 matrices. To be more specific there are 11 treatments that are compared with placebo (we have 11 comparisons) and each comparison is studied by a different number of trials and

Re: [R] repeat takes along time

2012-10-23 Thread PIKAL Petr
Hi > > Hi > > I want help for "repeat" because it takes a long time > > repeat{ > for (i in 1:n){ > probb[i]=sum(Wc[z[,j]>=yb[i]]) > } > deltab[,b]=rbinom(n,1,probb) > if(length(which(is.na(deltab[,b])==T))==0){break} > } > > This code works but takes much computation time. What is this code

Re: [R] plotting multiple variables in 1 bar graph

2012-10-23 Thread PIKAL Petr
Hi see in line > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of David Carlson > Sent: Tuesday, October 23, 2012 6:47 PM > To: 'Macy Anonuevo'; r-help@r-project.org > Subject: Re: [R] plotting multiple variables in 1 bar graph

Re: [R] incomplete final line found by readTableHeader

2012-10-23 Thread David Winsemius
On Oct 23, 2012, at 8:12 PM, Jeff Newmiller wrote: > Keep in mind that this is NOT a homework support list... you are supposed to > use the support provided by your educational institution if you are in a > course. Read the posting guide mentioned in the footer of every email. > > FWIW, as des

Re: [R] incomplete final line found by readTableHeader

2012-10-23 Thread Jeff Newmiller
Keep in mind that this is NOT a homework support list... you are supposed to use the support provided by your educational institution if you are in a course. Read the posting guide mentioned in the footer of every email. FWIW, as described your problem is with Excel, and this is not an Excel sup

Re: [R] Extracting results from Google Search

2012-10-23 Thread Duncan Temple Lang
Hi Eduardo Scraping the coordinates from the HTML page can be a little tricky in this case. Also, Google may not want you using their search engine for that. Instead, you might use their Geocoding API (https://developers.google.com/maps/documentation/geocoding), but do ensure that this fits wit

[R] incomplete final line found by readTableHeader

2012-10-23 Thread Shane2012
Hello, I am trying to read in an Excel file that I saved as a .csv so I can analyze my assignment data! I am getting really frustrated because this is what I keep getting: Warning message: In read.table("CityData.CSV", sep = "/", header = T) : incomplete final line found by readTableHeader o

Re: [R] daylight

2012-10-23 Thread Mark Dalphin
I would start with the data. My source for this is the US Navy Sunrise/Sunset tables: http://aa.usno.navy.mil/data/docs/RS_OneYear.php The page is produces is pure text; I've previously extracted the values with a simple Perl script, but would do it today using R (in general, most of the pa

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread David Winsemius
On Oct 23, 2012, at 1:25 PM, noobmin wrote: > AL AR CA NY > Doug250 250 250 NA > Jennifer 20 340 300 100 > Michele 250 500 250 60 > Obama15 45 520 600 > > My English is not very good, I'll try again. I want to list ALL states in > the country where Obama had grea

Re: [R] daylight

2012-10-23 Thread Jeff Newmiller
library(maptools) ?sunriset --- Jeff NewmillerThe . . Go Live... DCN:Basics: ##.#. ##.#. Live Go... Live: OO#.. Dead: OO#.. Play

Re: [R] daylight

2012-10-23 Thread David Winsemius
On Oct 23, 2012, at 12:45 PM, bambus wrote: > hi there, > does anyone know how to calculate the amount of daylight on every day of the > year in R? I mean the time between sunrise and sunset. http://www.esrl.noaa.gov/gmd/grad/solcalc/sunrise.html This should explain why you are posing an underd

Re: [R] Error in contrasts message when using logistic regression code.

2012-10-23 Thread David Winsemius
On Oct 23, 2012, at 1:57 PM, hoguejm wrote: > How to change categorical vars to factors. There is nio such thing as a "categorical var" in R, although the closest thing to one is a factor class vector. If you have either numeric or character vectors and you want them to become factors: facva

Re: [R] [r] How to pick colums from a ragged array?

2012-10-23 Thread arun
Hi, I read ur first post and I think I understand what you meant.  I guess this should work. ID <- c(58,58,58,58,167,167,323,323,323,323,323,323,323 ,547,794,814,814,814,814,814,814,841,841,841,841,841 ,841,841,841,841,910,910,910,910,910,910,999,1019,1019 ,1019) DATE <- c(20060821,20061207,20080

[R] Changing radii line type in radial plots

2012-10-23 Thread bwone
Hello all, Is it possible to change the radii line type in radial plots? I wasn't able to find anything online. Thanks, Bern -- View this message in context: http://r.789695.n4.nabble.com/Changing-radii-line-type-in-radial-plots-tp4647238.html Sent from the R help mailing list archive at Nab

Re: [R] frequency

2012-10-23 Thread farnoosh sheikhi
Thanks a lot. Is count command in package COUNT? I'm having a hard fine to fine this package. Thanks again:)   Best,Farnoosh Sheikhi Cc: R help Sent: Tuesday, October 23, 2012 2:07 PM Subject: Re: [R] frequency Hi, Try this: dat1<-read.table(text=" ID    Vis

[R] help using optim function

2012-10-23 Thread tmuman
Hi, am very new to R and I've written an optim function, but can't get it to work least.squares.fitter<-function(start.params,gr,low.constraints,high.constraints,model.one.stepper,data,scale,ploton=F) { result<-optim(par=start.params,method=c('Nelder-Mead'),fn=least.squares.fit,lower=low.const

Re: [R] factor or character

2012-10-23 Thread Silvano Cesar da Costa
Hi Rui, it doesn't work: > (mod5.sig = with(mod5, data.frame(snps = SNP[pvalor<5e-8], stringsAsFactors=FALSE))) > str(mod5.sig) 'data.frame': 76 obs. of 1 variable: $ snps: Factor w/ 220 levels "rs10058955_A",..: 89 59 88 73 40 35 97 55 87 204 ... > Selec = todos[ , colnames(todos) %in% mod5

[R] SEM multigroup modeling

2012-10-23 Thread Maya Abou Zeid
Hello, I am using the SEM package in R to fit a multigroup latent variable model and ran into some difficulties. I have 2 questions: 1. First, I am getting the following error message and wondering what to do to fix it: Error in solve.default((N[g] - 1) * robustVcov(mod.g, adj.obj = ad

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread arun
HI, I think I understand what you meant.  This will output all those states where contribution for Obama is higher than all the other candidates. dat1<-read.table(text="   AL  AR  CA  NY Doug    250 250 250  NA Jennifer  20 340 300 100 Michele  250 500 250  60 Obama    15  45 5

[R] daylight

2012-10-23 Thread bambus
hi there, does anyone know how to calculate the amount of daylight on every day of the year in R? I mean the time between sunrise and sunset. thanks -- View this message in context: http://r.789695.n4.nabble.com/daylight-tp4647213.html Sent from the R help mailing list archive at Nabble.com.

Re: [R] Error in contrasts message when using logistic regression code.

2012-10-23 Thread hoguejm
How to change categorical vars to factors. I am very new at R Thanks -- View this message in context: http://r.789695.n4.nabble.com/Error-in-contrasts-message-when-using-logistic-regression-code-tp4647198p4647226.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] parsing a structured object

2012-10-23 Thread David Winsemius
On Oct 23, 2012, at 4:43 PM, BenM wrote: > Hi All, > Thanks in advance for your help. I take this to be a very basic > question, but I'm very new to R. > I'm trying to figure out how to parse an object. I have the following: > >> fileLocation > location > 1 foo.c

[R] parsing a structured object

2012-10-23 Thread BenM
Hi All, Thanks in advance for your help. I take this to be a very basic question, but I'm very new to R. I'm trying to figure out how to parse an object. I have the following: > fileLocation location 1 foo.csv > fileLocation$location

[R] lm and glm

2012-10-23 Thread Elaine Kuo
Dear list, I am making a linear regression of the following format. lm(Y~X1+X2+log(X3)+log(X4)) Now I would like to check the linear regression above using generalized linear model. Please kindly if the following format is correct and thank you. (If it is wrong, please indicate why.) glm(Y~X1+

Re: [R] Understanding lattice barchart() display

2012-10-23 Thread Rich Shepard
On Tue, 23 Oct 2012, Bert Gunter wrote: I believe you are misunderstanding what a barchart is (or maybe I do, since I never use 'em). I believe that there should be one quant value for each tclass and stream, and you have several. Bert, My first attempt at using barchart() ?panel.barchart

Re: [R] apply and sapply oddity

2012-10-23 Thread Duncan Murdoch
On 12-10-23 6:56 PM, Brian wrote: Hi List, why are the results of the two bits of below code different? > sapply(1:ncol(d.f), function(i) mode(d.f[,i])) [1] "character" "character" "numeric" "numeric" "numeric" "numeric" [7] "numeric" "numeric" "numeric" "numeric" "numeric"

[R] apply and sapply oddity

2012-10-23 Thread Brian
Hi List, why are the results of the two bits of below code different? > sapply(1:ncol(d.f), function(i) mode(d.f[,i])) [1] "character" "character" "numeric" "numeric" "numeric" "numeric" [7] "numeric" "numeric" "numeric" "numeric" "numeric" "numeric" [13] "numeric" "numeric" "c

Re: [R] factor or character

2012-10-23 Thread Rui Barradas
Hello, I've just seen the error, you are _not_ searching for colnames in mod5.sig$snps. Corrected: Selec = todos[ , colnames(todos) %in% mod5.sig$snps] Hope this helps, Rui Barradas Em 23-10-2012 21:17, Silvano Cesar da Costa escreveu: Hi Rui, it doesn't work: (mod5.sig = with(mod5, dat

Re: [R] Understanding lattice barchart() display

2012-10-23 Thread Bert Gunter
I believe you are misunderstanding what a barchart is (or maybe I do, since I never use 'em). I believe that there should be one quant value for each tclass and stream, and you have several. ?panel.barchart is the place to look for documentation for details of any lattice display. Note especially

Re: [R] barplot

2012-10-23 Thread arun
Hi, May be this example helps you. dat1<-data.frame(position= 1:5,pop1=c(3,5,15,25,28),pop2=c(5,8,12,22,35),pop3=c(2,10,17,20,31)) dat2<-melt(dat1,id.vars="position") library(lattice) barchart(value~factor(position),data=dat2) A.K. - Original Message - From: Thiho Jules To: r-help@r

Re: [R] Summary of variables with NA, empty

2012-10-23 Thread Bert Gunter
To highlight: "Basically all Null values" is a meaningless phrase in R. ?Null ?NA ?NaN have **very specific meanings** in R and have nothing to do with the various sorts of whitespace characters that David mentions (spaces, tabs...). If you wish to use R, you **must** understand the distinctions (

[R] Understanding lattice barchart() display

2012-10-23 Thread Rich Shepard
I've a data frame with this structure: 'data.frame': 1987 obs. of 11 variables: $ site : Factor w/ 24 levels "B(W)","BC-1",..: 1 1 2 2 2 1 1 1 ... $ sampdate : Date, format: "2000-07-18" "2000-07-18" ... $ tclass : Factor w/ 8 levels "Annelida","Arachnida",..: 1 5 5 5 5

[R] ROC with more than one predictor

2012-10-23 Thread Luigi
Dear all, I would like to perform a receiver operating characteristics (ROC) curve analysis on data obtained using molecular assays. I have here an example: the first column is the sample number, the second is the response variable and the last three columns are the predictors. I wish to set the

Re: [R] Summary of variables with NA, empty

2012-10-23 Thread David Winsemius
On Oct 23, 2012, at 11:17 AM, Lopez, Dan wrote: > Hi, > > Is there a function I can use on my dataframe to give me a concise summary of > variables that are NA,blank,etc? Basically all Null values, Empty strings, > white space, blank values. Ideally it would look something like the below: > >

Re: [R] frequency

2012-10-23 Thread arun
Hi Farnoosh, Sorry, it's in library(plyr) If you don't want to install plyr, then, you can use ?table() dat1<-read.table(text=" ID    Visit x a1 x a2 x a2 x a1 x a1 y b1 y c23 y b33 ",sep="",header=TRUE,stringsAsFactors=FALSE) cn2<-data.frame(table(dat1[!duplicated(dat1),]$ID))  colnames(cn2)<-c

Re: [R] frequency

2012-10-23 Thread arun
Hi, Try this: dat1<-read.table(text=" ID    Visit x a1 x a2 x a2 x a1 x a1 y b1 y c23 y b33 ",sep="",header=TRUE,stringsAsFactors=FALSE) cn1<-count(dat1[!duplicated(dat1),]$ID) colnames(cn1)<-c("ID","response") merge(dat1,cn1,by="ID",all=TRUE) #ID Visit response #1  x    a1    2 #2  x    a2   

Re: [R] How Rcmdr or na.exclude blocks TukeyHSD

2012-10-23 Thread John Fox
Dear Bob, I'll just add very briefly that I think that this isn't an Rcmdr problem, but more generally a problem with -- or limitation of --TukeyHSD(), which doesn't work properly when na.action=na.exclude. The Rcmdr sets na.action=na.exclude so that it can correctly add observation statistic

Re: [R] Export summary from regression output

2012-10-23 Thread Brian Diggs
On 10/23/2012 5:59 AM, PIKAL Petr wrote: Hi section Arguments of write.table help page clearly says x the object to be written, preferably a matrix or data frame. If not, it is attempted to coerce x to a data frame. summary object from lm is highly structured list an AFAIK can not be easily co

Re: [R] frequency

2012-10-23 Thread arun
Hi, Assuming that there are two columns in your data. dat1<-read.table(text=" ID    Visit x a1 x a2 y b1 y c23 y b33 ",sep="",header=TRUE,stringsAsFactors=FALSE) cnt<-count(dat1$ID) colnames(cnt)<-c("ID","response") merge(dat1,cnt,by="ID",all=TRUE) #  ID Visit response #1  x    a1    2 #2  x 

Re: [R] scatterplot with wrong line offset

2012-10-23 Thread John Fox
Dear Francisco, >From ?scatterplot: "reset.par: if TRUE then plotting parameters are reset to their previous values when scatterplot exits; if FALSE then the mar and mfcol parameters are altered for the current plotting device. Set to FALSE if you want to add graphical elements (such as li

Re: [R] frequency

2012-10-23 Thread Bert Gunter
Are the data in a data frame? Is it the first letter of the id that defines unique ID's or something else? Depending on your answers: ?substring ?table ?with may be useful, as in with(yourdata,table(substring(ID,1,1))) ... or not, if you meant something else. -- Bert On Tue, Oct 23, 2012 at

[R] How Rcmdr or na.exclude blocks TukeyHSD

2012-10-23 Thread Muenchen, Robert A (Bob)
Dear R-Helpers, I was calling the TukeyHSD function and not getting confidence intervals or p-values. It turns out this was caused by missing data and the fact that I had previously turned on R Commander (Rcmdr). John Fox knew that Rcmdr sets na.action to na.exclude, which causes the problem. I

Re: [R] factor or character

2012-10-23 Thread Rui Barradas
Hello, When creating the data.frame of snps use the option stringsAsFactors = FALSE I believe your error comes from the fact that you are trying to find colnames in a variable coded as integers (a factor, like str shows). Hope this helps, Rui Barradas Em 23-10-2012 19:02, Silvano Cesar da Cos

Re: [R] After sorting a dataframe by date

2012-10-23 Thread David Winsemius
On Oct 23, 2012, at 9:34 AM, martiny wrote: > HI, > I have created a dataframe "df" and try to sort it by its date using the > order() as below: > > df<-read.csv(constr,header=T) > sorted.df<-df[order(as.Date(df$Date), decreasing = F),] > print(sorted.df) > > The dataframe was sorted, but th

Re: [R] Error in contrasts message when using logistic regression code.

2012-10-23 Thread Marc Schwartz
On Oct 23, 2012, at 1:43 PM, hoguejm wrote: > I have a rather large data set (about 30 predictor variables) > > I need to preform a logistic regression on this data. My response variable > is binary. > > My code looks like this: > > mylogit <- glm(Enrolled ~ A + B + C + ... + EE, data = data,

Re: [R] Package "Design"

2012-10-23 Thread Joost Kremers
Ah, thanks for the info. I'll go ahead and use rms and see how far I get. Joost On Mon, Oct 22 2012, Frank Harrell wrote: > Incorrect. The code is 90% compatible. Look at > http://biostat.mc.vanderbilt.edu/Rrms for differences. > Frank > > Joost Kremers wrote >> On Mon, Oct 22 2012, R. Mich

[R] frequency

2012-10-23 Thread farnoosh sheikhi
Hello, I have a data as follow: ID    Visit xa1 xa2 yb1 yc23 yb33   I want to look at frequency of visit for ID and create a new column as response .  For example my response would be 2 for x and 3 for y. I think I need to write a loop, but I don't know how. I really appreciate your help. Thanks

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread Bert Gunter
You're posting on Nabble, so we don't see earlier messages in the thread here. -- Bert On Tue, Oct 23, 2012 at 11:36 AM, noobmin wrote: > The criteria is to list where Obama has a higher number of contributions. The > table shows the number of contribution that each presidential candidate > rece

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread arun
Hi, Your question is not clear. Suppose if you want to find the highest two contributions for each candidate: dat1<-read.table(text="   AL  AR  CA  NY Doug    250 250 250  NA Jennifer  20 340 300 100 Michele  250 500 250  60 Obama    15  45 520 600 ",header=TRUE,stringsAsFactors=

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread noobmin
I meant where obama has higher value compared to other candidates. Looking at the column NY, Obama has the highest. So to state that he wins. Looking for AR column, Michelle wins. I JUST want to list where obama wins. Thank you! This seems to work, just do not understand why you used a threshold?

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread noobmin
Thank you! This seems to work, just do not understand why you used a threshold? I will study your solution, thanks again! -- View this message in context: http://r.789695.n4.nabble.com/How-to-use-tapply-with-more-than-one-variables-grouped-tp4646948p4647199.html Sent from the R help mailing li

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread noobmin
The criteria is to list where Obama has a higher number of contributions. The table shows the number of contribution that each presidential candidate received in a state of the country. The table shown is an example, the query should be generic to a database with hundreds of candidates and dozens

[R] Error in contrasts message when using logistic regression code.

2012-10-23 Thread hoguejm
I have a rather large data set (about 30 predictor variables) I need to preform a logistic regression on this data. My response variable is binary. My code looks like this: mylogit <- glm(Enrolled ~ A + B + C + ... + EE, data = data, family = binomial(link="logit")) with A,B,C, ... as my predic

[R] scatterplot with wrong line offset

2012-10-23 Thread fm3c2007
Hi All, I'm trying to do a Scatterplot (package: car), and add a line (just for reference). There is my code: #Code--- library("car") library("calibrate") G_T<-c("car","bike","boat") ave<-c(80,10,45) perf<-c(100,8

Re: [R] Data type in a data frame

2012-10-23 Thread William Dunlap
> When read into a data.frame, R defaults to reading character strings as > factors. If you don't want that, use option stringsAsFactors = FALSE. This is somewhat tangential, but if you plan on using predict(fit,newdata=nd) after fitting a model like fit <- lm(y~x, data=d) be sure you have con

Re: [R] Creating a polygon from an unordered set of points

2012-10-23 Thread Greg Snow
One possibility: Estimate the center of the polygon with the mean of the x coords and the mean of the y coords. Calculate the angle of each point from that center point using the atan2 function sort the data by the angle calculated. This will not be perfect if you have inlets and peninsulas, but

Re: [R] Longitudinal categorical response data

2012-10-23 Thread Frank Harrell
Random effects models of the type fitted by ordinal assume something akin to compound symmetry, which is not realistic when time between measurements is long or irregular. Frank Rune Haubo-2 wrote > lmer is not designed for ordered categorical data as yours are. You could > take a look at the ordi

Re: [R] rms plot.Predict question: swapping x- and y- axis for categorical predictors

2012-10-23 Thread Frank Harrell
Stephanie, I just realized this is already implemented. For your problem use p <- Predict(f,x2); plot(p, ~ x2, nlines=TRUE) Frank Frank Harrell wrote > Stephanie, > > I'm working on an option for the plot method for Predict that will allow > you to do this. Note that this approach will not re

Re: [R] Data type in a data frame

2012-10-23 Thread Rui Barradas
Hello, When read into a data.frame, R defaults to reading character strings as factors. If you don't want that, use option stringsAsFactors = FALSE. Using your dataset, dat1 <- read.table(text = " Observation Gender Dosage Alertness 1 m a 8 2 m

[R] factor or character

2012-10-23 Thread Silvano Cesar da Costa
Hi, The program below work very well. (snps = c('rs621782_G', 'rs8087639_G', 'rs8094221_T', 'rs7227515_A', 'rs537202_C')) Selec = todos[ , colnames(todos) %in% snps] head(Selec) But, I have a data set with 1.000 columns and I need extract 70 to use (like snps in command above). This 70 snps ar

[R] Summary of variables with NA, empty

2012-10-23 Thread Lopez, Dan
Hi, Is there a function I can use on my dataframe to give me a concise summary of variables that are NA,blank,etc? Basically all Null values, Empty strings, white space, blank values. Ideally it would look something like the below: # it should only includes the fields with NAs, blanks, etc. Add

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread arun
Hi, Suppose if you have a threshold (say >500), then: dat1<-read.table(text="   AL  AR  CA  NY Doug    250 250 250  NA Jennifer  20 340 300 100 Michele  250 500 250  60 Obama    15  45 520 600 ",header=TRUE,stringsAsFactors=FALSE,sep="")  res<-unlist(lapply(split(dat1,rowname

Re: [R] [r] How to pick colums from a ragged array?

2012-10-23 Thread arun
Hi,  res1<-data.frame(col=sapply(tapply(DATE,ID,function(x)  duplicated(head(x,2))),function(x) x[2])) row.names(subset(res1,col==TRUE)) #[1] "167"  "841"  "1019" #assuming that dates are sorted A.K. - Original Message - From: Stuart Leask To: Rui Barradas Cc: "r-help@r-project.org

Re: [R] plotting multiple variables in 1 bar graph

2012-10-23 Thread Macy Anonuevo
The data isn't in a matrix yet. The data printed at the bottom of the jpg are the means of the variables for each sampling time and I haven't calculated the means yet. Does this mean that I have to get the means first then use cbind to make a new matrix? The data looks like this: [site] [time]

[R] Random Forest imbalanced data and partial plots

2012-10-23 Thread Valerie Steen
Hello, Regarding imbalanced data: When using sampsize correction to balanced inbalanced data in Random Forests, what are the implications of the algorithm no longer using a bootstrapped sample? For instance, if I set sampsize to 25, 25 for a binary response, in a dataset of N=800, how does randomf

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread noobmin
To take this example I reduced the number of records absurdly. In the original database there are 48 000 candidates and dozens of states. There is no way to analyze data visually. I would not put 400 mb of tables here. But based on the example how could list the states where obama received more con

[R] After sorting a dataframe by date

2012-10-23 Thread martiny
HI, I have created a dataframe "df" and try to sort it by its date using the order() as below: df<-read.csv(constr,header=T) sorted.df<-df[order(as.Date(df$Date), decreasing = F),] print(sorted.df) The dataframe was sorted, but the output from the command console shows reserved line order..r

[R] barplot

2012-10-23 Thread Thiho Jules
Hi, I want to make a barplot with the following datasets: I have a file as following: name chr position A1 A2 pop1 pop1 pop2 pop2 I have calculated a measure using all the values in columns "pops", the values are saved in a vector. Now I want to make a barplot using the values in this vector

Re: [R] Data type in a data frame

2012-10-23 Thread asafwe
So helpful, Arun -- Thank you! Asaf -- View this message in context: http://r.789695.n4.nabble.com/Data-type-in-a-data-frame-tp4647161p4647171.html Sent from the R help mailing list archive at Nabble.com. __ R-help@r-project.org mailing list https

Re: [R] [r] How to pick colums from a ragged array?

2012-10-23 Thread arun
Hi Stuart, This also should get you the IDs you wanted. new1<-id.d[duplicated(id.d[,2])|duplicated(id.d[,2],fromLast=TRUE),] earliest <- tapply ( DATE, ID, min)                 rownames(earliest[earliest%in% new1]) #[1] "167"  "841"  "1019" A.K. - Original Message - From: Stuart Lea

Re: [R] Trouble returning 2D array into R from Fortran

2012-10-23 Thread paulfjbrowne
Thank you for your help. In any case, I eventually realized that I had reversed the Fortran/R column major order in the Fortran, which is why elements were returned incorrectly. As you point out, I did not run into memory access issues because of the self-similar array sizes. -- View this messa

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread arun
Hi, If the criteria is to pick which among the following states are the top 2 contributors for each candidate, dat1<-read.table(text="   AL  AR  CA  NY Doug    250 250 250  NA Jennifer  20 340 300 100 Michele  250 500 250  60 Obama    15  45 520 600 ",header=TRUE,stringsAsFactors

[R] Creating a polygon from an unordered set of points

2012-10-23 Thread peleve
Hello, I have the contour of the shoreline of a lake. I have measured data points away from the lake shore signifying a particular depth. The data is not ordered as a polygon and hence trying to draw it creates a series of lines all over the place. I would like to turn the points into a ordered

[R] find similarity between two spectral profile

2012-10-23 Thread pina
Hi, I'm Pina and I'm a student in geology. I'm working with spectral profile of sand and I have to find the similarity between one spectral profile selected by hyperspectral image anche one that I created to mix different percentage of 4 mineral component. I have to find the best mix of percentage

[R] repeat takes along time

2012-10-23 Thread JPM
Hi I want help for "repeat" because it takes a long time repeat{ for (i in 1:n){ probb[i]=sum(Wc[z[,j]>=yb[i]]) } deltab[,b]=rbinom(n,1,probb) if(length(which(is.na(deltab[,b])==T))==0){break} } This code works but takes much computation time. Anyone could help me to find a solution to take a

[R] Data type in a data frame

2012-10-23 Thread asafwe
Hi all, How does R know to regard a variable as a factor and not a character? For example, consider the following table: ObservationGenderDosage Alertness 1 ma 8 2

[R] Best R textbook for undergraduates

2012-10-23 Thread Jonathan Greenberg
R-helpers: I'm sure this question has been asked and answered through the ages, but given there are some new textbooks out there, I wanted to re-pose it. For a course that will cover the application of R for general computing and spatial modeling, what textbook would be best to introduce computin

Re: [R] plotting multiple variables in 1 bar graph

2012-10-23 Thread David Carlson
If you have your data organized in a matrix like the one printed at the bottom of your jpg, barplot will produce the same graph: > set.seed(42) > a <- matrix(round(runif(45)*100, 0), nrow=5, ncol=9) > a [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [1,] 91 52 46 94 90 51 74 83

Re: [R] Any good R server-with connection examples

2012-10-23 Thread Aleksandar Blagotić
Don't try to integrate R with PHP, as you'll end up writing spaghetti code. Use AJAX to send requests to the server with RApache scripts. OpenCPU will do the job just fine, but make sure you use JSONP/CORS to bypass the same origin policy. Long story short, it's something like this: LAMP <-AJAX->

[R] Testing proportional odds assumption in R

2012-10-23 Thread Eiko Fried
I want to test whether the proportional odds assumption for an ordered regression is met. The UCLA website points out that there is no mathematical way to test the proportional odds assumption (http://www.ats.ucla.edu/stat//R/dae/ologit.htm), and use graphical inspection ("We were unable to locate

[R] Filling a covariance matrix

2012-10-23 Thread emorway
useRs – I’m working with the attached data that contains one year’s worth of sub-daily observations of flow (“Q”) and specific conductance (“SC”, a surrogate for concentration) at a point in a stream. The R code posted below shows the extent of data processing thus far. My goal is to create a co

Re: [R] Trouble returning 2D array into R from Fortran

2012-10-23 Thread Berend Hasselman
On 23-10-2012, at 12:33, paulfjbrowne wrote: > Yes, I had stripped out the Fortran from the geta subroutine downwards > because is wasn't very important in returning a test output matrix. > But then any results are not reproducible. So there is no purpose in trying to reproduce your results. S

Re: [R] Downloading a html table

2012-10-23 Thread Duncan Temple Lang
Rather than requiring manual tweaking, library(XML) readHTMLTable("http://www.worldatlas.com/aatlas/populations/usapoptable.htm";) will do the job for us. D. On 10/22/12 8:17 PM, David Arnold wrote: > All, > > A friend of mine would like to use this data with his stats class: > > http://www.

Re: [R] bitwise XOR of Matrix

2012-10-23 Thread shahab
You are right.Thanks a lot for the help Rui. best, /Shahab On Mon, Oct 22, 2012 at 5:52 PM, Rui Barradas wrote: > Hello, > > Your error message means that the arrays have different dim attributes. > check with > > dim(M1) == dim(M2) > > They must be the same. > If they are, the result is not 0/

Re: [R] Join data frame columns

2012-10-23 Thread Rui Barradas
Hello, Inline. Em 23-10-2012 15:23, Bert Gunter escreveu: I don't think so. The OP wanted the list by columns, not rows, if I understand correctly. unlist(df) provides this. Of course, the request probably does not makes sense in the first place, as the different types/classes in the data.fram

Re: [R] Join data frame columns

2012-10-23 Thread Ivan Calandra
Hi again, It seems that you want the modes to be conserved. This is just not possible; everything will be coerced to characters, as Rui highlighted. But the question is why do you want to do this? You would loose helpful information (i.e. modes). Maybe there is a better way to do what you wa

Re: [R] How to use tapply with more than one variables grouped

2012-10-23 Thread PIKAL Petr
Hi and what is wrong? Petr > -Original Message- > From: r-help-boun...@r-project.org [mailto:r-help-bounces@r- > project.org] On Behalf Of noobmin > Sent: Tuesday, October 23, 2012 2:52 PM > To: r-help@r-project.org > Subject: Re: [R] How to use tapply with more than one variables groupe

Re: [R] Join data frame columns

2012-10-23 Thread Bert Gunter
I don't think so. The OP wanted the list by columns, not rows, if I understand correctly. unlist(df) provides this. Of course, the request probably does not makes sense in the first place, as the different types/classes in the data.frame will be coerced to one type/class. Moreover, factors will b

Re: [R] Join data frame columns

2012-10-23 Thread Rui Barradas
Hello, Sorry for my earlier post, I misunderstood what you want. dat <- data.frame(letters, 1:26) as.vector(sapply(d, as.character)) Hope this helps, Rui Barradas Em 23-10-2012 14:13, brunosm escreveu: Hi Ivan, thanks for your help! For example: df num letters 1 1 A 2 2

Re: [R] Help with applying a function to all possible 2x2 submatrices

2012-10-23 Thread Michael Friendly
On 10/22/2012 1:10 PM, CMB123 wrote: Hi all, I'm working with a large data set (on the order of 300X300) and trying to apply a function which compares the elements of all possible 2x2 submatrices. There are rc(r-1)(c-1) such submatrices, so obviously the naive method of looping through the rows

Re: [R] Mirror of the R manuals with a new visual style

2012-10-23 Thread Jon Clayden
Hi Barry, On 23 October 2012 14:00, Barry Rowlingson wrote: > On Tue, Oct 23, 2012 at 12:37 PM, Jon Clayden wrote: >> Dear all, >> >> I've created a new mirror of the HTML versions of the main R manuals >> at . This mirror does not modify the >> content of the manua

Re: [R] [r] How to pick colums from a ragged array?

2012-10-23 Thread Rui Barradas
Hello, Inline. Em 23-10-2012 14:53, Stuart Leask escreveu: I too had a parsimonious solution that was also fooled by IDs that had a duplicate date that wasn't the first date, but was the same as another ID's duplicate+first. The right answer >From this data: ID <- c(58,58,58,58,167,167,323,3

[R] List of multidimensional arrays

2012-10-23 Thread Loukia Spineli
Dear all, I am trying to create a list, where each list element is a vector of different length arrays that contain 2by2 matrices. To be more specific there are 11 treatments that are compared with placebo (we have 11 comparisons) and each comparison is studied by a different number of trials and

[R] multi-panel figure: overall title for each row

2012-10-23 Thread capy_bara
Dear all, I have a 3x2 plot and in addition to the title of the individual plots I would like to have an overall title for each row. I managed to get an overall title for the whole plot matrix with mtext: par(mfrow=(c(3,2)), mar=c(6.4,4.5,4.2, 1.8), oma=c(0,0,3,0)) for (i in 1:6) barplot(sample

Re: [R] Linear discriminant function analysis based median as group centroid and nonparametric scale estimators???

2012-10-23 Thread Richard James
Hi Thomas, It does appear me and you are working on very similar sediment mixing model problems. I ran a robust lda using the median by specifying method = "t" within the lda function. So for my data I used: model<-lda(All[,2:12],grouping=All$Catagory, method = "t") Hope this helps. Regards R

Re: [R] Join data frame columns

2012-10-23 Thread arun
Hi, Try this: set.seed(1) df1<-data.frame(col1=rnorm(10,15),col2=rep(c("a","b"),5),col3=sample(1:50,10,replace=TRUE),col4=sample(LETTERS[1:10],10,replace=TRUE)) df2<-do.call(rbind,lapply(df1,function(x) data.frame(x))) str(df2) 'data.frame':    40 obs. of  1 variable:  $ x: chr  "14.3735461892577"

Re: [R] plotting multiple variables in 1 bar graph

2012-10-23 Thread Macy Anonuevo
Thank you for replying. On Tue, Oct 23, 2012 at 9:11 PM, PIKAL Petr [via R] < ml-node+s789695n4647131...@n4.nabble.com> wrote: > Hi > > > > -Original Message- > > From: [hidden > > email][mailto: > r-help-bounces@r- > > project.org] O

[R] Extracting results from Google Search

2012-10-23 Thread ECAMF
Dear list, I have a long list of towns in Africa and would need to get their geographical coordinates. The Google query [/TownName Country coordinates/] works for most of the TownNames I have and give a nicely formatted Google output (try Ingall Niger coordinates for an example). I would like to l

Re: [R] FW: [r] How to pick colums from a ragged array?

2012-10-23 Thread Stuart Leask
So I get my list of IDs to exclude from: g.rr<-do.call(rbind, g.r)[1] dim(g.rr) g.rr[1:(dim(g.rr)[1]/2)] Many thanks. Stuart -Original Message- From: Rui Barradas [mailto:ruipbarra...@sapo.pt] Sent: 23 October 2012 13:42 To: Stuart Leask Cc: r-help@r-project.org Subject: Re: FW: [R] [r

  1   2   >