Re: [R] recode the same subset of variables in several list elements

2015-04-02 Thread Jim Lemon
Hi Simon, How about this? library(plotrix) revlist<-grep("i",names(df),fixed=TRUE) df[,revlist]<-sapply(df[,revlist],rescale,c(3,1)) Jim On Fri, Apr 3, 2015 at 6:30 AM, Simon Kiss wrote: > Hi there: I have a list of data frames with identical variable names. > I’d like to reverse scale the s

Re: [R] Kruskal-Wallace power calculations.

2015-04-02 Thread Jim Lemon
Hi Collin, Have a look at this: http://stats.stackexchange.com/questions/70643/power-analysis-for-kruskal-wallis-or-mann-whitney-u-test-using-r Although, thinking about it, this might have constituted your "perusal of the literature". Plus it always looks better when you spell the names properly

Re: [R] double-axis labels function of each other

2015-04-02 Thread Jim Lemon
Hi Hurr, Try this: par(mar=c(7,4,4,2)) plot(x1,x2,type="l",xlab="") require(plotrix) fullaxis(1,at=pretty(x1),labels=round(1/pretty(x1),2),tick=TRUE, col="red",col.axis="red",lwd=4,pos=-0.2) mtext("x1",side=1,line=4.5) Jim On Fri, Apr 3, 2015 at 11:16 AM, Hurr wrote: > I have been doing other

Re: [R] double-axis labels function of each other

2015-04-02 Thread Jim Lemon
Hi Hurr, The problem is with the quotes in xlab="". In your version the quotes are not ASCII double quotes but some sort of "smart" quotes. Either your email client has substituted them or more likely, you are editing your code in something like MS Word and cutting and pasting the result into R. Tr

Re: [R] species names on a RDA plot

2015-04-04 Thread Jim Lemon
Hi Antonio, Is it possible to use "add=TRUE" and display the plot in two passes? Jim On Sat, Apr 4, 2015 at 11:44 PM, Antonio Silva wrote: > Hello everybody > > The problem is that species names are shown in the ordination diagram when > the data set has a maximum of 80 rows, and mine has 81 (

Re: [R] Aggregating daily rainfall raster data to bimontly data

2015-04-05 Thread Jim Lemon
Hi John, One way is to create an index variable that will divide your data into the appropriate intervals. There are a number of ways to do this. Say you want the "two month" version of bimonthly and you have a date variable ("raindate") for each observation like "1982-01-01". date_order<-paste(re

Re: [R] stripchart

2015-04-07 Thread Jim Lemon
Hi Catalin, I'm not quite sure which values you want to use, but does this start to do what you want? Jq90<-quantile(spei$J,0.9) Jq10<-quantile(spei$J,0.1) require(plotrix) plot(spei$year,spei$J,xlab="Year",ylab="Temerature anomaly", main="Temperature anomalies by year (1901 to 2013)", pch=ifels

Re: [R] recode the same subset of variables in several list elements

2015-04-07 Thread Jim Lemon
hat on each list element using lapply or llply. I have > about 4 data frames and a few other recodes to do so automating would be > nice, rather than applying your code to each individual list element. > simon > > On Apr 2, 2015, at 6:30 PM, Jim Lemon wrote: > > Hi Simon, >

Re: [R] strip levels

2015-04-07 Thread Jim Lemon
Hi Chistine, The latticeExtra package should be included with your installation of R. Enter: library(latticeExtra) in your R session to make it available. Jim On Tue, Apr 7, 2015 at 4:28 PM, David Winsemius wrote: > > On Apr 6, 2015, at 9:38 PM, Christine Lee via R-help wrote: > > > Thank yo

Re: [R] Removing words and initials with tm

2015-04-10 Thread Jim Lemon
Hi Sun, No, I was thinking of something like hunspell, which seems to fit into the sort of work that you are doing. Jim On Fri, Apr 10, 2015 at 11:42 PM, Sun Shine wrote: > Thanks Jeff. > > I'll add that to the ever-growing list my current studies are generating > daily. :-) > > Cheers > S > >

Re: [R] Finding values in a dataframe at a specified hour

2015-04-10 Thread Jim Lemon
Hi Alexandra, The error probably comes from the first iteration of i in 0:23. As indexing in R begins at 1, there is no element 0. Try using: for(i in 1:24) { ... and see what happens. Jim On Sat, Apr 11, 2015 at 7:06 AM, Alexandra Catena wrote: > Update: > > I have this so far. * The first

Re: [R] Finding values in a dataframe at a specified hour

2015-04-10 Thread Jim Lemon
> to the next loop, yet it doesn't. I will keep trying! > > Thanks, > Alexandra > > On Fri, Apr 10, 2015 at 3:43 PM, Jim Lemon wrote: > > Hi Alexandra, > > The error probably comes from the first iteration of i in 0:23. As > indexing > > in R begins at 1, t

Re: [R] Convert color hex code to color names

2015-04-13 Thread Jim Lemon
Hi Alejo, The color.id function in plotrix will do this, one color at a time: sapply(rainbow(6),color.id) #FFFF #00FF #00FF00FF #00FF # #FF00 [1,] "red" "yellow" "green" "cyan""blue""magenta" [2,] "red1""yellow1" "green1" "cyan1" "blue1" "magent

Re: [R] Make a Excel chart by R code

2015-04-14 Thread Jim Lemon
Hi jpm miao, What sort of "Excel" graphs do you want to produce? There are a few varieties, you know. Jim On Wed, Apr 15, 2015 at 1:54 PM, jpm miao wrote: > Hi, > >I understand that there're many great graphic packages in R (e.g., > ggplot2) . Nevertheless, my office uses Excel extensively

Re: [R] (no subject)

2015-04-15 Thread Jim Lemon
Hi Dot, Jeff's guess is probably correct, but perhaps you could describe the crazy tick marks and the repeating labels a little more. I suspect that if "newdate" was a character variable you wouldn't get a plot at all, and if it is a factor, a few of the labels might identify what went wrong. Jim

Re: [R] scan - open text file as list

2015-04-15 Thread Jim Lemon
Hi Hermann, This isn't much more elegant, but test.list<-sapply(test,function(x) { strsplit(x," ") },simplify=TRUE) names(test.list)<-NULL Jim On 4/15/15, Hermann Norpois wrote: > Hello, > > I try to open a text file test.txt with the content > > * a b d > * z u i h hh > * h bh kk > > so that

Re: [R] assign variables to function output

2015-04-16 Thread Jim Lemon
Hi merm, In case Sergio's message is a little cryptic: return_a_list<-function() { a<-"First item of list" b<-c(2,4,6,8) c<-matrix(1:9,nrow=3) return(list(a,b,c)) } x<-return_a_list() x Jim On Thu, Apr 16, 2015 at 7:21 PM, Sergio Fonda wrote: > Collect in a vector or dataframe or list the

Re: [R] read txt file - date - no space

2018-07-30 Thread Jim Lemon
Hi Diego, You may have to do some conversion as you have three fields in the first line using the default space separator and five fields in subsequent lines. If the first line doesn't contain any important data you can just delete it or replace it with a meaningful header line with five fields and

Re: [R] Plot Rclimdex or Climpact map with R

2018-07-30 Thread Jim Lemon
Hi Agathe, You can start with the "maps" package: # in an R session install.packages("maps") # assume you want a simple map containing France map("world",xlim=c(-6.0,9.6),ylim=c(42,51.5)) then plot your data by the coordinates of the stations. You will probably want to plot graphical elements to

Re: [R] read txt file - date - no space

2018-07-31 Thread Jim Lemon
ive, >>>dadf$datetime <- as.POSIXct(paste(dadf$V1,dadf$V2)) >>> since the dates appear to be in the default format. >>> (I generally prefer to work with datetimes in POSIXct class rather than >>> POSIXlt class) >>> >>> -Don >>> >&

Re: [R] read txt file - date - no space

2018-07-31 Thread Jim Lemon
ot. >> >> Unfortunately, I get the following error: >> >> >> st1_daily<-by(MyData$st1,MyData$date,mean) >> Error in tapply(seq_len(0L), list(`MyData$date` = c(913L, 914L, 925L, : >> arguments must have same length >> >> >> This is particul

Re: [R] Combinations of true/false values where one pair is mutually exclusive

2018-08-01 Thread Jim Lemon
Hi Rod, How about this? scenarios <- expand.grid(A = c("pass", "fail"), B = c("pass", "fail"), C = c("pass", "fail"), D = c("pass", "fail"), E = c("pass", "fail")) scenarios$F<-ifelse(scenarios$E=="pass","fail","pass") Jim On Thu, Aug 2, 2018 at 11:20 AM, R Stafford wrote: > I have 6 variable

Re: [R] how to allign data

2018-08-02 Thread Jim Lemon
Hi Petr, I recently had to align the minima of deceleration events to form an aggregate "braking profile" for different locations. It seems as though you are looking for something like: find_increase<-function(x,surround=10) { inc_index<-which.max(diff(x)) indices<-(inc_index-surround):(inc_inde

Re: [R] linear regression

2018-08-07 Thread Jim Lemon
Hi Kenneth, My guess is that you have tried to send screenshots of your output and these were blocked. Try to cut and paste the output into your message. Jim On Tue, Aug 7, 2018 at 6:38 PM, John wrote: > On Mon, 6 Aug 2018 20:18:38 +0200 > kenneth Barnhoorn wrote: > > Your examples did not app

Re: [R] (no subject)

2018-08-07 Thread Jim Lemon
Hi malika, You don't seem to have defined your functions correctly. For example: H<-function(u,x1) would define an empty function H if that command worked, but it doesn't Jim On Tue, Aug 7, 2018 at 3:51 PM, malika yassa via R-help wrote: > hellothis is my programmeyou can help me, i cann't fo

Re: [R] Help reinstalling rgdal (Ubuntu 16.04)

2018-08-09 Thread Jim Lemon
Hi Alex, I don't use Ubuntu, but if I saw that error message I would upgrade my C++ compiler and try again. With luck, this is what caused the cascade of errors beneath it. Jim On Fri, Aug 10, 2018 at 1:36 AM, Alexandra Thorn wrote: > Hi all, > > Following some updates to R that I received via S

Re: [R] source script file that contains Unicode non-English characters

2018-08-11 Thread Jim Lemon
Hi Farid, Whatever you attached has not gotten through. Jim On Sat, Aug 11, 2018 at 6:47 PM, Farid Ch wrote: > Hi all, > > Please check the attached file. > > Thanks > Farid > > > __ > R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see >

Re: [R] cumulate of snow cumulates from daily values of different automatic stations for some time intervals

2018-08-12 Thread Jim Lemon
Hi Stefano, This was such a stinker of a problem that I just had to crack it: # create some data the lazy man's way year_dates<-c(paste(2000,rep("01",31),formatC(1:31,width=2,flag=0),sep="-"), paste(2000,rep("02",29),formatC(1:29,width=2,flag=0),sep="-"), paste(2000,rep("03",31),formatC(1:31,wid

Re: [R] bar plot add space to group data

2018-08-18 Thread Jim Lemon
Hi citc, Try this: geac<-matrix(c(9,9,8,8,8,23,23,23,23,22,27,27,27,25,24, 19,19,19,20,20,17,17,17,18,19,8,8,8,9,9,2,2,3,3,3),ncol=5,byrow=TRUE) library(plotrix) barp(geac,names.arg=2014:2018,main="A level grades chemistry", xlab="Year",ylab="Percentage of each grade",ylim=c(0,30), col=c("white

Re: [R] [FORGED] Re: bar plot add space to group data

2018-08-18 Thread Jim Lemon
pink")) and I thank you for alerting me to the fact that the legend arguments in barp don't position the legend properly. I'll fix it. Jim On Sun, Aug 19, 2018 at 9:52 AM, Rolf Turner wrote: > > Jim: > > (a) There's no legend. > > (b) I am still curious as to

Re: [R] as.Date() function

2018-08-19 Thread Jim Lemon
Hi Phillip, Jose has the correct answer. You probably missed this sentence in the "Note" section of the help page: "If the date string does not specify the date completely, the returned answer may be system-specific." In your case, the function throws up its hands and returns NA as you haven't sp

Re: [R] Transforming data for nice output table

2018-08-20 Thread Jim Lemon
Hi David, As you want the _values_ of Year from the initial data frame appended to the _names_ of GW_Elevation, you can't do it the easy way: dddf<-read.table(text="LocationDateYear GW_Elevation 127(I)5/14/2006 2006 752.46 119(I)5/14/2006 2006

Re: [R] graphing repeated curves

2018-08-22 Thread Jim Lemon
Hi Richard, This may be what you want: data(mtcars) m<-list() for(i in 1:6) { rhterms<-paste(paste0("I(hp^",1:i,")"),sep="+") lmexp<-paste0("lm(mpg~",rhterms,",mtcars)") cat(lmexp,"\n") m[[i]]<-eval(parse(text=lmexp)) } plot(mpg~hp,mtcars,type="n") for(i in 1:6) abline(m[[i]],col=i) Jim On

Re: [R] Account for a factor variability in a logistic GLMM in lme4

2018-09-03 Thread Jim Lemon
Hi Pedro, I have encountered similar situations in a number of areas. Great care is taken to record significant events of low probability, but not the non-occurrence of those events. Sometimes this is due to a problem with the definition of non-occurrence. To use your example, how close does an ani

Re: [R] pheatmap query

2018-09-03 Thread Jim Lemon
Hi Tanya, Have you looked at the return value of pheatmap? ret<-pheatmap(counts_filtered_df,scale="row",cluster_col=FALSE, cluster_row=TRUE,border_color=NA,show_rownames = TRUE) str(ret) names(ret$tree_row) names(ret$tree_col) Look at what is in "ret" to see if your numeric matrix is hidden ther

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 vegetab

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 freq

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] 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 R-h

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] loop for comparing two or more groups using bootstrapping

2018-09-11 Thread Jim Lemon
l(colname.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

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. Howeve

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)". source("dotchart.noax.R")

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 UNSU

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 4

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 error:

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 pa

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 itsel

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

2018-09-27 Thread Jim Lemon
ction, I get: > > > 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, > Lui

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

2018-09-27 Thread Jim Lemon
tion(x) return(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.

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 kkdf<-subset(airquality,Te

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

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] 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 w

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 6,

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
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 to c

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 on

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: R_code___

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 interact

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 su

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] 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, levels=c("

Re: [R] Plot a matrix

2018-10-31 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 0.

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

2018-11-01 Thread Jim Lemon
low but 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 &g

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
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 >> >>

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 create

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] 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] [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) assign(paste0("veh",i),rep(sample(10:35,1),10)+runif(10,-4,4

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

2018-11-20 Thread Jim Lemon
gn=signaturevirality5&;> > Sender > notified by > Mailtrack > <https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&;> > 11/21/18, > 7:02:18 AM > > > On Wed, Nov 21, 2018 at 4:38 AM Jim Lemon wrote: > >>

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

2018-11-20 Thread Jim Lemon
teful to > you. > > Thank you very much for your kind help. > > > > [image: Mailtrack] > <https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&;> > Sender > notified by > Mailtrack > <https://mailtrack.

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

2018-11-20 Thread Jim Lemon
edium=signature&utm_campaign=signaturevirality5&;> > Sender > notified by > Mailtrack > <https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&;> > 11/21/18, > 9:12:14 AM > > On Wed, Nov 21, 2018 at 8

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

2018-11-20 Thread Jim Lemon
<https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&;> > Sender > notified by > Mailtrack > <https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&;> > 11/21/18, > 10:35:03 AM

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 help

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 PM,1

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 data-column

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 ha

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: myframe[c(sample(which(myframe$da

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 25.10

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

2018-12-11 Thread Jim Lemon
ke 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-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), rect.col=color.scale(1:5,extremes=c("blue","red")),gr

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

2018-12-14 Thread Jim Lemon
track.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&;> >>> Sender >>> notified by >>> Mailtrack >>> <https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&;> >&g

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 comple

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: testlist<-list(a=1:8,b=1:9,c

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

2018-12-16 Thread Jim Lemon
uld like to discuss another 2 queries. >> >> Thank you very much Sir for educating a new R learner. >> >> [image: Mailtrack] >> <https://mailtrack.io?utm_source=gmail&utm_medium=signature&utm_campaign=signaturevirality5&;> >> Sender >> notified by

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 pass

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 serie

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 3

Re: [R] Plotting rgb proportions in R

2018-12-18 Thread Jim Lemon
Gunter > > "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: >> >> H

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 "rectang

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

2018-12-19 Thread Jim Lemon
file = "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

Re: [R] Plotting rgb proportions in R

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

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 these

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

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 devi

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) kripp.alpha(as.ma

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 Halli

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,

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