Displaying 20 results from an estimated 3000 matches similar to: "data.frame to array?"
2008 Aug 27
1
Updating a list.
I have a list that is generated from the resape package function 'cast'. It consists of three columns, Sku, DayOfYear, variable it is generated like:
r2007 <- cast(m2008, DayOfYear ~ variable | Sku, sum)
Now DayOfYear can range from 1:365 but there are not necessarily that many rows in the list. What I want to do is make every row in the list of lenght 365 and have the values
2008 Aug 11
3
Exporting a list of lists
I have a list
List(Sku=" ", Shape=1, Scale=3, DayOfYear=daylist)
Note: picture daylist as c(2,3,4,3) it is a list with variable length.
Then I have a list of lists
al <- c(al, List(List(Sku=" ", Shape=1, Scale=3, DayOfYear=daylist))
Note: same comment on daylist as above.
So far this creates a list of lists just how I want it. If I do al[1] I get each member and the
2008 Aug 09
1
Reshape set operations?
I have mange to use the library reshape to give me data structures that I want. Specifically:
m2008 <- melt(t2008, id.var=c("DayOfYear","Category","SubCategory","Sku"), measure.var=c("Quantity"))
m2007 <- melt(t2007, id.var=c("DayOfYear","Category","SubCategory","Sku"),
2008 Aug 05
1
RESHAPE cast help.
I have a set of data that is basically sales figures for a given year. It has columns for Yeaqr, Day Of Year, Sku, SubCatetory, and Category. The first few lines of data look like:
Year DayOfYear Sku Quantity CatId Category SubCategory
1 2007 1 100091 1 10862 HOLIDAY Christmas
2 2007 1 100138 1 11160 PET COSTUMES Famous
2008 Jul 26
1
Simple vector question.
I have some data that I read in via read.csv:
sales2007 <- read.csv("Total2007.dat", header=TRUE)
The data looks like:
> sales2007[1:605,]
Year DayOfYear Sku Quantity CatId Category SubCategory
1 2007 1 100091 1 10862 HOLIDAY Christmas
2 2007 1 100138 1 11160 PET COSTUMES Famous (Licensed)
3 2007
2009 Mar 11
1
Reshape question.
This hopefully is trivial. I am trying to reshape the data using the reshape package.
First I read in the data:
a2009 <- read.csv("Total2009.dat", header = TRUE)
Then I trim it so that it only contains the columns that I have interested in:
m2009 <- melt(a2009, id.var=c("DayOfYear","Category","SubCategory","Sku"),
2009 Mar 29
4
Constrined dependent optimization.
I have an optimization question that I was hoping to get some suggestions on how best to go about sovling it. I would think there is probably a package that addresses this problem.
This is an ordering optimzation problem. Best to describe it with a simple example. Say I have 100 "bins" each with a ball in it numbered from 1 to 100. Each bin can only hold one ball. This optimization is
2010 Nov 20
4
How to sync an exact list of files, Including deletes!?
Hello,
I'm author of Lsyncd - the live syncing deamon -
http://code.google.com/p/lsyncd/ - a daemon that uses Linux` inotify
to watch for filesystem changes - aggregates them for a few seconds
and then periodically calls rsync to transfer the changes to
target(s). Version 1 was simply aware of directories only, and it
called rsync once with --delete -d for every directory in which
anything
2013 Mar 15
2
Help finding first value in a BY group
I have a large Excel file with SKU numbers (stock keeping units) and
forecasts which can be mimicked with the following:
Period <- c(1, 2, 3, 1, 2, 3, 4, 1, 2)
SKU <- c("A1","A1","A1","X4","X4","X4","X4","K2","K2")
Forecast <- c(99, 103, 128, 63, 69, 72, 75, 207, 201)
PeriodSKUForecast <-
2006 Jun 07
8
erb Regex ?
Hi
Got a column named ''sku'' in a table named ''product''
<%= product.sku %>
...looks like this.... ''1234_56''
These last two chars (56) are an audio Track number.
I ultimately want to display:
Track <%= product.sku %>
I can isolate the first part with /\d+\_/ = 1234_
But can''t figure out how to get the last two
2017 Aug 27
6
regex - optional part isn't considered in replacement with gsub
Hello, I need some help with regex.
I have this to sentences. I need to extract both "49MU6300" and "LE32S5970"
and put them in a new colum "SKU".
A) SMART TV UHD 49'' CURVO 49MU6300
B) SMART TV HD 32'' LE32S5970
DataFrame for testing:
ecommerce <- data.frame(a = c(1,2), producto = c("SMART TV UHD 49'' CURVO
49MU6300",
2011 May 22
2
Convert dataframe with two factors from wide to long format
I know how to convert a simple dataframe from wide to long format with one
varying factor. However, for a dataset with two factors like the following,
Subj T1_Cond1 T1_Cond2 T2_Cond1 T2_Cond2
1 0.125869 4.108232 1.099392 5.556614
2 1.427940 2.170026 0.120748 1.176353
How to elegantly convert to a long form as
Subj Time Cond Value
1 1 1 0.125869
1
2017 Aug 28
0
regex - optional part isn't considered in replacement with gsub
"Please, consider that some SKUs have "-"
in the middle, for example: "PG-9021".
Then you need to include these in the list of patterns you gave. Try it
again -- this time with a **complete** list.
-- Bert
Bert 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
2011 Oct 22
7
"Plotting" text?
I noticed that the text() command adds text to a plot. Is there a way to
either make the plot blank or add text to a "blank sheet". I would like
to "plot" a page that contains just text, no plot lines, labels, etc.
Suggestions?
Kevin
[[alternative HTML version deleted]]
2008 Oct 10
2
Leap year?
Given a Date object or simply a year is there an R function to tell me if the it is a leap year or not? I was hoping for something like 'is.leapyear'. I probably can build my own function (year divisible by 4 etc.) but I would rather use an existing function if it is available.
Thank you.
Kevin
2017 Dec 29
1
cannot mount with glusterfs-fuse after NFS-Ganesha enabled
Hi,
I've created a 2 node glusterFS test (Gluster 3.8).
Without enabling NFS-Ganesha, when I try to mount from a client using
glusterfs option - everything works.
However, after enabling NFS-Ganesha, when I try to mount from a client
using the glusterfs option (fuse), it fails with the following output (when
using the log-file option):
[2017-12-28 08:15:30.109110] I [MSGID: 100030]
2008 Aug 28
6
Function not returning a vector?
Why does:
(shape/scale) * (1:365/scale)^(shape - 1)
return a vector of numbers but calling a function
hasard(1:365,shape,scale)
defined like:
hazard <- function(x,shape,scale)
{
return (shape/scale) * (x/scale)^(shape - 1)
}
Only return a single value? It is like x becomes a single value passed as an argument.
Thank you.
Kevin
2010 Mar 22
2
Factors attribute?
I noticed that when I fit a linear model using 'lm' there is an attribute called "factors" that is added to the "term". It doesn't seem to appear for 'model.matrix', just 'lm'. I have been unable to find where it gets constructed or what it means? It looks like a two dimensional array that I may be able to use so I would just like to get some
2009 Jan 03
5
Power functions?
I had a question about the basic power functions in R.
For example from the R console I enter:
-1 ^ 2
[1] -1
but also
-1^3
[1] -1
-0.1^2
[1] -0.01
Normally pow(-1, 2) return either -Infinity or NaN. Has R taken over the math functions? If so I would think that -1^2 is 1 not -1 and -0.1^2 is 0.01 not -0.01.
Thank you.
Kevin
2008 Feb 27
1
Hmisc xYplot won't do conditioning on factors?
Hi,
I am trying to replace (lattice) standard xyplot with xYplot variant from
Hmisc package to be able to add error bars to my plots. However, this does
not work, e.g:
library(lattice)
d <- data.frame(
SKU=gl(3, 1, 21, labels=c("a", "b", "c")),
Weekday=gl(7, 3, 21),
QCRate=runif(21))
xyplot(QCRate ~ Weekday | SKU, data=d)
(this plots nice 3 panels as per