Hello everyone,
I'm having a big trouble with which seems to be a bug in as.POSIXct()
date-time conversion. I have massive GPS datasets in which each location
has it's own date and time attribute. As I convert them to POSIXct format,
1300 cases (of about half a million locations) simply return NA
I have a multi-panel lattice figure. It has an even number of equal-width
columns. I would like to center text across the columns.
The xlab argument often handles this job nicely. But I want a more flexible
solution. (I have many strings and want to position them at different heights,
but
Hi all,
I'm running an if else loop to normalize my data to a known control.
I have calculated values that need to be subtracted from each treatment
applied. I'm trying this within a for loop with if and else commands to apply
to correct subtraction. This is done as follows:
attach(data.2013)
Hi Duncan,
Thanks for the reply - my apologies: my example data set was definitely
overly complex, and the labels too abstract. I'd really like to provide
labels for the assignments on the axis (species in the new example
below), and I'm not sure how I could accomplish this using your approach.
HI,
Couldn't reproduce the problem. I am using R 3.0.1.
time$convert-as.POSIXct(paste(time[,1],time[,2]),format=%Y/%m/%d %H:%M:%S)
time
date hour convert
1 2012/10/21 00:02:38 2012-10-21 00:02:38
2 2012/10/21 00:11:05 2012-10-21 00:11:05
3 2012/10/21 00:19:33
Hi,
Could you try:
time-data.frame(date,hour,stringsAsFactors=FALSE)
time$convert-as.POSIXct(paste(time[,1],time[,2]),format=%Y/%m/%d
%H:%M:%S)
head(time)
# date hour convert
#1 2012/10/21 00:02:38 2012-10-21 00:02:38
#2 2012/10/21 00:11:05 2012-10-21 00:11:05
#3
HI,
It may be better to provide an example dataset using ?dput().
dput(head(dataset),20)
Try:
signal3- ifelse(t.tr==Pst 24, signal2-17.29, ifelse(t.tr==Pst 48, signal2
- 43.93256, etc.))
A.K.
- Original Message -
From: Fethe, Michael mfet...@utk.edu
To: r-help@r-project.org
There have been a couple of threads recently on proper usage of POSIXct. I
suggest you read the archives.
After you read the archives: In your case, you don't seem to have zone offset
data in your time info, so you probably need to use Sys.setenv to set an
appropriate default time zone. The NA
Hi,
I am trying to load a daily time series as a r time series
object in the script at below link using the data at second link. I tried
setting the frequency as 365, but the data is not getting loaded with
correct number of samples which is 2192. Can any one help me on this how to
Thank you Jim,
I was trying few options but was not able to get
it done.
Thanks a lot.
with best regards,
Sudheer
On Mon, Aug 26, 2013 at 3:40 AM, jim holtman jholt...@gmail.com wrote:
Forgot the year on the plot:
n - 100
x - data.frame(time = seq(from =
Thank you.
with best regards,
Sudheer
On Mon, Aug 26, 2013 at 4:36 AM, Jim Lemon j...@bitwrit.com.au wrote:
On 08/26/2013 01:09 AM, Sudheer Joseph wrote:
Attached is a plot with a time series. If I have a time series object in
R.
How do I get the plot in the attached format of time axis?.
Dear all!
I want to arbitrary subset a data frame by variables.
I try this code, but the subset work only for rows, but I want to subset by
variables.
# sample without replacement
mysample - df[sample(1:ncol(df), 50,
replace=FALSE),]
Please help me to solve this
You've misplaced the comma.
mysample - df[, sample(ncol(df), 50, replace=FALSE)]
ir. Thierry Onkelinx
Instituut voor natuur- en bosonderzoek / Research Institute for Nature and
Forest
team Biometrie Kwaliteitszorg / team Biometrics Quality Assurance
Kliniekstraat 25
1070 Anderlecht
Belgium
+
Dear R-list,
l have been working on a translation of a matlab library into R, it took me
a while but I am almost there to submit it to CRAN...however, for this
library to be computationally competitive I need to solve an issue with the
home-made R version of the spdiags.m function (an old issue
Dear all!
I have a data frame composed by 13 columns (year, and 12 months). I want to
transform this data base in another like this
year month values
1901 1
1901 2
1901 3
.
1901 12
1902 1
1902 2
1902 12
Is there a possibility to succeed that in R?
Thank you!
best regards!
CR
--
On 08/26/2013 12:35 PM, Sudheer Joseph wrote:
Hi,
I am trying to load a daily time series as a r time series
object in the script at below link using the data at second link. I tried
setting the frequency as 365, but the data is not getting loaded with
correct number of samples
Hello, Catalin,
assume your data frame is as simple as
A - data.frame( year = years, month01 = values01, ,
+ month12 = values12)
then, e.g.,
reshape( A, varying = c( month01, , month12),
+ v.names = Values, timevar = Month, direction = long)
should do
On 08/26/2013 09:04 PM, catalin roibu wrote:
Dear all!
I have a data frame composed by 13 columns (year, and 12 months). I want to
transform this data base in another like this
year month values
1901 1
1901 2
1901 3
.
1901 12
1902 1
1902 2
1902 12
Is there a possibility to succeed
Dear All,
Sorry to bother you again. As my previous mail was messy to understand,
please find it again to give me a solution. I'd like to do a partial
correaltion test ['pcor.test ()' or 'parcor()'] between Irid.area and
Casa.PC1 variables controlling the influence of SL (co-variate) according
to
Have a look at the packages reshape and reshape2
They were written with this type of problems in mind.
On Aug 26, 2013, at 1:04 PM, catalin roibu catalinro...@gmail.com wrote:
Dear all!
I have a data frame composed by 13 columns (year, and 12 months). I want to
transform this data base in
Catalin,
first, keep the communication on the list, so it gets documented also for
others.
Second, my code does work for an example I made up myself, but if you
don't provide commented, minimal, self-contained, reproducible code (as
the posting guide asks you to; see last line of this
Hi Ben,
This question apparently has nothing to do with R and is therefore
off-topic for this list. You should post this question on a statistics
forum, or seek local help.
Best,
Ista
On Mon, Aug 26, 2013 at 1:50 AM, Ben Harrison
h...@student.unimelb.edu.auwrote:
Hello, I am quite a novice
HI,
You could also try:
res-reshape(yrmon,varying=!grepl(year,colnames(yrmon)),v.names=Values,timevar=Month,direction=long)[,-4]
res1- res[order(res$year,res$Month),]
head(res1)
# year Month Values
#1.1 1901 1 -0.2557446
#1.2 1901 2 -0.2318646
#1.3 1901 3 -0.1961822
#1.4 1901
On 8/25/2013 8:12 PM, Jim Lemon wrote:
lags - function(x, k=1, prefix='lag', by) {
if(missing(by)) {
n - length(x)
res - data.frame(lag0=x)
for (i in 1:k) {
res - cbind(res, c(rep(NA, i), x[1:(n-i)]))
}
colnames(res) - paste0(prefix, 0:k)
}
else {
for(levl in
Hi,
Also, you could also try:
vec1-rep(yrmon[,1],each=(ncol(yrmon)-1))
vec2-as.vector(t(yrmon[,-1]))
vec3- rep(1:12,nrow(yrmon))
res2-data.frame(year=vec1,Month=vec3,Values=vec2)
row.names(res1)- row.names(res2)
attr(res1,row.names)- attr(res2,row.names)
identical(res1,res2)
#[1] TRUE
#Speed
Suggestion:
Don't do the ifelse stuff below.
See ?switch instead.
-- Bert
On Sun, Aug 25, 2013 at 11:32 PM, arun smartpink...@yahoo.com wrote:
HI,
It may be better to provide an example dataset using ?dput().
dput(head(dataset),20)
Try:
signal3- ifelse(t.tr==Pst 24, signal2-17.29,
Silvano,
I am a little confused as to what you are looking for. Do you want each
group to have approximately the same mean and variance? Randomly assigning
groups should be sufficient for the means and variances to be somewhat
similar. I'm not sure what your goal would be to randomly split
Hi R.L.,
No problem.
You may try:
set.seed(24)
dat1- as.data.frame(matrix(sample(1:10,2000*3,replace=TRUE),ncol=3))
lst1-split(dat1,((seq_len(nrow(dat1))-1)%/%69)+1)
lst2-lapply(lst1,function(x) {colnames(x)-letters[1:3];x})
res-lapply(lst2,function(x) {x$z-with(x,(a-b)/c);x})
Hi,
You could try:
set.seed(549)
dat1- data.frame(t.tr=sample(c(paste(Pst, c(24, 48, 72)), paste(Pto,
c(24, 48, 72)), paste (Pm, c(24, 48, 72))), 50, replace=TRUE), signal2 =
sample(600:700, 50, replace=TRUE))
dat2- data.frame(t.tr=c(paste(Pst, c(24, 48, 72)), paste(Pto, c(24, 48,
72)),
I deal with non-daylight-savings time data all the time using Windows with its
system time set to daylight time. Sys.setenv(TZ=Etc/GMT+4) sets the zone for
the R process only and does not affect the system time settings. Using this
method lets me handle data from all around the world, with or
Dear All,
Suppose I have a categorical variable
a=as.factor(sample(1:3,10,replace=T))
plot(a) and hist(as.numeric(a),freq=F) would give the histogram of it.
But I do not know how to add the counts or percentage information for
plot.factor().
hist() can do it but as a numeric variable, the x-axis
Here's one way to do it ...
# create example data frame
y - rnorm(30)
gene_subset - data.frame(y, x1=rnorm(30), x2=rnorm(30), x3=100*y+rnorm(30))
# fit a full linear model
fit - lm(y ~ ., df)
# reduce the model
reduced_model - stepAIC(fit, trace=FALSE)
# NON-omitted variables (excluding the
Jie,
I'm not exactly sure what you're after. Perhaps this will help you get
started.
count - table(a)
prop - count/length(a)
b - plot(a)
text(b, count, prop, pos=1)
Jean
On Mon, Aug 26, 2013 at 11:27 AM, Jie jimmycl...@gmail.com wrote:
Dear All,
Suppose I have a categorical variable
Hi Jean,
I would like to give a histogram for a categorical variable, with
x-axis be different levels, and a number of percentage showed on top
of each bar.
Thanks.
Best wishes,
Jie
On Mon, Aug 26, 2013 at 12:43 PM, Adams, Jean jvad...@usgs.gov wrote:
Jie,
I'm not exactly sure what you're
Here is a way of getting the percents (and total if you want it):
a=as.factor(sample(1:3,10,replace=T))
# use 'barplot' since it return x-values for putting labels on bars
aTable - table(a) # count the factors
xPos - barplot(aTable)
# put percent at top bar
text(xPos, aTable, sprintf(%.0f%%,
Hi,
May be this helps:
dat1- as.data.frame(matrix(1:30,6,5))
lapply(seq_len(ncol(dat1)),function(i) dat1[,i])
[[1]]
[1] 1 2 3 4 5 6
[[2]]
[1] 7 8 9 10 11 12
[[3]]
[1] 13 14 15 16 17 18
[[4]]
[1] 19 20 21 22 23 24
[[5]]
[1] 25 26 27 28 29 30
#from excel dataset (the same data)
Dear all,
I am calculating the bivariate skew normal cdf in sn package using pmsn
function.
Although it is quite convenient ( thanks to prof. Azzalini) but it seems to be
slow.
For example, it takes about 1 minute in calculation of 100k of such cdf values.
I am thinking to write a c++ code for
Hi,
Suppose you created a dataframe like this:
set.seed(28)
dat1-as.data.frame(simplify2array(list(letters[1:5],sample(1:20,5,replace=TRUE),6:10)),stringsAsFactors=FALSE)
str(dat1)
#'data.frame': 5 obs. of 3 variables:
# $ V1: chr a b c d ...
# $ V2: chr 1 2 10 18 ...
# $ V3: chr 6 7 8
Greetings,
I am familiar with the function cite('packageName') which provides the
output generated from the DESCRIPTION file. In most cases this is
sufficient but I was wondering if there are contributing authors (in
addition to the primary) also listed on the CRAN page. Is there a proper
way
Hi,
it usually is a good idea to look at the output of citation() (which,
however, also often is auto-generated) or at the authors listed in
package vignettes.
And thanks for citing R package authors. When I review papers, I often
have to remind authors of this...
Best
Stephan
On
Thank you for your reply Stephan,
I like to be very thorough and make sure all names are attributed so in the
case that I check the url of a package and it lists contributing authors
that aren't provided with citation() would it be appropriate to cite it
like this:
Smith, J. [pr] and Johnson, J.
On Mon, 26 Aug 2013, Charles Determan Jr wrote:
Greetings,
I am familiar with the function cite('packageName') which provides the
output generated from the DESCRIPTION file.
...unless the package provides a CITATION file. Then, citation('pkg')
shows the content of the CITATION.
I don't fully understand what you are looking for, but you may want to
check out ?predict, ?predict.lm
On Sat, Aug 24, 2013 at 7:43 AM, alR ac...@le.ac.uk wrote:
I have fitted a multiple regression model to the row of a matrix using lm:
ft-lm(datos[i, ]-r1 + r2+ r3 + r4,keep.data =
On 08/26/2013 11:44 PM, Michael Friendly wrote:
...
Thanks for trying again, but that doesn't work either with a by=
variable. Note that your function is recursive, and also k=k
should be passed in the else{ ... lags() }.
Hi Michael,
You are correct about the k=, and I had used a separate
Two years ago, as shown in the script at the end, I created shortestpaths
using Igraph, then using Melt in Reshape2 I converted the the resulting
matrix into
three column vectors - vertex1, vertex2, shortestpath. It worked
then.
However, in the meantime I have installed new versions of R
On Aug 26, 2013, at 11:59 AM, Sebastian Hersberger wrote:
Hi David
Thanks for your help.
I tried it for a simplified example with vectors instead of matrices.
Once again the formula:
C = (Σ(from i=0 to i) A^i ) x B x (Σ(from i=0 to i) A^i )’
I applied it at follows – but couldn’t figure out
Hi Noah
I have modified to give you an idea of panel widths. Also for factors
you must have the same factors for all panels although not all will
have the full complement.
I usually do this by hand as latticeExtra does not do exactly what i want.
library(lattice)
library(latticeExtra)
tab -
Hi
better approach is to use match. Let have some lookup table called test
test
onetwo
1 Pst 24 -17.29
2 Pst 48 -43.93
3 Pto 24 -29.39
and original data called big
big-data.frame(one=sample(test$one, 20, replace=TRUE), two=100)
big
one two
1 Pto 24 100
2 Pst 48 100
3 Pst
Thank you let me try my luck,
Sudheer
On Monday, August 26, 2013, Jim Lemon wrote:
On 08/26/2013 12:35 PM, Sudheer Joseph wrote:
Hi,
I am trying to load a daily time series as a r time series
object in the script at below link using the data at second link. I tried
setting
Hi,
As we are in thinking of installing and using R as a data analysis
software on our machines, we have few questions before going ahead with
the installation. Please find below the questions:
1) Does R allow data to be sent out or processed out of the organization
network (e.g. ability
Thank you all for your suggestions. However, Dennis since your method seemed
the easiest. I gave it a shot with no success while it produces NAs. The R
inferno is not helpful for this part of my data normalization. I need to apply
this to my whole data.frame before I perform statistical tests
OK, thanks:) Maybe for my purpose a visible evaluation is also fine. But in
general I imagine it to happen quite often that in ecological data, people
have e.g. more species than sites.
--
View this message in context:
Match worker perfectly. Thanks for the help!
Michael Fethe
On Aug 26, 2013, at 11:10 AM, arun smartpink...@yahoo.com wrote:
Hi,
You could try:
set.seed(549)
dat1- data.frame(t.tr=sample(c(paste(Pst, c(24, 48, 72)), paste(Pto,
c(24, 48, 72)), paste (Pm, c(24, 48, 72))), 50,
Hi all,
Does anyone know how to export an excell spreedsheet into notepad in R
format as a linear vector as opposed to columns? I.e. 2,3,4,5,6,7 etc.
Thanks,
Mary
--
View this message in context:
http://r.789695.n4.nabble.com/Pasting-excell-spreedsheet-into-notepad-for-R-tp4674568.html
Sent
Hi David
Thanks for your help.
I tried it for a simplified example with vectors instead of matrices.
Once again the formula:
C = (Σ(from i=0 to i) A^i ) x B x (Σ(from i=0 to i) A^i )’
I applied it at follows – but couldn’t figure out what’s missing:
library(expm)
i - c(0,1,2,3,4,5,6,7,8,9,10)
Hi,
I am new to R, and am trying to use the SimpleR manual. The manual is
excellent. However, when I try to install the SimpleR package with R version
3.x.x, I get errors. The manual says that the package is good with R versions
1.5.0 and above. So:
1) Is there an updated package for
How do you extend factor() without abstract data types?
The idea is to have
factor (x, TYPE)
to transform all or selected components of x to factor TYPE.
Value:
a data structure of same type as x, with factor-like components
transformed to be like TYPE.
In the Pascal family, you
Thanks a lot. That works great.
I have another question, I will send you another email.
Best,Farnoosh Sheikhi
Cc: R help r-help@r-project.org
Sent: Monday, August 26, 2013 12:06 PM
Subject: Re: Loop for converting character columns to Numeric
Hi,
Suppose
Hi ,
I just imported a large data set from notepad. I want to label the columns
in R.
I used 'import Dataset' to bring in my data set
Now, I would like to label V1,V2,V3 etc??
Thanks
--
View this message in context:
http://r.789695.n4.nabble.com/Naming-columns-tp4674595.html
Sent from the R
Your question prompts more questions than answers. Not sure what imported from
notepad means (clipboard? delimited how?). Don't know what you obtained in R
(what does the str function tell you? What about dput(head(yourdata)))? You
really need to tell us what R code you executed and data you
Hello,
Please keep the r-list included when you reply.
Why do you want to add points to lines only in the legend? If so, the
legend would be incorrect.
Regards,
Pascal
2013/8/26 Igor Ribeiro igor...@gmail.com
Hi Pascal,
Thank you very much - your solution works partially - it will include
Because I'm already controlling points using points function. So I don't
want labcurve to change anything on the lines... Just draw the legend the
way I need.
On Aug 26, 2013 8:35 PM, Pascal Oettli kri...@ymail.com wrote:
Hello,
Please keep the r-list included when you reply.
Why do you want
Hi,
Your attachment didn't came through..
Using the same example, that I used before:
set.seed(549)
dat1- data.frame(t.tr=sample(c(paste(Pst, c(24, 48, 72)), paste(Pto,
c(24, 48, 72)), paste (Pm, c(24, 48, 72))), 50, replace=TRUE), signal2 =
sample(600:700, 50, replace=TRUE))
dat2-
Hi R.L.
No problem.
Try this:
#slightly modified the example:
set.seed(24)
dat1-
as.data.frame(matrix(sample(c(1:10,Inf,-Inf),2000*3,replace=TRUE),ncol=3))
lst1-split(dat1,((seq_len(nrow(dat1))-1)%/%69)+1)
lst2-lapply(lst1,function(x) {colnames(x)-letters[1:3];x})
Hello,
That is why I changed 2 lines in the code. Because points are misplaced if
you keep points with the lines.
Regards,
Pascal
2013/8/27 Igor Ribeiro igor...@gmail.com
Because I'm already controlling points using points function. So I don't
want labcurve to change anything on the
Hi,
Hope this is what you meant..
with(dat1,mean(V21[(V2==1|V2==0) V2425],na.rm=TRUE))
#[1] 2.8125
sapply(0:1,function(i) with(dat1,mean(V21[V2==i V2425],na.rm=TRUE)))
#[1] 2.75 3.00
. who are in condition 1 or 0 (V2) and then vice
versa ...
dat1[,21]
# [1] NA 3.40 3.00 3.00
Thanks to Aleksey Vorona and Duncan Murdoch, this bug is now fixed in R-devel!
Mathieu.
Le 08/01/2013 01:47 PM, William Dunlap a écrit :
You could report it as a bug at
https://bugs.r-project.org/bugzilla3/
Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com
-Original
hi all -- i'm running into a strange problem that i can't seem to
easily get around, but i'm probably just missing something obvious.
i have a model to which some data is fit using glm with no intercept
term (using my data variables x and y and a specific link function
mylink):
I would like to store a big spatial weight matrix in R memory to do more
calculation. I know there are memory issue for 32 bit computer and I have tried
increasing the memory to maximum without success. I am using R version 2.15.2
and window vista. The data has about 15,000 observations and I
Is there a fuction that will allow me to retrun the filename for a script
from within that script.
fir instance
If I have a script myscript.r:
FileName-unknown.fucntion()
print(FileName)
and run it
source(myscript.r)
will return
myscript.r
Thanks
Nevil Amos
[[alternative HTML
70 matches
Mail list logo