Displaying 20 results from an estimated 30000 matches similar to: "ordering data frame"
2010 Mar 24
2
splitting word
Hi all,
Could someone tell me how to split a word.
c("AA")
to
c("A","A")
Thanks!
Phoebe
[[alternative HTML version deleted]]
2009 May 04
2
rotate texts
Hi all,
I'm hoping to add texts into a plot. I'm using text() to do it. I wonder if
the text() allow me to make the text vertically printed?
Thanks in advance for help,
phoebe
[[alternative HTML version deleted]]
2012 Jun 13
5
finding duplicates in a data frame
I have two data frames which has 3 columns each.My first data frame is large
like this below
"new.col ppm.p. freq.p."
"1_3_diaminopropane 3.13859 5.67516"
"1_3_diaminopropane 3.137 6.65388"
"1_3_diaminopropane 3.13541 8.0142"
"1_3_diaminopropane 3.13383 9.64184"
"1_3_diaminopropane 3.12075 298.243"
"1_3_diaminopropane 3.1152
2009 May 01
3
factor level
Hi All,
I have problem about the factor features.
I read in a .cvs file, a column which is supposed to be numeric, but it
becomes factor level data after reading in.
mydata[,"newXaxis"]
[1] 0 0.430010601 11.23198508 25.00940297 37.75338045
45.98289639
[7] 48.92328133 52.51142822 61.12359751 63.85832121 70.98927949
77.16550181
[13] 97.73545713 113.6588007 118.6588007
2013 Mar 19
4
Copying rows in data frames
Hi,
I'm trying to copy the first row of one data frame to another. This is the
statement I am using :
df2[1,]<-df1[1,];
I have printed them out separately:
df1[1,] = A C D E F
But after copying:
df2[1,] = 96 29 88 122 68
Why isn't it copying? They are both data frames, and "as.character" isn't
working either.
Thanks for your input :)
[[alternative HTML version
2011 Nov 30
1
Replace columns in a data.frame randomly splitted
Dear community,
I'm working with the data.frame attached (
http://r.789695.n4.nabble.com/file/n4122926/df1.xls df1.xls ), let's call it
df1.
I typed: df1<- read.xls("C:/... dir .../df1.xls",colNames= TRUE, rowNames=
TRUE)
Then I splited randomly df1 using splitdf function
(http://gettinggeneticsdone.blogspot.com/2011/03/splitting-
dataset-revisited-keeping.html)
2013 Sep 10
3
to delete lines by means of a vector
Hi
I would like to eliminate a large number of lines of the dataframe df1
The lines to delete are given here by the values of Mat (ex : 2,4,7,10).
but I have a large number (300) values of Mat
dput(df1)
structure(list(Mat = c(1, 1, 1, 1, 1, 1, 2, 2, 2, 2, 3, 3, 3,
3, 3, 4, 4, 4, 4, 4, 5, 5, 5, 5, 5, 5, 6, 6, 6, 6, 6, 6, 7, 7,
7, 7, 7, 7, 7, 8, 8, 8, 8, 8, 8, 8, 9, 9, 9, 9, 9, 9, 10, 10,
10, 11,
2010 Aug 03
1
concatenate values in the vector
Hi all,
Is there a function that allow me to concatenate each value in a vector to a
string?
x<-c("a","b","c","d")
output string = a+b+c+d
Thanks,
phoebe
[[alternative HTML version deleted]]
2009 Nov 09
1
categorization
Hi All,
I have a dataset with a column named "Condition",
Sample Condition
1 c20
2 c20
3 c10
4 c10
5 c9
6 c9
7 c5
8 c5
9 c20
10 c10
Could you let me know the fastest way to change c20->"AA", c20->"BB",
c9->"CC", c5->"DD"
2009 Mar 22
5
If statement generates two outputs
Hi,
How do I tell an if statement to generate two seperate outputs.
E.g If X>5 I want to create df1 and df2:
if (X>5) {df1<-c(4,5,6,7,8) AND df2<-c(9,10,11,12,13)}
Thanks,
James
--
View this message in context: http://www.nabble.com/If-statement-generates-two-outputs-tp22650844p22650844.html
Sent from the R help mailing list archive at Nabble.com.
2012 Oct 11
1
as.data.frame.matrix() returns an invalid object
Hi,
Two ways to create what should normally be the same data frame:
> df1 <- data.frame(a=character(0), b=character(0))> df1
[1] a b
<0 rows> (or 0-length row.names)
> df2 <- as.data.frame(matrix(character(0), ncol=2,
dimnames=list(NULL, letters[1:2])))
> df2
[1] a b
<0 rows> (or 0-length row.names)
unique() works as expected except that I
2008 Sep 14
5
difference of two data frames
Hello
I have 2 data frames DF1 and DF2 where DF2 is a subset of DF1:
DF1= data.frame(V1=1:6, V2= letters[1:6])
DF2= data.frame(V1=1:3, V2= letters[1:3])
How do I create a new data frame of the difference between DF1 and DF2
newDF=data.frame(V1=4:6, V2= letters[4:6])
In my real data, the rows are not in order as in the example I provided.
Thanks much
Joseph
[[alternative HTML version
2010 Dec 01
2
draw categorical histogram
Hi,
Can someone tell me how to draw a histogram for the following summary?
Richard Minnie Albert Helen Joe Kingston
12 33 56 67 15 66
The summary tell that Richard has occurrence 12, Minnie has occurrence 33,
and so on. I would like to view this summary in a histogram.
I want the X-axis be the person name (Richard, Minnie, ....), Y-axis be the
2006 Aug 13
2
How to order or sort a data.frame
I have a dataframe where I would like to order first
by variable, year, and then within that variable by
month.
So far the only way that I have seen to do this is to
order by year and then subset year and sort by month
and then do an rbind to get things back together.
Is this the right approach?
Example:
us.state <-rep("California", 23)
2013 Jul 12
4
simplify a dataframe
Hello
I have the following problem : group the lines of a dataframe when no
information change (Matricule, Nom, Sexe, DateNaissance, Contrat, Pays)
and when the value of Debut of lines i = value Fin of lines i-1
I can obtain it with a do loop. Is it possible to avoid the loop ?
The dataframe initial is df1
dput(df1)
structure(list(Matricule = c(1L, 1L, 1L, 6L, 6L, 6L, 6L, 6L,
6L, 8L, 8L, 8L,
2008 Apr 17
2
Conditionally swap items in a data frame
df1 <- data.frame(a = LETTERS[1:2], b = LETTERS[3:4], c = 1:2)
I am looking for an idiom that swaps the elements of df$a and df$b
when (e.g.) df$c == 2, resulting in
df2 <- data.frame(a = LETTERS[c(1, 4)], b = LETTERS[c(3, 2)], c = 1:2)
_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS: P.O.Box 400400 Charlottesville, VA
2018 Feb 27
3
Aggregate over multiple and unequal column length data frames
Thank you Pikal and Bert. My apology for posting parts of my previous
email in HTML. Bert's suggestion will work but i am wondering if there
is an alternative
especially in the case where the data frames are big; that is the
difference in lengths among them is large. Below is a list of sample
date frames and desired result.
EK
2012 Oct 23
6
Join data frame columns
Hi,
I have a data frame with 100 variables (numeric and non numeric types), and
I want to join them in only one column, like a vector, but i want to keep
the non numeric variables like they are.
I know that i can do something like this:
Suppose that my data is in df variable
new_df<-data.frame(c(df[,1],df[,2],df[,3],df[,4],...........)
This works but i have 100 variables!
Any way of doing
2010 Oct 19
3
scatter.smooth() fitted by loess
Hi there,
I would like to draw a scatter plot and fit a smooth line by loess.
Below is the data.
However, the curve line started from 0, which my "resid" list doesn't
consist of 0 value.
It returned some warnings which I don't know if this is the reason
affecting such problem. Here I also attached the warning messages.
Please let me know if there is a solution to fix this. Thank
2011 Dec 07
2
Dividing rows when time is overlapping
Hi all,
I have dataframe that was created from the fusion of two dataframes. Both
spanned over the same time intervall but contained different information.
When I put them together, the info overlapped since there is no holes in the
time interval of one of the dataframe. Here is an example where the rows
"sp=A and B" are part of a first df and the rows "sp=C" come from a