Displaying 20 results from an estimated 2000 matches similar to: "sort dates within a factor"
2009 Jul 29
2
quetions about dimensions
hi ,everyone,
I have a script shown as below:
> bj2=bjerrdata$tyerr[bjyearnum[2]+1:bjyearnum[3]]
> length(bj2)
[1] 448
while
> b=bjyearnum[3]
> a=bjyearnum[2]+1
> bj1=bjerrdata$tyerr[a:b]
> length(bj1)
[1] 169
it is different with bj2 and bj1 . and the array bjyearnum is
[1] 0 279 448 633 1021 1365 1813 2237 2839 3314 3798 4157 12
why bj1 is 169 while bj2 is 448
2009 Oct 08
1
To hell with OpenSuse, ditch it and go to Ubuntu
this blog entry
http://www.viggie.com/blog/software/opensuse-ubuntu-usage-experience
, if credible , would seem to suggest that there is no good reason to
choose Suse.
I really don't have time for such nonsense, maybe I'll just reinstall as Ubuntu.
Also, noticed that GCC was not installed when Suse installed. That's
just weird, GCC is part of Linux.
And if you try to install GCC,
2008 Apr 29
2
ggplot2: labels and breaks order does not match and I can't use scale_fill_identity
Hi,
I'm plotting a bar chart like this:
ggplot() +
geom_bar(data=res,aes(fill=f1,x=f2,y=y),stat="identity",position="dodge")
f1 contains quite a few levels and the plot is really quite difficult to
read when the order of bars on the graph and on the legend does not match.
This problem has been discussed recently here:
2009 Oct 09
2
Problems with code containing a for loop
The following code isn't working and we can't figure out why..
letters = c("A","B","C","D","E","F","G","H","I","J")
numbers = 1:3
for(i in 1:6){ #6 letters
for (j in 1:3) { #3 numbers
for (k in -1:1) {
2009 Dec 13
2
Reshape a data set
I am trying to reshape a data set. Could someone please help me with the
reshape, cast, and melt functions? I am new to R and I have tried reading
up on how to use the reshape package, but I am very confused. Here is an
example of what I am trying to do:
subject coder score time
[1,] 1 1 20 5
[2,] 1 2 30 4
[3,] 2 3 10 10
[4,] 2 2
2009 Jun 18
3
QuestÃon regarding the use of write.csv2, write.table ...
Hi all,
I use "write.csv" and "write.table" to write a data frame in a file like
following:
write.csv2(allRandomTestCase_XDroped, "allRandomTestCase.csv")
But in the created file "allRandomTestCase.csv" an additional column with
consecutive numbers is automatically added to the column of the data frame
"allRandomTestCase_XDroped".
That is why my
2008 Oct 17
3
Guitar Pro in Wine?
My uncle recently bought a new computer and he wants me to help him install Guitar Pro.
The thing is, he doesn't have Windows, and I'm thinking of installing Ubuntu with wine on the comp.
Quiz time!
Can you use wine, with GP, and if you can, deos it perform poorly in any ways?
2008 May 06
1
ggplo2: x_discrete labels size/direction
Hi everyone,
I've got quite a few labels along the x axis and ggplot2 basically just
crams them on top of each other.
Is it possible to reduce the font size and/or text direction?
Stretching the "windows" device window manually also helps, but I found that
setting the parameters for the pdf device (where my scripts should print the
data), such as paper="a4r" just results
2009 Sep 28
4
Running an ANOVA with a BY
I have a simple 1 way anova coded like
summary(ANOVA1way <- aov(Value ~ WellID, data = welldata))
How can I use the BY function to do this ANOVA for each group using another
variable in the dataset?? I tried coding it like this, but it doesn't seem
to work.
summary(ANOVA1way <- by(welldata, Analyte, function(x) aov(Value ~ WellID,
data = welldata)))
In SAS I would code it like this:
2009 Aug 05
2
using ddply but preserving some of the outside data
I have a bit of a quandy. I'm working with a data set for which I
have sampled sites at a variety of dates. I want to use this data,
and get a running average of the sampled values for the current and
previous date.
I originally thought something like ddply would be ideal for this,
however, I cannot break up my data by date, and then apply a function
that requires information
2009 Jun 17
2
Re gression by groups questions
I have a large dataset grouped by a factor and I want to perform a regression
on each data subset based on this factor. There are many ways to do this,
posted here and elsewhere. I have tried several. However I found one method
posted on the R wiki which works exactly as I want, and I like the elegance
and simplicity of the solution, but I don't understand how it works. Its
all in the formula
2009 Nov 05
2
sort of cumulative counting in a vector
Dear list,
I need help, since I can not come up with an easy solution to convert
this vector
test <- c('p','p','t','t','t')
to
[1] NA NA 1 2 3
which means the occurences of 't' should be summed up at the
corresponding positions. The solution should also be able to handle the
following scenarios:
test2 <-
2009 May 06
1
model fitting using by(): how to get fitted values?
Hi all,
I'm doing nonlinear regressions on data with several factors. I want to fit say a logistic curve with different parameter values for each factor level. So I'm doing something like:
tmp <- by( myData, list(myFactor1, myFactor2), function(x) nls(...) )
It works fine. However, I could not find an easy way to retrieve fitted values. I can use fitted() on each element of tmp, but
2009 Aug 17
3
Reshape package: Casting data to form a grid
Dear R Users,
I'm trying to use the 'cast' function in the 'reshape' package to convert column-format data to gridded-format data. A sample of my dataset is as follows:
head(finalframe)
Latitude Longitude Temperature OrigLat p-value Blaney
1 -90 -38.75 NA -87.75 17.10167 NA
2 -90 135.75 NA -87.75 17.10167 NA
3 -90 80.25
2009 Jun 16
2
tapply with cbinded x
Dear List,
why does this not work?
df <- data.frame(var1 = c(3,2,1), var2 = c(6,5,4), var3 = c(9,8,7),
fac = c('A', 'A', 'B'))
tapply(cbind(df$var1, df$var2, df$var3), df$fac, mean)
Thank you,
Stefan
2008 Nov 05
2
access (exactly/only) one dimension of a multidimensional table
Dear list,
I have a multi(3)dimensional table, which is printed as two tables:
> table.a
, , = female
not at all a little medium heavy
no 53 27 8 6
yes 30 67 61 66
, , = male
not at all a little medium heavy
no 31 20 11 5
yes 5 19 34 25
How can I access (manipulate)
2008 Apr 29
1
ggplot2: setting global graphic parameters with png driver
Hi all,
I prepared a few charts with ggplot2, and was happy with the results as
displayed on screen.
I tried to draw them with a PNG driver instead. But I ran into several
problems while trying to increase the resolution of the picture.
Mainly, when I increased the picture size (e.g png(width=1024,
height=768) ), the texts (title, labels, etc...) where too small. I
tried to set the
2010 Jul 23
2
start and end times to yes/no in certain intervall
Hi List,
I have start and end times of events
structure(list(start = c("15:00", "15:00", "15:00", "11:00",
"14:00", "14:00", "15:00", "12:00", "12:00", "12:00", "12:00",
"12:00", "12:00", "12:00", "12:00", "12:00", "12:00",
2008 Dec 11
5
Extracting the name of an object into a character string
Dear List,
I am writing a function in R with the facility to store models for later
use in scoring.
It would be very useful if I could include in the name of the file
stored the name of
the model object being stored, this name being chosen by the user in the
function
call. A simple function to store the name of an object as a character
string would fit the
bill, but I have not found one. name()
2009 Feb 19
1
code patterns in vector
Dear List,
I have this column/vector:
vec <- c("function", "missing", "string")
and want to compute a second column/vector:
- value if the pattern "unc" is found: 1
- value if the pattern "iss" is found: 2
- value if none of the patterns is found: 0
This should be the result:
> vec2
[1] 1 2 0
Any help? Tried it with grep, but the output