Displaying 20 results from an estimated 10000 matches similar to: "write.csv naming file after function argument"
2011 Aug 15
3
how can I read a xlsx file
Hello,
How can I read a xlsx file using xlsx package?
Thanks
Albert
[[alternative HTML version deleted]]
2011 Jun 27
2
Add use of dput() to the instructions at bottom of post?
It's often difficult to figure out what a problem data set looks like when someone pastes a mess of output from R into an e-mail. The dput command, used judiciously?I would hope no one would send a 1 M data set?can make life much easier.
I wonder if it would be useful to add a hint in the instructions at the bottom of the posting page, where the list asks for self-contained reproducible
2011 Aug 01
1
Write.table Question
Hi,
I'm trying to create an abbreviated data file from a larger version. I can
use the subset command to create a value for this data:
dat <-subset(raw.data, select=c(SNP, Pvalue))
> head (dat)
SNP Pvalue
1 rs11 0.6516
2 rs12 0.3311
3 rs13 0.5615
but when I try to write.table using:
write.table (dat, file = "/path/to/my/data.txt", sep = " ",
2011 Sep 27
2
searching several subsequences in a single string sequence
Hi all
I am analyzing bird song element sequences. I would like to know how can I
get how many times a given subsequence is found in single string sequence.
For example:
If I have this single sequence:
ABCABAABABABCAB
I am looking for the subsequence "ABC". Want I need to get here is that the
subsequence is found twice.
Any idea how can I do this?
Thanks
2011 Aug 30
1
R crash
Dear users,
By running the script below, R crashes systematically at the last
command, namely dev.off(), on Windows 7, but not on Windows XP.
I therefore don't provide a reproducible example and do not really
extract the relevant parts of the script because it has most likely
nothing to do with the script itself. I can do it though if you think it
might be relevant.
R crashes on Windows
2011 Sep 09
2
get and save
I have a data frame 'tmp' and a vector 'name' containing 'd2'.
I want to save 'tmp' under the name hidden in 'name', and the file must have
the same name, plus the extension '.rda'.
So I try
> tmp
x y
1 1 3
2 2 4
> name
[1] "d2"
> assign(name, tmp)
> summary(get(name))
x y
Min. :1.00 Min. :3.00
1st
2011 Jun 15
3
Column of numbers added to dataframe when saving with read.csv
I have a dataframe object having the following structure
FinalOutput[1:3,]
GasDays 2011-03-31 2010-09-30 2010-10-31 2010-11-30 2010-12-31
2011-01-31 2011-02-28
1 2006-10-01 217303553 221205033 222824639 217016511 216093460
216477468 216834021
2 2006-10-02 231158527 234565250 236004109 231467851 230100639
230079907 230734064
3 2006-10-03 282062314 285427832 286372163
2011 Jan 12
3
Outputting csv file from dataframe with columns in a particular order
I have a dataframe with columns "ID",'date","estimate","actual" (but
not necessarily in that order - I do a merge somewhere and that
somehow messes up the order of the columns).
How can I output it to a csv file with the columns in the order that I
want?
Thanks.
2011 May 04
1
Str info. Thanks for helping
It looks from str(SA) that Response IPS1 is a data.frame of class "anova", which probably cannot be coerced to vector.
Maybe you can use unlist() instead of as.vector()
Or something like
SA[["Response IPS1"]]["as.factor(WSD)",] ## to select the first row only, even maybe with unlist()
Without a better REPRODUCIBLE example, I cannot tell more (maybe some others
2010 Dec 08
5
Summing up Non-numeric column
Dear All
If I have the following dataset
V1 V2
x y
y x
z b
a c
b j
d l
c o
How do I use R command to get the total number of different letter in column
"V1"
column "V1" has 7 different letters.
Thank you
--
View this message in context: http://r.789695.n4.nabble.com/Summing-up-Non-numeric-column-tp3077710p3077710.html
Sent from the R help mailing list archive
2011 Apr 20
2
user input
Dear users,
I have looked on different sources and found different functions to
prompt the user to provide input. However, I couldn't find one that does
exactly what I'm looking for.
select.list() and menu() are nice because a graphic window appears to
prompt the user. However, the user can only choose from a predefined
list of choices. readline() and scan() are more free in the
2010 May 19
3
save in for loop
Dear users,
My problem concerns save() within a for loop.
Here is my code:
for (i in 1:4) {
temp <- data.frame(a=(i+1):(i+10), b=LETTERS[(i+1):(i+10)])
filename <- paste("file", i, sep="")
assign(filename, temp)
save(filename, file=paste(filename, ".rda", sep=""))
}
As you can see, save() doesn't work as I would like: (1) the object
2011 Feb 21
2
naming vectors
Hello R users
I was trying to find a less annoying way of naming vectors than:
x<-1:10
names(x)[1:length(x)]<-"A"
So I tried:
x<-1:10
names(x)<-"A" #but this gave only the first element named (as described in the help files)
and
x<-1:10
names(x)[]<-"A" #but this gave all elements named NA
The curious thing with this last option is
2010 Mar 11
3
Help function "?" in R 2.10.1
Hello everyone,
I have versions 2.7.2 and 2.10.1 installed on a machine that has no
access to internet.
In 2.7.2 I can use ? to get help on functions, which in 2.10.1 that
does not work, all I see is "starting httpd help server...done" and
then nothing.
Have I downloaded 2.10.1 incorrectly (=forgot to tick some box for
local help file repository) or is the internet help now the
2010 Dec 13
7
descriptive statistics
Hi. In a data set I have a variable that takes values from 1 to 14. For each
subgroup of values of this variable, I would like to obtain some descriptive
statistics of other variables present in the data set. I've been trying with
a "for" loop but I couldn't get nothing. Could you please suggest me some
lines?
--
View this message in context:
2011 Jul 05
1
How to translate string to variable inside a command in an easy way in R
I want to write a function that get 2 strings y and z and does the following
R command.
temp<-qq1[qq1$z==y,]
for example if it get y="AMI" and z="PrimaryConditionGroup"
It should do the following
temp<-qq1[qq1$PrimaryConditionGroup=="AMI",]
I could do it by the following function that is ugly and I wonder if there
is an easier way to do it espacielly when temp
2010 May 18
3
"Re: Change class factor to numeric"
sorry I had a mistake sending my question without a subject. I do resend again. Please excuse me.
> Hello
> I have a data array with soil variables (caperf), in which the variable "clay" is factor (as I see entering str(caperf)) . I need to do a regression model, so I need to have arcilla (=clay) as a numeric variable. For that I have entered
>
>
2010 Dec 06
1
Loading .RData from Internet
Dear All,
Can you please suggest me a correct way to load the following R data frame
from the internet and save it to the hard drive?
The following is what I tried:
> raceprofiling <-
> read.table("http://rss.acs.unt.edu/Rdoc/library/twang/data/raceprofiling.RData")
> save(raceprofiling, file = 'raceprofiling.RData')
However, when I used dim() to check the dataset,
2010 Dec 07
3
string
Hi,
I'm running R 2.11
Does anyone know if it possible to transform one character vector to one
character string ?
Many thanks
Benoit
--
Benoit Wastine
Laboratoire des Sciences du Climat et de l?Environnement (LSCE/IPSL)
CEA-CNRS-UVSQ
CE Saclay
Orme des merisiers
B?t 703 - Pte 13A
91191 Gif sur Yvette Cedex
France
Tel : 33 (0)1 69 08 21 97
Fax : 33 (0)1 69 08 77 16
2011 Jan 18
2
dataframe: string operations on columns
Dear all,
how can I perform a string operation like strsplit(x," ") on a column
of a dataframe, and put the first or the second item of the split into a
new dataframe column?
(so that on each row it is consistent)
Thanks
Boris