Displaying 20 results from an estimated 40000 matches similar to: ""Write.table" problem"
2010 Jan 05
2
Dynamic arguments in "rbind" function
Hi, all
Basically, I have unknown number of data that need to be imported and
collapsed row-wisely.
The code below works fine, however the "rbind" function may require 50
arguments if there are 50 data files...
Thus, I would like to explore whether there are any methods in using dynamic
objects (i.e from the resulting objects in the for loop) as an argument in
the *"rbind"*
2009 Aug 27
5
Help on efficiency/vectorization
Dear R users,
I am trying to extract the rownames of a data set for which each columns
meet a certain criteria. (condition - elements of each column to be equal
1)
I have the correct result, however I am seeking for more efficient (desire
vectorization) way in implementing such problem as it can get quite messy if
there are hundreds of columns.
Arbitrary data set and codes are shown below for
2009 Nov 22
5
Removing "+" and "?" signs
An embedded and charset-unspecified text was scrubbed...
Name: not available
URL: <https://stat.ethz.ch/pipermail/r-help/attachments/20091123/36ef28cf/attachment-0001.pl>
2009 Aug 25
2
Removing objects from workspace
Hi all,
I am currently woking with hundreds of objects in workspace and whenever I
invoke ls() to observe the names of the objects, there are too much of
unnecessary variables.
For example, if I only require say 3 or 4 objects from hundreds of objects
in workspace, are there any methods that may do the job?
I have tried rm(-c(x,xx,xxx)), but no luck..
Your feedback in this problem would be
2009 Nov 20
2
Finding & replacing non-ASCII characters
Hi guys,
Are there any feasible methods in searching & finding non-ASCII characters
in R?
For example, from the following object,
x <- mia. SzaÌmitaÌó
The desired output is,
x.out <- mia. SzaImitaIA
Your help in resolving this would be greatly appreciated.
[[alternative HTML version deleted]]
2010 Jul 16
2
Storing processed results back into original objects
Hi all,
There are matrices with same column names but arranged in different orders
and I desire columns of these matrices to have same order.
For example, below are 2 arbitrary data sets with columns arranged in
different order. I require columns of these to have same order as specified
in "columns" object and the results stored in the original object names.
I know this can be done
2009 Sep 10
2
"Read.csv" in R with dynamic file (1st) argument
Dear R users,
I have numerous data sets (csv files) saved in the folder which has the same
name as individual data.
(i.e data x1 saved in x1 folder, data x2 in x2 folder etc)
I would like to read in the desired data set name using 'scan' function and
assign this inputted value to an object so that it can be used in the
'read.csv' function.
For example,
x <- scan()
1: 0708
2010 Sep 29
2
String split and concatenation
Hi R users,
I desire to transform the following vector consisting of repeated characters
x <- rep(letters, 3)
into this exact format (i.e a single string containing each characters in
quotation mark separated by comma between each; al ).
("a", "b", "c", "d", ........"a", "b", "c", "d", ...........,
2010 Jan 24
2
Creating directories & folders
Dear R users,
I would like to create the following 3 folders (FUND1, FUND2, MARINE) within
the 'parent.dir' as defined below.
FUND1 <- "FD1 Q4 2009"
FUND2 <- "FD2 Q4 2009"
MARINE <- "MARINE Q4 2009"
parent.dir <- "D:/....................."
folders <- c("FUND1", "FUND2", "MARINE")
for (i in
2010 Aug 04
1
Carriage return character issue
Hi all,
I imported a file (in CSV format) into R for processing, then imported the
result into MySQL. However, there are *carriage return* characters
(hexadecimal: *0D*) that are appended to the characters in the last field of
the table.
i.e *\r* appended to the character values (as shown below)
Before importing into MySQL: asdf
After importing into MySQL: asdf*\r*
**
**
Are there any options
2009 Sep 15
1
Header names when importing csv/excel data sets
Dear R users,
Suppose the csv file contains header names such as *"Nike, dunk"*, *"Converse,
All stars"* etc
When imported to R (with header = T option), the column names are given by:
*"Nike..dunk"* *"Converse..All.stars"*
I have tried the following command to convert these column names to the
original names as in the input source.
2009 Sep 11
2
Accumulating results from "for" loop in a list/array
Dear R users,
I would like to accumulate objects generated from 'for' loop to a list or
array.
To illustrate the problem, arbitrary data set and script is shown below,
x <- data.frame(a = c(rep("n",3),rep("y",2),rep("n",3),rep("y",2)), b =
c(rep("y",2),rep("n",4),rep("y",3),"n"), c =
2010 Mar 10
1
Generating records from data frame
Hi all,
I wish to generate additional records according to one of the field values
in a data frame.
For example, unique record from the input data is required to be generated
number of times as specified in the 'Number' field in the following code.
> x <- data.frame(Name = c("a", "b", "c", "d"), Group = c("VR", "MR",
2009 Oct 29
3
Removing & generating data by category
Dear R users,
Basically, from the following arbitrary data set:
a <-
data.frame(id=c(c("A1","A2","A3","A4","A5"),c("A3","A2","A3","A4","A5")),loc=c("B1","B2","B3","B4","B5"),clm=c(rep(("General"),6),rep("Life",4)))
> a
2003 Sep 23
1
Omitting blank lines with read.table
Say we have a tab delimited file called bug.txt
Part Rep Cage Hb pupae
1 1 S 32
1 M 34
L 42
2 S 36
M 28
L 36
read.delim("bug.txt")
Part Rep Cage Hb.pupae
1 1 1 S 32
2 NA 1 M 34
3 NA NA L 42
4 NA NA NA
5 NA NA NA
6 NA 2 S 36
7 NA NA M 28
8 NA NA L 36
>
2016 Apr 26
0
How to print the frequency table (produced by the command "table" to Excel
Hi jpm miao,
You can get CSV files that can be imported into Excel like this:
library(prettyR)
sink("excel_table1.csv")
delim.table(table(df[,c("y","z")]))
sink()
sink("excel_table2.csv")
delim.table(as.data.frame(table(df[,c("y","z")])),label="")
sink()
sink("excel_table3.csv")
2012 May 04
2
read.table() vs read.delim() any difference??
Hi,
I have a tab seperated file with 206 rows and 30 columns.
I read in the file into R using read.table() function. I checked the dim()
of the data frame created in R, it had only 103 rows (exactly half), 30
columns. Then I tried reading in the file using read.delim() function and
this time the dim() showed to be 206 rows, 30 columns as expected.
Reading the read.table() R-help documentation, I
2010 Aug 05
3
Date conversion
Hi all,
I am trying to convert all the dates (all days that are not Friday) in data
frame into dates to next Friday.
The following works but the result is returned as vector rather than the
original class.
It would be greatly apprecited if you could provide any solution to this
problem.
Many thanks in advance.
# Define arbitrary initial date value
ini <- as.Date("2010/1/1",
2012 Feb 08
2
Problems reading tab-delim files using read.table and read.delim
Hello,
I used read.xlsx to read in Excel files but for large files it turned out to
be not very efficient.
For that reason I use a programme which writes each sheet in an Excel file
into tab-delim txt files.
After that I tried using read.table and read.delim to read in those txt
files. Unfortunately, the results
are not as expected. To show you what I mean I created a tiny Excel sheet
with some
2009 Sep 04
1
User defined function's argument as Subset function's input
Dear R users,
I have a data where I desire to subset according to certain conditions.
However, the script is very messy as there are about 30 distinct conditions.
(i.e. same script but with different conditions)
I would like to make a user defined function so that I can input the desired
conditions and just get the results accordingly.
Below is an arbitrary data set & sample statements