Displaying 20 results from an estimated 10000 matches similar to: "reshape::rename package unable to install !?!"
2011 Jul 31
5
Appending 4 Digits On A File Name
Greetings all,
I would like to append a 4 digit number suffix to the names of my
files for later use. What I am using now only produces 1 or 2 or 3 or
4 digits.
############
for (i in 1:1000) {
temp <- (kegg [i,])
temp <- merge (temp, subrichcdt, by="gene")
file.name <- paste ("kegg.subrichcdt.", i, ".txt", sep="")
2011 Aug 03
2
Error message for MCC
Greetings all,
I am getting an error message that is stifling me.
Any ideas?
> ## Define Directories ##
> load_from <- "/home/mcc/Dropbox/abrodsky/kegg_combine_data/"
> save_to <- "/home/mcc/Dropbox/abrodsky/ttest_results/"
>
> ###############################
> ## Define Columns To Compare ##
> compareA <- "log_b_rich"
> compareB
2011 Aug 01
4
Use dump or write? or what?
Greetings all,
I am calculating two t-test values for each of many files then save it
to file calculate another set and append, repeat.
But I can't figure out how to write it to file and then append
subsequent t-tests.
(maybe too tired ;} )
I have tried to use "dump" and "file.append" to no avial.
ttest_results = tempfile()
two_sample_ttest <- t.test (tempA, tempB,
2011 Dec 23
2
cast in reshape and reshape2
> library(reshape2)
> x = melt(airquality, id=c('month', 'day'))
With reshape I can cast with multiple functions:
> library(reshape)
> cast(x, month+variable~., c(mean,sd))
month variable mean sd
1 5 ozone 23.615385 22.224449
2 5 solar.r 181.296296 115.075499
3 5 wind 11.622581 3.531450
4 5 temp 65.548387
2011 Aug 16
1
Unusual separators
Hi all,
I have a list that I got from a web page that I would like to crunch.
Unfortunately, the list has some unusual separators in it. I believe
the columns are separated by 1 space and 1 tab. I tried to insert
this into the read.table( ..., sep=" \t", ...) but got an error that
said something like 'only one byte separators can be used.
I have thought about using a gsub to
2011 Aug 01
2
Errors, driving me nuts
Greetings all,
I am getting this error that is driving me nuts... (not a long trip, haha)
I have a set of files and in these files I want to calculate ttests on
rows 'compareA' and 'compareB' (these will change over time there I
want a variable here). Also these files are in many different
directories so I want a way filter out the junk... Anyway I don't
believe that this is
2012 Jul 25
2
reshape -> reshape 2: function cast changed?
Hi,
I used to use reshape and moved to reshape2 (R 2.15.1). Now I tried some of my older scripts and was surprised that my cast function wasn't working like before.
What I did/want to do:
1) Melt a dataframe based on a vector specifying column names as measure.vars. Thats working so far:
dfm <- melt(df, measure.vars=n, variable_name = "species", na.rm = FALSE)
2) Recast the
2017 Jul 05
0
Help with reshape/reshape2 needed
This does not use reshape/reshape2, but it is pretty straightforward. Assuming X is your example data:
> Y <- split(X[, 2], X[, 1])
> vals <- sapply(Y, length)
> pad <- max(vals) - vals
> Y2 <- lapply(seq_along(Y), function(x) c(Y[[x]], rep(NA, pad[x])))
> names(Y2) <- names(Y)
> X2 <- do.call(cbind, Y2)
> X2[, 1:6]
1957 1958 1959
2012 Dec 13
2
More efficient use of reshape?
Hi all,
I have played a bit with the "reshape" package and function along with
"melt" and "cast", but I feel I still don't have a good handle on how to
use them efficiently. Below I have included a application of "reshape" that
is rather clunky and I'm hoping someone can offer advice on how to use
reshape (or melt/cast) more efficiently.
#For this
2017 Jul 05
0
Help with reshape/reshape2 needed
The reason it doesn't work easily with reshape/reshape2 is that the
order of the rows is not determined. Your answer could be
1957 1958 ... 1985 1986
0.8625000 0.7500000 ... 0.7307692 0.23750000
0.0733945 0.6435644 ... NA 0.05769231
0.5096154 NA ... NA 0.65137615
or
1957 1958 ... 1985 1986
0.0733945 0.6435644 ... NA
2013 Jan 11
2
Merging list of dataframes with reshape merge_all
Hi,
I'd like to merge mutliple dataframes from a list of dataframes by some common
columns. The approach for simply merging 2 dataframes is working with:
merge(df1,df2,by=c("col1","col2","col3"),all=TRUE)
For mutliple dataframes in a list I try to use the merge_all command
from the package reshape.
The documentation states that the command takes a list of
2017 Jul 05
1
Help with reshape/reshape2 needed
Hi Tom,
Or perhaps:
#assume the data frame is named "tadf"
library(prettyR)
stretch_df(tadf,1,2)
Jim
On Thu, Jul 6, 2017 at 6:50 AM, Ista Zahn <istazahn at gmail.com> wrote:
> The reason it doesn't work easily with reshape/reshape2 is that the
> order of the rows is not determined. Your answer could be
>
> 1957 1958 ... 1985 1986
>
2012 Oct 17
1
Comparing dcast and reshape
I'm in the middle of my own little intellectual exercise comparing
dcast() and reshape() and have successfully stumped myself. I want to
melt() a data frame, then dcast() it into a new form. After doing so, I
want to duplicate the process using reshape().
So far, I can do the melt and cast
require(reshape2)
Raw <- data.frame(site = c(1, 1, 1, 1, 2, 2, 2, 2),
id =
2017 Jul 05
4
Help with reshape/reshape2 needed
Hi all:
I'm struggling with getting my data re-formatted using functions in
reshape/reshape2 to get from:
1957 0.862500000
1958 0.750000000
1959 0.300000000
1960 0.287500000
1963 0.675000000
1964 0.937500000
1965 0.025000000
1966 0.387500000
1969 0.087500000
1970 0.275000000
1973 0.500000000
1974 0.362500000
1976 0.925000000
1978 0.712500000
1979 0.337500000
1980 0.700000000
1981 0.425000000
2011 Aug 05
2
Which is more efficient?
Greetings all,
I am curious to know if either of these two sets of code is more efficient?
Example1:
## t-test ##
colA <- temp [ , j ]
colB <- temp [ , k ]
ttr <- t.test ( colA, colB, var.equal=TRUE)
tt_pvalue [ i ] <- ttr$p.value
or
Example2:
tt_pvalue [ i ] <- t.test ( temp[ , j ], temp[ , k ], var.equal=TRUE)
-------------
I have three loops, i, j, k.
One to test the all of
2012 Jul 24
3
Simple reshape problem I am completely missing
I seem to be doing something really stupid or missing something really obvious but what?
I have a simple three column data.frame that I would like to reshape to wide preferably using reshape2.
An example from http://stackoverflow.com/questions/9617348/reshape-three-column-data-frame-to-matrix looked perfect except I wanted a data frame but it seemed okay. I just changed acast to dcast and it
2012 Mar 19
2
Reshape from long to wide
Hi,
I'm a total beginner in R and this question is probably very simple but I've
spent hours reading about it and can't find the answer. I'm trying to
reshape a data table from long to wide format. I've tried reshape() and
cast() but I get error messages every time and I can't figure why. In my
data, I have the length of two fish from each family. My data table (called
2011 Sep 09
4
reshape data from long to wide format
This is my reproducible example:
example<-structure(list(SENSOR = structure(1:6, .Label = c("A", "B", "C",
"D", "E", "F"), class = "factor"), VALUE = c(270, 292.5, 0, 45,
247.5, 315), DATE = structure(1:6, .Label = c(" 01/01/2010 1",
" 01/01/2010 2", " 01/01/2010 3", " 01/01/2010
2011 Nov 19
3
reshape data.frame
A late friday afternoon coding question. I'm having a hard time thinking
of the correct search terms for what I want to do.
If I have a df like this:
a <-
data.frame(name=c(rep('a',10),rep('b',15)),year=c(1971:1980,1971:1985),amount=1:25)
name year amount
1 a 1971 1
2 a 1972 2
3 a 1973 3
4 a 1974 4
5 a 1975 5
6 a 1976
2011 Jan 19
2
Reshape
Hi - I'm up against a complicated reshape problem. I have data of the form
X1,Y1,hr1,hr2,hr3
X1,Y2,hr1,hr2,hr3
X1,Y3,hr1,hr2,hr3
X2,Y1,hr1,hr2,hr3
X2,Y2,hr1,hr2,hr3
X2,Y3,hr1,hr2,hr3
where X and Y are factors and the hr(1,2,3) are values. I need it as
,X1, X2
Y1,hr1,hr1
Y1,hr2,hr2
Y1,hr3,hr3
Y2,hr1,hr1
Y2,hr2,hr2
Y2,hr3,hr3
..,
Any hints? I've been at it for hours.
p
--
View