Hi Georg,
You may find the "add.value.labels" function in the prettyR package useful.
Jim
On Tue, May 31, 2016 at 10:00 PM, wrote:
> Hi All,
>
> I am using R for social sciences. In this field I am used to use short
> variable names like "q1" for question 1, "q2" for question 2 and so on and
>
80+"))
age
value.labels(age)
Jim
On Thu, Jun 2, 2016 at 3:37 AM, wrote:
> Hi Jim,
>
> many thanks for the hint.
>
> When looking at the documentation I did not get how I do control which
> value gets which label. Is it possible to define it?
>
> Kind regards
>
&
Hi ce,
a<-10
condition<-expression("a>0")
if(eval(parse(text=condition))) cat("a>0\n")
Jim
On Thu, Jun 2, 2016 at 12:30 PM, ce wrote:
>
> Dear all,
>
> I want to make an if condition variable like :
>
> a = 10
> CONDITION = " a > 0 "
>
> if ( CONDITION ) print(" a is bigger" )
>
> I tried get ,
Hi Tjun Kiat,
This seems to work:
daily_date<-as.Date(paste("2000-01",1:28,sep="-"),"%Y-%m-%d")
weekly_date<-as.Date(paste(c(1,8,15,22,28),"01/2000",sep="/"),
"%d/%m/%Y")
cut(daily_date,breaks=weekly_date,include.lowest=TRUE,
labels=paste("Week",1:4))
Jim
On Fri, Jun 3, 2016 at 6:00 PM, TJUN
Hi Michael,
Have a look at my.symbols in the TeachingDemos package.
Jim
On Sat, Jun 4, 2016 at 4:19 AM, Michael Weber
wrote:
>
> Dear R users,
>
> I have been using R for several years and really appreciate all the
> developments which have been done. Maybe you can help me with the following
>
Hi Gafar,
As Jeff has pointed out, the median value may not exist within the
dataset. However, this function will give you either the position of
the value that is the median, or the position of the two closest
values if none equal the median. Be aware that this function may fall
victim to the "ind
Hi EKE,
Your problem may be that the date strings are being read as a factor.
Try using stringsAsFactors=FALSE when you read the data in. Another
way is to convert your dates to strings when passing to as.Date:
as.Date(as.character(mydf$Date),"%m/%d/%Y")
Jim
On Sun, Jun 5, 2016 at 10:53 PM, Ek
Hi Nick,
I think you want to get the maximum run length:
jja<-runif(92,0,16)
med_jja<-median(jja)
med_jja
[1] 7.428935
# get a logical vector of values greater than the median
jja_plus_med<-jja > med_jja
# now get the length of runs
runs_jja_plus_med<-rle(jja_plus_med)
# finally find the maximum r
Hi Doug,
I think this will work for you:
adl1<-read.csv("test.csv")
adl1[,"a"]
[1] 1 4 7
so, adl1[,args[1]] should get you the column that you pass as the
first argument.
Jim
On Mon, Jun 6, 2016 at 5:45 AM, Douglas Johnson wrote:
> I'm guessing this is trivial but I've spent two hours searchi
sample01.csv d j
> .
>
> I can't figure out how to get the column names from the args[] to the
> aes(x=?, y=?).
> There must be some kind of indirect reference or eval() or substitute()
> operator in R but I can't find it.
>
> Anyway, thanks fo
Hi Stefano,
I might be missing something, but try this:
MteBove<-read.table(text="posix_date posix_time snowtemp
2010-01-19 23:30:00 45 NA
2010-01-20 00:30:00 10 2.7
2010-01-20 03:00:00 45 NA
2010-01-20 03:30:00 44 NA
2010-01-20 04:00:00 44 NA
2010-01-20 04:30:00 44 NA
2010-01-20 05:0
Hi Tjun Kiat,
The following examples work for me. One uses the dates you have
specified, adding one weekly date to cover the range of your daily
dates, otherwise you will generate NAs. The second defines weekly
breaks for a year and then simulates daily dates throughout that year.
Remember that you
Hi Joonas,
It is easy to display hierarchic classification using either the
plot.dendrite or sizetree functions (plotrix). At the moment, they
will only display counts, not percentages. It would not be too
difficult to reprogram either one to display percentages. Here are
examples with shortened ca
Hi John,
With due respect to the other respondents, here is something that might help:
# get a vector of values
foo<-rnorm(100)
# get a vector of increasing indices (aka your "recent" values)
bar<-sort(sample(1:100,40))
# write a function to "clump" the adjacent index values
clump_adj_int<-functio
Hi Francisco,
I tried this just to see if it would work. It did, after a while.
wtmat<-matrix(rnorm(4602*1817),nrow=4602)
library(plotrix)
x11(width=5,height=13)
color2D.matplot(wtmat,c(1,1,0),c(0,1,0),0,border=FALSE)
Jim
On Fri, Jun 10, 2016 at 8:27 AM, FRANCISCO XAVIER SUMBA TORAL
wrote:
> Hi
Hi Francisco,
Your example plot shows me what you want to do (I think). I'm guessing that
you want to display the values in your matrix that are NOT zero or NA,
either colored in some way, or just in one color as the example. The
following example shows how to do both of these:
# wtmat<-matrix(rno
Hi Greg,
You've got a problem that you don't seem to have identified. Your
"reg" field in the "map" data frame can define at most 10 unique
values. This means that each value will be repeated about 270 times.
Unless there are constraints you haven't mentioned, we would expect
that in 135 cases
Hi Greg,
Okay, I have a better idea now of what you want. The problem of
multiple matches is still there, but here is a start:
# this data frame actually contains all the values in ref in the "reg" field
map<-read.table(text="reg p rate
10276 0.700 3.867e-18
71608 0.830 4.542e-16
29220 0.430
Hi Fahman,
That error message usually means that there is no newline at the end
of the last line of the input file. Try adding a newline,
Jim
On Tue, Jun 14, 2016 at 1:17 AM, Fahman Khan via R-help
wrote:
> I have written a following piece of code.
>> binaryFile <- file("sampleBinary.dat", 'rb'
) : no non-missing arguments to min; returning Inf
>> 2: In max(x) : no non-missing arguments to max; returning -Inf
>>
>>
>> On Mon, Jun 13, 2016 at 3:19 AM, Jim Lemon wrote:
>>>
>>> Hi Greg,
>>> Okay, I have a better idea now of what you want. The
Hi JI,
The most likely problems are negative numbers for sd or "k" being
larger than the number of mu.m2 or disp.m2 values.
Jim
On Wed, Jun 15, 2016 at 4:06 AM, JI Cho wrote:
> Dear R users,
>
> I have been using rnorm, rbinom and have been getting the following warning
> message when I do not h
2 columns. file
> size is 110 MB.Please guide
> me what is wrong.
>
> Shashi
> On Thu, 09 Jun 2016 14:27:17 +0530 Jim Lemon wrote
>>Hi Shashi,
>
> Without trying to go through all that code, your error is something
>
> simple. When you read in "matrixdata" right
I'm still unsure of what you are attempting to do with this data.
First, it is very sparse, appearing to be the counts of occurrences of
2567 strings, some of which are recognizable English words. I suspect
that you are trying to get something very simple like the frequency of
these strings within
Hi Alice,
Have you tried creating a vector of the start position (xpos[1],ypos[1]):
xstart<-rep(xpos[1],n)
ystart<-rep(ypos[1],n)
# where "n" is the number of subsequent positions in the trip
max(trackDistance(xstart,ystart,xpos[2:n],ypos[2:n],...))
may then give you the value of the longest dist
Hi farzana,
Probably the first thing is to ascertain what the class of "farzana" might be:
class(farzana)
Because "write.csv" expects "the object to be written, preferably a
matrix or data frame. If not, it is attempted to coerce x to a data
frame." to be the first argument. It seems that "farzan
Hi Pradip,
I'll assume that you are reading the data from a file:
pm.df<-read.csv("pmdat.txt",stringsAsFactors=FALSE)
# create a vector of numeric values of prevalence
numprev<-as.numeric(sapply(strsplit(trimws(pm.df$prevalence)," "),"[",1))
# order the data frame by that vector
pm.df[order(numpre
Hi Shane,
Try the "Kendall" package.
Jim
On Fri, Jun 17, 2016 at 7:47 PM, Shane Carey wrote:
> Hi,
>
> I was hoping someone could help me. I was wondering are there any libraries
> available to undertake a kendall correlation on a matrix of data, in the
> same way as what can be undertaken with
Hi Humberto,
The "0 row" error usually arises from a calculation in which a
non-existent object is used. I see that you have created a vector with
the name "lens" and that may be where this is happening. Have a look
at:
length(lens)
or if it is not too long, just:
lens
If it is zero length, tha
: NULL
> $ dual : NULL
> $ ux : NULL
> $ vy : NULL
> $ gamma :function (x)
> $ ORIENTATION: chr "in"
> $ TRANSPOSE : logi FALSE
> $ param : NULL
> - attr(*, "class")= chr "Farrell"
>
>
>
>
>
&
Hi Lucie,
You can visualize this using the sizetree function (plotrix). You
supply a data frame of the individual choice sequences.
# form a data frame of "random" choices
coltrans<-data.frame(choice1=sample(c("High","Medium","Low"),100,TRUE),
choice2=sample(c("High","Medium","Low"),100,TRUE))
si
> I need to calculate two normalizations with the vectors lens and cnts, and
> have the two options for sorting the normalizations up or down.
>
> Thanks for any help you can give me to fix this issue.
>
> Humberto
>
>> On Jun 18, 2016, at 12:19 AM, Jim Lemon wrote:
>
Hi Tanvir,
Not at all elegant, but:
make.seq<-function(x) return(seq(x[1],x[2]))
apply(matrix(c(a,b),ncol=2),1,make.seq)
Jim
On Wed, Jun 22, 2016 at 5:32 PM, Mohammad Tanvir Ahamed via R-help
wrote:
> Hi,
> I want to do the follow thing
>
> Input :
> a <- c(1,3,6,9)
>
>
> b<-c(10,7,20,2)
>
>
>
Now why didn't I think of that?
apply(matrix(c(a,b),ncol=2),1,function(x)x[1]:x[2])
Jim
On Wed, Jun 22, 2016 at 6:14 PM, Rolf Turner wrote:
> On 22/06/16 20:00, Jim Lemon wrote:
>>
>> Hi Tanvir,
>> Not at all elegant, but:
>>
>> make.seq<-function(x) r
Hi Marius,
There are a few things that are happening here. First, the plot area
is not going to be the same as your x and y limits unless you say so:
# run your first example
par("usr")
[1] -0.04 1.04 -0.04 1.04
# but
plot(NA, type = "n", ann = FALSE, axes = FALSE,
xlim = 0:1, ylim = 0:1,xaxs=
Hi Rezvan,
I'll take a guess that you have been presented with a matrix of
coefficients. You probably know that a linear model is going to look
something like this:
Y = ax1 + bx2 + cx3 ...
So I will further guess that you want to infer a distribution of Y
(the response variable) from more than on
> winter site1 9.2 2 4
> winter site2 10.2 4 4
> winter site3 11.2 4.5 4
> Would you please tell me how I can do this in R?
>
> Cheers
>
> Rezvan
>
>
> --
> *From:* Jim Lemon
> *To:* rezvan hatami ; r-help mailing list <
> r-help@r-project.org
am=data1
>
> Change the value of fertelizer--à datafram=data2
>
> predict(lm(nitrate~0.9*fertilizer2-0.02*flowrate+0.5*rain), datafram=data2
>
> Is that better now?
>
>
>
> --
> *From:* Jim Lemon
> *To:* rezvan hatami ; r-help mailing list
Hi Tanvir,
How about this:
value<-1
(1:length(d))[unlist(lapply(lapply(d,"==",value),any))]
Jim
On Tue, Jun 28, 2016 at 5:03 PM, Mohammad Tanvir Ahamed via R-help
wrote:
> Can any one please help me. I will apply this for a very large list, about
> 400k vector in a list and vector size is une
Hi Ken,
As far as I can see, ggtitle accepts a single string. The help page is
a bit obscure, implying that you can change the title with the "labs"
function(?), but using the same explicit string in the "ggtitle" line,
perhaps for didactic purposes. You seem to be asking to substitute
your own ver
Hi Vasilis,
Your question has more to do with telepathy than statistics, but I
will attempt an answer anyway. You have in your possession a matrix
(perhaps) named Matrix. Within are at least two columns of something,
one of which contains dates. You have revealed that the other column
contains nume
Hi Doug,
To expand a bit on what Bert has written, all the the "best
subset/best model" procedures use random variation in the dataset to
produce a result. This means that you will almost certainly include
variables in your "best model" that cannot be replicated. Sometimes
you can see this as a var
Hi,
I don't have excel.link, but have you tried:
"=G9*100/G6\n"
Jim
On Thu, Jun 30, 2016 at 10:34 PM, wrote:
> Hi All,
>
> I am using excel.link to work seemslessly with Excel.
>
> In addition to values, like numbers and strings, I would like to insert a
> full operational formula into a cell.
Hi Carlos,
The STATA function assumes estimated population SDs. If you have
sample SDs you can specify with this:
combine<-function(n,mu,sd,sd.type=c("pop","sample")) {
N<-sum(n)
mean<-sum(n*mu)/N
if(sd.type[1]=="sample") {
meanss<-(n[1]*(mean-mu[1])^2+n[2]*(mean-mu[2])^2)/N
SD<-sqrt(sum(sd
Hi Rolf,
A bit of poking around reveals that different fonts have different
size asterisks. If you are not already using Times Roman, it might be
worth a look. I only have Windows on this (work) PC, so I can't check
the Postscript fonts.
Jim
On Fri, Jul 1, 2016 at 12:50 PM, Rolf Turner wrote:
>
Hi Clemence,
I don't have sciplot installed, but the help page suggests that the
"xaxt" argument is available. This will prevent the x axis from being
displayed and you can then specify the x axis you want. Assume that
you want an x axis from 0 to 300 by 50:
axis(1,at=seq(0,300,by=50))
Jim
On T
Hi Marietta,
You may not be aware that the variable k is doing nothing in your
example except running the random variable generation 2 or 3 times for
each cycle of the outer loop as each successive run just overwrites
the one before. If you want to include all two or three lots of values
you will h
Hi Cristina,
Try this:
names(mydata)
It may be NULL or "ppitrst" may be absent.
Jim
On Thu, Jul 7, 2016 at 8:26 PM, Cristina Cametti
wrote:
> Dear all,
>
> I am not able to find a reliable r code to run a multilevel latent class
> model. Indeed, I have to analyze how social trust (three vari
Hi Kristi,
The period is there for a reason. If you want to extract that column like this:
x<-data.frame(a=1:3,b=2:4,c=3:5)
> names(x)[3]<-"dif of AB"
> x
a b dif of AB
1 1 2 3
2 2 3 4
3 3 4 5
> x$dif of AB
Error: unexpected symbol in "x$dif of"
> x$'dif of AB'
[1] 3 4 5
Hi Julia,
You seem to be looking for a test for trend in proportions in the
first question. Have a look at this page:
http://sphweb.bumc.bu.edu/otlt/MPH-Modules/BS/R/R6_CategoricalDataAnalysis/R6_CategoricalDataAnalysis6.html
The second question may require GLMs using experimental condition as a
Hi Matthew,
This question is a bit mysterious as we don't know what the object
"chr" is. However, have a look at this and see if it is close to what
you want to do.
# set up a little matrix of character values
tTargTFS<-matrix(paste("A",rep(1:4,each=4),"B",rep(1:4,4),sep=""),ncol=4)
# try the assi
Hi Tagmarie,
This might help:
datframe$numberdata<-as.numeric(as.character(datframe$numberdat))
library(plotrix)
barcol<-color.scale(datframe$numberdat,extremes=c("black","white"))
barplot(matrix(datframe$numberdat,nrow=2,byrow=TRUE),
beside=TRUE, horiz=TRUE,names.arg=paste("Week",1:3),
col=matr
Hi Elham,
It looks to me as though you have created the numeric variable "ID"
and then passed it to a function that expects it to be a character
variable. Try changing the line:
ID<-60101:60128
to:
ID<-paste("ID",60101:60128,sep="")
and see what happens.
Jim
On Wed, Jul 13, 2016 at 8:29 PM,
Hi Kyle,
First, see if you can identify which data are getting lost. This will
often reveal what is losing them if there is some common
characteristic.
If not, try to create some toy data (a puddle, not a lake) that will
produce the same problem. Then send an email with the toy data as
formatted b
me
> the error.
>
> Regards,
>
>
>
> On Thursday, July 14, 2016 3:10 AM, Jim Lemon wrote:
>
>
> Hi Elham,
> It looks to me as though you have created the numeric variable "ID"
> and then passed it to a function that expects it to be a character
> vari
Hi Christa,
The error messages tell you that the file contains NULL characters,
which can cause problems with reading files. You can remove these
characters with a "hex editor". I am not familiar with those used on
Windows, but look at this Web page:
http://alternativeto.net/software/okteta/?platf
uot;,"Leon"),3),prop=1)
I don't see any other way to put the names on the y-axis that makes any sense.
Jim
On Fri, Jul 15, 2016 at 5:14 PM, Dagmar wrote:
> Dear all, dear Jim,
>
> Thank you for trying to help Jim. Unfortunately it didn't solve my problem.
>
>
Hi Lawrence,
Try installing pbkrtest on its own:
update.packages("pbkrtest")
version 0.4.6 is up on CRAN, so this may allow you to make an end run.
Jim
On Sun, Jul 17, 2016 at 2:06 AM, Lawrence A. Janowitch
wrote:
> I'm trying to load the caret package in R-Studio (Version 0.99.902) on a
> W
Hi Daniel,
Judging by the numbers you mention, the distribution is either very
skewed or not at all normal. If you look at this:
plot(c(0,0.012,0.015,0.057,0.07),c(0,0.05,0.4,0.05,0),type="b")
you will see the general shape of whatever distribution produced these
summary statistics. Did the paper
Hi sri,
Maybe something like this?
has_values<-function(x,values) {
if(is.list(x)) {
return(sum(unlist(lapply(svlist,
function(x,values) return(all(values %in% x)),c(11,12)
}
}
svlist<-list(a=c(11,15,12,25),
b=c(11,12),
c=c(15,25),
d=c(134,45,56),
e=46,
f=c(45,56),
g=c(15,12),
h
Oops, didn't translate that function correctly:
has_values<-function(x,values) {
if(is.list(x)) {
return(sum(unlist(lapply(svlist,
function(x,values) return(all(values %in% x)),values
}
}
Jim
On Wed, Jul 20, 2016 at 7:18 PM, Jim Lemon wrote:
> Hi sri,
> Maybe somet
;arrows" with calls to "foobars".
Obviously "foobars" will only work for vertical bars, but could easily
be modified to handle horizontal bars. I think that should be all you
need.
Jim
On Thu, Jul 21, 2016 at 10:05 PM, Jim Lemon wrote:
> Hi Florian,
> I'll have t
Hi lili,
The problem may lie in the fact that I think you are using
"interpolate" when you mean "extrapolate". In that case, the best you
can do is spread values beyond the points that you have. Find the
slope of the line, put a point at each end of your time data
(2009-01-01 and 2009-12-31) and us
Hi Cristina,
As Rolf has noted, you probably don't want to persist with "lm" since
I think you have dichotomized your initial dependent variable. I also
think that you meant "don't worry about the change of variable names"
with "how I wrote the variables". I also think that you want to test
interac
Hi Shane,
FreeOCR is a really good place to start.
http://www.paperfile.net/
Jim
On Wed, Jul 27, 2016 at 6:11 AM, Shane Carey wrote:
> Hi,
>
> Has anyone ever done any ocr in R?? I have some scanned images that I would
> like to convert to text!!
> Thanks
>
>
> --
> Le gach dea ghui,
> Shane
>
my own script for this as I have many
> images/ pdf's in a folder and would like to batch process them using an R
> script!!
> Thanks
>
>
> On Tuesday, July 26, 2016, Jim Lemon wrote:
>>
>> Hi Shane,
>> FreeOCR is a really good place to start.
>>
>>
Hi Maria,
The "plot.gam" function doesn't use the "col" argument for lines, but
does change the color of points in the second example on the help
page. There doesn't seem to be an easy way to change the function to
get what you want.
Jim
On Tue, Jul 26, 2016 at 11:47 PM, Maria Lathouri via R-hel
Hi Gang,
This is one way:
gangdat<-read.table(text="subject QMemotion yi
s1 75.1017 neutral -75.928276
s2 -47.3512 neutral -178.295990
s3 -68.9016 neutral -134.753906
s1 17.2099 negative -104.168312
s2 -53.1114 negative -182.373474
s3 -33.0322 negative -137.
Hi Roslina,
Try this:
aggbalok_mth[aggbalok_mth$year %in% 2009:2014,]
Jim
On Fri, Jul 29, 2016 at 1:12 PM, roslinazairimah zakaria
wrote:
> Dear r-users,
>
> I would like to extract year from 2009 to 2014 with the corresponding month
> and rain amount.
>
> I tried this:
> aggbalok_mth[aggbalo
class = "data.frame")
>
> Thank you.
>
> On Fri, Jul 29, 2016 at 2:30 PM, roslinazairimah zakaria
> wrote:
>>
>> I have one more question, how do I get the sum for the years. Thank you.
>>
>> On Fri, Jul 29, 2016 at 12:36 PM, roslinazairimah zakaria
Hi Alain,
You are probably storing the result, replicated five times, in df$VAR.
Each cycle of the loop replaces the last value with the current value.
If you really want the entire output of binom.test in the last column:
multi.binom.test<-function(xs,ns) {
reslist<-list()
for(i in 1:length(xs
Hi Courtney,
I haven't seen any answers to your question, and perhaps it is because
others, like I, were unable to open the file you attached. The
uninformative labels you are getting may be the names of values or the
character value of factors. Is there a sample data set from the
original file tha
Hi Roslina,
As we do not know whether the file actually exists, all I can do is to
suggest that you look in your file manager (Windows Explorer,
probably) and see if the file is where you think it is. The problem is
most likely a spelling error somewhere in the path or filename.
Jim
On Tue, Aug
Hi Roslina,
You only specify space for two plots in:
par(mfrow=c(1,2))
However, you only try to plot two plots, so I will assume that you
only want two. You haven't defined "x" in the above code, which will
cause an error. The code below gives me two plots as I would expect (I
made up the data th
Hi Nelly,
The message David suggested was about scaling the values, not
adjusting the parameters. It is quite possible that the empirical
distribution is nothing like beta or Weibull. Have you tried plotting
the values with "density"?
Jim
On Fri, Aug 5, 2016 at 6:56 AM, Nelly Reduan wrote:
> He
Hi Thomas,
Be aware that if you are attempting to calculate "birthday age", it is
probably better to do it like this:
bdage<-function(dob,now) {
dobbits<-as.numeric(unlist(strsplit(dob,"/")))
nowbits<-as.numeric(unlist(strsplit(now,"/")))
return(nowbits[3]-dobbits[3]-
(nowbits[2] wrote:
> dif
Hi Zun Yin,
The first problem requires something like this:
pixel8<-function(x,y,pixsize=1) {
nsteps<-length(x)-1
newx<-x[1]
newy<-y[1]
for(i in 1:nsteps) {
dx<-diff(x[i:(i+1)])
dy<-diff(y[i:(i+1)])
if(dx && dy) {
newx<-c(newx,x[i]+dx,x[i]+dx)
newy<-c(newy,y[i],y[i]+dy)
}
else
[i+1])
newy<-c(newy,y[i+1])
}
lastdx<-dx
lastdy<-dy
}
return(list(x=newx,y=newy))
}
x<-c(5,4,4,3,2,2,1,1,2,2,3,4,5,5,6,6,7,8,8,9,8,7,7,6,6,5,5)
y<-c(1,2,2,3,4,4,5,6,6,7,8,8,9,8,8,7,7,6,6,5,5,4,3,3,2,2,1)
plot(1:9,type="n")
lines(x,y)
newxy<-pixel8(x,y)
lines(n
Hi Yuan,
Your file didn't make it. The error message you got is generally due
to a misspelt filename or to the file not being where you think it is.
Jim
On Fri, Aug 5, 2016 at 8:10 PM, Yuan Jian via R-help
wrote:
> Hello,I have a SAS formatted file as attached, when I use lookup.xport i got
>
Hi Vladimir,
Do you want something like this?
vdat<-read.table(text="numberoftweet,tweet,locations,badwords
1,My cat is asleep,London,glum
2,My cat is flying,Paris,dashed
3,My cat is dancing,Berlin,mopey
4,My cat is singing,Rome,ill
5,My cat is reading,Budapest,sad
6,My cat is eating,Amsterdam,ann
nd when I try to
> names(unlist(sapply(vdat$tweet,grep,pattern=badwords))) there is a mistake.
> I had this question before but do you know by any chance how to separate
> just those words in a column badwords and not include NA's or blanks.
>
> Thank you,
> Vladimir
>
> 2016-0
Hi Jennifer,
A very pedestrian method, but I think it does what you want.
remove_rows_after_1<-function(x) {
nrows<-dim(x)[1]
rtr<-NA
rtrcount<-1
got1<-FALSE
thisID<-x$ID[1]
for(i in 1:nrows) {
if(x$ID[i] == thisID && got1) {
rtr[rtrcount]<-i
rtrcount<-rtrcount+1
}
if(x$ID[i] !=
Hi Loris,
This looks a lot like a Gantt chart with variable bar widths. I'll
check it when I have a bit of time and repost.
JIm
On Mon, Aug 8, 2016 at 6:12 PM, Loris Bennett
wrote:
> Hi,
>
> I want to visualise temporal events as rectangles, one side of the
> rectangle being the length of the e
time evolves. That approach would not allow rectangles to
expand over time, but that could be accommodated. It's more
complicated than either of the two, but I think it can be done.
Jim
On Tue, Aug 9, 2016 at 8:19 AM, Jim Lemon wrote:
> Hi Loris,
> This looks a lot like a Gantt chart wi
Hi Sri Ram,
Do you mean that you want to produce a Gantt chart? Have a look at the
example for gantt.chart in the plotrix package.
Jim
On Wed, Aug 10, 2016 at 2:58 PM, Sriram Kumar wrote:
> Dear all,
>
> i am presently doing the r codes for developing the shiny app fro my
> professional ,i ne
;-paste(x,collapse="/")
return(xdate)
}
newx<-as.Date(sapply(xbits,long_year,new_century),"%m/%d/%Y")
return(newx)
}
Jim
On Mon, Aug 15, 2016 at 10:47 AM, Jim Lemon wrote:
> Hi Glenn,
> Perhaps this will help:
>
> dateCentury<-function(x,new_century=20
Hi Lauren,
As Sarah noted, if your blank responses are coming as NAs, it may be
best to leave them alone until you have done the calculations:
survey$responses<-!is.na(survey[,c("q1","q2","q3")])
survey$sum_survey<-rowSums(survey[,c("q1","q2","q3")],na.rm=TRUE)
# the next line returns a logical ve
Hi Adrian,
Try this:
sm$rowmeans<-rowMeans(sm[,2:length(sm)])
sm<-sm[order(sm$Gene,sm$rowmeans,decreasing=TRUE),]
sm[-which(duplicated(sm$Gene)),]
Jim
On Fri, Aug 19, 2016 at 7:33 AM, Adrian Johnson
wrote:
> Hi Group,
> I have a data matrix sm (dput code given below).
>
> I want to create a da
Hi Adrian,
I had to add an extra color, but this might do what you want:
chxx<-matrix(runif(100,-3.32,4.422),nrow=10)
chxx.cut<-as.numeric(cut(chxx,breaks=c(-3.5,-1.96,-1,0,1,1.96,5)))
chxx.col<-c("#FF","#FF","#FF","#FF","#FF",NA)[chxx.cut]
library(plotrix)
chxx_highcol<-color.
Hi SuBin,
This seems to work:
emp<-read.table(text="empno,ename,job,mgr,hiredate,sal,comm,deptno
7369,SMITH,CLERK,7902,1980-12-17,800,,20
7499,ALLEN,SALESMAN,7698,1981-02-20,1600,300,30
7521,WARD,SALESMAN,7698,1981-02-03,1250,500,30
7566,JONES,MANAGER,7839,1981-03-02,2975,,20
7654,MARTIN,SALE
Hi Gang Chen,
If I have the right idea:
for(zval in levels(myData$Z))
crossprod(as.matrix(myData[myData$Z==zval,c("X","Y")]))
Jim
On Wed, Aug 24, 2016 at 8:03 AM, Gang Chen wrote:
> This is a simple question: With a dataframe like the following
>
> myData <- data.frame(X=c(1, 2, 3, 4), Y=c(4, 3
Hi John,
I think it is "dput".
Jim
On Thu, Aug 25, 2016 at 8:00 AM, John Sorkin
wrote:
>
> There is a function that can be used to convert data structures such as a
> data frame into a different format that allows the data to be sent to the
> mailing list. The structure that is created can be
Hi Alexander,
A time series comes to mind, but perhaps all you need is a matrix with
0s for closed and 1s for open. Each row is a shop. Column names as the
times and the resolution is up to you. I think colSums will produce
what you want.
Jim
On Fri, Aug 26, 2016 at 1:10 AM, alexander.som...@tu-d
Hi Josephine,
Given the parameters you describe, you will probably have to write a
function to update the database of animals at regular intervals. You
can then run a number of repeats to get a better estimate of the final
populations. I tried this and it appears to work. I don't know of any
existi
Hi Kai,
Perhaps something like this:
kmdf<-data.frame(group=rep(c("exp","cont"),each=50),
time=factor(rep(1:5,20)),
condition=rep(rep(c("hot","cold"),each=25),2),
value=sample(100:200,100))
for(timeindx in levels(kmdf$time)) {
for(condindx in levels(kmdf$condition)) {
cat("Time",timeindx,"Co
Sometimes the problem stems from chronic exposure to user interfaces.
Yesterday I prepared some material for a Mac user's presentation and
said,
"This text file tells you the names of the files you need for the presentation"
the response was,
"Can I click on it?"
I deleted all the files in the
Hi Yucheng,
Have a look at "An Introduction to R" (get there with "help.start()"), section :
3.1 Intrinsic attributes: mode and length
The distinction between numeric and integer modes in R may not be
obvious, but it is important at times.
Jim
On Fri, Sep 2, 2016 at 5:47 AM, Yucheng Song via R
Hi Bailey,
Treat it as a guess, but try this:
for (i in c(1:3)){
y<-mydata[,i]
x <- mblm(y ~ Year, mydata, repeated = FALSE)
print(x)
}
I'm not sure that you can mix indexed columns with column names. Also,
Year is column 4, no?
Jim
On Sun, Sep 4, 2016 at 11:43 AM, Bailey Hewitt wrote:
> H
Hi Christofer,
You have embedded commas in your data structure. This is guaranteed to
mess up a CSV read.
Jim
On Sun, Sep 4, 2016 at 5:54 PM, Christofer Bogaso
wrote:
> Hi again,
>
> I was trying to read a subset of Data from a CSV file using below code
> as example :
>
> library(sqldf)
>
> Dat
I suppose you could try quote=TRUE
Jim
On Sun, Sep 4, 2016 at 8:13 PM, Christofer Bogaso
wrote:
> Thanks Jim. But my data is like that and I have to live with that. Any
> idea on workaround. Thanks,
>
> On Sun, Sep 4, 2016 at 3:40 PM, Jim Lemon wrote:
>> Hi Christofer,
&g
Shouldn't get that with write.csv.
Jim
On Sun, Sep 4, 2016 at 9:29 PM, Christofer Bogaso
wrote:
> Didnt work getting unused argument error.
>
> On Sun, Sep 4, 2016 at 4:47 PM, Jim Lemon wrote:
>> I suppose you could try quote=TRUE
>>
>> Jim
>>
201 - 300 of 3432 matches
Mail list logo