Re: [R] converting zipcodes to latitude/longitude

2019-05-15 Thread Jim Lemon
s > underneath my data points so that I can see them over the location to > which they correspond. > > Nicola > > On Mon, May 13, 2019 at 9:09 PM Jim Lemon wrote: > > > > Hi Nicola, > > Getting the blank rows will be a bit more difficult and I don't see > > wh

Re: [R] converting zipcodes to latitude/longitude

2019-05-13 Thread Jim Lemon
Hi Nicola, Getting the blank rows will be a bit more difficult and I don't see why they should be in the final data frame, so: townzip<-read.table(text="waltham, Massachusetts 02451 Columbia, SC 29209 Wheat Ridge , Colorado 80033 Charlottesville, Virginia 22902 Fairbanks, AK 99709 Montpelier, VT

Re: [R] multiple graphs on one plot

2019-05-13 Thread Jim Lemon
Hi Andrew, First, a little mind reading. My crystal ball says that "cw" can be interpreted as "carapace width". It didn't tell me the parameters of the distribution, so: set.seed(1234) mf<-list(rnorm(400,145,15),rnorm(400,160,15)) library(plotrix) multhist(mf, xlab="CW", ylab="Frequency",

Re: [R] R package that translates zip codes into longitude and longitude

2019-05-06 Thread Jim Lemon
Hi Nicola, There seems to be a big database of this here: http://download.geonames.org/export/dump/ Jim On Mon, May 6, 2019 at 2:47 PM Nicola Ruggiero wrote: > > Hi there, > > I'm looking for a R package that would enable me to add a column to a > data.frame that is itself a translation of zip

Re: [R] One-way ANOVA with replicates

2019-05-04 Thread Jim Lemon
Hi Senaka, Your attachments didn't make it through. If the datasets are not large, perhaps use "dput" to create a text version that can be pasted into the email. Large data sets may have to be uploaded to a public URL> Jim On Sat, May 4, 2019 at 3:10 PM Senaka Amarakeerthi wrote: > > Hi All, >

Re: [R] create a table for time difference (from t3 to t1, so on..)

2019-05-04 Thread Jim Lemon
ffs<-aggregate(dAT$date,list(dAT$Id),diffs,3) initdates<-as.character(as.Date(as.vector(by(dAT$date,dAT$Id,min)), origin=as.Date("1970-01-01"))) Result<-data.frame(Id=datediffs$Group.1,Release=initdates, 'T1-T2'=datediffs$x[,1],'T1-T3'=datediffs$x[,1]+datediffs$x[,2],

Re: [R] create a table for time difference (from t3 to t1, so on..)

2019-05-03 Thread Jim Lemon
Hi Marna, You can get the information you need with this: dAT$date<-as.Date(dAT$date,"%d-%b-%y") diffs<-function(x,maxn) return(diff(x)[1:maxn]) initdate<-function(x) return(min(x)) datediffs<-aggregate(dAT$date,list(dAT$Id),diffs,3) I can't do the manipulation of the resulting values at the

Re: [R] Fwd: Re: transpose and split dataframe

2019-05-02 Thread Jim Lemon
tsplit),nrow=length(allhits))) # change the names of the list names(tmmdf)<-mmdf$Regulator for(column in 1:length(hitsplit)) { hitmatches<-match(hitsplit[[column]],allhits) hitmatches<-hitmatches[!is.na(hitmatches)] tmmdf[hitmatches,column]<-allhits[hitmatches] } Jim On Fri, May 3, 20

Re: [R] Fwd: Re: transpose and split dataframe

2019-05-02 Thread Jim Lemon
Hi Matthew, I'm not sure whether you want something like your initial request or David's solution. The result of this can be transformed into the latter: mmdf<-read.table(text="Regulator hits AT1G69490

Re: [R] transpose and split dataframe

2019-04-30 Thread Jim Lemon
Hi Matthew, Is this what you are trying to do? mmdf<-read.table(text="Regulatorhits AT1G69490AT4G31950,AT5G24110,AT1G26380,AT1G05675 AT2G55980AT2G85403,AT4G89223",header=TRUE, stringsAsFactors=FALSE) # split the second column at the commas hitsplit<-strsplit(mmdf$hits,",") # define a

Re: [R] Downloading R Data

2019-04-14 Thread Jim Lemon
Hi Spencer, Just download it to your R working directory and: load("GBM_data.Rdata") Worked okay for me (all 53.9 Mb) Jim On Mon, Apr 15, 2019 at 8:39 AM Spencer Brackett wrote: > > I am also looking to be able to read this file on an appropriate > application. As of now, it’s too large to

Re: [R] create

2019-04-13 Thread Jim Lemon
Hi Val, For this particular problem, you can just replace NAs with zeros. vdat[is.na(vdat)]<-0 vdat$xy <- 2*(vdat$x1) + 5*(vdat$x2) + 3*(vdat$x3) vdat obs Year x1 x2 x3 xy 1 1 2001 25 10 10 130 2 2 2001 0 15 25 150 3 3 2001 50 10 0 150 4 4 2001 20 0 60 220 Note that this is not a

Re: [R] Define pch and color based on two different columns

2019-04-09 Thread Jim Lemon
Hi Matthew, How about this? library(lattice) xyplot(mpg ~ wt | cyl, data=mtcars, col = mtcars$gear, pch = mtcars$carb ) library(plotrix) grange<-range(mtcars$gear) xyplot(mpg ~ wt | cyl, data=mtcars, col =

Re: [R] Convert a character to numeric

2019-04-09 Thread Jim Lemon
Hi Bienvenue, Perhaps you should ask whether you really want to "sort it out". The warning is telling you that you are converting the NA values to NA in the returned numeric vector. I can't think of anything more sensible to do with NA values. You may also have character strings that cannot be

Re: [R] Fwd: Potential Issue with lm.influence

2019-04-02 Thread Jim Lemon
Hi Eric, When I run your code (using the MASS library) I find that rstudent(fit2) also returns NaN in the seventh position. Perhaps the problem is occurring there and not in the "influence" function. Jim On Wed, Apr 3, 2019 at 9:12 AM Eric Bridgeford wrote: > > I agree the influence

Re: [R] aggregate output to data frame

2019-03-27 Thread Jim Lemon
Hi Cyrus, Try this: pcr<-data.frame(Ct=runif(66,10,20),Gene=rep(LETTERS[1:22],3), Type=rep(c("Std","Unkn"),33),Rep=rep(1:3,each=22)) testagg<-aggregate(pcr$Ct,c(pcr["Gene"],pcr["Type"],pcr["Rep"]), FUN=function(x){c(mean(x), sd(x), sd(x)/sqrt(sd(x)))}) nxcol<-dim(testagg$x)[2]

Re: [R] creating a dataframe with full_join and looping over a list of lists.

2019-03-21 Thread Jim Lemon
quot; "AT2G18690" "AT2G30750" "AT2G39200" > "AT2G43620" > [22] "AT3G01830" "AT3G54150" "AT3G55840" "AT4G03460" "AT4G11470" "AT4G11890" > "AT4G14370" > [29] "AT4G15417" "AT4G159

Re: [R] creating a dataframe with full_join and looping over a list of lists.

2019-03-21 Thread Jim Lemon
Hi Matthew, First thing, don't put: mydf3 <- data.frame(myenter) inside your loop, otherwise you will reset the value of mydf3 each time and end up with only "myenter" and the final list. Without some idea of the contents of comatgs, it is difficult to suggest a way to get what you want. Jim

Re: [R] Fwd: high p values

2019-03-19 Thread Jim Lemon
Hi Javed, Easy. A<-c(2000,2100,2300,2400,6900,7000,7040,7050,7060) median(A) [1] 6900 B<-c(3300,3350,3400,3450,3500,7000,7100,7200,7300) median(B) [1] 3500 wilcox.test(A,B,paired=FALSE) Wilcoxon rank sum test with continuity correction data: A and B W = 26.5, p-value = 0.233 alternative

Re: [R] Sorting vector based on pairs of comparisons

2019-03-15 Thread Jim Lemon
Hi Bert, Good reference and David Urbina's example showed that a simple swap was position dependent. The reason I pursued this is that it seems more efficient to sequentially apply the precedence rules to the arbitrarily sorted elements of the vector than to go through the directed graph approach.

Re: [R] Sorting vector based on pairs of comparisons

2019-03-14 Thread Jim Lemon
Hi Pedro, This looks too simple to me, but it seems to work: swap<-function(x,i1,i2) { tmp<-x[i1] x[i1]<-x[i2] x[i2]<-tmp return(x) } mpo<-function(x) { L<-unique(as.vector(x)) for(i in 1:nrow(x)) { i1<-which(L==x[i,1]) i2<-which(L==x[i,2]) if(i2 wrote: > > Dear All, > > This should

Re: [R] Display common color scale on multiple scatter3D plots

2019-03-14 Thread Jim Lemon
Hi Luigi, Upon careful reading of the help page, you can do it with scatter3D: scatter3D(X, Y, Z, col.var = Z, pch = 16, cex = 2,clim=c(0.5,3)) scatter3D(X, Y, K, col.var = K, pch = 16, cex = 2,clim=c(0.5,3)) Jim On Thu, Mar 14, 2019 at 9:32 PM Luigi Marongiu wrote: > > Dear all, > I am trying

Re: [R] Issue with t.test

2019-03-13 Thread Jim Lemon
Hi Smruti, In the example in question, you are probably doing something like this: # I didn't see any attachment for the data X<-rnorm(99,mean=59.96753) t.test(X,mu=50,alternative="less") One Sample t-test data: X t = 101.29, df = 98, p-value = 1 alternative hypothesis: true mean is

Re: [R] How to change the number of bins?

2019-03-10 Thread Jim Lemon
Hi Bowie, As David suggested, you can substitute the R missing value (NA) for 999 (probably an SPSS missing value). If you don't want to change it, you could probably just subset your data like this: V<-create_infotables(data=Test[Test[n] != 999,-1],y="class",bins=10) where "n" is the column

Re: [R] strucchange Graph By Week and xts error

2019-03-06 Thread Jim Lemon
Hi John, You seem to have 1569 days of data, so perhaps you can get around your axis problem like this: plot(Nile,xaxt="n",xlab="Week") ... axis(1,at=seq(0,200,50),labels=seq(0,200,50)*7) (untested) Jim On Thu, Mar 7, 2019 at 10:46 AM Sparks, John wrote: > > Hi R Helpers, > > I am doing some

Re: [R] Remove Even Number from A Vector

2019-03-02 Thread Jim Lemon
Hi Darren, You're probably looking for the %% (remainder) operator: x<-1:10 # get odd numbers x[as.logical(x%%2)] # get even numbers x[!(x%%2)] Jim On Sun, Mar 3, 2019 at 4:10 PM Darren Danyluk wrote: > > Hello, > > I found this email when looking for some help with R Studio. It's actually >

Re: [R] color question

2019-02-28 Thread Jim Lemon
Hi Aimin, This example uses a log transformation to spread the colors out: d<-read.table(text=" lateRT earlyRT NAD ciLAD LAD 1.0 0.00 0.006224017 0.001260241 0.0069699285 0.0 1.00 0.001425649 0.007418436 0.0007096344 0.006224017

Re: [R] particle count probability

2019-02-21 Thread Jim Lemon
. > > > 1-(10-c(0.1, 1))* (10-c(0.1,1))/(10^2) > [1] 0.0199 0.1900 > > Cheers. > Petr > > > -Original Message- > > From: Jim Lemon > > Sent: Thursday, February 21, 2019 12:24 AM > > To: Rolf Turner > > Cc: PIKAL Petr ; r-help@r-project.or

Re: [R] particle count probability

2019-02-20 Thread Jim Lemon
Okay, suppose the viewing field is circular and we consider two particles as in the attached image. Probability of being within the field: R0 > sqrt((x1+R1-x0)^2 + (y1+R1-y0)^2) Probability of being outside the field: R0 < sqrt((x2-R1-x0)^2 + (y2-R1-y0)^2) Since these are the limiting cases, it

Re: [R] particle count probability

2019-02-20 Thread Jim Lemon
Hi Petr, This is off the top of my head, but I assume that the shape of the particle is not considered in counting. Assume particles are uniformly distributed in the viewing field. If all particles entirely within the field are counted, large particles will be undercounted. If all particles within

Re: [R] Problems trying to place a global map with Ncdf data plot

2019-02-17 Thread Jim Lemon
Hi rain1290, I have recently been working on a similar project, building a grid of event densities for geographic coordinates. If you are stuck, I may be able to provide some assistance. Jim On Sun, Feb 17, 2019 at 10:49 PM rain1290--- via R-help wrote: > > Hello there, > > I am trying to

Re: [R] Extending my code

2019-02-16 Thread Jim Lemon
eck if I can still go the way u have suggested or if the correction would > call for another approach. > Best regards > Ogbos > > > On Sun, Feb 17, 2019, 02:22 Jim Lemon wrote: >> >> Hi Ogbos, >> It may be easier to use strptime: >> >> dta<-data.fra

Re: [R] Extending my code

2019-02-16 Thread Jim Lemon
Hi Ogbos, It may be easier to use strptime: dta<-data.frame(year=rep(2005,5),month=rep("05",5), day=c("01","06","11","16","21"), hour=c(2,4,6,8,10),minute=rep(0,5),second=rep(0,5),value=1:5) dta$Ptime<-strptime(paste(paste(dta$year,dta$month,dta$day,sep="-"),

Re: [R] dates by week multiple years

2019-02-05 Thread Jim Lemon
Hi Keith, Perhaps you do not want to go with calendar weeks: 365/7 = 52.14 as there are not an even number of weeks in a year, you may want to plot by week from your initial observation. As you are using as.Date, you could simply calculate weeks as: data$Week<-1+as.numeric(data$Date -

Re: [R] problems when merging two data sets

2019-02-05 Thread Jim Lemon
Hi Sasha, I'll take a wild guess that your column names have periods (.) replacing the spaces in the names you use: species occurrence -> species.occurrence The error message means that R can't find the variable name you have used in the "by" argument. The second wild guess is that your column

Re: [R] troubleshooting data structure to run krippendorff's alpha

2019-01-29 Thread Jim Lemon
),occasion=rep(rep(1:4,each=6),3), var=rep(rep(1:6,4),3),obs=runif(72)) library(cccrm) cccUst(hkdf,"obs","rater","occasion") cccvc(hkdf,"obs","rater","occasion") Jim On Wed, Jan 30, 2019 at 1:01 PM Jim Lemon wrote: > > Hi Hallie,

Re: [R] troubleshooting data structure to run krippendorff's alpha

2019-01-29 Thread Jim Lemon
Hi Hallie, If I understand your email correctly, you have four repeated observations by the three raters of the same six variables. This is a tougher problem and I can't solve it at the moment. I'll return to this later and see if I can offer a solution. Jim On Wed, Jan 30, 2019 at 3:56 AM

Re: [R] troubleshooting data structure to run krippendorff's alpha

2019-01-28 Thread Jim Lemon
Hi Halllie, As Jeff noted, a data frame is not a matrix (it is a variety of list), so that looks like your problem. hkdf<-data.frame(sample(3:5,4,TRUE),sample(1:3,4,TRUE),sample(2:4,4,TRUE), sample(3:5,4,TRUE),sample(1:3,4,TRUE),sample(2:4,4,TRUE)) library(irr) kripp.alpha(hkdf)

Re: [R] Fwd: Overlapping legend in a circular dendrogram

2019-01-11 Thread Jim Lemon
Hi Meriam, I don't have the packages loaded that you use, but a first guess would be to start a wider device. For example, the default x11 device is 7x7, so: x11(width=10) would give you a rectangular output device that might move the columns of labels outward. The same applies for any other

Re: [R] Mailinglist

2019-01-06 Thread Jim Lemon
a new data frame etc, but I still feel a > bit lost. Do I need to make one per subject or per Probe etc.. > > > Thanks for your help. I hope that you can help me resolve this issue. > > > Best, > > > Rachel > > > > > > > On Sat, Jan 5, 2019 at 9

Re: [R] Mailinglist

2019-01-05 Thread Jim Lemon
Hi Rachel, I'll take a guess and assume that you are monitoring the mobile phones of 36 people, adding an observation every time some specified change of state is sensed on each device. I'll also assume that you are only recording four types of measurement. It seems that you want to aggregate

Re: [R] Plotting rgb proportions in R

2019-01-02 Thread Jim Lemon
metimes a bit tricky but quite >> handy, especially when you consider some grouping. >> >> Cheers >> Petr >> >> > >> > -- Bert >> > >> > >> > Bert Gunter >> > >> > "The trouble with having an open mind is

Re: [R] Combine recursive lists in a single list or data frame and write it to file

2018-12-19 Thread Jim Lemon
e = "Temp.txt",append = TRUE,quote = TRUE)} > Error in (function (..., row.names = NULL, check.rows = FALSE, > check.names = TRUE, : > arguments imply differing number of rows: 3, 55, 56, 53, 54, 16, 21, > 23, 50, 24 > > > On Wed, Dec 19, 2018 at 9:36 PM Jim

Re: [R] Combine recursive lists in a single list or data frame and write it to file

2018-12-19 Thread Jim Lemon
Hi Ek, Look at unlist and the argument "recursive". You can step down through the levels or a nested list to convert it to a single level list. Jim On Thu, Dec 20, 2018 at 1:33 PM Ek Esawi wrote: > > Thank you Bert. I don't see how unlist will help. I want to combine > them but keep the

Re: [R] Plotting rgb proportions in R

2018-12-18 Thread Jim Lemon
unter > > "The trouble with having an open mind is that people keep coming along and > sticking things into it." > -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) > > > On Tue, Dec 18, 2018 at 3:10 PM Jim Lemon wrote: >> >> Hi Tas

Re: [R] Plotting rgb proportions in R

2018-12-18 Thread Jim Lemon
Hi Tasha, I may be right off the track, but you could plot RGB proportions on a 3D plot. The easiest way I can think if would be to convert your 0-255 values to proportions: rgb_prop<-read.table(text="Red Green Blue pct 249 158 37 56.311 249 158 68 4.319 249 158 98 0.058 249 128 7 13.965 249 128

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-12-18 Thread Jim Lemon
Hi Subhamitra, My apologies, I caught a mistake. To have the first tick in the middle of the first year, you want half of the _observations_ in a year, not half of the days. As I now have your data at my fingertips: 3567/15.58385 [1] 228.8908 Almost exactly what was calculated for the first

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-12-17 Thread Jim Lemon
Hi Subhamitra, As for the error that you mention, it was probably: Error in axis(1, at = year_mids, labels = 3 - 1 - 1994:3 - 8 - 2017) : 'at' and 'labels' lengths differ, 24 != 1992 Anything more than a passing glance reveals that you didn't read the explanation I sent about the arguments

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-12-16 Thread Jim Lemon
; >> Thank you very much Sir for educating a new R learner. >> >> [image: Mailtrack] >> <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;> >> Sender >> notified by >> Mailtrack >> <https://mailtrack.io?utm_source=gmai

Re: [R] Combine lists into a data frame or append them to a text file

2018-12-15 Thread Jim Lemon
Hi Ek, I thought there would be a simple fix for this, but had to write a little function: fillList<-function(x) { maxrows<-max(unlist(lapply(x,length))) return(lapply(x,"[",1:maxrows)) } that fills up the rows of each list with NAs. I got the expected result with:

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-12-15 Thread Jim Lemon
Hi Subhamitra, Thanks. Now I can provide some assistance instead of just complaining. Your first problem is the temporal extent of the data. There are 8613 days and 6512 weekdays between the two dates you list, but only 5655 observations in your data. Therefore it is unlikely that you have a

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-12-14 Thread Jim Lemon
ource=gmail_medium=signature_campaign=signaturevirality5;> >>> Sender >>> notified by >>> Mailtrack >>> <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;> >>> 11/21/18, >>> 3:19:55 PM >>> >&g

Re: [R] Plotting Very Large lat-lon data in x-y axes graph

2018-12-13 Thread Jim Lemon
Hi Ogbos, Back on the air after a few days off. I don't have your data ("QUERY 2"), but I think this will fix your problem. library(maps) map("world") box() library(plotrix) color.legend(-180,-150,100,-130,legend=c(0,25000,5,75000,10),

Re: [R] Plotting Very Large lat-lon data in x-y axes graph

2018-12-11 Thread Jim Lemon
d like to add horizontal color bar legend that could be used to > > explain the number of lightning counts at different points on the > > latitude band as plotted. > > > > Thank you > > Warm regards > > Ogbos > > > > On Sun, Dec 9, 2018 at 9:46 PM Jim Lemon

Re: [R] Plotting Very Large lat-lon data in x-y axes graph

2018-12-09 Thread Jim Lemon
Hi Ogbos, Here is a slight modification of a method I use to display trip density on a map: oolt<-read.table(text="Lat Lon 30.1426 104.7854 30.5622 105.0837 30.0966 104.6213 29.9795 104.8430 39.2802 147.7295 30.2469 104.6543 26.4428 157.7293 29.4782 104.5590 32.3839 105.3293 26.4746 157.8411

Re: [R] sample (randomly select) from successive days

2018-12-07 Thread Jim Lemon
Hi Dagmar, This will probably involve creating a variable to differentiate the two days in each data.frame: myframe$day<-as.Date(as.character(myframe$Timestamp),"%d.%m.%Y %H:%M:%S") days<-unique(myframe$day) Then just sample the two subsets and concatenate them:

Re: [R] Seek help - plm package (Error message: duplicate 'row.names' are not allowed)

2018-12-01 Thread Jim Lemon
Hi david, The formatting of the data frame looks like the Province and Year columns have gotten stuck together. This probably has something to do with your Excel spreadsheet or the function that you are using to read it in. If there is are fewer column names than columns, this error is likely to

Re: [R] Applying a certain formula to a repeated sample data

2018-11-27 Thread Jim Lemon
Hi Ogbos, If we assume that you have a 3 column data frame named oodf, how about: oodf[,4]<-floor((cumsum(oodf[,1])-1)/28) col2means<-by(oodf[,2],oodf[,4],mean) col3means<-by(oodf[,3],oodf[,4],mean) Jim On Wed, Nov 28, 2018 at 2:06 PM Ogbos Okike wrote: > > Dear List, > I have three

Re: [R] detecting measurement of specific id in column in R

2018-11-22 Thread Jim Lemon
Hi Vicci, It's very clunky, but I think it will do what you want. rrdf<-read.csv(text="No,date,chamber,d13C,ppm_CO2,ppm_13CO2 1,10.14.2018 10:43 PM,IN,-0.192,439.6908,4.9382 2,10.14.2018 10:47 PM,101,-0.058,440.7646,4.9509 3,10.14.2018 10:50 PM,103,-1.368,535.6602,5.9967 4,10.14.2018 10:53

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-11-21 Thread Jim Lemon
1. xaxt="n" means "Don't display the X axis". See the help for "par" in the graphics package 2. axis(1,at=1:nrows,labels=names(MPG3)) This means, "Display the bottom axis (1) with ticks at 1 to the number of rows in the data frame" "Use the values of MPG$Year as labels for the ticks". see the

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-11-20 Thread Jim Lemon
iltrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;> > Sender > notified by > Mailtrack > <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;> > 11/21/18, > 10:35:03 AM > > On Wed, Nov 21, 2018 at 9:40 AM J

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-11-20 Thread Jim Lemon
m=signature_campaign=signaturevirality5;> > Sender > notified by > Mailtrack > <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;> > 11/21/18, > 9:12:14 AM > > On Wed, Nov 21, 2018 at 8:18 AM Jim Lemon wrote: > >> I assume that

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-11-20 Thread Jim Lemon
grateful to > you. > > Thank you very much for your kind help. > > > > [image: Mailtrack] > <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;> > Sender > notified by > Mailtrack > <https://mailtrack.io?utm_source=gmail_med

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-11-20 Thread Jim Lemon
t; > Sender > notified by > Mailtrack > <https://mailtrack.io?utm_source=gmail_medium=signature_campaign=signaturevirality5;> > 11/21/18, > 7:02:18 AM > > > On Wed, Nov 21, 2018 at 4:38 AM Jim Lemon wrote: > >> Hi Subhamitra, >> As Bert noted, you are

Re: [R] [R studio] Plotting of line chart for each columns at 1 page

2018-11-20 Thread Jim Lemon
Hi Subhamitra, As Bert noted, you are mixing base and grid graphics. Here is a simple way to get a plot like what you described. It will probably take more work to find what you actually do want and discover how to get it. for(i in 1:38)

Re: [R] How to create gridded data

2018-11-13 Thread Jim Lemon
Hi lily, Something like this should work: DF1<-read.table(text= "latitude longitude Precip 45.5 110.5 3.2 45.5 1115.0 45.5 111.5 1.8 45.5 1122.0 46 110.5 6.1 46 1114.5

Re: [R] HISTOGRAM

2018-11-10 Thread Jim Lemon
Hi Medic, Perhaps this: medic_df<-read.table(text="name number ds6277 lk 24375 ax46049 dd70656 az216544 df 220620 gh641827", header=TRUE) library(plotrix) options(scipen=10) barp(medic_df$number,names.arg=medic_df$name,width=0.5) As others have noted, this is really a

Re: [R] rnaturalearth: detail by degrees

2018-11-04 Thread Jim Lemon
Hi Ferri, One way is to snip out a Google Maps image of the area you want, then using the "maps" package, start a plot bounded by the corner coordinates of your Google Maps image. You can get those by clicking on the corners of the area that you selected. Then use the "readbitmap" package to

Re: [R] Different stack barplots - same color legends

2018-11-01 Thread Jim Lemon
ginal column lables which > I need in my barplot. Isn't it? > > Op do 1 nov. 2018 om 11:03 schreef Jim Lemon : >> >> I would use the "names" or "colnames" functions to change them to Q1, >> Q2, ... as I did. >> >> Jim >> >> O

Re: [R] Different stack barplots - same color legends

2018-11-01 Thread Jim Lemon
> dataname$"very long name". > So, is ther a way to do this procedure for all columns? > > Roberto > > > Op do 1 nov. 2018 om 10:50 schreef Jim Lemon : >> >> Hi Roberto, >> What I suggested is a brute force method of translating response &g

Re: [R] Different stack barplots - same color legends

2018-11-01 Thread Jim Lemon
ut could not find the right answer > Best Roberto > > > Op do 1 nov. 2018 om 00:25 schreef Jim Lemon : >> >> Hi Roberto, >> Here is a snippet of code that translates the text responses of the >> BIS-11 into numeric values. Note the reversal of the order in the >>

Re: [R] Plot a matrix

2018-11-01 Thread Jim Lemon
Hi Myriam, This may not be the ideal way to do this, but I think it works: mcdf<-read.table(text="41540 41540 41442 41599 41709 41823 41806 41837 41898 41848 41442 0.001 41599 0.002 0.001 41709 0.004 0.003 0.003 41823 0.002 0.001 0.002 0.001 41806 0.004 0.004 0.005 0.006 0.005 41837 0.004 0.004

Re: [R] Different stack barplots - same color legends

2018-10-31 Thread Jim Lemon
Hi Roberto, Here is a snippet of code that translates the text responses of the BIS-11 into numeric values. Note the reversal of the order in the second item: BIS$Q1<-as.numeric(factor(BIS$Q1, levels=c("Almost","Often","Occasionally","Rarely/Never"))) BIS$Q2<-as.numeric(factor(BIS$Q2,

Re: [R] Finding unique terms

2018-10-11 Thread Jim Lemon
Yes, I thought that as well and had worked out this but didn't send it: add_Pscores<-function(x) { return(sum(unlist(x),na.rm=TRUE)) } by(rzdf[,c("PO1M", "PO1T", "PO2M", "PO2T")],rzdf$STUDENT_ID,FUN=add_Pscores) rzdf$STUDENT_ID: AA15285 [1] 724.8

Re: [R] ANOVA in R

2018-10-10 Thread Jim Lemon
Hi again, Two things, I named the data frame SR as shown in the model. The other is for those who may wish to answer the OP. The mediafire website is loaded with intrusive ads and perhaps malware. Jim On Thu, Oct 11, 2018 at 9:02 AM Jim Lemon wrote: > > Hi Tranh, > I'm not sur

Re: [R] ANOVA in R

2018-10-10 Thread Jim Lemon
Hi Tranh, I'm not sure why you are converting your variables to factors, and I think the model you want is: lm(KIC~temperature+AC+AV+Thickness+temperature:AC+ temperature:AV+temperature:thickness+AC:AV+ AC:thickness+AV:thickness,SR) Note the colons (:) rather than asterisks (*) for the

Re: [R] Code "tags"

2018-10-10 Thread Jim Lemon
Hi Leslie, Keeping track of any sort of text (or music or pictures) can be challenging when the number of files becomes large. One way to organize a large collection is to categorize it in some way that makes sense to you. Say you create a directory structure:

Re: [R] Can I safely use an installed R folder in a portable manner?

2018-10-09 Thread Jim Lemon
Hi Marc, I do this quite often with Tcl-Tk. All you have to do is make sure that the PATH contains the correct location for the R executable if you don't specify it within your program. Jim On Wed, Oct 10, 2018 at 1:58 AM Marc Capavanni via R-help wrote: > > Hi there, > > I'm currently using R

Re: [R] Requesting for help on the problem of "subscript out of bounds"

2018-10-06 Thread Jim Lemon
ritten a code >> >> library(pracma) >> >> N<-nrow(ts) >> r<-matrix(0, nrow = N, ncol = 1)for (i in 1:N){ >> r[i]<-approx_entropy(ts[i,], edim = 2, r = 0.2*sd(ts[i,]), elag = 1)} >> >> * After calculating for 1 series, I need

Re: [R] Requesting for help on the problem of "subscript out of bounds"

2018-10-06 Thread Jim Lemon
ibrary(pracma) > > N<-nrow(ts) > r<-matrix(0, nrow = N, ncol = 1) > for (i in 1:N){ > r[i]<-approx_entropy(ts[i,], edim = 2, r = 0.2*sd(ts[i,]), elag = 1) > } > > After calculating for 1 series, I need to calculate the same things for the > multiple s

Re: [R] Requesting for help on the problem of "subscript out of bounds"

2018-10-06 Thread Jim Lemon
Hi Subhamitra, Where I think the error arises is in the line: N<-nrow(mat) Since we don't know what "mat" is, we don't know what nrow(mat) will return. If "mat" is not a matrix or data frame, it is likely to be NULL. Try this: print(N) after defining it and see what it is. Jim On Sat, Oct

Re: [R] Logic operators...more than one??

2018-10-03 Thread Jim Lemon
Hi David, I think you want this: SampledWells <- MyData[!( MyData$Location %in% c("MW-09", "MW-10")), ] Jim On Thu, Oct 4, 2018 at 9:02 AM David Doyle wrote: > > I'm sure this is a simple question but I'm not sure where to find the > answer. > > I want to remove some of the data. For example

Re: [R] Boxplot: draw outliers in colours

2018-09-28 Thread Jim Lemon
Hi Luigi, An easy way is to use "points" to overplot the outliers: grbxp<-boxplot(dfA$Y ~ dfA$X, ylim=c(0, 200), col="green", ylab="Y-values", xlab="X-values" ) points(grbxp$group,grbxp$out,col="green") On Fri, Sep 28, 2018 at 7:51 PM Luigi Marongiu wrote:

Re: [R] subset only if f.e a column is successive for more than 3 values

2018-09-27 Thread Jim Lemon
Bugger! It's eval(parse(text=paste0("kkdf[c(",paste(starts,ends,sep=":",collapse=","),"),]"))) What a mess! Jim On Fri, Sep 28, 2018 at 8:35 AM Jim Lemon wrote: > > Hi Knut, > As Bert said, you can start with diff and work from there. I can

Re: [R] subset only if f.e a column is successive for more than 3 values

2018-09-27 Thread Jim Lemon
Hi Knut, As Bert said, you can start with diff and work from there. I can easily get the text for the subset, but despite fooling around with "parse", "eval" and "expression", I couldn't get it to work: # use a bigger subset to test whether multiple runs can be extracted

Re: [R] Erase content of dataframe in a single stroke

2018-09-27 Thread Jim Lemon
turn(NULL) > > df<-as.data.frame(sapply(df,toNull)) > > df > data frame with 0 columns and 0 rows > > str(df) > 'data.frame': 0 obs. of 0 variables > On Thu, Sep 27, 2018 at 10:12 AM Jim Lemon wrote: > > > > Ah, yes, try 'as.data.frame" on it. &

Re: [R] Erase content of dataframe in a single stroke

2018-09-27 Thread Jim Lemon
gt; > > df > $A > NULL > > $B > NULL > > $C > NULL > > > str(df) > List of 3 > $ A: NULL > $ B: NULL > $ C: NULL > > The dataframe has become a list. Would that affect downstream applications? > > Thank you, > Luigi > On Thu,

Re: [R] Erase content of dataframe in a single stroke

2018-09-27 Thread Jim Lemon
Hi Luigi, Maybe this: testdf<-data.frame(A=1,B=2,C=3) > testdf A B C 1 1 2 3 toNull<-function(x) return(NULL) testdf<-sapply(testdf,toNull) Jim On Thu, Sep 27, 2018 at 5:29 PM Luigi Marongiu wrote: > > Dear all, > I would like to erase the content of a dataframe -- but not the > dataframe

Re: [R] Question on Binom.Confint

2018-09-13 Thread Jim Lemon
Hi Fang, Let's assume that you are using the "binom.confint" function in the "binom" package and you have made a spelling mistake or two. This function employs nine methods for estimating the binomial confidence interval. Sadly, none of these is "lrt". The zero condition is discussed in the help

Re: [R] Save printed/plotted output to different directory

2018-09-12 Thread Jim Lemon
Hi Rich, Sometimes an empty image is due to not closing the image file. If you forgot to put: dev.off() after the plotting commands, or there was an error in the plotting commands, the file may be left open. Try manually entering "dev.off()" after you have run the code. If you don't get an

Re: [R] customise tick marks

2018-09-12 Thread Jim Lemon
Hi Roslinazairimah, You seem to be using the dotplot function from the lattice package. If so: dotplot(cyl ~ mpg, data = mtcars, groups = cyl, cex=1.2, scales=list(y=list(labels=sort(unique(mtcars$cyl, main="Gas Milage for Car Models", xlab="Miles Per Gallon") Jim On Wed, Sep 12, 2018 at

Re: [R] Hierarchical Cluster Analysis

2018-09-11 Thread Jim Lemon
agnes (cluster) Jim On Wed, Sep 12, 2018 at 8:10 AM Bryan Mac wrote: > > > Bryan Mac > Data Scientist > Research Analytics > Ipsos Insight LLC > > > > > > [[alternative HTML version deleted]] > > __ > R-help@r-project.org mailing list -- To

Re: [R] Remove plot axis values in dotplot graph

2018-09-11 Thread Jim Lemon
Hi Abou, Surprisingly you can't omit the x axis in dotchart. This hack will work: sink("dotchar_noax.R") sink() Edit the resulting file by joining the first two lines with the assignment symbol (<-), delete the two lines at the bottom and comment out the line "axis(1)".

Re: [R] Increasing size of label in Taylor plot of Plotrix package

2018-09-11 Thread Jim Lemon
Hi Sonam, You're right. Although the cex.axis argument is present, it doesn't seem to be used. I will have to debug this, which may take a day or two. Jim On Tue, Sep 11, 2018 at 6:37 PM Sonam Sandeep Dash wrote: > > Respected Sir, > I have created a Taylor plot using the plotrix package.

Re: [R] loop for comparing two or more groups using bootstrapping

2018-09-11 Thread Jim Lemon
name.mat)) { > > assign(samplenames[column],replicate(k,sample(unlist(daT[,colname.mat[, > column]]),3,TRUE))) > > } > > > get(samplenames[1]) > [,1] [,2] [,3] [,4] [,5] [,6] [,7] [,8] [,9] [,10] > year224 0.556 0.667 0.571 0.526 0.629 0.696 0.323 0.52

Re: [R] loop for comparing two or more groups using bootstrapping

2018-09-11 Thread Jim Lemon
Hi Kristy, Try this: colname.mat<-combn(paste0("year",1:4),2) samplenames<-apply(colname.mat,2,paste,collapse="") k<-1 for(column in 1:ncol(colname.mat)) { assign(samplenames[column],replicate(k,sample(unlist(daT[,colname.mat[,column]]),3,TRUE))) } Then use get(samplenames[1]) and so on to

Re: [R] Packaged exe and Shiny

2018-09-10 Thread Jim Lemon
Hi Kevin, It might be just as easy to write R scripts that would do basic analyses. Users could "source" these scripts in an R session or from the command line. The scripts would be much more compact than the .exe files that you describe. Jim On Tue, Sep 11, 2018 at 8:06 AM Kevin Kowitski via

Re: [R] For loop with multiple iteration indexes

2018-09-09 Thread Jim Lemon
Hi David, If you mean that you have two data frames named x and y and want the correlations between the columns that would be on the diagonal of a correlation matrix: r<-list() for(i in 1:n) r[[i]]<-cor(x[,i],y[,i]) If I'm wrong, let me know. Jim On Mon, Sep 10, 2018 at 3:06 PM David Disabato

Re: [R] frequency distribution in figures....

2018-09-08 Thread Jim Lemon
Hi Akshay, Try this: table(cut(xht,breaks=seq(0,10,by=2))) Jim On Sat, Sep 8, 2018 at 8:26 PM akshay kulkarni wrote: > > dear members, > I am facing difficulties in plotting histograms > in R in Linux CLI. > > Is there a function in R which produces a table of

Re: [R] Multi-word column names in a data frame

2018-09-04 Thread Jim Lemon
Hi Philip, This may work: library(dplyr) `RefDate` <- as.Date(c("2010-11-1","2010-12-01","2011-01-01")) `Number of vegetables` <- c(14,23,45) `Number of people` <- c(20,30,40) MyData <- data.frame(RefDate,`Number_of_vegetables`, `Number_of_people`,check.names=FALSE) MyVars <- c("Number of

<    1   2   3   4   5   6   7   8   9   10   >